Commonly used handlebars

Recipient data

Capitalize the first letter of the first name

{{#capitalize}}{{lower contact.firstName}}{{/capitalize}}


Greeting according to whether the recipient has a first name and ensuring that the first letter is capitalized.
(E.g. with First Name: "Hello Firstname," without First Name: "Hello,")

{{#switch contact.firstName}}{{#compare '==' ""}}Hello,{{/compare}}{{#default}}Hello {{#capitalize}}{{lower contact.firstName}}{{/capitalize}},{{/default}}{{/switch}}


Create a different sentence according to an attribute (e.g. displaying a different preheader according to the recipient's language)

{{#switch contact.langue}}{{#compare "==" 'en'}}Englist sentence.{{/compare}}{{#default}}French sentence.{{/default}}{{/switch}}


Date formats

Current year (e.g. in the footer, © 2022)

{{date "yyyy" message.sendTime}}


Send date in the "Month Day, Year" format (e.g. May 18, 2022)

{{date "MMMM d, yyyy" message.sendTime}}


Send date in the "Year-Month-Day" format (e.g. 2022-05-18)

{{date 'yyyy-MM-dd' message.sendtime}}


Send date + 2 months (e.g. displaying the deadline for the return of an item following its purchase)

{{dateAdd contact.StartDate 2 "MONTHS"}}


Send date + 2 days (e.g. displaying the end date of a dynamic limited-time offer)

{{dateAdd contact.StartDate 2 "DAYS"}}


Send date + 7 days (e.g. displaying the date 7 days from now in a "Year-Month-Day" format)

{{dateAdd message.sendtime 7 "DAYS" "yyyy-MM-dd"}}



Hash the email address in lower case with sha256 (e.g. adding the encrypted email in an attribute to cross-check with the social audience data)

{{#lower}}{{#sha256Hex}}{{lower contact.emailAddress}}{{/sha256Hex}}{{/lower}}


Generate a random number between 1 and 10 (e.g. assigning a group number for audience testing purposes)

{{random 1 10}}
Was this article helpful?
0 out of 0 found this helpful