Skip to main content
Plan requirement: This feature requires an On-call Pro or higher subscription. Learn more

Use cases

The system uses templates to render notifications when you create an incident manually, when one is generated automatically, and on reassignment, escalation, and reopen.
The system uses Golang template syntax to parse data, supporting logic, loops, pipelines, and common functions. For more functions, refer to sprig function library.
For security, Flashduty disables the following sprig functions. Using them in a template causes a function "xxx" not defined parse error:If you need a unique identifier inside a template, use incident variables such as {{.ID}} or {{.Num}}. If you need environment-specific values, pass them in with alert labels or field mappings instead of reading host environment variables from the template.

Configuring templates

1

Create Custom Template

Go to Configuration → Templates and select Create. You can also select Copy from an existing template’s actions menu. Enter a template name, team, and optional description, then select Save.
2

Edit Template Content

Select a notification channel in the left navigation and edit its body. You can reference the variables listed below.
3

Save Template

Select Save for the current channel to save its content and settings. Save changes to each other channel separately.
System preset templates and read-only: System preset templates and templates the current member has no permission to manage are always read-only on the detail page, marked Built-in · Read-only next to the title (a template you lack permission for shows no badge, but is equally uneditable). To make one your own, click Copy as new template in the top right and edit the copy, whose name is pre-filled as “Copy original template name”; copying requires the Templates Manage permission and On-call Pro.For a template you can edit, the top right shows Template settings (gear icon), which changes the template name, team and description only — not the body. Delete sits in the More actions ⋯ menu; system preset templates have no such menu and cannot be deleted.

Apply template

1

Enter Escalation Rules

Go to Channel → Escalation Rules, click Edit
2

Select Template

In rule configuration, select which template to use for notifications
3

Save Configuration

Click Save to complete configuration. See Configure Escalation Rules

Variable reference

Reference examples

Incident variables

Complete variable list for incident objects:

Preview and test send

The right side of the template detail page is the preview pane: it renders the current channel’s content with the selected incident, followed by a line of diagnostics and any warnings the preview raises. The preview’s title bar also holds Send test, which sends the editor’s current content for real so you can see what the recipient gets.

What the preview tells you

The preview renders the current channel’s content with the incident selected under Render with this incident’s data; with nothing selected it uses the system default data. When the editor is empty, the preview renders the channel’s system default template and notes “No template content set, system default template will be used.” One line under the preview explains how this content was rendered: The yellow notices above that line mean the template will be reshaped or rejected on a real send. Trim it before saving: When the content exceeds the channel’s size limit, the notice is one of three:

Send test

Send test sits in the preview’s title bar. It renders the editor’s current content (unsaved changes included) with the incident selected in the preview and sends it to the channel for real, so you can confirm what the recipient sees. It needs the Templates Manage permission; system preset templates can be test-sent too. The button is disabled while the template fails validation. Supported channels: the five IM apps (Feishu/Lark, Dingtalk, WeCom, Slack, Teams), six group chat bots (Feishu/Lark, Dingtalk, WeCom, Slack, Telegram, Zoom) and email. SMS and voice are not offered — they are billed per message and the preview already equals what would be sent. The content is the same one the preview shows: the editor’s current content plus the selected incident’s data (system default data when none is selected), with the same channel switches (card field visibility, the Feishu Card 2.0 table and blank-line switches, WeCom bot Markdown v2). When the editor is empty, the channel’s system default template is sent. Where each channel can send:
  • Myself: requires your account to be linked to that IM integration; when it is not, the send button is disabled and members with permission can click the link to finish linking in the onboarding flow. The Slack app is the exception — no per-person linking is needed (it DMs workspace members directly), but the send still resolves you to a member of that workspace and shows “Your account isn’t linked to this IM” if it cannot.
  • Group chat: lists only chats this integration’s bot has already joined (Slack by channel, Teams by team channel or group chat). Everyone in the chat receives the test message.
  • When the channel has several integrations, pick one under Integration first; only enabled integrations are listed.
Test message markings:
  • The incident title is prefixed with [Test] (Chinese accounts get [测试] ).
  • A footer is appended: Test message · Template "<name>" · Sent by <sender>.
  • Buttons on the card only answer “This is a test message. Its buttons do not change any incident.” and neither acknowledge nor close anything; the Create War Room button does not appear in a test message.
The result is one of two: For IM apps, “Sent to …” means the message went out. For bots and email, “Submitted” only means the request was accepted, and a wrong address does not fail immediately. Limits and common failures:
  • Each member can send at most 5 test messages per minute; beyond that the console shows “Too many test sends. Try again later”.
  • A failure shows one of these messages:
How test sends differ from real notifications: when the template has a syntax error, a real notification falls back to the system default template and is still delivered, with the line ”【🔴 Custom template rendering exception, downgraded to default template】” appended to bot and app messages, while a test send shows “The template failed to render. Fix it first” — that is the point, to surface template problems. Conversely, a test send leaves no notification record on the incident, so it never acknowledges or closes an incident and never creates a war room.

Channel templates

Different notification channels support different template formats and limitations.

Card fields and bottom action buttons

The Additional info tab next to Content controls which system content appears at the bottom of the card. Switches available per channel:
  • Create war room (off by default): When it’s on, the card shows a 👥 Create War Room button. The button appears if the incident is open, has responders, and has no war room yet. Click it to create the group.
  • Keep custom actions after incident closure (off by default): when it’s on, you can run custom actions from the message card for 3 days after the incident closes. Otherwise, or after 3 days, run them from the incident details page.
Save the template for switch changes to take effect.
Requires Feishu/Lark integration configured first. Supports message card format; system auto-removes empty render lines caused by non-existent labels.Default Template (render all labels):
Minimal Template (show key labels only):
On Feishu/Lark app cards, More Actions at the bottom is a dropdown menu with custom actions, snooze durations, and unacknowledge; the 👥 Create War Room button sits outside that menu.

Native tables

Feishu Card 2.0 adds a Native tables switch (off by default, saved with the template). When it is on, GFM Markdown tables in the template are recognised and rendered as the card’s native table component, so recipients see a pageable table instead of rows of text with |.Native tables have the limits below. If a card has more than 5 native tables, or the card exceeds 30 KB, every table on that card is sent as Markdown text. Any other limit affects only the table that exceeds it, which is sent as Markdown text while the other tables stay native:When a table falls back, the preview shows a notice (see What the preview tells you):The whole Feishu card is capped at 30 KB. Beyond that Feishu refuses the message outright and the preview shows “The content exceeds the channel’s size limit, so sending will fail, including real alerts. Please trim the template.”; trim the template and send again.Tables sent as Markdown text have one more limit: a single Feishu Markdown component holds at most 4 tables, and extra tables may not display. When you have many tables, turn on Native tables or split the content across several Markdown components.

Bot templates

Template formats supported by group chat bots.
SMS, voice, mobile app push and group chat bot messages automatically get a notice line appended when the incident is flapping (IsFlapping), in an alert storm (IsInStorm), or the first of its kind in 30 days. You don’t need to write it in the template and can’t remove it. App cards and email don’t get these lines.
These channels do not render Markdown tables and send them as raw text: the Dingtalk, Slack and Telegram bots, the WeCom bot on Markdown v1, and the Dingtalk, Slack, WeCom and Teams apps. The preview flags this. For those channels, rewrite tables as lists.
Supports message card, rich text, and plain text formats. Max message 4000 bytes, truncated if exceeded.

Other channels

Default Template:

FAQ

  • Manually created incidents have no labels
  • Auto-created incidents have labels, same as the first merged alert’s labels
Go to Incident List → view incident details to see all label information.
Passing the syntax check when you save a template does not guarantee that every incident renders. If rendering fails when a notification is sent, the system falls back to the default template, and bot and app messages end with the line ”【🔴 Custom template rendering exception, downgraded to default template】”.
Recommend checking if variable exists before referencing:
Use toHtml function to handle:
Add $ before external variable:
Use index function:
Use jsonGet function to extract values by path from valid JSON. Syntax reference at gjson.dev.
imageSrcToURL: Convert image_key or URL to accessible address (for Dingtalk/Slack App)
transferImage: Upload image to third-party platform (for Feishu/Lark App)
Image size cannot exceed 10 MB, supports JPG, PNG, WEBP, GIF, BMP formats.
codeBlock: Wrap a value in a code block so the chat client shows it as written (for Slack App). Slack mrkdwn treats a single ~ as the strikethrough delimiter, so a matcher such as module=~"api|worker" renders struck through without the code block.
Empty values and values that already contain a three-backtick fence come back unchanged; the value itself is not escaped.

Configure Escalation Rules

Define incident notification rules and escalation mechanisms

Configure Personal Preferences

Set your preferred channels for each notification scenario