Skip to content

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.

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.

FieldTypeRequiredDescription
template_htmlHTML EditorYesTemplate 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.

{
"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.

SyntaxDescription
{{name}}Root payload field
{{customer.email}}Nested field (dot-notation)
{{items.0.description}}First element of an array
{{$mem.invoice_id}}Workflow memory variable
<!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>
{
"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"
}
Next nodeUse case
sendMailSend the HTML as email body
generatepdfConvert HTML to PDF via API2PDF
setVariableSave data.html to memory for later use
httpSend 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}}.
  • generatepdf — converts data.html to 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