Mustache Template

Processes a Mustache template with the provided data

Overview

This node processes a Mustache template using provided data to render a customized output string. It is useful for dynamically generating text based on input data or custom JSON data, such as creating personalized messages, generating formatted reports, or preparing templated content for emails or documents.

Use Case Examples

  1. Rendering a greeting message like 'Hello John!' by using input item data with a 'name' field.
  2. Generating a report summary by applying a Mustache template to custom JSON data provided in the node.
  3. Creating dynamic email content by rendering templates with data from previous workflow steps.

Properties

Name Meaning
Template The Mustache template string to be rendered, which can include placeholders for variables.
Data Source Specifies whether to use data from the input item or custom JSON data for template variables.
Custom Data Custom JSON data to use for template variables when 'Custom Data' is selected as the data source.
Output Key The key under which the rendered template string will be stored in the output JSON.
Keep Input Data Determines whether to keep the original input data and add the rendered template to it, or to return only the rendered template in the output.

Output

JSON

  • outputKey - The rendered Mustache template string stored under the user-defined output key.
  • error - Error message if template rendering fails (present only on error).
  • success - Boolean indicating success status of the rendering (false if error occurs).

Dependencies

  • Mustache library for template rendering

Troubleshooting

  • Common issues include syntax errors in the Mustache template or invalid JSON in the custom data field.
  • If the template references variables not present in the data source, the output may be incomplete or empty for those placeholders.
  • Error messages during rendering will be logged and included in the output under 'error' key; check the message for details and correct the template or data accordingly.

Links

Discussion