The power of integration in API-first referral marketing
By: Mike Sedzielewski
Tags: Referral Marketing, API, Digital Marketing

In our introductory post on referral marketing, we showed you how to give it a go without breaking your budget or committing large development efforts to initial experiments. If you’re new to referral marketing or not sure how well it would work for you, we strongly encourage you to read that post and run some experiments before you continue.

This time, we’d like to go deeper. We’d like to show you how to make the best use of API based integration when implementing and streamlining referral campaign management and execution.

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

KEEP VOUCHERIFY IN THE LOOP ON WHAT’S GOING ON WITH YOUR CUSTOMERS

Let’s start at the first point where integration will bring benefits: the exchange of customer data.As you may know from the previous post, 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.This time, however, we’ll focus on what happens once you go beyond experiments and decide to 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 its own.Using the API, you can easily build synchronization scripts that will make sure the 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 '{

"source_id":"your-tracking-id",

"name": "John Doe",

"email": "email@example.com",

"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": {

"lang":"en"

}

}' \ https://api.voucherify.io/v1/customers

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 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. Available Voucherify SDKs, currently including ones for Node.js, Java, Ruby, PHP, Python, .NET, Voucherify.js, Android, iOS (Swift), Unity (.NET), and Xamarin (.NET) will do this for you, providing you with convenient methods to work with.

HOOK UP YOUR SYSTEMS TO 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:

{

"id":"event_jhTlrNjLifPLPDUyZQrf7gpG",

"object":"event",

"webhook_id":null,

"project_id":"proj_f1r5Tpr0J3Ct",

"created_at":"2017-03-28T20:54:45.021Z",

"type":"redemption.succeeded",

"data":{

"object":{

"id":"r_Rlbe0UzSHdTqxegImt92Qpc1",

"object":"redemption",

"date":"2017-03-28T20:54:44.062Z",

"customer_id":"cust_KiFZJoyHzBmmQKR7SY5NXMBK",

"tracking_id":"1",

"amount":1000,

"order":{

"id":"ord_jvezDre9TtyMIkJ8U4zmvSah",

"created_at":"2017-03-28T20:54:43.692Z",

"status":"CREATED",

"amount":10000,

"items":[



],

"customer_id":"cust_KiFZJoyHzBmmQKR7SY5NXMBK"

},

"metadata":{



},

"result":"SUCCESS",

"customer":{

"object":"customer",

"id":"cust_KiFZJoyHzBmmQKR7SY5NXMBK"

},

"voucher":{

"object":"voucher",

"code":"refjgS8DhE2",

"campaign":"Referral campaign demo"

},

"gift":{

"amount":1000

},

"failure_code":null,

"failure_message":null

}

},

"metadata":{

"source":"API"

}

}

This response contains demo data, but when you look at the structure, it’s clear that every bit of information you might need for analytics is there; which customer received what reward as part of which campaign and as a result of what order. The example response above describes the award received by a Referee. In case you decide to reward Referrers as well, you would also get a second event, describing the reward assigned to the Referrer. See the example.

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.

PLUG IN YOUR DISTRIBUTION CHANNELS

Invite

Voucherify has recently released the Distribution Manager (DM). Its primary goal is to help you share your promo codes automatically, based on events. You can learn how it works in the tutorial and I’m telling you about it for a reason — DM can be useful for referral programs, too.

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

defining when the referral link should be sent

composing a message

set the campaign live

DM 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 “friends” start coming to your store, it’s time to reward the referrers. DM takes care of this too.

Rewards

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 reward that is granted is automatically passed on for further handling, the moment it is granted.

A common use case for this is to notify your 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. 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 email or SMS) as well as target customer segment and 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.

IN SUMMARY

In case you were wondering what the benefits of the API-first approach 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.Once you’re there, make sure to look around as it’s not just a tool for referral campaigns. It will do voucher, coupon, and gift card campaigns. It will allow you to reuse the rewards you define, such as coupons or gift cards, across campaigns. Make sure to check out all the functionality we offer, there’s plenty to choose from.

And imagine the possibilities that open up once you use webhooks to plug Voucherify into a tool like Zapier. In fact, we’ll have more on this topic in our next posts so, stay tuned.