Skip to main content
SuprSend template editor uses handlebars as the default templating language to add variables in all templates except Slack and MS Teams JSONNET templates. You’ll find the generic syntax and list of helpers supported. Helpers are used to format data or add conditions on the data passed in the template.

Variable types and their syntax

Handlebars Helpers

You can find the list of inbuilt handlebars helpers here. Apart from the inbuilt helper functions, we have also created some custom helper functions which you can use in template editors.
Not supported in SMS and WhatsApp:Since SMS (in India) and WhatsApp require pre-approved templates to send messages, we can’t support conditional content rendering in SMS and WhatsApp templates. You can use handlebars helpers if you are sending SMS in US with vendors like Twilio and Messagebird.
AI prompt — write a Handlebars expression: “Write a Handlebars expression for SuprSend that [describe task — for example ‘shows a comma-separated list from an array’, ‘formats a date as Mon DD YYYY’, ‘shows different content for premium vs free users’]. My variables: [paste JSON]. SuprSend supports custom helpers: formatDate, math, capitalize, default, formatCurrency.”

default

Can be used to add a default value if the variable values are " " , null , undefined.
Returns:
  • Variable value if the variable value is present. For instance, the above example with data {"name":"Joe"} will return Joe
  • Default value if variable value is in " " , null , undefined. For instance, the above example with data {"name":""}, {"name":null} or {"city":"Bangalore"} will return user

compare

Can be used to show some content in the template based on a condition. For email, you can use display condition to show or hide a particular content block
Returns:
  • Returns if the condition inside compare statement returns truthy value. For instance, the above example with data{"candidate_count":1}will returnis
  • Returns (in case else statement is present) if the condition inside compare statement returns falsy value. For instance, Example-1 with data{"candidate_count":3}will returnare
  • or Returns if the else statement is not present. For instance, Example-2 with data{"candidate_count":3}will not return anything
Supported Conditional operators in compare statement:
Builtin helpers and custom helpers in handlebars can only work with nested objects if the value of parent key is present.For instance, {{default place.city "San Francisco"}} will return "San Francisco" only if place key is present, that is {"place":[]}
However, you can use the nested if condition to check if the parent is present and if so, then render nested objects value. Refer below example:

each

You can iterate over a static or dynamic length list using each helper. Inside the block, you add the array object key which you want to iterate over.
Returns: Above example for below mock data will return steve Olivia

datetime-format

Returns a formatted date string. This helper will throw error if an invalid date is provided.
Examples:

jsonStringify

Converts any type of JSON input to a string. Can be used to print JSON and array directly in templates without having to convert it into individual strings. One of the common use case is to pass complete JSON in Inbox template -> custom JSON field to generate custom UI.
variable should be a valid JSON input.
Examples:

lowercase

This handlebar helper is used to convert string to lowercase. If non string values are provided empty string '' is returned.

uppercase

This handlebar helper is used to convert string to uppercase. If non string values are provided empty string '' is returned.

capitalize

This handlebar helper is used to capitalize the first character in provided string. If non string values are provided empty string '' is returned.

Math operators

add

Returns the sum of two operands. Both input values should be numbers, else it will throw an error.
Examples:

subtract

Returns the difference between two operands. Both input values should be numbers, else it will throw an error.
Examples:

multiply

Returns the product of two operands. Both input values should be numbers, else it will throw an error.
Examples:

divide

Returns the quotient of the left operand divided by the right operand. Both input values should be numbers; else it will throw an error.
Examples:

round

Returns the value of a number rounded to the nearest integer. The input value should be a number; else it will throw an error.
Examples:

mod

Returns the remainder left over when one operand is divided by a second operand. It always takes the sign of the dividend. This helper will throw an error if it encounters an input value that is not a number or if the divisor is 0.
Examples:

Array Operators

unique

Returns unique items in an array.
Examples:

itemAt

Returns item at a particular index in the array. It can be useful in scenarios where you want to display a message like liked by Mike and 3 others.
Examples:
Note:This helper only works with an array of primitive data types like string, boolean, etc. If you have an array with objects in it, you can combine it with a unique helper to return the indexed value of a particular key inside the object. For instance, {{itemAt (unique array "city") 0}} in above mock will return San Francisco.

join

Concatenates all the values in an array, using a specified separator string between each value.
Examples:
Note:This helper only works with an array of primitive data types like string, boolean, etc. If you have an array with objects in it, you can combine them with a unique helper to join the value of a particular key inside the object. For instance, {{join (unique array "city")}} in above mock will return San Francisco, Austin

length

Can be used to get the number of items in an array or the character length of a string. It can be useful in scenarios where you want to display a message like your post has got 100 likes.
Examples:
We are adding further helpers to this list. If you have a use case that is not covered, ping us on our Slack Support Channel

AI prompt - debug rendering: “My SuprSend template isn’t rendering. Template: [paste]. Variables JSON: [paste]. Expected: [describe]. Actual: [blank/raw syntax/error]. Check for: path mismatch, double vs triple braces for URLs, #each on non-array, missing closing tags, missing ononrecipient/$brand.”

Frequently Asked Questions

This is happening because handlebars by default does url encoding, use triple curly braces syntax like {{{ variable }}} whenever you need to print the value of the variable as is without any encoding.
SuprSend uses the default syntax for variables {{ var }} to print the value of the variable. This is HTML-escaped, so characters like <, >, ", ', & are converted into their HTML entity equivalents when rendered as text.