On this page
Sommatic Docs
Open portal

Handlebars

How data.template renders text with Handlebars — what data the template sees, the built-in helpers you can use, HTML escaping, and how later nodes read the rendered text.

View as Markdown
Open in

data.template renders a text — an email body, a message, a document — from a Handlebars template. Use it when the text is long and mostly fixed, with values and repeated blocks in between.

What the template sees

The template field is read by Handlebars, not by the expression engine. It renders against the input of the node (the output of the previous node), and nothing else: fields are named directly, and run variables such as $json, $execution or $('…') are not available.

Handlebars
Hello {{customer.first_name}},

We received your request {{request_id}} on {{received_at}}.

When the template needs data from several nodes or from the run, put a data.transform before it that builds exactly the object the template reads:

JavaScript
{{ ({ customer: $('Find customer').item.json, request_id: $execution.id, received_at: $now.setZone('America/Bogota').toFormat('yyyy-LL-dd HH:mm') }) }}

Output

The node returns its input plus a text field with the rendered result. Later nodes read it like this:

JavaScript
{{ $('Render email').item.json.text }}

Built-in helpers

Only the helpers that ship with Handlebars are available:

HelperUse
if / elseRender a block when a value is truthy
unlessRender a block when a value is falsy
eachRepeat a block for every element of a list (@index, @first, @last)
withChange the context to a nested object
lookupRead a key whose name is in another field
logWrite a value to the log
Handlebars
{{#if vip}}Priority customer{{else}}Standard customer{{/if}}

{{#each items}}
- {{sku}} × {{qty}}{{#unless @last}},{{/unless}}
{{/each}}

{{#with customer}}{{first_name}} {{last_name}}{{/with}}

{{lookup labels status}}

Escaping

Double braces escape HTML characters (&, <, >, quotes): {{name}} renders Ana &amp; Co for Ana & Co. Use triple braces to insert a value as it is, for example a fragment of HTML you built yourself:

Handlebars
{{{signature_html}}}

A missing field renders as an empty string. To write literal double braces, escape them with a backslash: \{{name}}.

Next steps

Install agent tools

Give your coding agent the official Sommatic AI docs: skills, the docs MCP server and Markdown pages, so it never has to scrape the site.

Skills only. They do not update by themselves; run it again to refresh.

npx skills add https://docs.sommatic.ai
How agents read these docs