Template Variables
Overview
Template variables let you insert event data into your notification messages. Use the {{variable}} syntax in any destination template field — the variables are replaced with real values when the event is delivered.
Available Variables
| Variable | Description | Example |
|---|---|---|
{{title}} | Event title | Subscription Started |
{{message}} | Event message | New subscription |
{{event}} | Event name / key | user.purchase |
{{link}} | Event link URL | https://example.com |
{{tags}} | Comma-separated tags | android, growth |
{{tags.0}} | Individual tag by index | android |
{{workspace}} | Workspace name | My Project |
{{channel}} | Channel name | General |
{{created}} | Event timestamp (ISO 8601) | 2026-04-03T15:57:33Z |
{{eventId}} | Event hash ID | vDjQP73X4e |
{{workspaceId}} | Workspace hash ID | 0JNbYVX8BM |
{{channelSlug}} | Channel slug | general |
{{data.key}} | Custom data field | John |
Custom Data
When you send an event with a data object, each field is accessible as a template variable using dot notation.
{
"message": "New order",
"data": {
"name": "John",
"amount": 49.99,
"items": ["Widget", "Gadget"]
}
}
This makes the following variables available:
| Variable | Value |
|---|---|
{{data.name}} | John |
{{data.amount}} | 49.99 |
{{data.items}} | Widget, Gadget |
{{data.items.0}} | Widget |
Nested objects are supported: {{data.address.city}} accesses deeply nested fields.
Fallback Values
Use the pipe | syntax to set a fallback when a variable is empty:
{{title|No title provided}}
If the event has no title, the text No title provided is used instead.
How Variables Work Per Destination
SMS and Email
Variables resolve to plain text strings. Arrays like {{tags}} are comma-separated. Use variables in:
- SMS: Title and message fields
- Email: Subject line and body section values
Slack
Variables resolve to plain text within Block Kit blocks. Use them in:
- Header: The bold title block
- Text: The message body block
- Fields: Label and value columns
- Buttons: Button label and URL
Webhooks
Webhooks use JSON mode — variables are automatically typed to produce valid JSON:
- Strings are quoted:
{{event}}becomes"user.purchase" - Numbers stay raw:
{{data.amount}}becomes49.99 - Booleans stay raw:
{{data.active}}becomestrue - Arrays stay as JSON:
{{tags}}becomes["android","growth"] - Objects stay as JSON:
{{data}}becomes{"name":"John",...}
This means you can write clean JSON templates without worrying about quoting:
{
"event": {{event}},
"amount": {{data.amount}},
"tags": {{tags}},
"metadata": {{data}}
}
And the output is valid JSON:
{
"event": "user.purchase",
"amount": 49.99,
"tags": ["android", "growth"],
"metadata": {"name": "John", "amount": 49.99}
}
Building URLs
Use the ID variables to construct dashboard URLs or deep links:
https://app.apialerts.com/workspace/{{workspaceId}}/channel/{{channelSlug}}