Browse Docs

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

VariableDescriptionExample
{{title}}Event titleSubscription Started
{{message}}Event messageNew subscription
{{event}}Event name / keyuser.purchase
{{link}}Event link URLhttps://example.com
{{tags}}Comma-separated tagsandroid, growth
{{tags.0}}Individual tag by indexandroid
{{workspace}}Workspace nameMy Project
{{channel}}Channel nameGeneral
{{created}}Event timestamp (ISO 8601)2026-04-03T15:57:33Z
{{eventId}}Event hash IDvDjQP73X4e
{{workspaceId}}Workspace hash ID0JNbYVX8BM
{{channelSlug}}Channel sluggeneral
{{data.key}}Custom data fieldJohn

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:

VariableValue
{{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}} becomes 49.99
  • Booleans stay raw: {{data.active}} becomes true
  • 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}}