Templates
Compose a body once, reuse it, and personalise it with variables that fail loudly rather than silently.
A template is a message body you set up once and send many times. Every template keeps both an HTML body and a plain-text body, so a recipient whose client blocks HTML still gets something readable rather than an empty message.
Two ways to compose
Use the block editor, or write the markup yourself. The same template can be edited either way — the editor is a convenience, not a separate format.
The block editor builds a body from five blocks:
| Block | What it is for |
|---|---|
| Heading | A section title. |
| Text | A paragraph. |
| Image | A hosted image. |
| Button | A call to action with its own link. |
| Spacer | Vertical room between blocks. |
If you would rather write HTML and plain text directly, do that instead. Attachments are supported either way.
Variables
Variables are wrapped in double braces and resolve against the contact the message is going to, including any custom properties you have defined on your contacts:
Hi {{first_name}},
Always set a fallback
?? supplies the value to use when the property is missing or empty:
Hi {{first_name ?? there}},
A contact with no first_name now reads “Hi there,” instead of “Hi ,”. Write the
fallback every time. Imported lists are never as complete as they look, and the one
contact missing a first name is the one who notices.
When a variable does not resolve
A template variable that cannot be resolved produces a rendering_failure event. It is
recorded as a bad outcome, exactly like a bounce or a reject, and it carries the same
trace as every other event — so a send that quietly degraded into “Hi ,” is something you
can find rather than something a recipient has to tell you about.
See the events reference for the full list of event types and what each one means.
Sending with a template
A campaign is a segment, a template, and a from name and address. Build the segment from your contacts, attach the template, set who it comes from, and send.
Two things worth knowing:
Preview sends go to you first. Send the real message to yourself before it goes to
thousands of people. Previews are recorded with the source preview, so they never
pollute the campaign’s counters.
The campaign records what it used. A finished campaign keeps the exact template and segment it sent with, so “what did we actually mail them in March” has an answer that does not depend on anyone remembering.
Sending without a template
The send endpoint takes the body inline — html and text as fields on the request —
rather than a reference to a stored template. The full field list is in the
API reference.
Coming from Mailchimp
Mailchimp’s merge tags are not this syntax, so a template you carry over needs its
variables renamed. *|FNAME|* becomes {{first_name ?? there}}. The rest of the move is
in From Mailchimp.