Custom API Embed
Useful for pulling ad or external content into your newsletter apart from using content sources.
<!-- Query for Newsletter Ad Units and load first one into ad variable. -->
[% set ad1 = fetchdata('https://myfeedurlthatreturnsJSON', '{}')[0] %]<!-- You can dump the ad1 contents for review,debug purposes -->
<p>Debug: [[ ad1 | json_encode ]]</p>
<!-- Conditional to show ad or default html when ad is not present -->
[% if ad1 and ad1|length >0 %]
<!-- Sample Display All Data -->
[[ad1.title]]
[[ad1.title_url]]
[[ad1.logo_url]]
[[ad1.logo_link]]
[[ad1.links[0].text]]
[[ad1.links[0].url]]
<!-- Sample Styled HTML Ouput -->
<div>
<a href="[[ad1.title_url]]">[[ad1[0].title]]</a><br/>
<a href="[[ad1.logo_url]]" target="_blank">
<img src='[[ad1.logo_url]]' />
</a>
</div>
[% else %]
<div>
<a href="[[custom.topFallbackUrl]]"><img src='[[custom.topFallbackSrc]]'/></a>
</div>
[% endif %]
<p>## end json api display ##</p>Last updated
