What is the Message Template Engine?
  • 17 Apr 2023
  • 2 Minutes to read
  • Dark
    Light
  • PDF

What is the Message Template Engine?

  • Dark
    Light
  • PDF

Article Summary

The Message Template Engine is a special-purpose text-based identifier that offers variables to create messages with dynamic content.

Here’s how it works: first, customer data is uploaded using engine variables. The system then displays the details that belong to each particular customer.

In other words, the message you send to each client will be personalized based on the parameters that you’ve specified you want to include — such as their name, gender, birthdate, bonus point balance, actions (e.g items they’ve browsed or added to their carts), orders, and more.

To visit the Variables page, click CampaignsMessage Template Variables:

00_tempengine

You can also open this section directly from the message editor:

01_tempengine

Details Available in the Variables Section

Name

This is compiled by joining all the names end-to-end, with the target variable name at the end.

For instance, to display the custom field Favorite color: сhoose the base parameter (Recipient), then a group of custom fields (AdditionalData), and only then the name of this custom field (which is Color in our case).

The final variable name will include all these names joined by dots:
Recipient.AdditionalData.Color

02_tempengine

For details on how to render a variable in a message, please refer to this article.

Type

Data types can be grouped into two categories:

  • Primitive:

    • String
    • Date & time
    • Number
      • Integer
      • Decimal
    • Boolean
  • Composit:

    • Aggregate

Messages only support primitive data types, e.g., booleans in conditional statements.

All elements in aggregates consist of primitive fields. First, the user requests an aggregate element using the cycle @for...@end for. Then, the system populates relevant details into each element.

A customer (Recipient), a change in a customer’s balance (CustomerBalanceChange), and an order are implemented as sets of variables. They belong to the composite data type but they are not aggregates. The user cannot display the values of such variables in a message directly. Instead, you have to call a string, number, or other values that are ’inside’ a given variable.

For example, you cannot display a Recipient in a message as the system does not know which details the user is requesting.

However, the user can display a customer’s name (Recipient.FirstName — which is a "string" type of data) or their birthdate (Recipient.BirthDate, which falls into the "date & time" data category).

Description

A short description for your variable to help you better understand what it refers to.

Accessibility

There are variables that depend on events. These are not simply customer details. Instead, these variables deal with details of a specific action, order, or website session. Variables like this can only be used in custom automated campaigns that are launched after a specified trigger event.

Example:

03_tempengine

For more details on how to handle these types of events and test messages related to them, please refer to this article.

What Operators are Available

Operators that are available to handle given data depend on the type of this data.

— Logical connectives (and, or)

Available with all primitive data types

— Arithmetic operators: Addition (+), Subtraction (-), Multiplication (*), Division (/)

Available with all numbers

— Concatenation operator (&)

Available with all primitive data types

— Comparison operators (<, >)

Available with all numbers

— Equality operators (=, !=)

Depend on the data type. For more information, please refer to this article.