Skip to content

Generate text from Handlebars template

The “Generate text from template (Handlebars)” service task produces text based on a template. The Handlebars engine injects data into the template and returns the final text.

Input parameters

Provide the following fields as task input:

{
  "template": "string",
  "content": { "key1": "value1", "key2": "value2" }
}

Explanation:

  • template: Text template to fill dynamically. Use Handlebars expressions such as {{key1}}.
  • content: JSON object containing the values to insert into the template.

Output

The task returns the generated text.

{
  "status": 200,
  "response": {
    "result": "Final generated text."
  }
}

Explanation:

  • status: Status of the operation (200 indicates success).
  • result: Final text based on the template and content.

JSONata examples

{
  "template": "<h1>Hello {{name}}</h1><p>Your order: {{order}}</p>",
  "content": {
    "name": "Jane Doe",
    "order": "12345"
  }
}

Available Handlebars helpers

All available helpers (date, numbers, conditions, text, QR code, and more) are documented in the Handlebars Helpers Reference.

Notes

  • Ensure the template and data match so all placeholders can be resolved.
  • Ideal for generating HTML emails, personalized documents, or other text content.
  • See the Handlebars guide for more details.

Tip

Test templates in the Handlebars Playground before using them in production.