Personalize Email Content with Content APIs

Content APIs allow you to create personalized campaigns by fetching data dynamically at the time of sending the campaign based on Recommendations or coupons 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. For more information about Content APIs, click here.

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. Personalize different elements in the email using Content API such as Images, Links, Dynamic text, and so on. You can employ Content API in both Subject Line and the email body.
  4. 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.
    AddContentAPI.png

     
  3. Fill in the following details:

 
Field Description
API Name Type the Content API name
API Type Select the type as Single.
API URL Type the complete URL of the Content API.
Header Click the plus sign and type the key value for the headers used in the Content API
Key Value Parameters Click the plus sign to add key value for the parameters used in the Content API. Use “@” in the value field to choose from the list of pre-defined user attributes. The parameters cannot be personalized using Event attributes in the value field.

4. Click Save.

The Content API is saved in the MoEngage app.

Create a personalized email campaign

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.  You can use the Content API by directly calling the ContentApi variable in the code or by choosing the Content API from the Email Personalization UI.

You can add the created Content APIs using the Personalization screen as shown below. Type '@' in the Custom HTML Editor and add the Content API created.

Email_ContentAPI.png

Click on 'Done' and the Content API gets added to the email message.

For example, in the screenshot shown below, the Content API is used to dynamically fetch the Recommened Products for a given user id. Marketers can use this feature to engage users with product recommendations and nudge them towards making a purchase. The value parameter can be a dynamic parameter (type '@' to add a user attribute to be passed to the Content API) or can be a static parameter that can be keyed in the value section.

ContentAPI_RecoPdt_EmailPersonlizationUI.png

This when added, appears as follows in the Custom HTML Editor.

ContentAPI_added_in_Email_Editor.png

Click on the Preview option to see how the user will see it in their inbox.

Examples

Example 1

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

JSON
{
 "date": "March 10, 2016",
 "items": [
   {
     "name": "belt",
     "image": "http://mydomain.com/images/1001.jpg",
     "price": 11
   }, {
     "name": "shoes",
     "image": "http://mydomain.com/images/1002.jpg",
     "price": 12
   }, {
     "name": "hat",
     "image": "http://mydomain.com/images/1003.jpg",
     "price": 10
   }
 ]
}

In the content creation, use the following code:

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

Example 2

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

SavedContentAPI.png

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.

DynamicContentExample.png

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

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

How can we improve this article?