Content syndication
Simple Content Syndication
Dynamic Content can be used to automatically insert content downloaded from external server into email (content syndication). This can be achieved using GetRemoteContent
function:
${GetRemoteContent('http://domain.com/mycontent')}
If external server requires authentication, login/password can be specified:
${GetRemoteContent('http://domain.com/mycontent', 'username', 'password')}
Content returned from external server will be inserted where above function was used. Function can be used to insert HTML fragments and plain text as well (for example to insert content in subject or From: field).
A single email can contain multiple external contents. HTTP and HTTPS protocols are supported. Any communication errors (such as External server not responding
) will abort sending email – subscriber will never receive an incomplete or corrupted message.
Downloaded content is cached, to improve performance of message generation. Cached content is recognized by URL address. If you want to insert different content in every email, URL can be built using parameters, e.g. subscriber attributes:
${GetRemoteContent('http://domain.com?age=' + SubscriberProperty('age'))}
The best practice while building URLs is to use attributes with limited number of different values. Good examples are: gender, city, age, sign etc.
NOTE: It is NOT recommended to use values unique to subscriber, e.g. ID or email. This will cause sending a request to external server for every single email (cache does not work in such scenario). Sending speed of such messages will suffer greatly, depending on external server ability to process requests.
Some examples:
Hello ${SubscriberFirstname}!
<p>
Next holidays are:
${GetRemoteContent('http://calendar.domain.com/holidays')}
</p>
<p>
Your horoscope for today:
${GetRemoteContent('http://calendar.domain.com/horoscope?sign=' + SubscriberProperty('sign'))}
</p>
<p>Today offers in your city:</p>
<p>
${GetRemoteContent('http://offers.domain.com?city=' + SubscriberProperty('city') + '&gender=' + SubscriberProperty('gender'))}
</p>
Advanced Content Syndication
GetRemoteContent
method is a simple way to fill your message with content from remote server. The method is efficient and simple. The downfall is that retrieved content cannot be manipulated in any way, changed or processed before inserting.
If you need to perform some additional operations on the content, use the alternate GetRemoteContentAsText
method. This method will allow assigning retrieved data to a string variable which then can be manipulated, used in other methods (e.g. as parameter to Data Table queries) etc.
Example (display only first 100 characters, uppercased):
<var x="GetRemoteContentAsText('http://domain.com')"/>
${x.Substring(0, 100).ToUpper()}
Overloaded method with username/password is also available:
<var x="GetRemoteContentAsText('http://domain.com', 'username', 'password')"/>