Pulling in External JSON/XML Data

RSS bypassing the FeedOtter UI

This is useful if you want to display some rss content without date/url filters impacting the content. A popular use-case for this is displaying a list of events.

This function expects a valid RSS feed to be returned by the provided URL.

    [% set events = feed('https://www.feedotter.com/feed') %]
    <h2>Display data directly from an rss feed. Bypass the UI.</h2>
     [% for post in events  %]
    [% endfor %]

Custom JSON/XML Data

Here is a use case where we pull in the first element of a JSON feed. In this case it will be used as an ad.

<!-- Fetch and display an ad unit -->
[% set todayDate = "now"|date("Y-m-d")  %]
<!-- [[todayDate]] -->

<!-- Query for Newsletter Ad Units -->
[% set ad1 = fetchdata('...your endpoint url here....', '{"Date":"' ~ todayDate ~ '"}')[0] %]
[% set ad2 = fetchdata('...your endpoint url here....')[0] %]
<!-- Usage in the Email HTML could look like this: -->
[% if ad1 and ad1|length >0 %]
<div><a href="[[ad1.URL]]" target="_blank">
<img src='[[ad1.Creative]]'></a>
[% else %]
<!-- Optional Fallback ad if none provided by feed -->
<div><a href="[[custom.topFallbackUrl]]">
<img src='[[custom.topFallbackSrc]]'></a>
[% endif %]

Last updated