Mattermost Notifications

Follow the steps below to configure a webhook for receiving Zammad notifications in a Mattermost channel.

Step 1 - Setup Incoming Webhooks Integration for your Mattermost Channel

In your Mattermost top-left corner product menu, choose Integrations.

Integrations menu item in Mattermost

Click on Incoming Webhooks integration button.

Incoming Webhooks in Mattermost Integratons

Click on Add Incoming Webhook button.

Add Incoming Webhook button

Provide an appropriate Title and Description for the incoming webhook, and choose a target Channel for the notification messages.

Optionally, you may choose to check Lock to this channel to limit notifications to a single Mattermost channel. If unset, it will be possible to configure the target channel from Zammad side as well.

Incoming Webhook Setup

Click on Save button.

Once created, make sure to copy the webhook endpoint URL to clipboard and save it for later. You can do this in one click via the button shown right next to the field.

Copying Incoming Webhook URL

Finally, close the incoming webhook setup by clicking Done.

Step 2 - Add a Pre-defined Webhook in Zammad

Go to Webhook management screen in your Zammad instance and click on the arrow next to the green button in the upper right corner. Choose Pre-defined Webhook from the dropdown menu.

New Pre-defined Webhook button

In the subsequent modal dialog, select Mattermost Notifications as the pre-defined webhook.

New Mattermost Notifications Pre-defined Webhook modal

Click Next.

In the new dialog, paste the webhook endpoint URL from Mattermost into Endpoint field.

Optionally, you can set Messaging Username which will be used to post the Zammad notifications. Default value is zammad.

Optionally, you can also set Messaging Channel, if you would like to post to a different target channel than configured in the Mattermost incoming webhook.

Configuring Mattermost Webhook endpoint

Finally, click on Submit.

Step 3 - Configuring a Trigger for firing of the Webhook

As a last step, you need to create a Trigger for posting a notification to the Mattermost channel under certain conditions.

Once the trigger is in place, your webhook is ready for use!

Sample Mattermost Channel Notification

From now on, whenever a ticket is created or updated in your Zammad system, a suitable notification will be posted in the configured Mattermost Channel. The notification will contain the link to the ticket, updated data and content of the last article. It will also be color coded according to its latest state.

Sample Mattermost Channel Notification

Removing Article Content from the Mattermost Notification

If you are concerned about leaking sensitive article content via notifications, there is a way to remove them by further customizing the webhook payload.

Find your webhook in the list on the management screen and click on it to edit it.

Switch on Custom Payload and the code editor below will be shown, pre-populated with the default payload.

Next, identify the line starting with "text": "... block in the JSON structure.

Custom Payload for Mattermost Webhook

Scroll horizontally to the end of the line and select \n\n#{notification.body} part near the end. Be sure not to include the end double quote with comma (",) in the rest of the line, since the new payload must remain a valid JSON value.

Custom Payload with Article Content for Mattermost Webhook

Then, simply delete the selected code.

Custom Payload w/o Article Content for Mattermost Webhook

Finally, click on Submit to save your webhook changes.

On the next invocation of the webhook, the notification will not include content of the last article.