Skip to main content

What it is for

The Variables page explains how to insert a variable in the editor. This page is the complete reference of what a template can write between double braces, where each value comes from and what happens when it is missing.

Common variables

Every template of every event can use these five, whatever data the event carries.
There are exactly five common variables. Any other name must come from the event’s data.

Event variables

The rest of the variables are the event’s data (its payload). Each event declares in the code the shape of its data, the payload schema: which fields it carries, their type and which are required. That schema decides:
  • which variables the editor offers in the Variables card;
  • which variables a template may use: publishing fails when a template uses a field the schema does not declare;
  • the sample data of the preview and of the test send.
The fields of each event are on its page under Events, in the “Template variables” table, with the sensitive ones marked. A field that the schema declares but that a given firing does not carry prints as empty text.

Format helpers

A helper goes before the variable, inside the same braces. There are four; any other word is not a helper. Dates and amounts use the recipient’s language (es-CL, en-US, fr-FR, it-IT or pt-BR) and timezone. A recipient without a timezone uses America/Santiago.

Conditional blocks

Templates have no conditional blocks or loops: there is no {{#if}}, {{#each}} or {{else}}. The syntax is only {{path}} and the four helpers. That is on purpose: a business user can read any template from top to bottom and the preview always shows every line. When a text depends on a condition, use one of these instead:

Escaping and safety

Validation

Email and in-app layout

  • Email. The body you write is wrapped in the brand’s layout (logo, colours, footer). The footer adds the unsubscribe link from {{links.preferences}} when the event can be turned off, and a plain-text version is built automatically.
  • Images. An image whose address changes per environment, such as the icon of the coupon emails, arrives as a variable: write <img src="{{icon_url}}">. The address must start with https:; otherwise the image is shown without it.
  • In-app. The text is rendered when the send is created, in the recipient’s language, and stored ready to show in the inbox. There is no separate layout.

Technical detail