Transactional emails

Transactional emails is a powerful tool for sending emails with custom logic. In transactional email you can pass variables and use different logic in it. Such emails are divided into 2 types: Service and Marketing.

Service transaction emails

This type ignores the user's subscription status, and is traditionally used to send service emails:

  • Password recovery;
  • Subscription confirmation (double opt-in (DOI));
  • Confirmation of registration;
  • Processes related to payment (invoice for payment, check, money refund, problems with payment, etc.)

🚧

Limit

One user can't receive more than 5 service emails per hour;

Marketing transactional emails

This type is used for marketing mailings, for example:

  • Mailing coupons;
  • Discounts and product offers to regular customers;

🚧

Note

Users can unsubscribe from marketing campaigns and will no longer be able to receive emails until they subscribe again. Unsubscribing also applies to triggered mailings.

Using variables in email layout

Request body - JSON object with data, which should be used in email. Example of email for confirming order:

{  
    "TransactionId": "123",  
    "Products": [{  
        "Id": 123,  
        "Name": "Sample Product Name",  
        "Url": "http://example.com/product1",  
        "PictureUrl": "http://example.com/product1image.png",  
        "Price": 13130,  
        "OldPrice": 14500  
    }, {  
        "Id": 321,  
        "Name": "Another product name",  
        "Url": "http://example.com/product2",  
        "PictureUrl": "http://example.com/product2image.gif",  
        "Price": 16120,  
        "OldPrice":""  
    }]  
}

You can receive access to variables from the request body by accessing the CampaignProcess.Data object.

Email layout example:

{% if CampaignProcess.Data %}
		
	<h2>Order:</h2>

	{% for product in CampaignProcess.Data.Products %}
		<p>{{product.Name}}</p>
	{% endfor %}

	{% assign productIds = CampaignProcess.Data.Products | map : "Id" | join : ","%}
	{% assign reco = Products.Related.productIds %}
	{% assign recoSize = Products.Related.productIds | size %}
	{% if recoSize > 0 %}
	
        <h2>Recommendations:</h2>

        {% for product in reco %}
            <p>{{product.Name}}</p>
        {% endfor %}

	{%endif%}

{% else %}
	{{ Message | cancel : "No data" }}
{%endif%}

<a target="_blank" href="{{Message.CancelThisSubscriptionUrl}}">Unsubscribe</a>

To extend functionality of templates, Retail Rocket emails use the Liquid language. Liquid allows you to use additional data of subscribers/products into the template, use “if” conditions, access loops and apply standard filters.

📘

Additional information

You can find more about Liquid language here.