HTML Template
This node receives an HTML template with {{field}} markers and returns the rendered HTML with the actual payload values. Ideal for generating tickets, invoices, purchase orders, order confirmations, and any parameterized HTML document.
Function
Section titled “Function”Applies procesarVariablesDinamicas over the template: replaces {{field}}, {{field.subfield}}, and workflow memory variable references. The result is an HTML string ready to be sent via email, converted to PDF, or stored.
Configuration
Section titled “Configuration”| Field | Type | Required | Description |
|---|---|---|---|
| template_html | HTML Editor | Yes | Template with {{field}} markers. Supports full HTML with inline CSS. |
The built-in editor includes HTML syntax highlighting, real-time preview, and a dynamic variable explorer that lets you insert markers from the payload without typing them manually.
Output
Section titled “Output”{ "html": "<html>...rendered content...</html>"}The node replaces the entire payload with { html }. To keep original data available in later nodes, combine with a Merge node or save the HTML to a memory variable first.
Dynamic variable syntax
Section titled “Dynamic variable syntax”| Syntax | Description |
|---|---|
{{name}} | Root payload field |
{{customer.email}} | Nested field (dot-notation) |
{{items.0.description}} | First element of an array |
{{$mem.invoice_id}} | Workflow memory variable |
Usage Example
Section titled “Usage Example”Basic invoice template
Section titled “Basic invoice template”<!DOCTYPE html><html><head> <meta charset="UTF-8"> <style> body { font-family: Arial, sans-serif; color: #333; } .header { background: #1976d2; color: white; padding: 20px; } table { width: 100%; border-collapse: collapse; margin-top: 20px; } th, td { border: 1px solid #ddd; padding: 8px; text-align: left; } th { background: #f5f5f5; } </style></head><body> <div class="header"> <h1>Invoice #{{invoice_number}}</h1> <p>Date: {{date}}</p> </div> <p>Customer: <strong>{{customer.name}}</strong> — {{customer.email}}</p> <table> <tr><th>Product</th><th>Quantity</th><th>Price</th></tr> <tr> <td>{{product.name}}</td> <td>{{product.quantity}}</td> <td>{{product.price}}</td> </tr> </table> <p><strong>Total: {{total}}</strong></p></body></html>Workflow configuration
Section titled “Workflow configuration”{ "type": "htmlTemplate", "config": { "label": "Generate invoice HTML", "template_html": "<!DOCTYPE html>...", "nextModule": "send_email" }}Sample input payload:
{ "invoice_number": "INV-2024-0042", "date": "2024-05-13", "customer": { "name": "Acme Corp", "email": "billing@acme.com" }, "product": { "name": "Premium Service", "quantity": 1, "price": "$299" }, "total": "$299"}Common combinations
Section titled “Common combinations”| Next node | Use case |
|---|---|
| sendMail | Send the HTML as email body |
| generatepdf | Convert HTML to PDF via API2PDF |
| setVariable | Save data.html to memory for later use |
| http | Send HTML to an external API (e.g. a printing service) |
- If the template is empty, the node returns an error and stops the flow.
- Variables that don’t exist in the payload are left as literal text
{{field}}without causing an error. - To add an image from the Resources library, use the Image button in the editor toolbar: it inserts an
<img>with its public address. If the image is private, the picker offers to make it public, because whoever receives the HTML will not be signed in. - Inline CSS works correctly; external styles (CDN) only load if the execution environment has internet access.
- For complex loops or conditionals (e.g. dynamic item lists), pre-process the array with an evaluateExpression node that builds the table HTML and injects it as a single variable
{{items_table}}.
Related Nodes
Section titled “Related Nodes”- generatepdf — converts
data.htmlto PDF - sendMail — sends the HTML via email
- barcodeGenerator — generates barcode/QR images that can be embedded in the template via
<img src="{{data.barcode}}"> - evaluateExpression — pre-processes complex data before rendering the template