Overview
Content APIs allow you to create personalized campaigns by fetching data dynamically at the time of sending the campaign based on recommendations, coupons, or other Personalization APIs. Such targeted, relevant, and timely communication has much better engagement and conversion rates than generic email campaigns.
library_add_check |
Prerequisites Before starting your journey with content APIs, you must add a content API to MoEngage. For more information, refer to Content APIs. |
After adding the API to MoEngage, you can create campaigns using any existing content templates with API calls embedded in the content. These campaigns can contain placeholders for different SKUs, with the required formatting, segmentation, and triggering schedules.
Channels That Support Personalization Using Content APIs
You can add Content APIs to the campaigns sent using the following channels:
Channel | Supports Personalization? |
---|---|
Yes | |
Yes | |
SMS | Yes |
In-app Messaging | Yes |
On-Site Messaging | Yes |
Cards | No |
Yes | |
Connectors | Yes |
Facebook Audience | No |
Google Ads Audience | No |
info |
Information You can personalize Content APIs using user attributes. Personalization is also possible for event attributes when the event is linked to the same campaign. |
Create a Personalized Campaign
In step 2, "Content," of the campaign creation, 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 required content API from the Personalization editor:
-
- Type @ in the content editor of your campaign.
- On the Personalization dialog box, click the Data personalization tab.
- In the Select attribute list, click the Content API created.
- Click Done. The Content API gets added to the message.
For example, the Content API dynamically fetches the recommended products for a given user ID in the following screenshot. You can use this feature to engage users with product recommendations and nudge them toward 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 a static parameter that can be keyed in the value section.
When added, this appears as follows in the Template editor:
- Click Preview to see how the user will see it in their inbox.
Example
You may have a cart data source with the following 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:
{% 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 %}