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 %}
Frequently Asked Questions
If Content APIs fail due to an API timeout, MoEngage retries the request three times, and the maximum API timeout limit is 5 seconds.
The total number of users in a campaign is divided into multiple batches, which are processed in parallel. In each batch, the API calls are made sequentially.
For example, consider two campaigns, C1 (with a target user segment of 1 million users) and C2 (with a target user segment of 2 million users), starting simultaneously. If the batch size is 500, the total number of batches for both campaigns is (1M+2M)/500, which is 6000 batches. If the maximum number of machines employed for making these API calls is 100 and each machine has 10 processes, the number of API calls going out in parallel would be 1000. For each batch of 500, the calls would be made sequentially. However, MoEngage would make 1000 API calls in parallel at a given time.
info |
Information The batch size and the count for the maximum number of machines in use are different for every channel, and the example above is used only to explain how MoEngage makes content API calls. |