Using Mattermost as a receiver for Alertmanager

While working to move to Prometheus and Alertmanager for our monitoring lately, my team discovered that the generic webhook_config in Alertmanager does not work with a Mattermost webhook. The JSON included in the POST from Alertmanager causes Mattermost to return a 400, and the lack of flexibility in Alertmanager leaves a lot to be desired. Luckily, Mattermost webhooks translate Slack webhooks natively (according to the documentation here), and Alertmanager natively supports Slack with a slack_config.

  - name: mattermost
    - api_url: http://{your-mattermost-site}/hooks/xxx-generatedkey-xxx

Then, customize the alert routing and message as much as you want. Further reading on custom templating which I found helpful is available on the Prometheus Blog.