Message Templates

Prev Next

The Message Template connector enables to create and use static message templates for commonly used messages in Recipes. You can use message templates to generate HTML, text, JSON, and XML messages.

Templates allow you to separate the message composition logic (what the message looks like) from the message generation logic (when the message is sent). This separation enables you to change the message format without changing the Recipe that sends the message.

Message Templates are logic-less. This means that flow logic such as loops and conditional statements (including if and else) is not supported within templates. However, templates support Mustache tags for variable substitution, conditional blocks, and list iteration. Create tags by wrapping text in double curly brackets ({{ }}).

Each Message Template has an associated input schema that defines the variables that must be passed to the Template’s tags. The Recipe developer must provide values for the input schema when using the message template within a recipe.

To create a New Message Template, perform the following steps:

  1. Navigate to Integration Hub > Tools > Message Template.

    Figure: Message Templates

  2. Click Creating a New template on the Message Templates page.

    Figure: Message Templates

  3. Edit the Template Name and enter Template body and Template input in the The New Template page.

    Figure: Message Templates

    Note

    Input parameters must be surrounded by {{ and }}. For example, use {{name}} to insert a value from the input.

    Variables must be added in the Template input field. JSON can be used, or variables can be created manually. Template variables support both scalar data types string, integer, date, number, time, and Boolean and complex data types such as object and list. Values for template variables can be defined in recipes using the Create message action.

  4. In the Template Input select JSON or add the values manually.

    JSON

    Upon selecting JSON, Generate Schema page is displayed.
    Enter the JSON and click Next.

    Figure: JSON sample

    Review and click Generate Schema.
    Figure: Generate Schema

    Add Fields Manually

    1. Click add fields manually.
      Figure: add fields manually

    2. Enter the details in the popup window.

      Figure: Add new Field

    3. Click Add Field to insert in the Template Body.