On this page
Sommatic Docs
Open portal

Render Template

Generates dynamic text using the Handlebars templating engine.

View as Markdown
Open in
Data Available data.template Version 1.0.0 Execution: sync

Renders a Handlebars template against the incoming payload and adds the rendered text as text.

This operator allows you to merge data variables into a text template. It is ideal for constructing emails, SMS messages, HTML documents, or SQL queries.

Features:

  • Handlebars Syntax: usage of {{variable}}, {{#each list}}, {{#if condition}}.
  • Rich Input: Full access to the payload as context.

Use Cases:

  • Creating a personalized email body: "Hello {{user.name}}..."
  • Constructing a complex file path: "/archives/{{year}}/{{month}}/report.pdf"

How it works

  1. Reads template raw from the config: it is not passed through the Expression Engine, so every {{ }} in it belongs to Handlebars. Other config keys are resolved as usual.
  2. Compiles it with Handlebars 4 and renders it with the payload as context: {{customer.name}}, {{#each items}}...{{/each}}, {{#if paid}}...{{/if}}.
  3. Returns the payload plus text through out.

In a workflow

The node as it appears in a workflow file (draft_nodes[]), and the envelope of a successful run.

{
  "node_id": "node-ready-message",
  "label": "Ready message",
  "operator_slug": "data.template",
  "operator_version": "1.0.0",
  "config": {
    "template": "Hello {{customer.name}}, your order {{order_id}} is ready."
  }
}

Configuration

template string Required

The text template using Handlebars syntax.

Its configuration shows the shared execution settings, but this node does not apply retries (retryOnFail, maxTries) yet. continueOnFail is not applied by any node.

Behaviour in the code

What the implementation does with these keys beyond what the schema says.

template
Only payload fields are visible. Expression Engine variables ($json, $("Node"), $now, $execution) do not exist here: write {{order_id}}, not {{ $json.order_id }}. An empty template renders "".

Output ports

out default

The template rendered.

Data
{
  "customer": {
    "name": "Ana"
  },
  "order_id": "ord_123",
  "text": "Hello Ana, your order ord_123 is ready."
}
error

The template has a syntax error.

Data
{
  "ok": false,
  "errors": [
    "Template Error: Parse error on line 1: ..."
  ],
  "port": "error"
}

In expressions

What a later node can read from this node's output with $("Render Template").item.json.<path> (write your node's label instead of Render Template). Editor marks the paths the workflow editor suggests under Previous Nodes (the output contract); Worker marks the paths the worker really returns through out, from the output shown in Ports.

ExpressionEditorWorker
$("Render Template").item.json.resultstringThe worker does not return it: reads as undefinedThe rendered string. —
$("Render Template").item.json.customerobjectNot suggested by the editor= {…}—
$("Render Template").item.json.customer.namestringNot suggested by the editor= "Ana"—
$("Render Template").item.json.order_idstringNot suggested by the editor= "ord_123"—
$("Render Template").item.json.textstringNot suggested by the editor= "Hello Ana, your order ord_123 is ready."—

— Editor: The editor suggests it, but the worker does not return it: it reads as undefined.

— Worker: The worker returns it but the editor does not suggest it: write it by hand. Keys inside objects can depend on your data or configuration (for example one key per label).

Errors

Message Port Cause and fix
Template Error: Parse error on line <n>: <details> error Invalid Handlebars syntax, such as an unclosed {{#if}} block.

Input contract

payload object Optional

Data context available in the template.

Output contract

result string Optional

The rendered string.

Contracts (JSON Schema)

The definition exactly as the orchestrator declares it. All is the whole *.definition.js; compare it with the sections above to spot differences between the documentation and the schema. Use it to validate a node before you publish.

{
  "slug": "data.template",
  "name": "Render Template",
  "category": "data",
  "version": "1.0.0",
  "description": "Generates dynamic text using the Handlebars templating engine.\n\n  This operator allows you to merge data variables into a text template. It is ideal for constructing emails, SMS messages, HTML documents, or SQL queries.\n\n  **Features:**\n  - **Handlebars Syntax:** usage of `{{variable}}`, `{{#each list}}`, `{{#if condition}}`.\n  - **Rich Input:** Full access to the payload as context.\n\n  **Use Cases:**\n  - Creating a personalized email body: \"Hello {{user.name}}...\"\n  - Constructing a complex file path: \"/archives/{{year}}/{{month}}/report.pdf\"",
  "capabilities": [
    "templating",
    "handlebars",
    "text-generation"
  ],
  "config_schema": {
    "type": "object",
    "required": [
      "template"
    ],
    "properties": {
      "template": {
        "type": "string",
        "title": "Template String",
        "format": "textarea",
        "description": "The text template using Handlebars syntax."
      },
      "execution": {
        "type": "object",
        "title": "Execution Settings",
        "properties": {
          "alwaysOutputData": {
            "type": "boolean",
            "title": "Always Output Data",
            "description": "Always output data, even on error (if configured).",
            "default": false
          },
          "retryOnFail": {
            "type": "boolean",
            "title": "Retry On Fail",
            "description": "Retry the execution if it fails.",
            "default": false
          },
          "maxTries": {
            "type": "integer",
            "title": "Max Retries",
            "description": "Number of retries.",
            "default": 3,
            "displayOptions": {
              "show": {
                "retryOnFail": [
                  true
                ]
              }
            }
          },
          "waitBetweenTries": {
            "type": "integer",
            "title": "Wait Between Retries (ms)",
            "default": 1000,
            "displayOptions": {
              "show": {
                "retryOnFail": [
                  true
                ]
              }
            }
          },
          "continueOnFail": {
            "type": "boolean",
            "title": "Continue On Fail",
            "description": "Do not crash workflow on error.",
            "default": false
          },
          "timeout_ms": {
            "type": "integer",
            "title": "Timeout (ms)",
            "description": "Max execution time for this node before it is killed, in milliseconds. Honored by long-running operators (e.g. OCR/extraction, inline code). Default 300000 (5 min).",
            "default": 300000
          }
        }
      }
    }
  },
  "input_contract_schema": {
    "type": "object",
    "properties": {
      "payload": {
        "type": "object",
        "description": "Data context available in the template."
      }
    }
  },
  "output_contract_schema": {
    "type": "object",
    "properties": {
      "result": {
        "type": "string",
        "description": "The rendered string."
      }
    }
  },
  "ports": [
    {
      "port_id": "out",
      "label": "Rendered",
      "is_default": true
    },
    {
      "port_id": "error",
      "label": "Error"
    }
  ],
  "execution_mode": "sync",
  "tags": [
    "handlebars",
    "html",
    "template",
    "text"
  ],
  "is_stateful": false,
  "publisher": {
    "identity": "org_link_loom",
    "profile": {
      "name": "Link Loom",
      "verified": true,
      "url": "https://me.veripass.com/link-loom",
      "logo_url": null
    }
  }
}

Execution

Execution
sync
Stateful
No
Retries (retryOnFail)
No
Capabilities
templatinghandlebarstext-generation
Tags
handlebarshtmltemplatetext

Notes and limits

  • {{ }} escapes HTML characters (&, <, >, quotes); use {{{ }}} for raw output.
  • Only the built-in Handlebars helpers are available (if, unless, each, with, lookup, log); no custom helpers are registered. Missing fields render as empty text.
  • The output key is text (the output contract says result); an existing text key is overwritten.
  • When the envelope has no data (or data is falsy), the engine stores the whole envelope as the node output: on error the next node receives { ok: false, errors: [...], port: "error" } as its payload.

Reviewed against the orchestrator code · 31e874b · 2026-11-26

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