Personalize Email Content with Content APIs

One of the key ingredients is the relevance of the campaign goal to the recipient for any successful marketing campaign. Content APIs allow you to create campaigns personalized dynamically using the data fetched at send time from your Recommendation or coupon or other Personalization APIs.

Such targeted, relevant, and timely communication has been proven to have much better engagement and conversion rates than generic email campaigns.

As shown in the example below, if a user makes a flight booking, Dynamic Content APIs can be used to send emails to them with offers on hotel accommodation for the destination, keeping in mind the accommodation preferences of the user within a few hours of booking the flight.


Such personalized, relevant emails can be used to drive conversion and unlock up-sell and cross-sell opportunities in many scenarios.

Another example where a user has left a hotel booking incomplete in her shopping cart while looking for resorts in Bali. In this case, the website where she tried to make the transaction triggers an email to her reminding her to complete the transaction and make recommendations on similar hotels for her to choose from. Targeted, contextual, and personalized emails like this are an extremely useful tool for a marketer looking to grow their business.


Using Content APIs in MoEngage

Follow these three steps to use Content API in MoEngage.

  1. Add an API to MoEngage

  2. Create a personalized email campaign using the saved Content API

  3. Send the campaign

Add an API to MoEngage

To set up an API to be used during MoEngage campaigns, add the URL and parameters of the Content API to the MoEngage platform. Follow these steps:

  1. Navigate to MoEngage Dashboard > Settings > APIs and click the Content API tab.

  2. Click Add button.
    The following Add Content API screen is displayed.

  3. Fill in the following details:






API Name

Type the Content API name.

API Type

Select from the drop-down either single or bulk.


Type the complete URL of the Content API.


Click the plus sign type the key-value for the headers used in the Content API.




Click the plus sign type the key-value for the paraments used in the Content API.



Use “@” in the value field to choose from the list of pre-defined user attributes. The parameters cannot be personalised using Event attributes in the value field.

4. Click Save.

The Content API is saved in the MoEngage app.

Create a personalized email campaign using the saved Content API

Create a campaign using the steps described in Create Email Campaign.

During the campaign creation, in the content creation step use the ContentApi variable to access all the configured Content API sources.

Use the ContentApi variable


Example 1

You may have a “cart” data source with the following JSON:

 "date": "March 10, 2016",
 "items": [
     "name": "belt",
     "image": "",
     "price": 11
   }, {
     "name": "shoes",
     "image": "",
     "price": 12
   }, {
     "name": "hat",
     "image": "",
     "price": 10

In the content creation, use the following code:

{% for cart_item in ContentApi.cart().items %}
   <h2>{{ }}: ${{ cart_item.price|round(2) }}</h2>
   <img src="{{ cart_item.image }}" />
{% endfor %}

Example 2

The campaigns contain placeholders for different SKUs (in this case, hotels), along with the required formatting, segmentation, and triggering schedules.


Send the Email Campaign

At the time of sending the message, for the example above the system would:

  • Invoke the Content API to fetch hotels recommended for the user based on the search parameters like destination, check-in, and check-out dates, number of adults and children, and so on.

  • Populate the email with details of the recommended hotels like the name, rating, price, image, and ranking in an HTML-formatted, personalized email.

  • Do this for every user belonging to the specified segment dynamically without any manual input.


For more information on personalization language, refer to Templating Language Documentation.

Was this article helpful?
0 out of 0 found this helpful