Referral Program Technical Documentation
https://www.figma.com/design/J32zfGcr13Y5CRLgKzqLNM/Referral-Program?node-id=0-1&t=qImkyGUOXRJY7HTT-0 https://app.clickup.com/t/86cvk7r37 For this feature, we’ll implement it in both the web and native app. The only difference is the contact feature, because the web doesn’t support contacts.
Deeplink Referral
For the main page we’ll use URL https://web.hungryhub.com/en/member/referral please make sure if open that page redirect to this page:
Another case for register url will use this URL: https://web.hungryhub.com/register?referral_code=B4CE68
If open that URL will open registration page will referred by a friend banner.
If this banner is applied, when users try to register they need to include r_code with that referral code value in the registration payload, for example:
{
"minor_version": "{{ minor_version }}",
"name": "Pikachu",
"password": "pikapika",
"email": "pikapika@gmail.com",
"phone": "872817222",
"calling_code": "+66",
"provider": "hungryhub",
"language": "en",
"subscribe_marketing_email": true,
"r_code": "B4CE68"
}
We need to keep that state referral code until this pop up shown up:
And if we click go to my offers & gift card will open my offers & gift card page.
API Invite Referral Program
(This is the expected API to be provided by BE; the client can set up the HTTP request and payload in advance.) This API to send SMS or Email to the contact list. API URL: {base_api}/users/request_referral Method: POST Payload SMS:
{
"access_token": "1ul_ocPBQR9TUG825ecKodtPHasWkI6I1QcBmvjUVSA",
"type": "sms",
"data": [
"0812931234",
"0812931235",
"0812931236"
]
}
Payload Email:
{
"access_token": "1ul_ocPBQR9TUG825ecKodtPHasWkI6I1QcBmvjUVSA",
"type": "email",
"data": [
"emailone@gmail.com",
"emailtwo@gmail.com",
"emailthree@gmail.com"
]
}
Response:
{
"success": true,
"message": "Successfully sent!"
}
Error Responses
If the referral code is invalid or already used, the API will return an appropriate error. Handle these cases in the client UI.
API Total Referral Earned
This API shows progress on how many friends successfully booked with their referral code.
API URL: {base_api}/users/my_referral
Method: GET
Payload:
{
"access_token": "1ul_ocPBQR9TUG825ecKodtPHasWkI6I1QcBmvjUVSA",
}
Response:
{
"success": true,
"message": "",
"data": {
"total_points_earn": 400,
"total_referrer": 4
}
}