Demystifying Accelerators, DXC, and Pre-Composed Solutions
Join discussion
2022-10-19 5:00 pm
arrow pointing left
go to blog
Promo strategies
The Power of API Integration in Referral Marketing
Mike Sedzielewski
Mike Sedzielewski
April 25, 2019
Share it on Twitter
Share it on Facebook
Share it on LinkedIn
Share it on Twitter
Share it on Facebook
Share it on LinkedIn

The Power of API Integration in Referral Marketing

Do you want to run a flexible referral campaign but don't know where to start? Well, API-first referral software can be of help here. With this post, we’d like to show you how to make the best use out of API-based integration when implementing and streamlining referral campaigns.

Disclaimer: throughout this post, we will be using our own product, Voucherify, and its referral campaign features.



API-first referrals and the impact on customer data

Let’s start at the first point where integration will bring benefits – the exchange of customer data. Voucherify makes it easy to transfer customer data by hand using CSV file import/export. This is a good way to get started and experiment with referrals without much overhead. With this post, however, we’ll focus on what happens once you go beyond experiments and decide to grow your referral program at scale. At this point, you’ll need to take the process beyond the manual workflow and that’s exactly where the API-first approach offered by Voucherify comes into play.

Using the API, you can easily build synchronization scripts that will make sure that your customer base stays consistent across Voucherify and your CRM. This is a very non-invasive route, you can keep your scripts out of the way of your CRM and will not need to customize it. Still, you can get even better results by digging deeper into your CRM workflows. Working at this level, you can include Voucherify API calls wherever customer data is changed in the CRM and notify Voucherify of each update on the fly. This way, whatever happens in the CRM gets reflected in Voucherify automatically and without unnecessary lags. In practice, this is as easy as making a REST call to our Customers API, such as this one:


curl -X POST \

-H "X-App-Id: c70a6f00-cf91-4756-9df5-47628850002b" \

-H "X-App-Token: 3266b9f8-e246-4f79-bdf0-833929b1380c" \

-H "Content-Type: application/json" \

-d '{


"name": "John Doe",

"email": "",

"address": {

"city": "Melbourne",

"state": "FL",

"line_1": "226 E Fee Ave",

"line_2": null,

"country": "Australia",

"postal_code": "32901"


"description":"Premium user, ACME Inc.",

"metadata": {



}' \


The cool thing here is that you can use this for posting new customer data to Voucherify, as well as to update already existing records. All you have to do is to make sure that the same source_id is used for all API calls regarding the same customer.

For a large number of popular programming environments, you won’t even need to put such a request together and send it by hand. Voucherify SDKs currently include ones for Node.js, Java, Ruby, PHP, Python, .NET, Voucherify.js, Android, iOS (Swift), Unity (.NET), and Xamarin (.NET) and they will do this for you, providing you with convenient custom data sync methods to work with.

How to integrate your system with Voucherify?

Communication between Voucherify and your existing systems can just as easily be established both ways using webhooks. In this case, the API-first approach means that for every relevant customer-related event that occurs in Voucherify, you can get a detailed notification. For example, when you set up your referral campaign to invoke an HTTP callout action to an endpoint you choose, you will get this kind of response:




































       "campaign":"Referral campaign demo"














This response contains demo data, but when you look at the structure, it’s clear that every bit of information you might need for referral analytics is here – who received what reward as part of which campaign and as a result of what order. The example response above describes the reward received by a referee (invited friend). If you decide to reward referrers (advocates) as well, you would also get a second event, describing the reward assigned to the referrer.

Events like these can trigger your code, which then translates event information to updates in your CRM and thus makes sure customer data stays synchronized on both sides. Once you close this integration loop, Voucherify becomes part of your environment and any campaign you choose to run will require no further work on the customer data transfers. This, of course, will be equally true for any type of campaign Voucherify supports, whether based on referrals or otherwise.

Monitor your referral campaigns in real-time

Naturally, as soon as any reward is triggered, Voucherify will let you know by sending an event via the appropriate webhook. You can use this event feed to drive analytics. While Voucherify will allow you to monitor campaigns through its web GUI, you will likely be working with an existing analytics pipeline that consolidates data from multiple channels. In order to integrate Voucherify as one of the channels, all you need to do is to subscribe to reward events and consume the provided information within your BI environment. Setting it up this way lets you see what is going on with your referral campaign as it happens and in direct comparison with other marketing activities you are running – and all this within a single platform of your choosing.



How to plug in referral distribution channels?

Voucherify offers a Distribution Manager that allows users to share referral codes automatically via built-in tools or integrations with popular messaging platforms (e.g., Braze, MailChimp or ActiveCampaign). Its primary goal is to help you share referral codes automatically, based on both predefined and custom events.

Imagine you want to generate and send out invite links from the pool of unique referral codes. With Voucherify, it’s a walk in the park. It comes down to:

  • Defining when the referral link/code should be sent.
  • Composing the message.
  • Setting the campaign live.

Distribution Manager is equipped with a rich editor that allows you to intermix static content with variables for customer and reward data that will be filled in by Voucherify. The editor works with HTML for emails and plain text for SMS and gives you a live preview of what your messages will look like, making authoring a breeze.

Finally, when a campaign is live and invited friends start visiting to your e-store, it’s time to reward the referrers too.

How to manage referral rewards with webhooks?

Reward events are also useful when you have extra processing steps that need to be triggered. Using webhooks in Voucherify, you can easily set your environment up in a way that every referral reward that is granted is automatically passed on for further handling.

A common use case for this is to notify referrers and referees of the rewards they are receiving. The events you get from Voucherify are invaluable when it comes to generating notification messages and sending them out through your distribution channels. All this can be configured without coding, straight from the Voucherify web GUI with API working behind the scenes. Here, you can set up your email and SMS providers and once this is done - create templates for messages that will go out to customers.

An important first step in this is to choose the channels the messages will go out through (that is built-in email, SMS, or integrations) as well as target proper customer segment and referral campaign. Using these latter distinctions, you can adapt outgoing messages to the context of a campaign and audience as necessary, by setting multiple message templates for different campaigns and segments. This setup is pretty much set-and-forget and, as soon as you get this done, each time a customer is rewarded in a campaign, Voucherify will automatically take care of letting them know about it through the channels of your choosing.


If you were wondering what the benefits of the API-first approach to referral programs look like in practice, this post should give you a pretty good idea. But don’t just take our word for it, sign up for a Voucherify trial and try it out for yourself.


Launch your next refer-a-friend program with Voucherify

Get started


Share it on Twitter
Share it on Facebook
Share it on LinkedIn

Are you wasting time and money on digital promotions?

It’s time for a change.