Template Editor
The template editor lets you create and customize message templates with a visual editor and live previews for each supported platform.
Creating a Template
- Navigate to Templates → Create Template
- Enter a name
- The editor opens with a default template structure
Editor Layout
The template editor has two main panels:
- Left: Platform Tabs + Config Editor — switch between platform tabs (Discord, Slack, Telegram, Google Chat, Webex, Default) and edit the JSON config for each with syntax highlighting
- Right: Live Preview — see a rendered preview for the active platform tab as you type. Advanced template expressions (such as
index,rangeover array elements,{{with}}, and.Metafields) render in the preview just as they will at delivery, with the few exceptions listed below. If a template expression is invalid, the preview shows the template error instead of silently leaving the raw{{…}}text — fix the expression and the error clears.
Embed field values can span multiple lines — press Enter inside the value editor to add a line break (for example, one bullet per item when looping over an array). Field names stay single-line.
Advanced template expressions run on Dispatch's servers, so the preview supports a defined subset of the template language and tells you plainly when a template falls outside it. Field access, {{if}}, {{range}}, {{with}}, pipelines, index, slice, len, printf, urlquery, the comparison functions and every platform helper are all supported.
Simple field substitutions render instantly in your browser without a server round-trip. In rare cases their preview can differ slightly from the delivered message — very large numbers, len, json key ordering, short truncate widths, and .Payload.* fields referenced inside a {{range}} or {{with}} block (those preview as the payload value but deliver as <no value> or a template error — use the loop item's own fields instead) — while delivery always uses the real engine.
These are not, and show a "not supported in preview" message — they still work when the message is delivered:
- Variables declared outside a
{{range}}or{{with}}header ({{$x := …}}), and assignment ({{$x = …}}) — naming the subject, as in{{with $pr := .Payload.pull_request}}, is supported print,println,html,js,call— useprintfprintfargument indexes (%[1]s) and*widths — ordinary verbs and widths are finedefine,template,block- Looping over a computed value (
{{range len .Payload.x}}), or more than two nested loops
JSON numbers are floating point, so {{.Payload.amount}} renders a large value as 1.5e+06. Use {{fixed 0 .Payload.id}} for a whole number and {{fixed 2 .Payload.total}} for a money amount. Stripe, PayPal and Shopify send amounts in cents, so divide first: {{fixed 2 (div 100 .Payload.amount)}} renders 1200 as 12.00. This affects delivered messages too, so it is worth checking any existing template that renders an ID, timestamp, or amount.
So the preview stays responsive, it trims arrays and objects longer than 100 entries and leaves out anything nested deeper than 32 levels, telling you when it has. Delivery always uses your full payload. To preview the entire payload as JSON, use {{json .Payload}} — that renders identically in the preview and at delivery.
Platform Tabs
Each tab represents a platform variant within a v2 multi-platform template:
| Tab | Format | Description |
|---|---|---|
| Discord | Embed config | Standard Discord embed with title, description, fields, color |
| Slack | Block Kit JSON | Native Slack Block Kit blocks for rich Slack messages |
| Telegram | HTML template | HTML string for Telegram's HTML parse mode |
| Google Chat | Text template | Google Chat formatted text (*bold*, _italic_, `code`) |
| Webex | Markdown template | Webex markdown (**bold**, *italic*, `code`, [text](url)) |
| Default | Embed config | Fallback used when no platform-specific variant is configured |
At delivery time, Dispatch selects the variant matching the destination type. If no matching variant is set for that platform, the Default variant is used.
You don't need to configure all platforms. Configure only the tabs you need — leave the rest empty and Dispatch will fall back to auto-formatting or the Default tab.
Generating with AI
The Generate with AI button drafts a template from a plain-language description (for example, "Dependabot alert: severity, package, CVE link, red accent"). Paste a real sample payload first — the generator grounds every {{.Payload.…}} reference in your payload's actual structure, and paths are auto-corrected when they don't match it exactly. If any generated path can't be found in your sample payload, the review dialog flags it with a warning before you apply, so you can fix it rather than discover a blank field later. Generated values apply to the Default platform tab.
Discord Tab
The Discord tab uses the standard embed config format:
{
"title": "{{.Meta.EventType}}",
"description": "Event from {{.Payload.repository.full_name}}",
"color": 5763719,
"fields": [
{
"name": "Action",
"value": "{{.Payload.action}}",
"inline": true
}
],
"footer": "Dispatch",
"thumbnail": "{{.Payload.sender.avatar_url}}",
"timestamp": true
}
The live preview renders a Discord embed the way Discord destinations will receive it (see the preview note above for the few browser-side approximations).
Slack Tab
The Slack tab accepts a slack_blocks array containing native Block Kit blocks. All string values inside the blocks support template expressions:
{
"slack_blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "{{upper .Meta.EventType}}"
}
},
{
"type": "section",
"fields": [
{
"type": "mrkdwn",
"text": "*Repository*\n{{.Payload.repository.full_name}}"
},
{
"type": "mrkdwn",
"text": "*Action*\n`{{.Payload.action}}`"
}
]
}
]
}
Telegram Tab
The Telegram tab accepts a telegram_html string that supports template expressions and is sent with Telegram's HTML parse mode:
{
"telegram_html": "<b>{{upper .Meta.EventType}}</b>\n\nRepo: <code>{{.Payload.repository.full_name}}</code>\nAction: <code>{{.Payload.action}}</code>\n\nBy <b>{{.Payload.sender.login}}</b>"
}
Supported HTML tags: <b>, <i>, <u>, <s>, <code>, <pre>, <a href="...">, <tg-spoiler>.
Variable Discovery
The editor helps you discover available template variables:
- A Variables panel shows all available
.Metavariables (event ID, event type, endpoint ID, timestamp) - If recent events exist for linked endpoints, the editor shows actual payload paths from real event data so you can click to insert them
This panel is available across all platform tabs.
Assigning Templates
Templates are assigned per endpoint-destination link:
- Go to Sources
- Click on an endpoint
- Edit the destination link
- Select a template from the dropdown
You can also set up routing rules on a link to use different templates based on event field values. See Templates for details.