Braze

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

  1. Publish voucher via Braze's Connected Content
  2. Publish voucher via Braze's Custom Attributes

Publish voucher via Connected Content

You can publish a voucher and include it in the email using Braze‚Äôs Connected Content. Here is a code snippet that you need to add to the email template:

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

To display the published voucher code:

{{publication.voucher.code}}

Note

  • Assigning the campaign_name variable is a workaround to pass campaign names which include spaces. Alternatively, you can pass a campaign id directly in the :body
  • ${user_id} is the external_id of the user in Braze and will be set as source_id for the customer in Voucherify.
  • When testing email template be aware of 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}}


Publish via Custom Attributes

To start with, connect your Voucherify account with Braze. Copy the REST API Key from your Braze account (it should have a permission 'users.track' at least)

Go to the Integration Directory in your Voucherify dashboard and put the copied Key 

When connected, you can use the plus to start a new Braze distribution in the dashboard.

In the manager, go through first 6 stages to set distribution details:

1

Choose between a manual and automatic mode

2

Define distribution purpose

3

Define your audience:

  • choose a single customer (manual mode)
  • pick one of your existing segments or define a new one from scratch (automatic mode)
4

In 4th stage, add a message subject 

5

Lastly, choose a Braze as a channel and define a custom attribute name - you will use that property for putting a code in the Braze message 

When it's ready, choose SEND to test your distribution - as a result, you should get a user with text and QR/barcode assigned.

To find the user in Braze, use UserID (source_id) from a Voucherify customer profile

and type it into the following view in Braze:

To send an email from Braze with embedded code, you have to define a Braze campaign:

1

Choose `Campaigns`

2

Click `Create Campaign`,

3

Select `Email`, 

4

Choose `Blank Template`, 

5

Go to `Edit Email Body`, 

6

Switch to  `Body` tab 

7

Customize your template and add `Custom Attributes` defined in the Voucherify distribution

8
When it's ready, you can see your message in `Preview`
To leave the editor, confirm your template with DONE and choose FORWARD to finish campaigns settings. That's it!