Loymax, 2026

Template engine for personalization of mass messagings


The template engine allows you to customize message content (email, SMS, push) in mass messagings and campaigns. Each customer sees information in the message that is specifically relevant to them.

Contents:

Personalization

Personalization enables messages to be tailored to each individual customer. Loymax Smart Communications adapts message content and builds a personalized offer for each customer, optionally selecting the optimal send time.

Example:  
Within the same product recommendation campaign:

  • One customer receives a message (based on their purchase history) offering replacement razor blades, along with a promotional block stating that a “3 for the price of 2” offer is active at stores in their city.
  • Another customer receives a message (based on their purchase history) offering a charger, along with a promo block announcing the opening of a new order pickup point in their city.

Loymax Smart Communications provides the following personalization tools:

Template engine

The template engine includes:

  • Variables — data about the customer, their receipts, and products in those receipts. For example, a variable can be used to insert the customer’s name into a message;
  • Macros — functions that output information about promo codes, surveys, etc.;
  • Control structures — loops, conditions, and filters.

Example of a variable used in a message:

Good afternoon, {{client.properties.full_name}}.

When the message is sent, the variable is replaced with the actual value, for example:

Good afternoon, Jane Doe.

Variables in Smart Communications

Variables allow you to insert dynamic data into message content (and, for emails, also into the subject line), including:

  • From the customer profile:
    • Customer attributes and metrics;
    • Links for subscription management;
    • Attributes and contents from the most recent receipt and/or order;
    • Dates;
    • Any other custom attributes;
  • Data about the customer’s receipts;
  • Data about products in a receipt;
  • Data about product categories.

Variables are categorized as:

Variable syntax:

{{variable_name}}

System variables

The following system variables are available in Smart Communications:

Variable

Purpose

{{client.properties.full_name}}

Customer’s full name

{{client.properties.last_name}}

Customer’s last name

{{client.properties.first_name}}

Customer’s first name

{{client.properties.middle_name}}

Customer’s middle name

{{client.properties.register_date}}

Customer’s registration date

{{client.properties.city}}

Customer’s city

{{client.properties.zip}}

Customer’s ZIP code

{{client.properties.email}}

Customer’s email

{{client.properties.password}}

Customer’s password

{{client.properties.phone}}

Customer’s phone number

{{client.properties.order_cnt}}

Total number of customer receipts

{{client.properties.order_sum}}

Total value of all customer receipts

{{client.orders.first.date}}

Date of customer’s first receipt

{{client.orders.last.date}}

Date of customer’s last receipt

{{client.orders.last.number}}

Number of customer’s last receipt

{{client.properties.rating}}

Customer scoring

{{client.links.profile}}

Link to the customer’s profile in the Platform

{{client.links.unsubscribe}}

{{client.links.web_version}}

Link to the web version of the email

{{client.properties.bonus_active}}

Number of active bonus points

{{client.properties.bonus_expect_activate}}

Number of bonus points awaiting activation

{{client.properties.bonus_expect_deactivate}}

Number of bonus points awaiting deactivation

{{client.properties.bounce_expect_deactivate_date}}

Bonus points deactivation date

{{client.properties.bonus_expect_deactivate_next}}

Number of bonus points scheduled for deactivation soon

{{client.eventContext.<field_code>}}

Data from the event context

{{client.containers.webcart.items}}

Shopping cart contents

{{client.properties.eorder_cnt}}Total number of customer orders
{{client.properties.eorder_sum}}Total value of all customer orders
{{client.eorders.first.date}}Date of customer’s first order
{{client.eorders.last.date}}Date of customer’s last order
{{client.eorders.first.number}}Number of customer’s first order
{{client.eorders.last.number}}Number of customer’s last order
{{client.eorders.first.<field_code>}}Value of a field in the customer’s first order
{{client.eorders.last.<field_code>}}Value of a field in the customer’s last order
{{client.eorders.first.items}}Contents of the first order
{{client.eorders.last.items}}Contents of the last order

Custom variables

Access to user-defined fields for Customer/Receipt/Receipt Line/Product Category is provided via their field code using the following syntax: {{client.properties.<field_code>}}. For example:

{{client.properties.eye_color}}

You can find a field’s code in Settings > Fields under the tab of the corresponding object (for example, client or product). For instance, the receipt attribute “Payment status” has the code “payment_status_name”.

To construct a variable, use the following formats:

  • {{client.properties.<field_code>}} — value of an attribute from the customer’s profile;
  • {{client.orders.first.<field_code>}} — value of an attribute from the customer’s first receipt;
  • {{client.orders.last.<field_code>}} — value of an attribute from the customer’s last receipt.

To output product attribute values from a cart abandonment scenario, first/last receipt, or product category, you must use loops.

Default values

For string-type attributes, you can define a default value. This value is used in the message if the attribute is empty. For example, you can address the customer by name, falling back to a default if the name is unknown:

{{client.properties.full_name|default('Dear customer')}}

Macros

Macros are small commands that execute scripted actions in the system. For example, the macro {{client.promocode('promo_code_group')}} finds and returns a promo code from the specified group.

System macros

Smart Communications supports the following macros:

Macro

Purpose

{{"now"|date('format')}}

Current date

{{client.promocode('promo_code_group')}}

Issue a promo code to the customer from the specified group

{{client.last_promocode('promo_code_group')}}

Most recently issued promo code from the group

{{client.last_campaign_promocode('promo_code_group')}}

Most recent promo code from the group issued within this campaign

{{client.template_constant('name')}}

Regional constant

{{client.poll('POLL-<poll identifier>')}}

Link to a poll

{{client.loyaltyCard.lastActive.number}}

Information about the customer’s active loyalty card

Date formats

Date-type fields can be displayed in various formats. Use any combination of the following placeholders to define the format:

  • Year:
    • y — 2 digits (e.g., 97, 20);
    • Y — 4 digits (e.g., 1997, 2020);
  • m — month (01–12);
  • d — day (01–31);
  • h — hour;
  • i — minute;
  • s — second.

Example 1. Displaying a date in a message

With format 'Y-m-d', the date appears as '2020-10-20'. With format 'd.m.Y h:i', it appears as '20.10.2020 11:56'.

Example macro usage for Thanking a customer for their latest order:

Thank you for your order placed on {{client.orders.last.date|date('d.m.Y')}}!

The customer receives a message like:

Thank you for your order placed on 29.06.2020!

Example 2. Displaying a date a few days after the current date

To display a future date in the message, use this macro:

{{"now"|date_modify('+1 day')|date('Y-m-d')}}

The customer will see tomorrow’s date.

Example 3. Displaying a date one month after the customer’s registration date

Output a date that is +1 month from the customer’s registration date:

{{client.properties.register_date|date_modify('+1 month')|date('Y-m-d')}}

Inserting a variable or macro into a message

All message editors include a flag icon button. Clicking it reveals the list of available system variables and macros:

To insert a custom variable, you must type it manually.

Preview

To preview how the message will appear with variables and macros replaced by actual values, use the Message preview button.

You can preview an email for a specific customer. In the Customer field, enter the customer’s last name/first name/phone number/email/local identifier (local_id). For unambiguous results, we recommend searching by phone number/email/local customer ID.

The Customer search field is case-sensitive. Customer first and last names must be entered with an initial capital letter.

Control structures

Control structures enable the creation of more sophisticated templates using variables and macros. They include for-loops, conditional statements (if/elseif/else), and filters, and are enclosed in {% ... %} blocks.

Variables

To reuse the same expression multiple times in a message, define a variable. For example, define the variable webcart for the shopping cart items array:

{% set webcart = client.containers.webcart.items %}

Loops

Use loops in the following scenarios:

  • Output product attributes from the customer’s first/last receipt;
  • Output product attributes from the cart;
  • Output product category attributes;
  • Display information for all active customer loyalty cards (when multiple exist).

For example, output the names of all products in the customer’s last receipt:

{% for item in client.orders.last.items%}
   {{item.name}}
{% endfor %}

Output name and color for all products in the cart:

{% set webcart = client.containers.webcart.items %}
{% for item in webcart %}
    {{item.name}}
    {{item.color}}
{% endfor %}

Output the category name for all products in the last order:

{% for item in client.orders.last.items%}
{{item.category.name}}
{% endfor %}

Output information for all active customer cards:

{% for card in client.loyaltyCard.items %}
{{card.number}}
{% endfor %}

Conditions

You can display data only when a specific condition is met. For example, issue a promo code only to customers from Birmingham:

{% if client.properties.city == 'Birmingham' %}
{{client.promocode('promo_code_group')}}
{% endif %}

Examples of condition syntax:

  • {% if client.properties.city == 'Birmingham' %} — if the customer is from Birmingham;
  • {% if client.properties.city %} — if the customer’s city is specified;
  • {% if not client.properties.city %} — if the customer’s city is not specified;
  • {% if client.properties.city == 'Birmingham' OR client.properties.city == 'Manchester' %} — if the customer is from Birmingham or Manchester;
  • {% if client.properties.city == 'Birmingham' AND client.properties.first_name == 'Maria' %} — if the customer is from Birmingham and their name is Maria.

Filters

The following filters are available for arrays:

  • sortArray — sorts an array by attribute values:
    • sortArray('date', true) — descending date order;
    • sortArray('date', false) — ascending date order (you can sort by other attributes as well);
  • get — limits the number of elements returned:
    • get(10) — returns the first 10 array elements;
  • date_diff('date') — calculates the number of days between two dates. For example, output the number of days from 2020-11-11 to today:

{{"now"|date('Y-m-d')|date_diff('2020-11-11')}}

Outputting cart data

Example using filters: output the name, image, and price for the first 10 products added to the cart.

{% set webcart = client.containers.webcart.items|sortArray('date', false)|get(10) %}
{% for item in webcart %}
{{item.name}}
{{item.image_url}}
{{item.price}}
{% endfor %}

To make the product name a clickable link, use an <a> tag with an href attribute:

<a href="{{item.product_url}}">{{item.name}}</a>

Adding data from data marts

Loymax Smart Communications allows you to insert values from data marts into message content. For “one-to-one” marts, use the following syntax:

{{client.marts.<mart_code>.<field_code>}}

For multi-marts (collections of objects), use a loop:

{% set items = client.multimarts.<mart_code>.items %}
{% for item in items %}
   {{item.<field_code_1>}}
   {{item.<field_code_2>}}
   {{item.<field_code_3>}}
{% endfor %}

Using trigger context data

When a trigger fires, the trigger context stores information about the object or collection of objects that caused the trigger. Depending on the trigger type, this could be a product, order, category, etc. The context is always tied to a specific customer and can be used to personalize communications.

In campaign messages, you can use values from the fields of the object in the trigger context. The data structure matches the object’s data model and includes all fields configured for that object type.

Every trigger context includes a client object. Using this object, you can access any field from the customer profile, whether system or custom. Use the following syntax: {{trigger.client.properties.<field_code>}}

Some triggers pass additional objects besides client. See the table below.

TriggersObjects in contextNotes
  • client (Customer)
  • order (Receipt)

To access receipt fields, use: {{trigger.order.<receipt_field_code>}}

To iterate over all receipt lines, use a loop:

{% for item in trigger.order.items %}
   {{item.<receipt_line_field_code>}}
{% endfor %}

Receipt lines also include a category field populated with data from the product’s category. Access category fields using: {{item.category.<category_field_code>}}

  • client (Customer)
  • eorder (Order)

To access order fields, use: {{trigger.eorder.<order_field_code>}}

To iterate over all order lines, use a loop:

{% for item in trigger.eorder.items %}
   {{item.<order_line_field_code>}}
{% endfor %}

Order lines also include a category field. Access category fields using: {{item.category.<category_field_code>}}

Added product to container
  • client (Customer)
  • product (Product)
Use this syntax to access product fields: {{trigger.product.<product_field_code>}}
  • client (Customer)
  • products (collection of Product objects)

To iterate over all products in the collection, use a loop:

{% for product in trigger.products %}
   {{product.<product_field_code>}}
{% endfor %}
Lost view of category
  • client (Customer)
  • category (Product category)

Because this trigger processes events from the last 48 hours, many Category view (view_category) events may occur. Only two categories are stored in the trigger context: the most recently viewed and the most frequently viewed.

To reference the most recently viewed category, use: {{trigger.last_category.<category_field_code>}}

To reference the most frequently viewed category, use: {{trigger.frequent_category.<category_field_code>}}