Examples of communications templates for orders

Ready-made examples of communications templates with variables that you can use to send on demand.
Written by Владислав Пономарь
Updated 2 weeks ago

In keyCRM, you can create message templates and use them to send messages in chat or via trigger automation.

We have prepared several ready-made templates that contain variables that substitute the saved data from the order fields into the message text.

Note! All templates below have variables and will only work if the «Order» context is selected in the message template settings. The «General» context does not support variables.

1. Confirmation of payment receipt:

Hello!

Your order № {{model.source_uuid}} in the amount of {% for payment in model.payments %}
{% if payment.status == "paid" %}{{ payment.amount|format_currency(currency, locale='de') }}{% endif %}{% endfor %} confirmed!

Departure is scheduled for {{model.shipping_date_actual}}. After shipping, you will receive a waybill.

2. Sent for delivery:

Your order №{{ model.id }} has been shipped by: {{ model.shipping_type }}

Delivery address: {{ model.shipping_receive_point }}

Tracking number: {{ model.tracking_code }}

3. Balance due:

Your order:

{% if (model.products is not empty) %}
{% for product in model.products %}
 {{ loop.index }}. {{ product.product_name }} * {{ product.product_quantity }} pcs. * {{ product.price_sold|format_currency(currency, locale="en") }} =  {{ (product.product_quantity * product.price_sold)|format_currency(currency, locale="en") }}
{% endfor %}
{% endif %}

{% if (model.discount_amount) %}
Discount on order: {{ model.discount_amount|format_currency(currency, locale="de") }}
{% else %}
{% endif %}
Paid: {% for payment in model.payments %}
{% if payment.status == “paid” %}{{ payment.amount|format_currency(currency, locale="de") }}{% endif %}{% endfor %}

{% set paid_amount = 0 %}
{% for payment in model.payments %}
{% if payment.status == “paid” %}
{% set paid_amount = paid_amount + payment.amount %}
{% endif %}
{% endfor %}
Balance to pay: {{ (model.total_price - model.discount_amount + model.shipping_price - paid_amount)|format_currency(currency, locale="de") }}

4. Welcome message depending on the time of sending

{% set name = model.client_name|split(' ') %}
{% if "now"|date('H', "Europe/Kyiv") < 18 %}

Good afternoon, {{ name|last }}!

Your order has been accepted. Please wait for our response 💙
{% else %}

Good evening, {{ name|last }}!

Our working day is over, so your order will definitely be processed tomorrow 💙
{% endif %}

Welcome message depending on the day of the week and time of sending

{# 1. Define time and day variables to simplify the logic #}
{% set day  = 'now'|date("w", "Europe/Kyiv") %}
{% set hour = 'now'|date("H", "Europe/Kyiv") %}

{% set is_weekend = (day == 0 or day == 6) %}
{% set is_business_hours = (hour >= 9 and hour < 20) %}

{# 2. Output messages based on the conditions #}
{% if is_weekend %}
    {% if is_business_hours %}
        Good afternoon! Today is a day off, so your order will be processed on the next business day.
    {% else %}
        Good evening! Today is a day off, so your order will definitely be processed on a working day.
    {% endif %}
{% else %}
    {% if is_business_hours %}
        Good afternoon! Your order has been accepted. A manager will contact you shortly.
    {% else %}
        Good evening! Your order has been accepted, but our working day has already ended, so we will definitely contact you tomorrow.
    {% endif %}
{% endif %}

5. Messages with different text

Usually, automatic messages are identical, and if you send a large number of them, you may be blocked for spam.

To reduce the likelihood of this happening, you can use the method of replacing words or phrases according to the order ID:

{% set last_digit = model.id|split('')|last %}
{% if last_digit in ['1', '4', '7'] %}
Good afternoon! 🙂
{% elseif last_digit in ['2', '6', '8'] %}
Good afternoon! 😉
{% elseif last_digit in ['3', '5', '9'] %}
Hello! ♥️
{% elseif last_digit == '0' %}
Hello! 👋
{% endif %}

{% set last_digit = model.id|split('')|last %}
{% if last_digit in ['4', '5', '0'] %}
We are pleased to inform you that we have received your application and have begun processing it. We will send you the details shortly.
{% elseif last_digit in ['3', '6', '9'] %}
We have received your request and are working on it. We will contact you with details shortly.
{% elseif last_digit in ['2', '7', '8'] %}
We are sending this message to confirm receipt of your application. Please wait for our specialist to contact you for clarification, if necessary.
{% elseif last_digit == '1' %}
We have received your request and are ready to fulfill it. Our team will contact you to confirm the information.
{% endif %}

6. Send only the customer's first name in the chat (without the last name)

If you store the full name of customers or contacts in the format «Ivan Petrenko»:

{% set foo = model.client_name|split(' ')%}
Hello, {{ foo|last }}!

If you store the full name of customers or contacts in the format «Limanso Jackson»:

{% set foo = model.client_name|split(' ')%}
Hello, {{ foo|first }}!

If you store the full name of customers or contacts in the format «Jackson Robert Limanso»:

{% set foo = model.client_name|split(' ') %}
Hello, {{ foo[1] }}!

7. Sending a link to the fiscal receipt

The template sends the payment method and amount for all non-cancelled payments in the order, and if there is a fiscal receipt, it adds it as well:

✅We have received payment for your order № {% if model.source_uuid %}{{ model.source_uuid }}{% else %}{{ model.id }}{% endif %} 

{% for payment in model.payments %}
{% if payment.status != "canceled" %}
 Payment type: {{ payment.type }}
 Total: {{ payment.amount }} USD
{% if payment.fiscal_url %}Fiscal receipt: {{ payment.fiscal_url }}

{% endif %}
{% endif %}
{% endfor %}

To send data only for payments that contain a reference to a fiscal receipt, regardless of their status, use the code:

✅We have received payment for your order № {% if model.source_uuid %}{{ model.source_uuid }}{% else %}{{ model.id }}{% endif %} 

{% for payment in model.payments %}
{% if payment.fiscal_url %}
 Payment type: {{ payment.type }}
 Total: {{ payment.amount }} USD
 Fiscal receipt: {{ payment.fiscal_url }}
{% endif %}
{% endfor %}

  • Links to receipts separately for each type of fiscalization:

{% for payment in model.payments %}
{% if payment.fiscal_type == "Prepayment" or payment.fiscal_type == "Prepayment" or payment.fiscal_type == "Prepaid" %}
Prepayment, receipt:{{ payment.fiscal_url }}
{% endif %}
{% endfor %}

{% for payment in model.payments %}
{% if payment.fiscal_type == "Postpayment" or payment.fiscal_type == "Postpayment" or payment.fiscal_type == "Postpaid" %}
Postpayment, receipt:{{ payment.fiscal_url }}
{% endif %}
{% endfor %}

{% for payment in model.payments %}
{% if payment.fiscal_type == "Full payment" or payment.fiscal_type == "Full payment" or payment.fiscal_type == "Full" %}
Full payment, receipt:{{ payment.fiscal_url }}
{% endif %}
{% endfor %}

8. Sending a link to the invoice for online payments

If you issue invoices for online payment with WayForPay, Plata by mono acquiring, LiqPay, Fondy, RozetkaPay, NovaPay, you can add the variable «Payments: Payment link» to the document template so that the link is automatically added to the message text.

We are waiting for payment for the order № {% if model.source_uuid %}{{ model.source_uuid }}{% else %}{{ model.id }}{% endif %}:  

{% for payment in model.payments %}
{% if payment.invoice_url %}
 Total: {{ payment.amount }} USD
 Payment link: {{ payment.invoice_url }}
{% endif %}
{% endfor %}

Tags: message template, SMS template, SMS template example, custom message, pipeline message, message code
Did this answer your question?