Unlock loyalty ROI insights with Omnivy and Voucherify – register now for expert tips and a free worksheet!
0
Days
0
Hours
0
Minutes
0
Seconds
Get it now
2025-01-13 12:00 am
2024-10-03 12:00 am
2024-09-23 12:00 am
2024-09-18 12:00 am
2024-05-09 12:00 am
2024-03-18 12:00 am
2024-04-16 12:00 am
2024-04-14 12:00 am
2024-09-16 12:00 am
2024-06-25 12:00 am
2024-06-13 12:00 am
2024-06-17 12:00 am
2024-05-29 12:00 am
arrow pointing left
go to blog
Marketing
How to Fast-track a Referral Program with Voucherify, Segment, Braze, and Branch?
Mike Sedzielewski
Mike Sedzielewski
May 16, 2023
Share it on Twitter
Share it on Facebook
Share it on LinkedIn
Share it on Twitter
Share it on Facebook
Share it on LinkedIn

How to Fast-track a Referral Program with Voucherify, Segment, Braze, and Branch?

Referral programs have long been hailed as one of the most effective marketing strategies to acquire new customers. However, running a successful referral program requires careful planning, execution, and the right set of tools to achieve optimal results.

In this post, I will explore how you can fast-track your referral program using the combination of Voucherify, Segment, Braze, and Branch. These four platforms offer an integrated solution to build your referral campaigns in days. In this guide, I will recreate the success story of Pomelo Fashion and their award-winning low-code referral campaign.

{{CUSTOMER}}

{{ENDCUSTOMER}}

What were the rules of Pomelo's referral program?

Pomelo Fashion created a highly personalized messaging experience by:

  • Streaming user data into Segment.
  • Creating relevant referral messages in Braze.
  • Using Branch deeplinks to ensure that users land on the app page & app store.
  • Leveraging Voucherify to deliver personalized messages and manage the referral codes.
Diagram

Pomelo launched a two-sided referral program which rewarded both the advocate and their friends. When it comes to the promotional logic, several requirements had to be met to ensure that the campaign drives customer acquisition while preventing referral fraud and misuse:

  • Friend is not an existing Pomelo customer.
  • Friend uses advocate’s code to make their first Pomelo purchase.
  • Friend gets 200 THB off their purchase.
  • Advocate gets 200 THB coupon sent to their account EVERY TIME a new friend becomes a customer.
  • Friends referrals should work on both web and mobile channels.

But the real difficulty had to do with Pomelo’s scale. As an industry leader, Pomelo serves millions of customers in a dozen different countries. The real challenge was to launch, and more importantly, maintain the marketing agility of the referral campaign across markets and teams in a limited time frame for launching the campaign.

API-based building blocks of the referral campaign

Pomelo believes that with the right technology and marketing strategy, it’s possible to make personalization happen responsively, and at a massive scale. 

As personalization today means crunching large volumes of customer data and synchronizing them across sparse systems and databases, Pomelo has become a power user of API-first platforms. 

Here’s how they connected them to achieve:

  • Faster time-to-market.
  • Personalization flexibility.
  • Traffic spikes handled.

Now, let’s get our hands dirty recreating this setup. Before we continue, make sure you have these provided:

  • Voucherify, Braze, Branch, and Segment accounts (we need the API keys).
  • Postman (or any other tool allowing you to send and receive HTTP requests). We’re going to use it to simulate an app and backend exchanging messages. 

Note: Follow these links to find API documentation of Voucherify, Segment, Braze, and Branch.

Note: if you want to brush up on Postman and operating API-first platforms in general, you can visit our introductory article.

Note: here you can find the Postman collection of the requests we use in this tutorial.

Step 1 – Populate users across platforms (Segment)

Before we jump into the referral logic design, we need to ensure the basics are in place. The first thing on the list is the customer data integrity — we’ll make sure a customer gets identified properly on every platform. 

Learn more: Customer segmentation – how to ensure data integrity?

Let’s imagine a new user signing up to our shop. We need to populate this information to Braze, Branch, and Voucherify to make the customer data actionable. That’s a perfect task for Segment. It provides a coherent abstraction for identifying customers, tracking their behavior on various touchpoints and distributing these data to relevant systems.

Off we go to Segment. We’ll create the first connection. The connection will receive data from an app or actually its backend (source) and will send it to Braze and Voucherify (destinations).

Learn more: How to use Segment custom attributes to personalize promotions?

Go to Sources, add a new source and choose HTTP API option. This allows you to fire HTTP requests to Segment’s severs from Postman. Name the source and optionally add labels to filter sources in the future.

Setting up a source in Segment
Set up the Source in Segment

Let’s test the connection. Click on the source and copy your write key.

Write Key in Segment referral campaign
Copy the Write Key

Now, open Postman and create a new API request.

  • Change the method to POST.
  • Set URL to https://api.segment.io/v1/identify.
  • In the Authorization tab, select Basic Auth as TYPE and provide your Segment API key as Username.
  • Go to Body, select Raw and JSON. Place the following snippet in the body:

{{CODE}}

{

  "userId": "jim@dundermifflinpaper.com",

  "traits": {

    "email": "mike+jim@voucherify.io",

    "name": "Jim Halpert"

  }

}

{{ENDCODE}}

For simplicity, we’re using emails as customer identifiers and email aliases to test messages.

Authorize API connection
Api connection with segment
Exemplary API request

The customer data above serves as an example. To test the Segment API connection, you need to provide userID, email address, and customer name. Now SEND the request. When you see "success": true, open Debugger in Segment. You should see a confirmation that your source has received data from Postman. 

Checking the API connection in debugger
Check the API connection

Now that we have the source listening for requests, let’s pass them to Braze and Voucherify. 

Add Voucherify as Destination

  • Go to Destinations and click Add Destination. 
  • Select Voucherify from the Catalog and configure the integration.
  • Get your API keys and paste them into Segment. You can find your keys in the Project Settings in the Voucherify dashboard. Make sure the API URL corresponds with your Voucherify settings.
  • Voucherify Application ID serves as Segment's API Key. Voucherify Secret Key is Segment's API Token.
Voucherify & Segment
Configure Voucherify integration

Next, switch on your destination and go to Event Tester. Select Identify as Event Type and Send Event. On the right hand side, you should see the confirmation that Voucherify has created a test user. Likewise, when you go to Customers in Voucherify dashboard, you should see the newly-created test user.

Test Voucherify integration with Segment
Test the Voucherify destination

Add Braze as Destination

Adding Braze destination is quite similar, here’s how the settings might look like (make sure your REST API key has User Data permissions). You will find the data you need in the App Settings in Braze.

Setting up Braze & Segment
Set up Braze destination

Now, the final task in this step is to activate the whole workflow. Ensure that both destinations are switched on, go back to Postman and hit SEND once again. Segment will receive the request and translate it in a way it’s digestible by Voucherify and Braze. As a result, the Jim Halpert should be visible on both platforms.

Complete integration
Test the Connection by sending an API request

Step 2 – Generate referral codes (Voucherify)

Now that we have our customers synced, let’s invite them to join the referral program. We’ll start off with generating referral codes with Voucherify. Begin by providing general details of your referral program.

  • Create a new Referral Codes campaign.
  • Define the name and the code pattern for our program (you might want to give a prefix and remove misleading characters like O, 5, I from referral codes).
  • Impose some time limits, they’re optional but usually of high importance for the success of a campaign.

Learn more: How to build a referral program?

Referral Program – Basics
Provide general details of your referral program

The third stage is essential. Here, we need to design on what conditions Voucherify should reward people. In our case, we want to give 200 THB to both advocate and new customer so we choose double-sided reward.

Now to the conversion event. By default, Voucherify awards advocates when their referral code gets redeemed. Sometimes, however, this isn’t enough to account for a successful referral. You might want to wait for the shipping or event return period. That’s why Voucherify enables you to define a custom event for this purpose (whenever Voucherify receives such an event via API, the valid referral is counted).

Custom event ina referral program
Set up the referral program workflow

We know when a customer gets awarded, but we’re still missing the actual reward. Proceed to the next screen to set it up. First, we define how we award referred friends — in our case it’s a discount coupon worth 200 THB.

Referee Rewards
Create referral reward for invited customers

At this point, we should think of some ground rules of the program. First, a friend should be referred only once. Second, we might want to increase the spend with minimal cart value for the referred customer’s first order. Finally, we can exclude customers from the program based on any attribute like location or payment method. Voucherify validation rules builder will help you achieve that with a simple editor.

Let’s skip Referrer Reward and Notifications steps (we’ll come back to them in a minute) and save the campaign. In this way, Voucherify will be ready to generate referral codes.

Step 3 – Assign referral codes to user profiles (Braze)

It’s time to actually invite customers to the referral program. First, let’s call the Segment identify again to have at least two users. Here is an exemplary API call:

{{CODE}}

{

  "userId": "michael@dundermifflinpaper.com",

  "traits": {

    "email": "mike+michael@voucherify.io",

    "name": "Michael Scott"

  }

}

{{ENDCODE}}

Next, let’s create a Braze campaign that calls Voucherify to get a unique referral code and assigns it to every new user. To do so, we’ll use Connected Content.

  • Create a new email campaign.
  • Select your template and come up with an email copy.
  • Switch to HTML editor and paste the following snippet somewhere within the <body> tag (preferably between <table> tags), substituting API credentials and the referral campaign identifier (get it from the URL in the Voucherify dashboard).

{{CODE}}

{% 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": "YOUR APP ID", "X-App-Token": "YOUR APP SECRET" } 

:body campaign=camp_YOUR_CAMPAIGN_ID&customer={{${user_id}}}&channel=Braze&source_id={{source_id}} 

:content_type application/json 

:save publication %}

{{ENDCODE}}

Learn more: Explore a comprehensive GitHub library featuring helpful Liquid and Connected Code snippets for promotions and loyalty scenarios with Voucherify and Braze.

  • In the HTML editor, put {{publication.voucher.code}} where you want to display the code.
  • Set up other parameters of the campaign and save it. 
Braze Connected Content
Use Braze Connected Content functionality

We’ve used Scheduled Delivery with immediate send-out. However, you can trigger the email send-out based on multiple events and attributes.

Once the campaign is launched, this happens:

  • Voucherify generates a new unique referral code according to the pattern we defined.
  • Voucherify publishes it to a user whose id is sent with Connected Content API call. (Once published, it won’t be used again for another user).
  • Voucherify sends the new code back to Braze as a response to the API call.
  • Braze puts the code in the right place and sends the email.

If everything worked as planned, we should receive emails and unique referral codes assigned to Jim and Michael in their Voucherify profiles.

Referral email from Braze
Receive referral email from Braze
Referral code for Jim
A new referral code is assigned to Jim

Bonus step – upload codes to user profiles in Braze 

Thanks to Connected Content, Braze was able to send the assigned referral code in a message. However, it won’t be persisted in the Braze user profile. You might want to upload it to have it at your fingertips for further campaign engagement. 

To achieve this, you can configure the referral campaign to send corresponding referral codes via Custom Attribute.

  • Let’s edit our referral campaign in Voucherify.
  • Go to Notifications and select Send referral code to the referrer.
  • Scroll down and select Braze as a channel. (You’ll need a Braze API key with users.track permission enabled.)
  • Provide the name of Custom Attribute that will store the referral code.
Referral program notifications
Set up referral program notifications

Save the campaign. From now on, every new Connected Call will populate the referral_code attribute of a user in Braze.

Referral Program custom attribute
Use custom attributes to store referral codes

Step 4 – Create tiers for referrers (Voucherify)

Let’s wrap up the current setup. Thanks to Segment, every new user is synchronized with both Voucherify and Braze. Then, the active Braze campaign retrieves a unique referral code from Voucherify and sends it via email to the new user. The code is managed by Voucherify, it’s linked with the user and the promo engine treats it as a 200 THB off coupon for every new referred customer. You can validate the referral code to confirm this. 

Create a new Postman request and call validate endpoint from Voucherify API.

  • Select POST method and put the following URL https://api.voucherify.io/v1/vouchers/{CODE}/validate replacing CODE with your referral code.
  • Add X-App-Id and X-App-Token headers and fill it with Application ID and Secret Key respectively.
  • Set Content-Type header to application/json.
  • Set the following Body to simulate a friend trying to redeem the referral code and SEND.

{{CODE}}

{

    "customer" : {

        "source_id" : "pam@dundermifflinpaper.com"

    }

}

{{ENDCODE}}

Voucherify should reply with the information about the referral code.

Validate code
Test validating the referral code

What we’re still missing though is something that would move the needle – an actual incentive for advocates. Let’s give them 200 THB for every referred friend.

  • Edit your referral campaign and go to Referrer rewards.
  • Create the first and only tier which awards referrer every time referral event occurred. You can create many more to employ some gamification theme. Apart from the number of successful referrals you can add more validations rules, like location or budget to name a few examples.
Referrer Rewards tier
Create a tier for referrer rewards

Go to Rewards and CREATE NEW REWARD. Our plan is to give a 200 THB coupon for every referral. Name your reward to help you reference it in reports (something like “200 THB off”) and click CREATE NEW CAMPAIGN. Here select Amount type coupons of 200THB value and SAVE. Now ADD REWARD to assign reward to your referral campaign.

Confirm rewards
Confirm the referral reward

The last step is to notify an advocate about the reward. To do so, we’ll send a reward coupon code to advocates profiles at Braze. Enable Braze channel and define how Voucherify should name the reward related Custom Attributes

Referral reward notification
Notify customers about referral reward

Save the campaign and the Voucherify part is ready. It’s about time we tested what we’ve built so far end-to-end. We’ll simulate the scenario of Jim referring the service to his dear friend — Dwight. In effect:

  • Dwight gets 200THB off of her first order.
  • Jim gets a 200THB coupon reward.
  • Dwight receives an invitation to referral program with a unique referral code.

Switch to Postman and follow these steps:

Dwight installs the app and creates an account — the backend detects a new signup — call Segment Identify request with the body below to notify Braze and Voucherify about a new signup. Go to dashboards in Voucherify and Braze to see if Dwight data got populated correctly.

{{CODE}}

{

  "userId": "dwight@dundermifflinpaper.com",

  "traits": {

    "email": "mike+dwight@voucherify.io",

    "name": "Dwight Schrute"

  }

}

{{ENDCODE}}

Dwight uses the referral code at the checkout — the ecommerce engine needs to apply the code to the cart. Call Voucherify Redemption to validate the referral code and to calculate the discounted order price.

{{CODE}}

{

    "customer" : {

        "source_id" : "dwight@dundermifflinpaper.com"

    },

    "order": {

      "amount": 80000 // amount multiplied by 100 to handle decimals

    }

}

{{ENDCODE}}

Referral code redemption
Redeem the referral code with Voucherify API

Dwight gets his  first order delivered to the farm – the backend listens to the shipping status and notifies CRM platforms about the updates — call Segment Track Referral to notify that a successful referral should be counted.

{{CODE}}

{    

"userId":"dwight@dundermifflinpaper.com",    

"event":"referral",  

"referral":{  

"code":"torchie-MYRATKCP"    

}

}

{{ENDCODE}}

When we look into the referral program dashboard, we should see two things:

  • Jim’s referral code has been already used once (by Dwight).
  • A newly generated code for Dwight.
Referral Program 3
Visit the dashboard to see referral codes status

When you visit Jim’s profile in Braze, you can see that he received his first referral reward coupon.

referrcal code in braze
You can see the referral reward code in Braze

When you invite new users to the referral program again, Voucherify will generate Dwight’s referral code via Connected Content and send it to his profile in Braze.

The very last step is to notify Jim about the reward. The easiest way to achieve it is to create an action-based campaign which uses Change Custom Attribute Value trigger. So, whenever reward_coupon_code changes its value with successive reward notifications from Voucherify, Braze sends a message with the reward coupon code. 

In a production environment, you might and should integrate in-app customer profiles with Voucherify to show their full promotional wallet, including referral code, statistics, and above all rewards. For the web version, you can use Voucherify pre-built cockpits.

Referral score in cockpit
Visit individual customer hub to see the referral score

Bonus step – Add more tiers (Voucherify)

If the campaign performs too well, you can easily add more tiers to gamify the referral frenzy and protect your budget. For example, you might want to send one reward for one referred customer, and then another one but only if an advocate earns at least five referred customers — so two rewards in total regardless of the number of successful referrals. To apply this to your program, just edit your campaign, go to tiers section and:

  • Edit the original tier, so that number of Referred Customers is more than 0.
  • Create another tier, and set the condition to Referred Customers is more than 5.
Add more referral tiers
Build additional referral tiers

Step 5 – Onboarding with deeplinks (Branch)

The missing puzzle is how we can attribute app installs to our referral campaign and how to send newly registered users the referral deal. With our current setup, the advocate has to send a referral code to their friends. Then, they need to save it somehow to paste in during the checkout stage. What if we could modify the referral link in a way it lets the app store and apply the code automatically?

To achieve this goal, we need deeplinks. Many of you already use one of the deeplinking platforms, you can use it here for integrity. In our case, we’ll go with Branch.

While Braze x Branch integration has some advanced goodies for branded deeplinking, this is beyond the scope of this tutorial. We’re going to use long links to show how straightforward it is to attribute installations to our referral campaign and how to point new users to a specific view.

When our deeplink is clicked by a new user, Branch will redirect them to a corresponding place, either App Store, Google Store or a web page. Then, when the app is installed, the parameters that we pass with the URL, will be read by the Branch SDK on the mobile app. In this way, the app will be able to recognize the referral code and store it in the user's profile. Here’s how our deeplink is constructed: 

<domain> + <campaign parameter for tracking> + <unique referral code> + <other parameters>

Let’s implement it with Branch:

  • Open your Branch dashboard and go to Configuration.
  • Provide the links to the stores and a fallback link in for the web view. (As we don’t use real apps in this example, we skipped stored links).
Branch redirects
Configure Branch redirects

Scroll down to Link Domain and set up your domain. (Again, for simplicity we use default ones).

Default link domain
You can use default link domain to test the flow

Open Postman, create a new GET request and type the following long link:

g9xol.test-app.link/?~campaign=referral&code=torchie-MYRATKCP&$fallback=https%3A%2F%2Fshowcase.voucherify.io

Before we click SEND, let’s analyze each part of our long link:

  • g9xol.test-app.link — our Branch domain (you can configure your custom one for better branding).
  • ~campaign=referral — telling Branch how to attribute the click.
  • code=torchie-MYRATKCP — Jim’s referral code.
  • $fallback=https%3A%2F%2Fshowcase.voucherify.io — (optional) telling Branch where to redirect the user after click in the fallback mode (we’ve set up the primary mode in Branch dashboard).

Now, when you hit SEND, simulating a user clicking on the link, the request goes to Branch which will redirect the user to the right place. 

Branch test API call
Send a test API call to Branch

When you open Source and compare by campaign, you’ll see that the click was correctly attributed to our referral campaign.

Branch clicks attribution analytics
Test Branch click attribution

Now, go back to the Braze referral invitation campaign and add our link to the message. In the URL, remember to replace Jim’s code with {{publication.voucher.code}} to ensure every signup gets their own unique code.

Step 6 – Manage your referral campaign

In these five steps, we’ve created a complete POC of a solid referral program. Thanks to powerful mar-tech tools, we were able to spin off a highly targeted referral campaign in hours. The API-first approach allowed us to outsource the backend part while still having flexibility over the mechanics of the referral calculation. What’s most important, with the collaboration between Braze, Segment, Branch and Voucherify you can enjoy 100% personalized, on-brand experiences with app and web customer touchpoints. 

The best part? Lower development efforts required. Both of the implementation part and maintenance. With Voucherify, you can change the referral program conditions on your own. Think running A/B tests with limiting referrals per advocates or referrals in total, adding minimum spent value to the friend’s order, or excluding specific customers or whole segments from the program.

The final step is to define the requirements for your developers. Within a day or so, they should be able to translate our Postman requests into the production code (check out official SDKs). The initial launch might require some bulk customers sync and depending on your traffic you should consider the rate-limiting policies of the platforms — this is where the official API documentation comes in handy.

With Voucherify and your mar-tech stack you can launch many more personalized incentives. Visit our docs to learn what goodies come with our API, get our Postman collection, and happy hacking!

{{CTA}}

Launch award-winning referral programs with Voucherify

Get started

{{ENDCTA}}

Share it on Twitter
Share it on Facebook
Share it on LinkedIn
Bulding a Business
Case for Loyalty

Discover if loyalty truly pays off in our exclusive masterclass – plus, grab
your FREE Loyalty ROI 
Worksheet.

Download worksheet

Are you wasting time and money on digital promotions?

It’s time for a change.