Referral Quests
Referral quests allow your audience to support your user acquisition.
A referral reward is configured in the dashboard and (similar to all other point rewards) requires a title, description and amount of points to transfer to the user eligible for the reward.

Referral reward configuration modal
For the point reward to be transferred to the referring user we first need to make sure that the lead they referred to has been qualified. Qualification can be done in in various ways:
- 1.URL qualification (no-code) This approach is easy to implement but requires you to approve point rewards for qualified leads manually.
- 2.Webhook qualification (low-code) This approach requires you to execute a tiny code snipped during qualification but will not require manual approval. Look into this example for more details.
Warning: Never publish a webhook URL in a frontend application since it can be abused. Implement the webhook call in a backend system instead.
Referral URL's will only be shown for authenticated users. The URL contains information about lead qualification and the account originally sharing the URL.

Referral reward widget card
Your audience will be able to copy the referral URL for manual distribution or choose one of the social sharing buttons and post to post the referral URL through Twitter, LinkedIn, Whatsapp, Telegram or e-mail.
This pseudo code example shows how to qualify leads after doing a successful sign up. The implementation of such a flow can of course vary per system, but the steps required to call the webhook will always be the same.
// Execute on app initialization
onAppInit() {
// Store the ref parameter in the Referral URL in your browsers
// local storage for later usage.
localStorage.setItem('ref', location.searchParams.get('ref'));
}
// Execute on submit of the signup form
onClickSignup() {
// Your validation and client side signup code
// ...
// Your signup controller
await axios({
method: 'POST',
url: 'https://yourserver.com/signup',
data: { ref: localStorage.getItem('ref') }
});
}
This express-like controller example is responsible for validation the submitted data and stores in your database. After processing this successfully the webhook is called to let us know the lead (generated through the referral URL) has been qualified.
// Execute in the controller of the https://yourserver.com/signup endpoint
async function controller(req, res) {
// Your validation and server side signup code
// ...
// Lead qualification webhook
await axios({
method: 'POST',
url: 'https://api.thx.network/v1/webhook/referral/3bedcb13-e128-401f-b8ad-71ebc7f519d1/qualify',
data: { code: req.body.ref }
});
}
Last modified 2mo ago