Friend referral#
The friends referral module enables rewarding customer who refer friends. This feature needs to be enabled and configured in the Antavo Backoffice. This process is documented within the user manual. This article shows how friend referral features are used/visible from API calls.
Overview#
A friend referral is registered in Antavo when a customer account is opted-in with a referrer field, the customer ID of the friend’s account.
POST https://api.rc.antavo.com/events
"customer": "987654321",
"action": "opt_in",
"data": {
"email": "test@antavo.com",
"first_name": "test",
"last_name": "user",
"referrer": "123456789"
}
}
// Response:
{
"id": "987654321",
"created_at": 1638205368,
"email": "test@antavo.com",
"first_name": "test",
"last_name": "user,
"status": "active",
"score": 0,
"spent": 0,
"pending": 0,
"image_url": null,
"events": []
}
A referral
event is created on the referrer’s account upon a successful opt_in
event and can be used as a trigger point for further interactions e.g., reward the person who made the invitation.
The invited customer can also receive benefits by filtering, using the referrer value in a opt_in
triggered workflow.
When the referred customer makes their first purchase (or more depending upon the configuration), the points and reward are assigned to both parties.
POST []https://api.rc.antavo.com/events
{
"customer": "987654321",
"action": "checkout",
"data": {
"transaction_id":"TRX-777666555",
"total":100,
"points_burned":0,
"items":[
{
"product_id":"12345",
"product_name":"name_of_the_product",
"product_url":"http://www.antavo.com",
"price":50,
"quantity":1,
"discount":0,
"subtotal":50,
"points_rewarded":0
},
{
"product_id":"123456",
"product_name":"name_of_the_product",
"product_url":"http://www.antavo.com",
"price":50,
"quantity":1,
"discount":0,
"subtotal":50,
"points_rewarded":0
}
]
}
}
// Response:
{
"id": "987654321",
"created_at": 1638206162,
"email": "test@antavo.com",
"first_name": "test",
"last_name": "user,
"status": "active",
"score": 0,
"spent": 0,
"pending": 0,
"image_url": null,
"events": []
}
Javascript SDK#
Friends referral has been built into the Antavo Javascript SDK.
An Antavo-generated referral URL consists of the target domain that and a hashed form of the referrer’s customer ID.
Following this url leads to a page where Antavo’s JS SDK is initialized.
The SDK subsequently reads the full url and extracts the hashed ID, saving it into a cookie, __alr
.
The party responsible for the frontend and submitting registrations can access this cookie and include with a referrer
field in opt-in event of the invited customer place.