- DarkLight
Braze - Integration Guide
- DarkLight
The integration between Yotpo and Braze enables you to dynamically pull and display star ratings, top reviews, and visual UGC on products within emails and other communication channels within Braze. You can additionally include customer-level loyalty data in emails and other communication methods to create a more personalized interaction and boost sales and loyalty.
Before you begin
Before you connect Yotpo to your Braze account, you’ll need the following:
- If you’re integrating Braze with Yotpo Reviews, you’ll need your Yotpo app key. See Finding your Yotpo App Key and API Secret
- If you’re integrating Braze with Yotpo Loyalty & Referrals, you’ll need your Yotpo API key and GUID. See Finding your Loyalty & Referrals API Key and GUID
- You’ll also need to make sure that your Yotpo product ID matches your Braze product ID.
Do the following:
- Go to your store website.
- Open the product page.
- Right-click and select Inspect.
- Press Ctrl+F and search for ‘yotpo-main’ in the code. The data-product ID variable and its value appear in the Yotpo div:
Integrating Yotpo and Braze
To integrate Yotpo and Braze, do the following:
- Log into your Braze account.
- Go to Campaigns > Create Campaign.
- Select the Campaign channel.
- Select your preferred template.
- Click Edit email body.
Add the relevant Connected Content snippet according to what you want to display.
- Replace ##YOTPO API KEY## with your Reviews app key
- Replace ##YOTPO LOYALTY GUID## with your Loyalty & Referrals GUID
- Replace ##YOTPO LOYALTY API KEY## with your Loyalty & Referrals API key
Displaying star rating and review count
To display the public average score and total number of reviews for a product that is included in the email, add the following snippet:
{% connected_content https://api.yotpo.com/products/##YOTPO API KEY##/{{event_properties.${product_id}}}/bottomline :save result %}
{% if {{result.response.bottomline.average_score}} != 0 %}
The average rating for this product is:
{{result.response.bottomline.average_score}}/5, based on
{{result.response.bottomline.total_reviews}} reviews.
{% else %}
{% endif %}
Example:
Displaying recent 5-star review
To display a top (published) review for a specific product that is included in the email, add the following snippet:
{% connected_content https://api.yotpo.com/v1/widget/##YOTPO API KEY##/products/{{event_properties.${product_id}}}/reviews.json?per_page=50&star=5&sort=votes_up :save result %}
{% if {{result.response.reviews[0].score}} == 5 %}
Recent 5 Star Review for this product:
{{result.response.reviews[0].content}}
{% else %}
{% endif %}
Example:
Displaying visual UGC
To retrieve images that were tagged and published in Yotpo and add them to your emails instead of the stock image or as an additional gallery, add the following snippet:
{% connected_content https://api.yotpo.com/v1/widget/##YOTPO API KEY##/albums/product/{{event_properties.${product_id}}}?per_page=1 :save result %}
{% if {{result.response.images[0].tagged_products[0].image_url}} != null %} The Visual content of the product:
<img src="{{result.response.images[0].tagged_products[0].image_url}}" border="0" width="200" height="200" alt="" />
{% else %}
Image return NULL
{% endif %}
Example:
Displaying customer’s loyalty balance
To display a customer’s loyalty balance in an email, add the following snippet:
{% connected_content
https://loyalty.yotpo.com/api/v2/customers?customer_email={{${email_address}}}
:method get
:headers {
"x-guid": "##YOTPO LOYALTY GUID##",
"x-api-key": "##YOTPO LOYALTY API KEY##"
}
:content_type application/json
:save publication
%}
You have {{publication.points_balance}} points
Only {{publication.vip_tier_upgrade_requirements.points_needed}} more points to become part of our VIP Tier!
Example:
FAQ
What happens if I don’t have any 5-star reviews?
If the endpoint response returns NULL for the product image or 5-star review, the connected content endpoint for retrieving a 5-star review will not display any content.
What happens if I don’t have any images published for a product?
If the endpoint response returns NULL for the product image, the connected content endpoint for retrieving an image will not display any content.
Can I customize the look and feel, or pull other data fields from Yotpo?
Yes! See this guide about Braze Connected Content to discover what other data points and customization options are available. You may need some assistance from a front-end developer to do so.