Skip to main content

Liquid Templates

Liquid Templates can be used for dynamic content transformation. Liquid is a templating language

Common Use Cases​

  • JSON-to-JSON Transformation for API integrations.

  • Dynamic Email Template Generation for notifications.

    Liquid syntax enables placeholders, loops, conditionals, and filters to dynamically process data before rendering the final output. For detailed syntaxes and examples refer to Fuild core.

Example Use Cases​

  • A third-party API returns data in one format, but your application expects a different format. Using a Liquid Template, you can map and restructure the response dynamically.

  • Liquid Templates can be used to create dynamic email content. This is useful for:

    Sending personalized emails based on user data.

    Formatting transactional notifications dynamically.

Create Liquid Templates​

Follow the below steps to create a new liquid template:

  1. From the explorer menu, right-click Server (or) UI in Liquid Templates and select Add.

  2. In the properties panel, configure the properties as required and then click save.

    | Property | Description | Comments | | --- | --- | --- | | Name* | Name of the Template. | Name must start with a character followed by alphanumeric or ''. No spaces are allowed. Except underscore (), no other special characters are allowed. Name cannot start with a number. | | Template* | Define the template. Click the builder icon and add the template in Liquid Template pop-up window. | Supported formats are HTML, JSON, XML, TEXT. | | Description | Summary of the Liquid Template | - | | Is Active | Specify whether the exception is active for accessing. Either Yes or No. | By default, it is set to Yes. |

Note: An asterisk (*) denotes that the property is mandatory for creating a liquid template.

The "Liquid Template added successfully" message displays upon successful creation. Input Params folder is created by default.

Add Input Parameters​

Users can add the parameters for a liquid template as applicable. To add, follow the below steps:

  1. Right-click the Input Params and select Add. A pop-up window displayed.

  2. Configure the below properties as required and the click Save.

    | Property | Description | Comments | | --- | --- | --- | | Parameter Name* | Name of a parameter. | Name must start with a character followed by alphanumeric or ''. No spaces are allowed. Except underscore (), no other special characters are allowed. Name cannot start with a number. | | Is Array | Specify whether the parameter is an array or not. | By default, it is set to No. | | Data Type* | Select the data type of the parameter from the drop-down. | - | | Description | Provide a description for the parameter. | |

Note: An asterisk (*) denotes that the property is mandatory for creating a liquid template.

The "Input Parameter added successfully" message displays upon successfully adding a parameter or variable.

Examples of Liquid Template​

  1. Variable Output:

    Use {{ variable_name }} to display values dynamically.

    Example: Hello, {{ user.name }}!

  2. Filters:

    Modify output with built-in filters.

    Example: {{ user.name | upcase }} , {{ price | currency }}

  3. Control Flow:

    Conditional Statements:

    {% if user.is_admin %} Welcome, Admin! {% else %} Welcome, User! {% endif %}

  4. Loops:

    {% for item in cart.items %} {{ item.name }} - {{ item.price }} {% endfor %}

  5. Object Access & Nesting:

    Reference structured data within objects.

    Example: {{ order.customer.email }}, {{ order.items[0].name }}

  6. Includes & Partials (Reusable Components):

    You can create reusable template snippets using {% include %} or {% render %}.

    Example: {% include 'header' %}