← Back to documentation

Rich Message Templates

Configure per-output message templates so notifications carry just the fields that matter.

6 min read

PayloadRelay can render rich, channel-native messages on Slack, Discord, Microsoft Teams, and Telegram outputs instead of dumping the full request body as text. Templates are configured per output, so the same incoming webhook can fan out a long-form Slack block alongside a one-line Telegram alert.

Enabling a template

  1. Open the endpoint, switch to the Destinations tab and expand the output you want to customize.
  2. Open the Message template card and toggle Use custom message template.
  3. Fill in Title and/or Body using the placeholder syntax below. At least one of the two must be non-empty.
  4. (Optional) Pick a Color for Slack attachments / Discord embeds / Microsoft Teams theme. Telegram does not support color theming.
  5. Toggle Include "View in PayloadRelay" link to add a footer link that takes the recipient straight to the endpoint activity log.
  6. Save the endpoint. Live preview is rendered as you type.

Placeholder syntax

Code Example
{{ body.path.to.value }}      JSON dot-path into the request body
{{ headers.X-Event }}         case-insensitive header lookup
{{ query.token }}             query parameter value
{{ body }}                    entire JSON body, serialized

Unknown placeholders resolve to an empty string — they never fail delivery.

Helpers

Pipe the value through one of these helpers to format it:

HelperEffect
default('n/a')Substitute the literal when the value is null or blank.
upper / lowerChange case.
iso_dateParse epoch seconds, epoch millis, or ISO‑8601 input and emit ISO‑8601 UTC.
truncate(n)Truncate to n characters with ; values above 8000 are clamped at render time (save-time validation also rejects oversized helper arguments).
strip_htmlRemove HTML tags.

Examples:

Code Example
{{ body.event | upper }}
{{ body.timestamp | iso_date }}
{{ body.message | truncate(140) }}
{{ body.user.name | default('anonymous') }}

Channel-specific behaviour

  • Slack — Renders a Slack message with top-level text fallback plus a Block Kit attachments[].blocks payload with a header block (title), one or more section blocks with mrkdwn (body), and an optional link section. Long bodies are split to stay within Slack's section text limits. Body supports Slack mrkdwn (*bold*, _italic_, <url|text>).
  • Discord — Renders as an embed with title, description, optional url and a View in PayloadRelay field. Color is converted from #RRGGBB to the decimal value Discord requires. Discord embed descriptions are capped to 4000 characters; longer rendered bodies are truncated for Discord delivery and preview.
  • Microsoft Teams — Renders as a MessageCard with themeColor, title, text, and an optional OpenUri action. Legacy Incoming Webhook connectors render the link action as a button; Teams Workflows may ignore the button when posting the received card.
  • Telegram — Renders as parse_mode: "HTML" with <b>title</b> followed by the escaped body and an optional <a> link. Output is capped at 4096 characters per Telegram's API limit.

Limits and validation

  • Title: 512 characters.
  • Body: 8000 characters (rendered output). The truncate(n) helper is capped at the same 8000-character maximum.
  • Discord template bodies can be saved up to the generic 8000-character limit, but the generated Discord embed description is capped at 4000 characters.
  • Color: must match #RRGGBB.
  • Only body., headers., and query. namespaces are accepted; templates referencing anything else (e.g. {{ secrets.token }}) are rejected with a 400 at save time.
  • Unknown helpers are rejected with a 400.

Falling back to the default behaviour

Disable the template toggle to revert to the default behaviour: generated Slack output puts the incoming payload into Slack's text field. Existing outputs that have never had a template configured continue to work exactly as before.