Skip to content

Templates

Templates separate design from triggering: someone designs the receipt once in the visual editor, and your code sends it with three lines — an alias and the variables that change per email. No HTML in your codebase, and design fixes ship without a deploy.

Find the editor in the dashboard under Transactional → Templates. Any signed-in account can browse it; creating and sending templates requires a Pro or Business plan (see Transactional email).

Aliases

Every template has an alias — a short handle like order-confirmation — which is what your code passes as templateAlias on the send call. Aliases are unique per account; if you create a template with a taken alias, Faivelo appends a number (order-confirmation-2).

A template can be paused from the dashboard. Sends that reference a paused template fail with 409 and nothing goes out — useful when a template is mid-edit and must not be triggered.

Variables

Write {{name}} anywhere in the subject or body and it becomes a variable your code fills at send time:

{ "templateAlias": "order-confirmation", "variables": { "name": "Robin", "total": "$42.00" } }

Rendering is strict: if the template references a variable the send call didn’t provide, the call fails with 422 listing what’s missing — nothing is sent. A receipt can’t go out with a blank total.

Repeating sections

For variable-length content — order line items, a list of alerts — mark a block as a section. In the send call, feed it an array of rows, and the block renders once per row:

{
"variables": {
"items": [
{ "product": "Notebook", "price": "$12.00" },
{ "product": "Pen", "price": "$3.00" }
]
}
}

Inside the section block, {{product}} and {{price}} refer to the current row’s values.

The API-content slot

A template can include an API-content slot — a placeholder that your send call fills with its own html. The caller’s markup renders inside the designed template (header, theme, footer intact) instead of replacing it. This is the pattern for emails whose body is generated by your app — a digest, a report — that should still wear your design.

If a template has no slot, any html on a template send is simply unused.

Shared theme

Your account has a shared theme — brand color, fonts, logo — that every template inherits by default. Change the theme once and every inheriting template updates together. A template can also detach and carry its own values when one email needs to look different.

Test sends

The editor’s test send delivers the template to an address you choose through the real production pipeline, with the sample values shown in the preview — a faithful rehearsal, not a simulation. Test sends count against your monthly sending limit like any other delivery.

Next steps