← Back to documentation

Rich Message Templates

Configure one message template for each destination.

3 min read

A message template is text that uses values from the incoming request. PayloadRelay can use a template to create a message for Slack, Discord, Microsoft Teams, or Telegram. You configure the template for each destination. One incoming webhook can thus create a different message for each channel.

Enabling a template#

  1. Open the endpoint. Select the Outputs tab and expand the destination to change.
  2. Open the Message template card. Turn on Use custom message template.
  3. Enter a Title, a Body, or both. At least one field must contain text.
  4. Optional: Select a Color for a Slack attachment, a Discord embed, or the Microsoft Teams theme. Telegram does not support a color theme.
  5. Optional: Turn on Include "View in PayloadRelay" link to add a link to the endpoint activity log.
  6. Save the endpoint. The live preview updates while 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 as text

A missing value in a permitted namespace becomes an empty string. PayloadRelay rejects an unknown namespace and an unknown helper when you save the template.

Helpers#

Use one of these helpers after the pipe to format a value:

HelperEffect
default('n/a')Use the literal value when the value is null or blank.
upper / lowerChange the case.
iso_dateParse epoch seconds, epoch milliseconds, or an ISO‑8601 input, and write ISO‑8601 UTC.
truncate(n)Cut the value to n characters, and add . The maximum is 8000.
strip_htmlRemove the HTML tags.

Examples:

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

Channel-specific behavior#

  • Slack: PayloadRelay sends a Slack message with a top-level text fallback and a Block Kit attachments[].blocks payload. The payload contains a header block for the title, one section block or more with mrkdwn for the body, and an optional link section. PayloadRelay divides a long body to stay in the Slack section text limits. The body supports Slack mrkdwn such as *bold*, _italic_, and <url|text>.
  • Discord: PayloadRelay sends an embed with title, description, an optional url, and a View in PayloadRelay field. It converts #RRGGBB into the decimal color value that Discord needs. Discord limits an embed description to 4000 characters. PayloadRelay cuts a body that is longer than 4000 characters, for the Discord delivery and the preview.
  • Microsoft Teams: PayloadRelay sends a MessageCard with themeColor, title, text, and an optional OpenUri action. A legacy Incoming Webhook connector shows the link action as a button. Teams Workflows can ignore the button when it posts the card.
  • Telegram: PayloadRelay sends parse_mode: "HTML" with <b>title</b>, the escaped body, and an optional <a> link. Telegram limits the message to 4096 characters.

Limits and validation#

  • Title: 512 characters.
  • Body: 8000 characters in the message after the template processing. The truncate(n) helper has the same 8000-character limit.
  • You can save a Discord template body to the general 8000-character limit. The Discord embed description has a limit of 4000 characters.
  • Color: the value must match #RRGGBB.
  • PayloadRelay accepts the body., headers., and query. namespaces only. You cannot save a template that uses a different namespace, such as {{ secrets.token }}.
  • You cannot save a template that uses an unknown helper.

Falling back to the default behavior#

To use the default behavior, disable the template control. The default Slack message puts the incoming payload in the Slack text field. A destination with no configured template continues to give the same result.