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. Publish voucher via Braze's Connected Content
  2. Publish voucher via Braze's Custom Attributes
  3. Annotated emails powered by Google

Publish voucher via Connected Content

You can publish a voucher and include it in the email using Braze’s Connected Content. 

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:

{% assign campaign_name="NAME OF YOUR CAMPAIGN" %}
{% 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={{${braze_id}}}&channel=Braze&source_id=					    {{SOURCE_ID}}
     :content_type application/json
     :save publication
%}
  1. Replace NAME OF YOUR CAMPAIGN with your unique campaign name.
  2. Add VOUCHERIFY-APP-ID and VOUCHERIFY-APP-TOKEN from your Project Settings.
  3. 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.

  4. Define {{SOURCE_ID}} to prevent sending codes unintentionally in the case of unwanted multiplied requests invoked by Braze. Source id guarantees that each publication, which results in assigning a code to a customer, is a unique action. You can choose from the following options:
    • {{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).

    The following combinations of source id setups provide unique publications per customer:

    • {{campaign.${dispatch_id}}} + {{campaign.${user_id}}} – each customer within single send-out will use the same unique publication.
    • {{campaign.${api_id}}} + {{campaign.${user_id}}} – each customer will use the same unique publication in every send out.
    Unique publication per customer

    As a result, when you add {{campaign.${api_id}}}_{{${user_id}}} in the place of {{SOURCE_ID}}, even if Braze multiplies request, each user will receive the same unique code that was published to him/her in the first message.

  5. Lastly, you need to add the following code to the body to display the published voucher code:
{{publication.voucher.code}}

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

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

 

  • Each publication has a unique source_id assigned – thanks to that Voucherify always sends one unique code per email. Even in the case of invoking the same method for a particular customer twice (doubled request), publication source_id ensures that Voucherify always returns the same unique code assigned to a particular publication source_id.
  • 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.
  • 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 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}}.

Publish via Custom Attributes

Another way of assigning particular codes to customers and receiving Voucherify customer and code attributes is via releasing a Distribution. 

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)

Copying Braze API Key

Go to the Integrations 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 that is not going to send any messages but would rather work as a method of assigning particular code to a customer and receiving custom attributes that will be automatically transferred to your Braze account to be used in your Braze campaigns

Keep in mind that Braze Connected Content functionality will suffice for publishing referral codes to customers as Braze will connect with Voucherify and collect needed data automatically. 

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

1

Choose between a manual and automatic mode.

Manual or automatic mode

If you want to automate your Braze campaign to assign codes and receive custom attributes each time a customer meets the audience criteria, go with the Auto Messages. However, if you want to launch a specific campaign and codes once to a predefined audience, select Manual Mode

2

Define distribution purposes. 

As we want to assign codes to a customer, go with 'Send unique codes from a campaign'. Keep in mind that Voucherify is not going to send any messages as the codes are going to be assigned to customers and custom attributes (customer id, voucher code) are going to be transferred to the Braze account that you've integrated with Voucherify in the previous step. 

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)
  • segment your audience based on marketing permissions

Choosing audience based on segmentChoosing audience based on marketing permissions

4

In the 4th stage, add a message subject which is going to act only as an identifier for Voucherify, not an actual email subject which you will choose later on when launching an email campaign in Braze.

Title your message

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.

Braze as a distribution channel

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

Note

What’s important to notice is that sending messages via Braze acts more like assigning a code to a particular customer - after sending the message via Braze, you should go to your Braze account and create a new email campaign that is going to use custom attributes defined in Voucherify Distribution, that is Voucherify codes.


Let us come back to Braze. 
 

VoucherifyCode attribute in Braze

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

Customer source id

and type it into the following view in Braze:

Searching for a customer

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

1

Choose `Campaigns`

2

Click `Create Campaign`,

Braze - create a new email 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.

Add custom Voucherify attribute

8

When it's ready, you can see your message in `Preview`.

Message preview

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

New feature - 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