Description
N8N Text Templater Node – Dynamic Template Engine for Workflow Automation
Transform your N8N workflows with powerful text templating – Generate dynamic content using Mustache, Handlebars, Nunjucks, or EJS template engines for AI prompts, email automation, reports, and more.




—
📑 Table of Contents
- Why Text Templater?
- Key Features
- Installation
- Quick Start Guide
- Templating Engines
- Use Cases
- Examples
- Configuration
- Best Practices
- Troubleshooting
- Contributing
- License
- AI & LLM Integration – Generate dynamic prompts for ChatGPT, Claude, GPT-4, and other AI models
- Email Marketing – Personalize bulk emails with customer data and conditional content
- Report Generation – Create formatted reports with charts, tables, and dynamic data
- API Development – Build dynamic JSON/XML payloads for REST APIs
- Documentation – Auto-generate technical docs, release notes, and changelogs
- Content Creation – Produce blog posts, social media content, and marketing copy
- Workflow Automation – Transform data between services with custom formatting
- Works immediately after installation
- Sensible defaults for all parameters
- No external dependencies or API keys required
- Runs entirely within your N8N instance
- Built-in XSS protection with autoescape
- Sandboxed template execution
- No
eval()or arbitrary code execution (except EJS) - Secure by default for all engines
- Fast template compilation and rendering
- Minimal memory footprint
- Batch processing support for multiple items
- Efficient caching for repeated templates
- Rendered text content
- Character and line counts
- Engine used for rendering
- Timestamp of generation
- Error details (if any)
- Full support for N8N expressions (
={{$json.field}}) - Works with all N8N data types
- Seamless integration with other nodes
- Visual workflow builder compatible
—
🎯 Why Text Templater?
The N8N Text Templater is a must-have community node for anyone building automated workflows that require dynamic text generation. Whether you’re creating AI prompts, personalizing emails, generating reports, or building API requests, this node provides professional-grade templating capabilities directly in your N8N workflows.
Perfect for:
—
✨ Key Features
🎨 Multiple Template Engines
Choose from 4 industry-standard templating engines, each optimized for different use cases:
| Engine | Best For | Complexity | Performance |
|——–|———-|———–|————-|
| Mustache | Simple substitution | Beginner | ⚡ Fastest |
| Handlebars | Logic & loops | Intermediate | ⚡ Fast |
| Nunjucks | Filters & inheritance | Advanced | 🔥 Medium |
| EJS | JavaScript power | Expert | 🔥 Medium |
🚀 Zero Configuration
🔒 Security First
⚡ Performance Optimized
📊 Rich Output
Every execution returns:
🔗 N8N Integration
—
📦 Installation
Option 1: N8N Community Nodes (Recommended)
The easiest way to install the Text Templater node:
1. Open your N8N instance
2. Navigate to Settings → Community Nodes
3. Click “Install a community node”
4. Enter: n8n-nodes-text-templater
5. Click Install and wait for completion
6. Refresh your browser
Option 2: Manual Installation (npm)
For self-hosted N8N installations:
Navigate to your N8N custom nodes directory
cd ~/.n8n/nodesInstall the package
npm install n8n-nodes-text-templaterRestart N8N
n8n restart
Option 3: Docker Installation
Add to your docker-compose.yml or environment variables:
services:
n8n:
image: n8nio/n8n
environment:
- N8NCOMMUNITYPACKAGES=n8n-nodes-text-templater
ports:
- "5678:5678"
Or use environment variable:
docker run -it --rm
-e N8NCOMMUNITYPACKAGES=n8n-nodes-text-templater
-p 5678:5678
n8nio/n8n
Option 4: Development Installation
For developers who want to modify the node:
Clone the repository
git clone https://github.com/llmx-tech/n8n-nodes-text-templater.git
cd n8n-nodes-text-templaterInstall dependencies
npm installBuild the node
npm run buildLink for development
npm link
cd ~/.n8n/nodes
npm link n8n-nodes-text-templaterRestart N8N
n8n restart
—
🚀 Quick Start Guide
Step 1: Add Text Templater to Your Workflow
1. Click the “+” button in your N8N workflow
2. Search for “Text Templater” or “template”
3. Select the Text Templater node
Step 2: Select a Template Engine
Choose from Mustache, Handlebars, Nunjucks, or EJS based on your needs:
Step 3: Write Your Template
Enter your template with placeholders for dynamic data:
Hello {{name}}!Your order #{{orderId}} has been confirmed.
Step 4: Provide Variables
Add your data as JSON:
{
"name": "John Doe",
"orderId": "12345"
}
Step 5: Execute and View Results
Click “Execute node” to see your rendered template:
Hello John Doe!Your order #12345 has been confirmed.
—
🎨 Templating Engines
1. Mustache – Simple & Logic-Free
Use Mustache when: You need simple variable substitution without complex logic.
Syntax: {{variable}}
Features:
Example:
Hello {{name}}!Your order #{{orderId}} has been {{status}}.
{{#premium}}
🌟 Thank you for being a premium member!
Enjoy your {{discount}}% discount.
{{/premium}}
{{^premium}}
💡 Upgrade to premium for exclusive benefits!
{{/premium}}
Variables:
{
"name": "Alice Smith",
"orderId": "ORD-12345",
"status": "shipped",
"premium": true,
"discount": 20
}
Output:
Hello Alice Smith!Your order #ORD-12345 has been shipped.
🌟 Thank you for being a premium member!
Enjoy your 20% discount.
Learn more: Mustache Documentation
—
2. Handlebars – Logic & Helpers
Use Handlebars when: You need conditional logic, loops, and custom formatting.
Syntax: {{#if}}, {{#each}}, helpers
Features:
Example:
Order Summary for {{customer.name}}
{{#if customer.isPremium}}
VIP Customer 🌟
Loyalty Points: {{customer.points}}
Discount Rate: {{customer.discountRate}}%
{{else}}
Standard Customer
{{/if}}Items Ordered
{{#each items}}
{{@index}}. {{this.name}} - ${{this.price}} x {{this.quantity}}
Subtotal: ${{multiply this.price this.quantity}}
{{/each}}
---
Total: ${{total}}
{{#if customer.isPremium}}
After {{customer.discountRate}}% discount: ${{discountedTotal}}
{{/if}}
Variables:
{
"customer": {
"name": "Bob Johnson",
"isPremium": true,
"points": 1250,
"discountRate": 15
},
"items": [
{"name": "Laptop", "price": 999, "quantity": 1},
{"name": "Mouse", "price": 25, "quantity": 2}
],
"total": 1049,
"discountedTotal": 891.65
}
Learn more: Handlebars Documentation
—
3. Nunjucks – Filters & Inheritance
Use Nunjucks when: You need advanced formatting, filters, and template inheritance.
Syntax: {% if %}, {{ var | filter }}
Features:
Example:
Welcome {{ name | title }}!
{% if memberSince %}
Member since: {{ memberSince | date("MMMM YYYY") }}
Status: {{ status | upper }}
{% endif %}
Your Recent Activity
{% for activity in activities %}
{{ activity.date | date("MMM DD") }}: {{ activity.description }}
{% if activity.important %}⭐ Important{% endif %}
{% endfor %}{% if activities | length > 5 %}
Showing 5 of {{ activities | length }} activities.
{% endif %}
---
Email: {{ email | lower }}
Phone: {{ phone | default("Not provided") }}
Variables:
{
"name": "charlie brown",
"memberSince": "2023-01-15",
"status": "gold",
"email": "Charlie.Brown@EXAMPLE.com",
"activities": [
{"date": "2025-11-01", "description": "Logged in", "important": false},
{"date": "2025-11-05", "description": "Made purchase", "important": true}
]
}
Learn more: Nunjucks Documentation
—
4. EJS – Embedded JavaScript
Use EJS when: You need full JavaScript power for complex calculations.
Syntax: <%= expression %>, <% code %>
Features:
Example:
Analytics Report - <%= new Date().toLocaleDateString() %>
Performance Metrics
<%
const growth = ((metrics.current - metrics.previous) / metrics.previous * 100).toFixed(2);
const status = growth > 0 ? '📈 UP' : '📉 DOWN';
%>
Total Revenue: $<%= metrics.current.toLocaleString() %>
Previous Period: $<%= metrics.previous.toLocaleString() %>
Growth: <%= status %> <%= Math.abs(growth) %>% Top Products
<% products.sort((a, b) => b.sales - a.sales).slice(0, 3).forEach((product, index) => { %>
<%= index + 1 %>. <%= product.name.toUpperCase() %>
Sales: $<%= product.sales.toLocaleString() %>
Units: <%= product.units %>
Avg Price: $<%= (product.sales / product.units).toFixed(2) %>
<% }); %>
Summary
<% if (growth > 10) { %>
🎉 Excellent performance! Growth exceeded 10%.
<% } else if (growth > 0) { %>
✅ Positive growth. Keep it up!
<% } else { %>
⚠️ Negative growth. Review strategy.
<% } %>
Variables:
{
"metrics": {
"current": 125000,
"previous": 98000
},
"products": [
{"name": "Widget Pro", "sales": 45000, "units": 150},
{"name": "Gadget Plus", "sales": 38000, "units": 200},
{"name": "Tool Master", "sales": 42000, "units": 100}
]
}
Learn more: EJS Documentation
—
💡 Use Cases
1. AI Prompt Engineering
Generate dynamic prompts for ChatGPT, Claude, GPT-4, and other AI models:
You are a {{role}} assistant specializing in {{domain}}.Task: {{task}}
Context:
{{#each contextItems}}
{{this}}
{{/each}}Requirements:
Tone: {{tone}}
Length: {{maxWords}} words
Format: {{format}}
Target Audience: {{audience}} Additional Instructions:
{{#if includeExamples}}
Provide at least {{exampleCount}} examples.
{{/if}}
Please provide a comprehensive response following these guidelines.
2. Email Marketing Automation
Create personalized email campaigns:
Subject: {{#if isPremium}}🌟 Exclusive Offer for {{firstName}}{{else}}Special Offer Inside!{{/if}}Hi {{firstName}},
{{#if isPremium}}
As a valued premium member, we're excited to offer you an exclusive {{discount}}% discount!
{{else}}
We have a special offer just for you!
{{/if}}
{{#each recommendedProducts}}
📦 {{this.name}}
Regular Price: ${{this.originalPrice}}
{{#if ../isPremium}}Your Price: ${{this.premiumPrice}}{{else}}Sale Price: ${{this.salePrice}}{{/if}}
{{/each}}
Use code: {{promoCode}}
Offer expires: {{expiryDate}}
Best regards,
The {{companyName}} Team
3. Report Generation
Generate formatted business reports:
{{ reportTitle }} - {{ reportDate | date("MMMM DD, YYYY") }}
Executive Summary
Total Revenue: ${{ revenue | formatNumber }}
Total Orders: {{ orderCount }}
Average Order Value: ${{ (revenue / orderCount) | round(2) }}
{% if growthRate > 0 %}
📈 Revenue Growth: +{{ growthRate }}%
{% else %}
📉 Revenue Change: {{ growthRate }}%
{% endif %}
Regional Performance
{% for region in regions %}
{{ region.name }}
Revenue: ${{ region.revenue | formatNumber }}
Orders: {{ region.orders }}
Top Product: {{ region.topProduct }}
{% endfor %}Insights
{% for insight in insights %}
{{ insight }}
{% endfor %}
4. API Request Building
Create dynamic API payloads:
{
"query": "{{searchQuery}}",
"filters": {
"category": "{{category}}",
"priceRange": {
"min": {{minPrice}},
"max": {{maxPrice}}
},
"inStock": {{inStock}},
"tags": [{{#each tags}}"{{this}}"{{#unless @last}},{{/unless}}{{/each}}]
},
"sort": {
"field": "{{sortField}}",
"order": "{{sortOrder}}"
},
"pagination": {
"page": {{page}},
"limit": {{pageSize}}
}
}
5. Documentation Generation
Auto-generate technical documentation:
API Documentation - {{apiName}} v{{version}}
Endpoints
{{#each endpoints}}
{{this.method}} {{this.path}}
Description: {{this.description}}
Authentication: {{#if this.requiresAuth}}Required{{else}}Not required{{/if}}
Parameters:
{{#each this.parameters}}
{{this.name}} ({{this.type}}) - {{this.description}}
{{#if this.required}}Required{{else}}Optional{{/if}}
{{/each}}Example Request:
{{this.exampleLanguage}}
{{this.exampleRequest}}
Response:
json
{{this.exampleResponse}}
---
{{/each}}
6. Social Media Content
Generate social media posts:
{{#if platform}}{{#eq platform "twitter"}}
🚀 {{announcement}}{{#each features}}
✅ {{this}}
{{/each}}
Learn more: {{url}}
#{{hashtag1}} #{{hashtag2}}
{{/eq}}{{/if}}
{{#if platform}}{{#eq platform "linkedin"}}
I'm excited to announce: {{announcement}}
Key features:
{{#each features}}
• {{this}}
{{/each}}
This is a game-changer for {{audience}}.
{{url}}
{{/eq}}{{/if}}
—
⚙️ Configuration
Parameters
| Parameter | Type | Required | Default | Description |
|———–|——|———-|———|————-|
| Templating Engine | Dropdown | Yes | Mustache | Choose the template engine |
| Template | String | Yes | – | The template string with placeholders |
| Variables | JSON | Yes | {} | Data to populate the template |
Engine Selection
The Template field automatically updates its placeholder based on the selected engine, showing you the appropriate syntax.
Using N8N Expressions
You can use N8N expressions in the Variables field:
// Pass all incoming data
={{$json}}// Pass specific fields
={{"name": $json.customerName, "email": $json.email}}
// Combine static and dynamic data
={{"greeting": "Hello", "name": $json.name, "date": $now}}
// Use data from previous nodes
={{"userData": $node["Get User"].json, "orderId": $json.id}}
Output Format
The node returns:
{
"text": "The rendered template text",
"metadata": {
"engine": "mustache",
"charCount": 145,
"lineCount": 8,
"timestamp": "2025-11-08T10:30:00.000Z"
}
}
—
🎓 Best Practices
1. Choose the Right Engine
2. Security Considerations
3. Performance Tips
4. Template Organization
// Good: Clear, organized template
const template =
Hello {{name}}!{{#if premium}}
VIP Content
{{/if}}
;// Bad: Messy, hard to read
const template = "Hello {{name}}! {{#if premium}}VIP{{/if}}";
5. Error Handling
Always handle potential errors in your workflow:
1. Use an IF node to check for empty templates
2. Add error handlers for invalid JSON in variables
3. Test with edge cases (empty strings, null values)
4. Monitor the metadata output for issues
—
🐛 Troubleshooting
Node Not Showing Up?
1. Refresh browser (Cmd+Shift+R or Ctrl+Shift+F5)
2. Check installation:
cd ~/.n8n/nodes
ls | grep text-templater
3. Restart N8N:
n8n restart
4. Check N8N logs for errors
Template Not Rendering?
1. Check syntax matches selected engine
2. Verify variable names match placeholders exactly
3. Validate JSON in variables field
4. Look at error messages in execution details
Variables Not Working?
1. Ensure JSON is valid (use a JSON validator)
2. Check for typos in variable names
3. Verify N8N expressions are correct: ={{$json.field}}
4. Test with static JSON first
Performance Issues?
1. Reduce template size (break into smaller chunks)
2. Use a simpler engine (Mustache instead of EJS)
3. Process fewer items per execution
4. Check for infinite loops in templates
Common Errors
| Error | Cause | Solution |
|——-|——-|———-|
| “Invalid JSON” | Malformed variables | Validate JSON syntax |
| “Template syntax error” | Wrong syntax for engine | Check engine-specific docs |
| “Variable not found” | Missing data | Verify variable names |
| “Node not found” | Not installed | Reinstall the node |
—
🤝 Contributing
We welcome contributions! Here’s how you can help:
Reporting Issues
Found a bug? Create an issue with:
Feature Requests
Have an idea? Open a feature request describing:
Pull Requests
1. Fork the repository
2. Create a feature branch: git checkout -b feature/amazing-feature
3. Make your changes
4. Add tests if applicable
5. Run linting: npm run lint:fix
6. Commit: git commit -m 'Add amazing feature'
7. Push: git push origin feature/amazing-feature
8. Open a Pull Request
Development Setup
Clone your fork
git clone https://github.com/YOUR-USERNAME/n8n-nodes-text-templater.git
cd n8n-nodes-text-templaterInstall dependencies
npm installBuild
npm run buildLink for testing
npm link
cd ~/.n8n/nodes
npm link n8n-nodes-text-templaterStart N8N in dev mode
n8n start
—
📄 License
This project is licensed under the MIT License – see the LICENSE file for details.
—
🔗 Links
—
🌟 Show Your Support
If this node helps your workflow, please:
—
🏷️ Keywords
n8n n8n-node n8n-community-node workflow-automation template-engine mustache handlebars nunjucks ejs text-templating dynamic-content ai-prompts email-automation report-generation api-integration chatgpt gpt-4 claude workflow automation low-code no-code
—
Made with ❤️ by LLMX | Powered by N8N