Send a Webhook to Mattermost: Transform & Forward Any Payload

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 & Forward Any Payload

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 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

  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

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

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

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

Configure your source service's webhook to point at the Webhook Relay public URL. Trigger an event — or replay one from the Webhook Bin — and the message posts to Mattermost within seconds.

Going further

Get started

Create a free Webhook Relay account and turn any webhook into Mattermost messages — no servers to run. New to webhooks? Start with what is a webhook and how to transform webhooks.