Tracking code installation
Tracking page visits
Intents and Entities
Building Dialogflow agent and connecting to Activechat
Sending user input to NLP engine
Triggering bot skills by intents and events
Working with entities
NLP best practices
Sending order updates
Building a referral chatbot? Easy as 1-2-3 with Activechat!
We’ve built a set of scripts that will allow you to track referral users in bots that you build on our platform. You’ll be using JSON block to call these scripts and you can find example in “Referral chatbot” template in Templates section.
The logic is quite simple – every time one chatbot user invites another user to your offer (achieved easily with sharing card with your offer on Messenger, use “Share” button type) you can use “ADD” script to add referral points to inviting user and store names and IDs of invited users.
Later you can use “GET” script to check the amount of points earned by any user and trigger “CLEAR” script to remove data that is already collected in the database.
Please check “Referral chatbot” template to see example usage of these scripts for a simple referral program chatbot.
Three basic endpoints help you track referrals, add points, get current amount of referred users and clear data in case you need to start from scratch.
Calling this script will add one referral point to the user with refID and add userID and first_name last_name to the list of referred users in the database.
Returns $ok value which is set to true when points were added successfully and false in case of an error.
Messenger ID of referring user. Can be obtained from “ref=” parameter of bot Messenger link.
Messenger ID of user that is being referred. Can be obtained from $_id system variable for the current bot user.
First name of user that is being referred. Can be obtained from $_first_name system variable for the current bot user.
Last name of user that is being referred. Can be obtained from $_last_name system variable for the current bot user.
Calling this script will fetch existing points for user with refID from the database.
Returns $_ref_clicks with total amount of referral points for that user, $_ref_user_ids with the list of IDs of referred users (“|”-separated) and $_ref_user_names with the list of names of referred users (comma-separated).
Calling this script will erase existing points for user with refID from the database.
Returns $ok value which is set to true when points were erased successfully and false in case of an error.
Usually it’s a good practice to add referral points to inviting user only after invited user achieves a specific point in your bot conversation (for example, makes a purchase or shares his/her email and becomes a lead).
When this happens, you can use Activechat API to trigger specific event for inviting user and send him/her a heads up message – something like “Hey, you’ve just got a new referral and now have XX points!”
Again, please check Referral bot template for example (“new_ref” skill is triggered through API from “start” skill with Zapier webhook).