Embed JSON feeds into your campaign

Embed JSON feeds into your campaign

Starting with AppMail EMA 1.3 you can embed JSON feeds into you campaigns easily.
In order to take advantage of this feature, when you create a campaign, you will have to enable the feature.
Next, in the campaign template(or subject line), you will have to add a set of tags that AppMail EMA will recognize and transform into the actual content of the feed.
Here is a brief example of what you will have to add inside your campaign template to make use of this feature:

<!DOCTYPE HTML>
<html>
<head>
   <meta http-equiv="content-type" content="text/html" />
   <title>JSON FEEDS</title>
</head>
<body>
    [JSON_FEED_BEGIN url='https://www.appmail.com/_tests/json-feed.json' count='5']
        <table>
            <tr>
                <td>
                    <a href="[JSON_FEED_ITEM_LINK]">
                        <img src="[JSON_FEED_ITEM_IMAGE]" width="100" height="100"/>
                    </a>
                </td>
                <td>
                    <strong>[JSON_FEED_ITEM_TITLE]</strong><br />
                    <p>[JSON_FEED_ITEM_DESCRIPTION]</p>
                </td>
            </tr>
        </table>
    [JSON_FEED_END]
</body>
</html>

The [JSON_FEED_BEGIN] tag accepts following arguments:
url – string – the url from where we will fetch the feed items. Mandatory.
count – integer – the number of items you want to receive back from the feed. Optional.
Added in 1.5.1:
offset – integer – the number of items you want to skip loading. Optional.
days-back – integer – the number of days to look back for posts. Optional.
no-item-action – string – what action to take when no items are found in the feed. Valid values: postpone-campaign(postpones the campaign till next day). Optional.
send-only-unique-items – string – if we should only send unique items. if no items are found, then no-item-action is applied. Valid values: (yes or no). Optional.

Below is a list with all the tags accepted for JSON feeds:
[JSON_FEED_ITEM_TITLE] – The item title (the title of a product for example)
[JSON_FEED_ITEM_DESCRIPTION] – Short item description
[JSON_FEED_ITEM_CONTENT] – Item content
[JSON_FEED_ITEM_IMAGE] – The image of the item
[JSON_FEED_ITEM_LINK] – The url/permalink to the item
[JSON_FEED_ITEM_PUBDATE] – Item publish date
[JSON_FEED_ITEM_GUID] – Item guid.

Since 1.5.1 you can also use indexed tags for a better control, so you can use:

<!DOCTYPE HTML>
<html>
<head>
   <meta http-equiv="content-type" content="text/html" />
   <title>JSON FEEDS</title>
</head>
<body>
    [JSON_FEED_BEGIN url='https://www.appmail.com/_tests/json-feed.json' count='5' offset='0']
        <table>
            <tr>
                <td>
                    <a href="[JSON_FEED_ITEM_1_LINK]">
                        <img src="[JSON_FEED_ITEM_1_IMAGE]" width="100" height="100"/>
                    </a>
                </td>
                <td>
                    <strong>[JSON_FEED_ITEM_1_TITLE]</strong><br />
                    <p>[JSON_FEED_ITEM_1_DESCRIPTION]</p>
                </td>
            </tr>
        </table>
    [JSON_FEED_END]
</body>
</html>

All the above tags will work if the feed is valid and the content they try to replace exist in the feed.

You should test your feed campaign before sending, to make sure the tags are parsed, and the content is fine because the parsing is strict, any minor error will stop parsing the tags and render them without transformation.

    • Related Articles

    • Embed XML(RSS) feeds into your campaign

      Starting with AppMail EMA 1.3 you can embed XML(RSS) feeds into you campaigns easily. In the campaign template (or subject line), you will have to add a set of tags that AppMail EMA will recognize and transform into the actual content of the feed. ...
    • Campaign webhooks

      Starting with version 1.6.8, AppMail has the ability to send webhook requests when a campaign is opened and/or when a link (or more) inside the campaign is clicked. By default, this feature is disabled, in order to enable it, go to Backend > Settings ...
    • Send a campaign

      Finally, after your list is created and you have added your subscribers into it, it’s time to create your first campaign. You will be able to select the list you want to use for sending and optionally, a segment from the list. You can add a new ...
    • Campaign grid stats cache warmup command

      Starting with version 2.1.2 we introduced the campaign-grid-stats-cache-warmup command which will keep up-to-date the cache for the stats shown in the campaigns grid view. The command has the following signature: command: /usr/bin/php -q ...
    • Campaign activity map doesn’t work!

      The extension that will put opens, clicks and unsubscribes on a google map is called Campaign Activity Map and it has to be enabled from Backend > Extensions area. Once the extension is enabled, clicking on its title or on the extension details page ...