---
title: "Send a Webhook to Mattermost | WebhookRelay"
meta:
  "og:description": "Send any webhook to Mattermost. Forward an incoming webhook into a Mattermost channel, transforming the raw payload into the Mattermost incoming-webhook format in flight."
  "og:title": "Send a Webhook to Mattermost"
  description: "Send any webhook to Mattermost. Forward an incoming webhook into a Mattermost channel, transforming the raw payload into the Mattermost incoming-webhook format in flight."
---

![Stripes](https://webhookrelay.com/blog/webhook-to-mattermost/images/stripes.svg)

# **Send a Webhook to Mattermost**

Send any webhook to Mattermost. Forward an incoming webhook into a Mattermost channel, transforming the raw payload into the Mattermost incoming-webhook format in flight.

![Send a Webhook to Mattermost: Transform &amp; Forward Any Payload](https://webhookrelay.com/blog/webhook-to-mattermost/images/blog/heroes/route.jpg)

You have a service that fires webhooks — a CI pipeline, an uptime monitor, a payment provider, an alerting tool — and you want each event to show up in a **Mattermost channel**. The problem: Mattermost incoming webhooks expect a specific JSON body, and the webhook your source sends almost never matches that shape.

[Webhook Relay](https://webhookrelay.com) sits in the middle. It receives the incoming webhook at a stable public URL, **transforms** the payload into the format Mattermost expects, and delivers it — including to **self-hosted** Mattermost servers on a private network, since the agent connects outbound.

## [How it works](#how-it-works)

1. Your source service POSTs its webhook to a Webhook Relay endpoint.
2. A transformation function wraps the payload into a Mattermost message.
3. Webhook Relay forwards it to your Mattermost incoming webhook URL, and the message posts to the channel.

## [Step 1: Create the Mattermost incoming webhook URL](#step-1-create-the-mattermost-incoming-webhook-url)

In Mattermost, go to **Integrations → Incoming Webhooks → Add Incoming Webhook**, pick a channel, and copy the generated URL (it looks like `https://your-mattermost/hooks/xxxxxxxx`).

## [Step 2: Create a Webhook Relay output to Mattermost](#step-2-create-a-webhook-relay-output-to-mattermost)

Create a bucket with a public input, then add an output pointing at your Mattermost webhook URL:

- **Output destination:** `https://your-mattermost/hooks/xxxxxxxx`
- **Headers:** `Content-Type: application/json`

## [Step 3: Add a transformation function](#step-3-add-a-transformation-function)

Attach a function that wraps the incoming payload into Mattermost's `text` format:

```
local body = json.decode(r.RequestBody)

local message = {
  username = "Webhook Relay",
  text = "**" .. (body.title or "New event") .. "**\n" .. (body.message or r.RequestBody)
}

r:SetRequestBody(json.encode(message))
```

For richer messages, build a Mattermost `attachments` array (Slack-compatible) with colors, fields and titles instead of plain text.

## [Step 4: Point your source at the URL and test](#step-4-point-your-source-at-the-url-and-test)

Configure your source service's webhook to point at the Webhook Relay public URL. Trigger an event — or replay one from the [Webhook Bin](https://webhookrelay.com/blog/webhook-to-mattermost/webhook-bin/) — and the message posts to Mattermost within seconds.

## [Going further](#going-further)

- **Fan out:** post the same event to [Slack](https://webhookrelay.com/blog/webhook-to-mattermost/blog/webhook-to-slack/), [Microsoft Teams](https://webhookrelay.com/blog/webhook-to-mattermost/blog/webhook-to-microsoft-teams/) or page someone via [PagerDuty](https://webhookrelay.com/blog/webhook-to-mattermost/blog/webhook-to-pagerduty/) with [multiple destinations](https://webhookrelay.com/blog/webhook-to-mattermost/features/webhook-multiple-destinations/).
- **Self-host friendly:** deliver to private Mattermost servers with no public IP — see [forwarding webhooks to internal servers](https://webhookrelay.com/blog/webhook-to-mattermost/features/webhook-to-internal-server/).
- **Inspect first:** see the raw payload in the [Webhook Bin](https://webhookrelay.com/blog/webhook-to-mattermost/webhook-bin/) before writing the mapping.

## [Get started](#get-started)

[Create a free Webhook Relay account](https://my.webhookrelay.com/register) and turn any webhook into Mattermost messages — no servers to run. New to webhooks? Start with [what is a webhook](https://webhookrelay.com/blog/webhook-to-mattermost/blog/what-is-webhook/) and [how to transform webhooks](https://webhookrelay.com/blog/webhook-to-mattermost/features/transform-webhooks/).