LogoLogo
HomepageDocumentationGet FeedOtter
  • Welcome to FeedOtter
  • Automated Newsletters
    • Getting Started
      • Marketo Sending
      • Pardot Sending
      • Eloqua Sending
      • SFMC Sending
      • HubSpot Sending
      • MailChimp Sending
      • Active Campaign Sending
    • Scheduling Your Send
      • Require New Content to Send
      • Intervals
    • Features
      • Last Send Date
      • Send Now
      • Sending History
      • UTM Parameters
      • Custom Subject Lines
      • Notifications
      • Multiple Feeds
        • Merging Feeds
        • Pulling in External JSON/XML Data
  • Curated Newsletters
    • Getting Started
      • Newsletter Defaults
      • Adding Content Sources
      • Create your first curated issue
      • Test, Review, and Publish your curated email newsletter
    • Publishing
      • Publishing to Marketo
        • Create a New Email Program and Email
        • Create a New Email in Marketo
        • Schedule an Email Program Send From the FeedOtter Interface
      • Publishing to Pardot
      • Publishing to Eloqua
        • Create a New Email and Schedule a Send
        • Create a New Email
        • Update an Existing Email
        • Issue Naming
      • Publishing to HubSpot
      • Publishing to MailChimp
      • Publishing to HTML
    • Tags
    • Bookmarking Content
    • Content Sources
      • Google Sheets
      • YouTube
      • Algolia
      • WordPress API
      • UberFlip
      • JSON / XML API
        • Custom Data Fields
    • Advanced
      • Custom API Embed
    • Troubleshooting
      • Marketo Duplicate Object Naming
      • Marketo Emoji Support
      • MailChimp From Address
      • Pardot emails are missing a required Unsubscribe or Preference Center tag
  • Integrations
    • Getting Started
    • Marketo
      • How to Set Up Your Marketo Integration
      • FAQ
        • Email Reporting
        • Sending in Recipient Time Zone
        • Marketo Data Access
        • Custom Marketo Program Naming
        • Branded Domain and IP Settings
      • Troubleshooting
        • How do I reset my Marketo Automated Campaign
        • Marketo Error: Program with the same name exists
        • Marketo error: Daily quota '50000'
        • Marketo Error: Invalid request. Please check and try again.
        • Curated Issue Fails to Publish
          • FeedOtter Can Not Approve Marketo Template
          • Marketo rejects Duplicate Name
      • Exporting a FeedOtter email into Marketo
    • Pardot / Account Engagement
      • How to Set Up Your Pardot Integration
      • FAQ
        • Salesforce IP Whitelisting
        • Where Can I Find My Pardot Business Unit ID?
        • Pardot Data Access
        • Advanced Settings
          • Set Up a User for Integration
      • Troubleshooting
    • Eloqua
      • How to Set Up Your Eloqua Integration
      • FAQ
        • Custom Email and Campaign Naming
        • Custom Field Setup
        • Updating Eloqua Canvas Email
        • Eloqua Data Access
        • VMTA and BBE
    • Salesforce Marketing Cloud
      • How to Set Up Your SFMC Integration
      • FAQ
        • SFMC Tracking Code
        • SFMC Resources and Links
      • Troubleshooting
    • HubSpot
      • How to Set Up Your HubSpot Integration
      • FAQ
      • Manually publish an email to HubSpot
    • MailChimp
      • How to Set Up Your MailChimp Integration
    • ActiveCampaign
      • How to Set Up Your ActiveCampaign Integration
    • Microsoft Dynamics Marketing
      • How to Set Up Your MS Dynamics Integration
  • Email Templates
    • Getting Started
      • Custom Template
        • HTML Email Guidelines
          • In-Depth HTML Email Guidelines
        • Custom Template Resources
          • ESP Template Use
            • Export a Marketo Template for Use in FeedOtter
            • Export a Pardot Template for Use in FeedOtter
            • Export a HubSpot Template for Use in FeedOtter
            • Export an ActiveCampaign Template for Use in FeedOtter
        • Where to Access Template Code
        • Getting Started with FeedOtter Templates
          • Creating a Basic Email Template
          • Advanced Email Templates
            • Slicing loops
            • Multiple Feed Emails
            • Email With Columns
            • Conditionals
            • Filters
              • Image Resize Filter
              • Date Formatting Filter
              • Text Manipulation Filters
              • Other Handy Filters
            • Non-RSS XML values
            • Custom fields
            • Display a Full Article in Your Email
          • Curated Email Setup Best Practices
            • Curated Newsletter Sections
      • Element Customization
        • About Email Images
    • FeedOtter Tokens
    • ESP-Specific Tokens
      • Marketo Tokens
        • Using Marketo Tokens in the From and Reply-To
      • Pardot Tokens
        • Pardot Merge Token Reference
      • Eloqua Tokens
      • SFMC Tokens
      • HubSpot Tokens
      • MailChimp Tokens
      • ActiveCampaign Tokens
  • Account Management
    • Account Information
    • Company Details
    • Manage Users
      • Adding Users
      • User Roles
      • Campaign Permissions
      • Transfer Ownership
      • Disabling Users
    • Security
      • Enable SSO in Your Account
        • Enable SSO With Okta as the Identity Provider
        • Enable SSO with a Generic Identity Provider
        • Enable SSO with Azure AD as the Identity Provider
        • Enable SSO with OneLogin as the Identity Provider
      • Account Level 2FA
    • Billing
      • Update Your Payment Card
      • View Account Usage
      • View Receipts
      • Change Your Subscription Plan
  • FAQ
    • How to manually publish a curated newsletter
    • WordPress RSS Feed Reference
    • How to find your RSS feed
    • Help with HTML encoding
    • My automated email did not send as expected
    • How do I hard refresh my browser?
    • How to Remove "This Post First Appeared" from Your Blog's RSS Feed in WordPress
    • Whitelisting FeedOtter
    • Whitelist FeedOtter on CloudFlare
    • How do I contact support?
    • Red Dot: Campaign Status
      • Confirm your RSS Feed is valid
      • Confirm your integration is still connected
Powered by GitBook
On this page
  1. Curated Newsletters
  2. Advanced

Custom API Embed

Useful for pulling ad or external content into your newsletter apart from using content sources.

Place the following query just before the closing </head> tag in your email code. This querys the endpoint and places data in the 'ad1' Twig variable.

<!-- Query for Newsletter Ad Units and load first one into ad variable. -->
[% set ad1 = fetchdata('https://myfeedurlthatreturnsJSON', '{}')[0] %]

You can use standard twig notation to display, loop, manipulate the contents of the ad1 variable. The following code shows a few different options:

  • Dump the raw contents of ad1 to see the data

  • Display each field individually (notation will change based on the JSON data structure)

  • Display fields in basic HTML

  • Using conditionals to display a fallback ad/image/html block when there is no data in the ad1 variable.

<!-- 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 4 days ago