Skip to main content
Variables let you insert dynamic, personalized values into your notifications. Use curly brackets to reference values from the Send API, user profiles, tenants, and brands.

Using Variables in Notifications

You can insert variables into:
Example of Variable Replacement in Rendered Preview

Example of Variable Replacement in Rendered Preview

Content Blocks

Enclose the variable name in single curly brackets: {variable_name}. Properly formatted variables inside Text, Markdown, Quote, and List Blocks are highlighted in green.
Text Block With Variables

Text Block With Variables

Handlebars

In Handlebars, use double curly brackets {{ }} with the var or path helper:
  • Data object: {{var "variable_name"}}
  • Profile data: {{var "profile.variable_name"}}
You can use Handlebars in Template content blocks, Brand templates, and the Handlebars override in Email notifications.

Email Fields

Variables are also supported in the Subject line, From address, Reply-To, CC, and BCC fields in the email channel settings.
Email Subject With Variables

Email Subject With Variables

Email Channel Settings

Email Channel Settings

Data Sources

Courier resolves variables from the Notification Context, which has four top-level keys. Each data source has its own JSONPath prefix:
Courier queries the data object by default for any path not prefixed with profile., tenant., or brand.. So {orderId} is equivalent to {data.orderId}.

The Data Object

The Data object is an optional property of the Send call. Use it to pass key-value pairs into your notification template.
Nested values are accessed with dot notation:
Variable names must use camelCase or snake_case. Dashes and other special characters cause rendering errors: {firstName} and {first_name} work, {first-name} does not.

The User Profile

User Profile data can come from two places:
  • The profile object in the Send API request.
  • The stored User Profile associated with the recipient ID, created via the Profiles API.
Core fields: The profile is extensible; any custom fields you store on the profile are accessible via {profile.yourField}.
If a key exists in both the Send API profile object and the stored User Profile, the Send API value takes precedence.

Built-in Variables

Courier automatically populates these variables during the send process. You can use them in notification content and settings:

Tenant

The Tenant object contains information about the tenant associated with the send. Access tenant properties with {tenant.name} in content blocks or {{var "tenant.name"}} in Handlebars.

Brand

The Brand object contains branding values from the Brand associated with the notification. Commonly used paths: