Table of Contents:
While the feeds in the previous section: Ongage Feeds: HTML, RSS, XML and JSON use a URL to retrieve dynamic content from an external content/web server to populate outgoing email messages, with this feature you can specify the dynamic feed directly within the Transactional API call.
Your email message will include Dynamic List Fields (aka List Fields that get populated with values from your list), as well as Dynamic feed fields that will get populated from the feed data/values included in the Transactional API Request.
For example your email message might look like this:
Please note how the email message includes "{{ocx_feed{param=dynamic_feed}}}" where dynamic_feed is the name of the feed in the API call and contains the XML data as parameter in API request.
For any particular contact, the XML feed to populate content in above email message will look like below.
<feed> <mailing> <blocks> <block> <name>blockName</name> <items> <item> <variables> <variable> <key>title</key> <value>Your Order Confirmation</value> </variable> <variable> <key>classSummary</key> <value>Here goes the summary of transaction</value> </variable> <variable> <key>classUrl</key> <value>www.domain.com/class/Destination-Link</value> </variable> <variable> <key>classAmount</key> <value>$123,123</value> </variable> </variables> </item> </items> </block> </blocks> </mailing> </feed> |
Finally, to send Transactional Email, you need to use POST /api/transactional/send End point. The example API request below includes the Email Message ID and the XML feed as a parameter.
{ "recipients":["abc@domain.com"], "campaign_id":1234567890, // Transactional Campaign ID: If not used as parameter, Default Transactional Campaign will be used. "message_id":1234567, "message_dynamic_fields":{ "Customer_ID":"12345", "dynamic_feed": "<feed> <mailing> <blocks> <block> <name>blockName</name> <items> <item> <variables> <variable> <key>title</key> <value>Your Order Confirmation</value> </variable> <variable> <key>classSummary</key> <value>Here goes the summary of transaction</value> </variable> <variable> <key>classUrl</key> <value>www.domain.com/class/Destination-Link</value> </variable> <variable> <key>classAmount</key> <value>$123,123</value> </variable> </variables> </item> </items> </block> </blocks> </mailing> </feed>" } } |
Note: The "dynamic_feed and "blockName" in the Email Message, needs to match exactly how it is spelled in the API Request XML Feed (and it is Case Sensitive).
For the above setup, the transactional Email received in the Inbox, will look similar to the following screenshot: