Overview
Handlebars is a templating language that lets you insert dynamic data from your webhook events into notification titles and messages. Instead of static text, you can reference values from your incoming data to create personalized, informative notifications. Where you can use templates:- Webhook Title
- Webhook Message
Available Data Sources
Every webhook event provides access to these root objects:| Object | Type | Description |
|---|---|---|
body | Object | Request body (JSON, form data, query string, etc.) |
query | Object | URL query parameters |
headers | Object | HTTP request headers |
url | Object | Parsed URL components (protocol, hostname, pathname, port) |
ip | String | Client IP address |
Basic Template Syntax
Templates use double curly braces with dot notation to access nested data:Simple Variables
Nested Objects
Use dot notation to access nested properties:Array Access
Use numeric indexes to access array elements:Examples with Payloads
Example 1: User Signup
Incoming webhook payload:- Title:
New {{body.plan}} signup - Message:
{{body.name}} ({{body.email}}) just joined
- Title:
New Pro signup - Message:
Alice Johnson (alice@example.com) just joined
Example 2: Payment Transaction
Incoming webhook payload:- Title:
💰 Payment {{body.status}} - Message:
${{body.amount}} {{body.currency}} from {{body.customer}} (ID: {{body.transaction_id}})
- Title:
💰 Payment success - Message:
$99.99 USD from Acme Corp (ID: TXN-12345)
Example 3: Order Status Update
Incoming webhook payload:- Title:
Order {{body.order_id}} {{body.status}} - Message:
Tracking: {{body.items.0.name}} and {{body.items.1.name}} - {{body.tracking}}
- Title:
Order ORD-56789 shipped - Message:
Tracking: Widget and Gadget - TRACK-XYZABC
Example 4: Error Alert
Incoming webhook payload:- Title:
⚠️ {{body.service}} Error - Message:
{{body.error_code}} in {{body.function}} at {{body.timestamp}}
- Title:
⚠️ user-service Error - Message:
DB_TIMEOUT in getUserData at 2025-01-30T14:35:22Z
Handling Missing or Empty Values
Use thedefault helper to safely handle missing, null, or empty data with fallback values:
Syntax: {{default path "fallback_value"}}
What Triggers Fallback
The fallback is used if the value is:undefined(field doesn’t exist)null- Empty string (
"") - Zero (
0) - Empty array (
[]) false
Examples with Payloads
Scenario 1: Optional field is missing Payload:{{default body.email "No email provided"}}
Result: No email provided
Scenario 2: Required field is present Payload:
Status: {{default body.status "Inactive"}}
Result: Status: active
Scenario 3: Zero is a valid value Payload:
Retries: {{default body.retries "5"}} / Attempts: {{body.attempts}}
Result: Retries: 5 / Attempts: 5 (zero is falsy, so fallback “5” is used)
Advanced Features
Conditionals
Display content based on conditions:Loops
Iterate over array items:Comments
Add comments that won’t render:HTML Escaping & Security
Default Escaping
By default, Handlebars escapes HTML special characters (<, >, &, etc.) to prevent injection attacks:
System Limitations
- Data window: Variables are only available from events received in the last 7 days
- Private webhooks: Event data is not stored on servers, so the variable picker can’t display available fields (but you can still type paths manually)
- Render failures: If a template fails to render due to syntax errors, the original unprocessed template is returned as a fallback