Text Templater
AI-generatedOverview
The Text Templater node dynamically populates text templates using one of four templating engines: Mustache, Handlebars, Nunjucks, or EJS. It is useful for generating customized text outputs such as AI prompts, emails, reports, or any scenario where text needs to be dynamically generated based on input variables. For example, it can create personalized email content by filling in user names and membership status, or generate dynamic reports with conditional sections and loops.
Use Case Examples
- Generating personalized email content with user-specific data.
- Creating dynamic AI prompts with conditional logic and loops.
- Producing customized reports with formatted text and filters.
Properties
| Name | Meaning |
|---|---|
| Templating Engine | Selects the templating engine to use for rendering the template. Options include Mustache, Handlebars, Nunjucks, and EJS. |
| Template | The text template to be rendered, written in the syntax of the selected templating engine. Supports variables, conditional logic, loops, and filters depending on the engine. |
| Variables | A JSON object containing variables to populate the template. Supports n8n expressions and can pass all incoming data as variables. |
Output
JSON
text- The rendered text output after applying the template with the provided variables.metadataengine- The templating engine used for rendering.charCount- The character count of the rendered text.lineCount- The number of lines in the rendered text.timestamp- The ISO timestamp when the text was rendered.
Dependencies
- Uses templating libraries for Mustache, Handlebars, Nunjucks, and EJS engines.
Troubleshooting
- Invalid JSON in the 'Variables' parameter will cause an error; ensure the JSON is correctly formatted.
- An empty 'Template' parameter will cause an error; provide a non-empty template string.
- Template rendering errors may occur if the template syntax is incorrect or variables are missing; check the template syntax and variable names.
- Errors specify the item index to help identify which input caused the problem.