Braze

Voucherify and Braze integration

Voucherify <> Braze integration enables you to send vouchers with your Braze account. In this tutorial, we are going to show you two available modes of integration.

In this section:

  1. Send voucher via Braze's Connected Content
  2. Send voucher via Braze's Custom Attributes
  3. Use annotated emails powered by Google

Publish voucher via Connected Content

Add unique codes to Braze Campaigns via Braze’s Connected Content. You can use unique discount coupons, gift cards campaigns, loyalty cards and referral codes. 

Go to your Braze Account and create a new campaign.

Braze Connected Content

Define your campaign name, choose an email template, and edit the email body to add {% connected_content %} tag with code publication settings. 

Edit the email body:

Here is a code snippet that you need to add to the email template (it should not be visible in the email preview):

{% assign campaign_id = {{campaign.${api_id}}} %}
{% assign customer_id = {{${user_id}}} %}
{% assign source_id = campaign_id | append: customer_id %}

{% connected_content 
	https://api.voucherify.io/v1/publications
        :method post
        :headers {
        	"X-App-Id": "VOUCHERIFY-APP-ID",
                "X-App-Token": "VOUCHERIFY-APP-TOKEN"
        }
        :body campaign=CAMPAIGN_ID&customer={{${user_id}}}&channel=Braze&source_id={{source_id}}
        :content_type application/json
        :save publication
 %}

After you copy the code to the email body, add your API keys and campaign id as described below

  1. Add VOUCHERIFY-APP-ID and VOUCHERIFY-APP-TOKEN from your Project Settings (section Application Keys).
  2. Replace CAMPAIGN_ID which is a unique identifier of your Voucherify campaign, you can find the campaign id in the URL while displaying campaign details in the dashboard.

Unique publication per customer

The {{source_id}} parameter in the email body provides that each customer can receive only one unique code in a single Braze email campaign. As a result, even if the Braze unintentionally multiplies request, each user will receive the same unique code that was published to him/her in the first message. If you'd like to change this effect, go here to see other {{source_id}} configurations.

Lastly, you need to add the following code to the body to display the published voucher code (it should be visible in the preview):

{{publication.voucher.code}}

When you click on Preview and Test, you should see a random code from your campaign. 


Example setup of the email body with connected content:

As a result, each customer gets an email with a unique code automatically assigned to their profile

We highly advise you not to wholly depend on the 'Preview mode' and to send several test messages to confirm that everything works as it should. 

Important notes

  • When testing the email template be aware of the Connected Content cache (at least 5 minutes). If you want each test preview to publish a new voucher, you can omit the cache by appending a query parameter to the URL, e.g. ?t=1, and increment the number with each test.
  • X-Voucherify-API-Version (optional) – if your project uses the API Version older than v2017-04-20, then you should use a slightly different syntax :save voucher instead of :save publication and to display the code type {{voucher.code}}.
  • While setting up publication source_id you can differentiate your users by using two different variables: ${user_id} which is an external id (seen as source id in a customer profile in Voucherify) and ${braze_id} which is an internal id.
  • You can modify {{source_id}} bu using the following configurations: 
    • {{campaign.${dispatch_id}}} – ensures that all customers within a single send-out will use the same publication.
    • {{campaign.${api_id}}} –ensures that all customers within a single campaign will use the same publication.
    • {{${user_id}}} / {{${braze_id}}} – ensures that every customer will use the same publication no matter which campaign is sent (you can use ${user_id} which is an external id and ${braze_id} which is an internal id).
    • {{campaign.${dispatch_id}}} + {{campaign.${user_id}}} – each customer within single send-out will use the same unique publication.

Publish via Custom Attributes

Braze Custom Attributes enable you to assign Voucherify codes to custom attributes in user profiles in Braze. You can use unique coupons, gift cards, loyalty cards and referral codes.

First, connect your Voucherify account with Braze: 

  1. Copy the REST API Key from your Braze account (it should have a permission 'users.track' at least)

  2. Go to the Integrations Directory in your Voucherify dashboard, find Braze and choose Connect.

 Put the copied API Key and choose Connect:


When connected, you can start a new Voucherify distribution that assigns code to the custom attribute in the user profile in Braze. Later on, you can use received attributes with codes in your Braze campaigns.

Please note that before setting up distribution, you need to add your Braze users to the Voucherify dashboard. Go here to read more.

You can distribute codes to Braze using manual mode or define an automated workflow that triggers code delivery in response to action taken by your users.

Manual distribution 

Manual mode works as a one-time action that assigns codes to a chosen audience. 

Select a segment of users or a single customer as your receivers (1) and choose a campaign that will be a source of unique codes (2). 

Go to the Next step to add marketing permissions. If you don't collect permissions from your audience, disable the consents verification.

In the Next step, choose Braze as a channel and map custom fields that will be added to the user profile in Braze. You need to add the field representing code of published voucher, the rest of the fields are optional.

Choose Next step to see a summary of the distribution. Click Save and send to deliver codes to user profiles in Braze. 

Automatic workflow

Voucherify can push out codes to Braze automatically in response to the following triggers:

  • Customer entered/left specific Voucherify segment
  • Successful code publish – the message is sent once the code from a campaign is published (assigned) to a customer in Voucherify. 
  • Order status changed (order created, order update, order has been paid, order canceled)
  • Gift credits added – the message is sent once gift card credits are added to the customer's card. 
  • Loyalty points added – the message is sent once loyalty points are added to the customer's profile.
  • Voucher redeemed – the message is sent to customers who successfully redeemed vouchers.
  • Voucher redemption rollback – the message is sent to the customer whose redemption was successfully rolled back. 
  • Reward redemption – the message is sent when a customer redeems a loyalty or referral reward.

To set up an automatic workflow with Braze and Voucherify, visit our step-by-step tutorial.

When the custom attribute with code is added, you can use it in your Braze campaigns.       

VoucherifyCode attribute in Braze

Edit your email template and add `Custom Attributes` defined in the Voucherify distribution.

Add custom Voucherify attribute

When it's ready, you can see the code in your message preview.

Message preview

To leave the editor, confirm your template with DONE and choose FORWARD to finish campaign settings. 

Email annotations powered by Google

Now, Braze supports the promotional annotations of emails. You can use email markup to add key data to your emails such as promo codes, expiration dates, discount values, and more. The information included in the annotation will appear at the top of an email, right next to the subject line and sender credentials.

Email annotation

Google offers several types of data to be included in your email annotation. Go here for further reference.

Data types include the logo (ImageObject or URL), an image representing the discount (ImageObject or URL) and email subject line (text).

As far as vouchers are concerned you can use four fields:

Name Type Description
description Text The text on the promotion strip ("20% off + free shipping in the image above) - added manually
discountCode Text The discount code - {{publication.voucher.code}} in Voucherfiy
availabilityStarts DateTime The start date of your offer - {{publication.voucher.start_date}} in Voucherify
availabilityEnds DateTime The expiry date of your offer - {{publication.voucher.expiration_date}} in Voucherify

All these properties should be included in the header of your email message as JSON-LD.

Go here to learn how to optimize your promo annotations in Braze.

Still need help? Contact Us Contact Us