Skip to main content
SuprSend templates use Handlebars to insert variables and format data. This page is the syntax and helper reference. Slack and MS Teams templates use a different language — see JSONNET templates.
Conditional helpers do not work in WhatsApp or in SMS sent in India (pre-approved copy). They do work for US SMS on Twilio and MessageBird.

Syntax

Reserved variables

These are injected at render time, not by your trigger payload. Full preview context is on Templates.

Helper index

You can ask the copilot in the template editor to add a Handlebars helper. Describe the output you want and include your variables.

Built-in helpers

These are the default Handlebars helpers. They work in every template that uses Handlebars (official reference).

if

Renders a block when the value is truthy. Use condition, and, or or inside {{#if}} when you need a comparison or combined check. if itself does not compare two values — that is compare. Syntax
{{else}} is optional. Chain further branches with {{else if ...}}. Examples
Falsy values: false, 0, "", null, undefined. An empty array [] is truthy in Handlebars.

unless

Renders a block when the value is falsy. Inverse of if. Syntax
Example

each

Iterates over an array or object. Inside the block, properties of the current item are in scope. Syntax
Example
Mock data
With this mock data, the example above renders: steve, Olivia {{else}} renders when the array is missing or empty.

with

Shifts context to a nested object so you can write {{city}} instead of {{address.city}}. Syntax
Example
Mock data
With this mock data, the example above renders: Austin, US If order.address is missing or empty, the example renders No address on file instead.

lookup

Looks up a value in an object against a key, where the key is the value of another variable. For example, if status_key value is shipped, {{lookup statuses status_key}} is the same as {{statuses.shipped}}. Syntax
Example
Mock data
With this mock data, the example above renders:

Conditionals

default

Returns the variable if it has a value; otherwise returns the fallback. Treats "", null, and undefined as empty. Syntax
Examples Each row is the output of the expression with that mock data.

compare

Renders a block when the comparison is truthy. For email, you can also hide a row or block with display conditions instead of a helper. Syntax
{{else}} is optional. If you omit it and the comparison is falsy, the helper renders nothing. Examples Each row is the output of the expression with that mock data. Operators Nested paths need the parent key present — see Nested paths. {{#compare order.status '==' "shipped"}} does not run if order is missing. Guard the parent first:

condition

Returns a boolean for use inside {{#if}}. Use this when you need a comparison as a subexpression, not a block. If the variable is missing, condition returns false. Syntax
Examples Each row is the output of the expression with that mock data. Operators match compare, except typeof is not supported.
condition is not a block helper. Use {{#if (condition ...)}}, not {{#condition ...}}.

and

Returns true only when every argument is truthy. Use inside {{#if}}. Syntax
Example You can pass truthy variables, or build each check with condition:
Mock data
With this mock data, the example above renders: Welcome to premium and Team workspace

or

Returns true when at least one argument is truthy. Use inside {{#if}}. Syntax
Example You can pass truthy variables, or build each check with condition:
Mock data
With this mock data, the example above renders: Admin controls and Paid features

Dates

datetime-format

Returns a formatted date string. Throws an error if the value is not a valid date. Syntax
Example
Mock data
With this mock data, the example above renders:

JSON

jsonStringify

Converts a JSON value to a string. Use this to pass a whole object or array into an Inbox template’s custom JSON field. Syntax
variable must be valid JSON-serializable input. Example
Mock data
With this mock data, the example above renders:

jsonParse

Parses a JSON string into an object or array. Throws an error if the string is not valid JSON. Syntax
Example
Mock data
With this mock data, the example above renders: pro

jsonPath

Reads a nested value from an object using a path string. Combine with jsonParse when the source is a JSON string. Syntax
Example
Mock data
With this mock data, the example above renders: Barcelona

Strings

All three helpers return '' when the value is not a string.

lowercase

Converts a string to lowercase. Syntax

uppercase

Converts a string to uppercase. Syntax

capitalize

Uppercases the first character of a string. Syntax

Math

All math helpers throw an error if an argument is not a number. add, subtract, and multiply accept multiple arguments or an array of numbers.

add

Returns the sum. Syntax
Examples

subtract

Returns the difference, left to right. Syntax
Examples

multiply

Returns the product. Syntax
Examples

divide

Returns the left operand divided by the right operand. Syntax
Examples

round

Rounds to the nearest integer. Syntax
Examples

mod

Returns the remainder of dividend / divisor. The result takes the sign of the dividend. Throws an error if an input is not a number, or if the divisor is 0. Syntax
Examples

Arrays

unique and list-agg pull a field out of objects; join and itemAt then format that list. For example, {{join (unique cities "city")}}.

unique

Returns unique items from an array. Duplicate values are dropped. Syntax
Examples

list-agg

Collects values from an array into a new array. Unlike unique, duplicates are kept. Syntax
Examples

itemAt

Returns the item at an index. In a batch or digest, use this to name the first person and $batched_events_count for the rest — liked by Mike and 3 others. Syntax
Examples
Works on arrays of primitives (string, boolean, number). For an array of objects, combine with unique or list-agg first, as in the batch example.

join

Concatenates array values with a separator between each item. Syntax
Examples
For an array of objects, combine with unique or list-agg first. {{join (unique cities "city")}} returns San Francisco, Austin; {{join (list-agg cities "city")}} keeps duplicates.

length

Returns the number of items in an array, or the character length of a string. Returns 0 for any other type. Syntax
Examples

Localization

t

Resolves a translated string from the template’s translation files. Only works when translations are enabled for the template. Use this helper to keep one template and swap copy per locale. For file setup, pluralization examples, and CLI/API management, see Translations. Syntax
Examples Translation files (mock)
en.json
email.en.json
Template data
With this mock data, the examples render:
t throws an error if translations are disabled, translation data is empty, the key is missing, or required interpolation variables are absent.

Nested paths

Helpers only resolve a nested path if every parent key exists. {{default place.city "San Francisco"}} does not fall back when place is missing — the whole expression fails.
Guard the parent first:

Troubleshooting

Double braces ({{ var }}) turn special characters into safe codes so they display as text. An apostrophe can show up as ' in push preview.To print the value exactly as stored — apostrophes, &, or URLs — use triple braces: {{{ variable }}}.
By default, {{ var }} converts characters that could change the page (<, >, ", ', &) into safe text codes (HTML entities). That way a variable can’t inject HTML or scripts into the message.Use {{{ var }}} only when you need the raw character, such as a URL, and only for values you trust.
if — show a block when something is present or true. Example: is this user on premium?compare — show a block when two values match (or don’t). Example: is plan equal to "pro"?condition — the same kind of comparison as compare, but you place it inside if so you can combine checks with and / or: {{#if (and (condition plan '==' "pro") has_access)}}.condition does not support typeof. Use compare for that.
Preview errors when t can’t find a string to print. That happens if translations are off for this template, the translation files are empty, the key isn’t in the default locale file, or the string expects a variable (like {{name}}) that you didn’t pass.Turn translations on, add the key to the default locale file, and pass every variable the string uses. See Translations.
You’re asking for a field inside an object that isn’t in the data — for example place.city when place itself is missing. Helpers can’t look inside something that isn’t there, so the fallback never runs.Check the parent first with {{#if place}}, then use default. See Nested paths.

Next steps

Translations

File setup, pluralization, and locale fallback for the t helper.

JSONNET templates

Slack and MS Teams templates, which do not use Handlebars.