Braze
Power relevant, personalized customer experiences in real time.
Introduction
Braze is a customer engagement platform that specializes in multichannel marketing, such as email and push notifications. Braze supports programmatic access to all Miso APIs, making it easy to send personalized products recommendations to your customers.
Integration Steps
Create a Connected Content object
Braze’s Connected Content feature allows you to connect to a Miso API within an email template and save the JSON output as a local variable. The basic structure of a Connected Content object is the following:
{% connected_content
[API request]
:save variable_name
%}
Using the % connnected_content
tag, enter the API request you’d like to use and save the output by giving it a descriptive variable name. For example, using the User to Products API, the code might look like the following:
{% capture body %}
{
<!-- Request all fields -->
"fl": ["*"],
<!-- Dynamically generated the user_id -->
"user_id": {{${user_id}}}
}
{% endcapture %}
{% connected_content
<!-- API Request -->
https://api.askmiso.com/v1/recommendation/user_to_products?api_key={{API_KEY}}
:method POST
:body {{body}}
<!-- End API Request -->
<!-- Save JSON to miso_data variable-->
:save miso_data
%}
Notes:
- You must replace
{API_KEY}
with your secret API key found in Dojo. - The User to Products API requires the
user_id
in the request body. Since we need to dynamically generate theuser_id
during send-time, we need to use Braze’s Liquid Syntax to set it as a variable -{${user_id}}
.
Use Connected Content in an email template
-
From the Braze dashboard, select Templates & Media and create a new template or open an existing template using the HTML Editor.
-
In the email body, select Edit Email Body.
-
In the HTML editor, paste the Connected Content script inside the
<body>
section. -
Use dot notation inside a handlebar expression to access attributes from the Miso API. For example, the first
cover_image
attribute inside theproducts
array would be accessed by{{ miso_data.data.products.cover_image.[0] }}
.
Tips and Tricks
-
To loop through all the recommended products in the returned
products
array and create a section for each product in the email template (such as when building recommended product shelves), use a FOR loop in liquid syntax:<table> <tr> <td> {% for product in miso_data.data.products %} <!--Enter the <div> here. You can call Miso attributes using dot notation. To call the product title for example, simply use {{ product.title }}. --> {% endfor %} </td> <tr> </table>
-
When bulk-sending an email campaign to more than 10,000 users, ensure that a Rate Limiter is added in the Braze campaign via the Target Audience settings panel. It is recommended to set the limit to 2,500 requests per minute. Additionally, you can add a
:retry
parameter to the connected content object so that any failed requests will retried. For more information on the retrying requests, see Braze's documentation.
Additional Resources
For more information on Miso’s API, check out the official API Documentation.
For more Integrations like this, visit the Integrations page on our Docs site.
Published Date: July 6th, 2022