Email marketing is a powerful tool for engaging customers and growing your business. To enhance its effect, use external data feeds to create personalized and up-to-date content. With real-time data, your messages can be relevant and timely, thus standing out in your customers' inboxes.
What is an external data feed?
External data feed acts as a bridge between Brevo and your external API, by dynamically fetching dynamic data from external sources and incorporating it into your email campaigns for personalized and up-to-date content. Use only one email template for multiple use cases and update the feed!
Depending on your needs, you can create two types of external data feeds:
-
👥 Global feed
All recipients will receive the same email containing the same information. For example, if you have a website with articles on pet health, you could create a monthly newsletter containing the top 5 trending advice or videos on your website this week. -
👤 Personalized feed
Each recipient will receive the same email, but containing unique information based on their contact attributes. For example, if you have a website with articles on pet health, you could send a monthly newsletter containing only articles and videos based on the pet your recipients (cat, dog, rabbit...) have chosen when they signed up for your newsletter.
If a general error that applies to all your contacts occurs during the sending of your email campaign that contains an external data feed, all recipients will be skipped. Access your email campaign report to view the reasons for the skip.
If an error that applies to one of your specific contacts occurs during the sending of your email campaign that contains an external data feed, that contact will be skipped.
Before you start
-
Contact your Customer Success Manager (CSM) to:
- Activate the external feed feature on your account and, if necessary, help you set it up.
- Enable the Developer mode if you use the Drag & Drop Editor. Else, use the HTML editor to create your email.
- Your external data has to be hosted at an accessible URL in JSON format.
- Create the email template in which you want to add an external data feed. To learn more, check our dedicated article Create an email template.
-
To help you understand how to set up and use an external data feed into your email templates, we created a use case for illustration purposes that you can easily adapt to your needs: Show articles on pet health and behavior.
For reference, this is an example of the content Brevo should have access to via the external feed. Your IT team can set up the external feeds you need:
1️⃣ Optional: Create a contact attribute for a personalized feed
To create personalized content for each recipient using an external data feed, you need to create a contact attribute related to the external data feed you want to retrieve. The contact attribute will provide information about the recipient's preferences to your external data feed, allowing it to understand which content the recipient would like to receive. To set up the API for a personalized data feed, check our dedicated API documentation.
To create a contact attribute for your external feed:
- Go to Contacts > Settings > Contacts attributes.
- Click + Add a new attribute.
- Enter your attribute name and select an attribute type.
- Click OK.
- For each recipient receiving this newsletter, enter a value for your newly created attribute.
In our use case, we want to display information about our recipient's pet, so the value for the PET attribute could be cat, dog, or any other pet name accessible in the API and data feed.
💡 Good to knowAdd this attribute as a field to your subscription form to allow your contacts to choose their preferences. Then create an automation workflow to automatically add contacts to a specific list according to their preferences. For example, if when subscribing to your newsletter, your contact selects Cat as their pet, the PET attribute will automatically be filled, and they can be added to the Cat lovers contact list.
2️⃣ Create and set up your external data feed with your Brevo account
Use our almost no-code wizard to connect and configure your external data feed with your Brevo account:
- Go to your account drop-down > Data feeds.
- Click Add data feed. You are redirected to the feed setup flow.
- Name your data feed to easily find and recognize it in your list and click Continue. In our example, we will call it Pet preferences.
- In the External source URL field, paste the link to your API hosted at an accessible URL in JSON format and containing your external data.
- (Optional) To create a personalized feed:
- Click {} next to the External source URL and select the Brevo contact attribute that contains your contacts' preferences.
The value of your contacts' attribute in Brevo will be compared with the data from your external feed during the API call to display only the data relevant to them at the time of sending. In our example, we will select the PET attribute so that if a recipient's PET attribute is Cat, we will only show the data from the Cat category. - Select a default preview contact from the drop-down list. You can only select contacts from your test list. In the next screen, we will display a preview of the data that the server was able to retrieve for this specific contact thanks to their Brevo contact attribute.
This preview will allow you to ensure that you successfully retrieve the data that corresponds to the attribute of the contact you selected. In our example, we want to show the data for John B. <John.b@example.com> whose PET attribute is Cat.
- Click {} next to the External source URL and select the Brevo contact attribute that contains your contacts' preferences.
- Choose the authentification method that protects your external data source and enter your credentials to access it.
- No authentication
- Basic
- Token
- Headers
- Click Continue.
- Check the preview of your external data feed. Ensure the data retrieved for this external data feed is correct. If you've added a contact attribute for a personalized feed, select other contacts from your test list to ensure that the personalized data retrieved is the right one for each contact.
- Click Save.
Congratulations! 🎉 Your external data feed is created and set up in your Brevo account. If you want to edit or delete this external feed, click the three dots next to the feed name on the Data feeds page of your Brevo account.
3️⃣ Connect your external data feed to your email template
Depending on the design tool you chose, the steps and syntax to connect your external data feed to your email template are different:
- From the Drag & Drop Editor, click > Developer mode to open the code editor.
- Copy the following placeholder and paste it after the subject line:
feeds:
-
name: myvariable
source: feedname - In this placeholder, replace:
- myvariable with the name you want to give to your variable to later access feed data, here petlover.
-
feedname with the name of your feed as defined in your API, here petloverfeed.
❗️ ImportantBe careful to write the feedname exactly how it appears in your API setup as it is case-sensitive. For example, if your feed name is petloverfeed and you write Petloverfeed, the connection between your email template and your external feed will fail.
- Close the developer mode by clicking the close icon.
- Copy the following placeholder and paste it into the HTML editor at the beginning of your HTLM code before the body tag:
<!-- feed.myvariable : {{ feed.get ("feedname") }} -->
- In this placeholder, replace:
- myvariable with the name you want to give to your variable to later access feed data, here petlover.
-
feedname with the name of your feed as defined in your API, here petloverfeed.
❗️ ImportantBe careful to write the feedname exactly how it appears in your API setup as it is case-sensitive. For example, if your feed name is petloverfeed and you write Petloverfeed, the connection between your email template and your external feed will fail.
4️⃣ Access the external data feed in your email template
Your external data feed is set up and connected to your email template. It is now time to access the data contained in your external data feed to display it. Each data will be called separately with variables according to the information you want to display.
Depending on the design tool you chose when creating your email, the steps and syntax to access your external data feed are different:
- From the Drag & Drop Editor, insert a content block where you want to display your data.
- Copy the following placeholder:
{{ feed.myvariable.field }} - In your content block, paste the placeholder for each data you want to retrieve from your external data feed. Leave feed as is and replace:
- myvariable with the variable alias or the name of your variable, here petlover.
-
field with the field's name in the API that contains the data you want to retrieve. For example, if you want to retrieve the title from your external feed, replace field with title.
Drag & Drop Editor Email preview
- To retrieve an image, click the image icon and paste the placeholder in the Insert image from URL field, here:
{{ feed.petlover.small }} - To add a link to a button, insert a button block and click Add a link. Choose Absolute link (URL) and paste the placeholder in the Link target field, here:
{{ feed.petlover.link }} - Optional: To display the same content block multiple times to show, for example, the top 5 trending articles on your website, use the repeat block feature. To learn more, check our dedicated article Repeat a block of items in your emails.
- Once you are done designing your email template, click Save & Quit.
- Copy the following placeholder and paste it where you want your external data to display in the email template:
{{ feed.myvariable.field }} - In this placeholder, leave feed as is and replace:
- myvariable with the variable alias or the name of your variable, here petlover.
-
field with the field's name in the API that contains the data you want to retrieve. For example, if you want to retrieve the small image from your external feed, replace field with small.
HTML editor Email preview
- Optional: To display the same content block multiple times to show, for example, the top 5 trending articles on your website, use for-loops. To learn more, check our dedicated article Advanced - Repeat a block of items using for-loops.
- Once you are done designing your email template, click Continue.
5️⃣ Test your email template
To ensure that your email content will display correctly in your recipients' inboxes, we highly recommend testing your email template. The best way to test an email template with product feed data is to send a test email. To learn more, check our dedicated article Preview and test your email campaign.
Congratulations! 🎉 You can now use your email template in your automations or send email campaigns containing external data feeds.
❓FAQ
What are the common errors that can be faced during the sending of an email campaign with an external data feed?
The most common errors that can be faced are:
- The external feed either does not exist or its definition is incorrect in the template.
- External feed placeholders are defined incorrectly in the template.
- An API issue prevents access to the external data feed. (Error 403: Forbidden).
⏩ What's next?
- Creating an email campaign
- Creating an A/B Test campaign
- Repeat a block of items in your emails
- Advanced - Repeat a block of items using for-loops
🤔 Have a question?
If you have a question, feel free to contact our support team by creating a ticket from your account. If you don't have an account yet, you can contact us here.
If you’re looking for help with a project using Brevo, we can match you with the right certified Brevo expert partner.