Utiliser les flux de données pour envoyer des emails personnalisés en répétant des données en temps réel

Personalize your emails using real-time data for more relevant and engaging content. Brevo's data feed pulls the latest information from your external sources or API, delivering personalized content at the time of sending. Use it for inventory updates, reminders, or recommendations, for example, to deliver timely and tailored messages.

Which emails can be personalized with data feeds? 

Data feeds can be used in: 

  • Promotional emails and newsletters sent through campaigns.
  • Automated emails sent through automation. 
  • Transactional emails triggered from a website via an eCommerce plugin or API.

Before you start

  • Make sure you’ve learned all about data feeds in our dedicated article About data feeds in Brevo.
  • Create the data feed that you will be using to personalize your email content. To learn more, check our dedicated article Create a data feed.
  • Create an email template or campaign in which you want to insert your data feed variables and access the Design step. Data feeds can be inserted into emails designed with the drag and drop email editor or HTML editor. 

Repeatable vs. non-repeatable data feed variables

datafeed_variable-replaced-repeat-not-repeat_en-us.gif

datafeed_structure-nextyogaclasses_en-us.png

To insert data feed variables into your email, you first need to wonder if this data is a: 

  1. Single object data (non-repeatable)
    This data is a single object at the root of the data feed, directly accessible. It is the data that represents the most relevant, immediate, or ongoing entity. In our example above, next_yoga_class is the root object that contains only one object since there is only one immediate next class. This data can be inserted into your email directly.
    ➡️ Follow the steps from Step 2: Insert data feed variables into your email content.
  2. List/arrays data (repeatable)
    Data stored in an array represents multiple past or future occurrences of similar entities, all stored in a separate object. In our example above, following_classes is an array that contains multiple items, all stored as a separate object, since there can be multiple future classes scheduled. To insert this data, you need to use a Dynamic content block to loop through the list and repeat each item stored.
    ➡️ Follow the steps from Step 1: Insert a dynamic content block to repeat data.

Step 1: Insert a dynamic content block to repeat data

If you want to insert non-repeatable data, you can directly follow Step 2: Insert data feed variables into your email content. However, if you want to loop your data to create a list of items in your email design, you first need to insert a Dynamic content block.

In our example, we want a section at the end of our email to propose other upcoming yoga classes if our recipient is not available for the first available class:

  1. From the email editor, drag and drop the Dynamic content block into your canvas. The block settings open in the left panel.
  2. From the Data source dropdown, select Data feed.
    💡 Good to know
    You can select a different data source for each Dynamic content block inside your email design. 
  3. Choose the data feed you want to use to personalize your email (e.g., yoga_classes).

  4. Choose the specific array where the data variables are stored (e.g., following_classes).
    dde_choose-data-feed_en-us.gif

  5. By default, we limit the number of items to repeat to 3, but you can change it anytime. In our example, we want to limit the number of next yoga classes displayed to 4: 
    datafeed_limit-items_en-us.png
    1. From the Dynamic content block settings in the left panel, open the Layout section.
    2. The Limit number of items option should be activated by default. 
    3. From the Number of items fields, click +/- or enter the maximum number of times your dynamic content block should be looped. In our example, we will enter 4
    4. Optional: By default, the Index is set to 0. The index determines the position of elements in the array and starts from index 0 for the first element, 1 for the second, and so on. To start your list from the second item instead, enter 1. 

Congratulations! 🎉 Now all the data feed variables you will insert in your email will be looped to create a list of items such as a list of products, events, and more! When a Dynamic content block is inserted, the section and its content blocks feature a database and curly brackets icon:

datafeed_repatable-data-text_en-us.png

Step 2: Insert data feed variables into your email content

Choose the data to include in your email by adding data feed variables to your email. When the email is sent, these variables will be replaced with the relevant information for each recipient.

  1. Insert the content blocks you want to use to display the data from your data feed. For example, you can use:
    • An Image block to show a picture of the items or related to them.
    • A Text block to display details, such as the class names, locations, or dates in our example.
    • A Button to redirect to a URL, such as the register form or event schedule in our example. 
      datafeed_insert-content-blocks_en-us.gif
  2. Add event variables inside your content blocks. Expand the following accordions to learn how to add variables for each type of content:

    🔠 Add a variable to text

    Add a variable inside a content block containing text to display specific details related to an item, such as a name, location, or date here.

    1. Click a content block containing text (Title, Text, or Button blocks).
    2. Place your cursor where you want to add a variable.
    3. Click the Add variable { } icon in the formatting bar.
      datafeed_text_variable_en-us.png
    4. From the Which attribute would you like to insert? dropdown, select the variable you want to include in the email ("class_name", "studio_location", etc.).
      To insert a non-repeatable data feed variable, you need to select Data feeds > feed name > object name > variable and then the variable, in our example, it would be Data feeds > yoga_classes > next_yoga_class > class_name.   
      datafeed_choose-attribute-text_en-us.png
    5. (Optional) In the Which value should be used if the attribute is empty? field, enter the fallback text to use in case the value is missing for a data feed variable.
    6. Click Insert. The variable will be inserted, and a tag will appear in your content block.
    7. Repeat the steps for each variable you want to add to text.

    datafeed_repatable-data-text_en-us.png

    🖼️ Add a variable to an image

    Add a variable to an Image block to display the image associated with an item, such as an event picture.

    1. Click an Image block.
    2. From the sidebar, go to Image settings.
    3. In the Insert image from URL field, click the Add variable { } icon.
    4. Select the variable you want to use to display your image.
      datafeed_repatable-data-image_en-us.png
    5. To insert a non-repeatable data feed variable, you need to select Data feeds > feed name > object name > variable and then the variable, in our example, it would be Data feeds > yoga_classes > next_yoga_class > image.
    🔗 Add a variable as a hyperlink on text

    Add a variable as a hyperlink on text to direct recipients to the URL associated with an item, such as a register form or event schedule page.

    1. Click a content block containing text (Title or Text blocks).
    2. Highlight the text where you want to add the link.
    3. Click the Link 🔗 icon in the formatting bar.
      datafeed_highlight-text_en-us.png
    4. In the Link target field, click the Add variable { } icon.
    5. Select the variable you want to use to generate your link.
      To insert a non-repeatable data feed variable, you need to select Data feeds > feed name > object name > variable and then the variable, in our example, it would be Data feeds > yoga_classes > next_yoga_class > url.   
    6. Click Insert.
    🔗 Add a variable as a hyperlink on an image

    Add a variable as a hyperlink on an image to direct recipients to the URL associated with an item, such as an event page.

    1. Click an Image block.
    2. From the sidebar, go to Link settings.
      dde_add-variable-image_en-us.png
    3. In the Link target field, click the Add variable { } icon.
    4. Select the variable you want to use to generate your link.
      To insert a non-repeatable data feed variable, you need to select Data feeds > feed name > object name > variable and then the variable, in our example, it would be Data feeds > yoga_classes > next_yoga_class > url
    5. Click Insert.
    🔗 Add a variable as a hyperlink on a button

    Add a variable as a hyperlink on a button to direct recipients to the URL associated with an item, such as a product page.

    1. Click a Button block inside a Dynamic content block.
    2. From the sidebar, go to Link settings.
      dde_add-variable-button_en-us.png
    3. In the Link target field, click the Add variable { } icon.
    4. Select the variable you want to use to generate your link.
      To insert a non-repeatable data feed variable, you need to select Data feeds > feed name > object name > variable and then the variable, in our example, it would be Data feeds > yoga_classes > next_yoga_class > url.   
    5. Click Insert.

(Optional) Step 3: Show or hide content based on specific conditions

Personalize your emails further by dynamically showing or hiding content elements based on specific conditions. This ensures that only relevant content is displayed to each recipient, based on their attributes, event data, or device type.

Expand the following accordions to see examples of how you can control content visibility in your emails:

👤 Contact attribute

Show or hide content based on the information stored in a recipient's contact attributes.

➡️  For example
If a contact’s "LEVEL" attribute is set to "BEGINNER", display a section featuring beginner-friendly yoga products, while hiding this section for recipients with a different level.

➡️ To learn more, check our dedicated article Show or hide content based on contact attributes.

📱 Device type

Show or hide content based on the recipient's device type (mobile or desktop).

➡️  For example
Show a mobile-friendly banner for smartphone users while displaying a wider image for desktop users.

➡️ To learn more, check our dedicated article Show or hide content based on device type.

Step 4: Preview and test your email personalized with data feed variables

To ensure that the content in your email will display correctly in your recipients' inboxes, we highly recommend previewing and testing your email before sending it.

Click the tab below corresponding to the method with which you want to test your email:

Preview Send a test
  1. When your email design is ready, click Preview & test in the top bar of your email editor.
  2. Stay on the Preview tab.
  3. In the Who would you like to preview this email as? field, start entering one of your contact's email addresses and select it. 
    dde_preview-datafeed-email_en-us.png
  4. Your preview for this contact generates automatically on the left of your screen. If you created a personalized data feed, enter another email address to check how the email will display for each contact according to their contact attributes. 

Congratulations! 🎉 You can now use your email in your automations or send email campaigns containing live data from your data feeds.

Email template Email in recipients' inboxes
emailfeed2.png emailfeed1.png

⏩ What's next? 

  •  

🤔 Vous avez des questions ?

Pour toute question, n’hésitez pas à contacter notre service client en créant un ticket à partir de votre compte. Si vous n’avez pas encore de compte, vous pouvez nous contacter ici.

Si vous avez besoin d'aide pour un projet impliquant Brevo, nous pouvons vous mettre en relation avec un Partenaire Brevo certifié.

💬 Cet article vous a-t-il été utile ?

Utilisateurs qui ont trouvé cela utile : 0 sur 5