# Set up Mattermost alerts

Mattermost alerts reuse the same incoming-webhook payload format as Slack, so if you've set up Slack alerts
before, this will look familiar. Under the hood a Mattermost contact is an `http` contact with its `gateway`
set to `Mattermost`.

## Settings reference

| Setting (UI label) | API field (v2) | Type / allowed values | Default | Plan limits | What it does for you |
|---|---|---|---|---|---|
| Contact Type | `type` | `"http"` | - | - | Mattermost is stored as a plain `http` contact |
| Gateway | `gateway` | `"Mattermost"` | - (must be set explicitly) | - | Formats the request for Mattermost's incoming-webhook shape |
| Webhook URL | `address` | Mattermost's incoming-webhook URL | - (required) | - | Where the message posts |
| Group events | `groupedAlerts` | boolean | `false` | - | Combine simultaneous alerts into one message - see [grouped alerts](/alerts/grouped-alerts/) |

## Set it up in the app

1. In Mattermost, enable **Incoming Webhooks** (System Console → Integrations, if it isn't already on) and
   create one for the channel you want alerts in. Copy the webhook URL.
2. In HostTracker, open **Contacts** and click **Add contact**.
3. Choose **Mattermost**.
4. Paste the webhook URL and give the contact a name.
5. Save.

## What the message looks like

A formatted message in the target channel, using the same layout Slack alerts use - monitor name, status and
detail fields, not a raw text blob.

## Do it with the API or MCP

```
POST /contact
{ "type": "http", "gateway": "Mattermost", "address": "https://...", "name": "Ops Mattermost channel" }
```

MCP: use `api_request` with the body above - `create_contact` doesn't cover `http`/gateway contacts.

## What happens next

An `http` contact is born confirmed - there's no code to verify. [Send a test alert](/alerts/test-a-contact/)
to confirm it actually posts.

## Limits and gotchas

- Alerts land in whichever channel the webhook is bound to - create another webhook in Mattermost for a second
  channel.
- Grouping is **off** by default. Turn on the contact's **Group events** toggle to combine simultaneous alerts
  into one message instead of posting them individually.
- The `gateway` must be spelled exactly `Mattermost`; an unrecognized value is refused (`422 unknown_enum_value`)
  rather than silently treated as a plain webhook.
- Being a **recognized gateway** also means Mattermost can receive certificate-expiry, domain-expiry, DNSBL
  blacklist and Web Risk notices - a plain unrecognized webhook contact cannot (see
  [Webhook](/alerts/channels/webhook/#limits-and-gotchas)).

## Related

- [Slack](/alerts/channels/slack/)
- [All channels](/alerts/channels/)
