Skip to content

Mattermost Notifications

Scripts send Mattermost messages via the injected $notifications object, using named webhooks you configure in Admin Settings. The payload format is Slack-compatible, so any Mattermost incoming webhook works out of the box.

1. Create a Mattermost Incoming Webhook

  1. In Mattermost, go to Main Menu → Integrations → Incoming Webhooks(If you don't see Integrations, ask your admin to enable it under System Console → Integrations → Integration Management)
  2. Click Add Incoming Webhook
  3. Give it a display name (e.g. "ApiMeld") and optionally set a default channel
  4. Click Save and copy the webhook URL — it looks like:
    https://mattermost.example.com/hooks/xxxxxxxxxxxxxxxxxxxxxxxxxxxx

Channel per environment

Consider separate webhooks for different channels — e.g. apimeld-prod for failures and apimeld-dev for dev runs. Each gets its own name in ApiMeld.

2. Add the webhook to ApiMeld

  1. Go to Admin → Settings → Notifications
  2. Under Mattermost Webhooks, click Add
  3. Enter a name (e.g. "Ops Channel") and paste the webhook URL
  4. Click Save

The name you enter here is what you pass as webhookName in your scripts.

Sending from a script

LanguageOne-liner
PowerShell$notifications.SendMattermost('Ops Channel', 'Task complete')
JavaScript / TypeScriptnotifications.sendMattermost('Ops Channel', 'Task complete')
Pythonnotifications.send_mattermost('Ops Channel', 'Task complete')
Bashnotify_mattermost "Ops Channel" "Task complete"
C#Notifications.SendMattermost("Ops Channel", "Task complete");

Larger example (Python)

python
import json

processed = 0
failed = 0

for record in records:
    try:
        process(record)
        processed += 1
    except Exception as e:
        failed += 1

summary = f"Sync complete — {processed} processed, {failed} failed."
notifications.send_mattermost('Ops Channel', summary)

Parameters

ParameterDescription
webhookNameThe name of the webhook as saved in Admin → Settings → Notifications
messagePlain text message to post

Testing the webhook

After saving, click Test next to the webhook in Admin → Settings → Notifications to send a test message and confirm it's working.

Self-hosted Mattermost

Works with both Mattermost Cloud and self-hosted installations. Ensure your ApiMeld server can reach the Mattermost URL — if Mattermost is on an internal network, make sure the two services can communicate.