...Create a referral program
Last updated
Last updated
The functionality of the created bot: 1. Generating the referral (partner) link; 2. Checking if the user is in the base already; 3. Notifying the inviter about the new referral; 4. Registering users in the base; 5. Requesting the list of referrals.
So that we can understand from whom the user came from, the bot creates the link by the template: link = https://wa.me/(your number the bot is connected to)?text=You%20were%20recommended%20by%20#{phone}%20Hello
Instead of #{phone} the client’s phone number gets entered, the same number that requested its referral link.
The generated link we send not as the block’s text, but as an attachment (a link with a click notification), this way the link seems shorter.
2. So, we have a link through which new users come in to the bot. When moving through the partner link, the client gets an opened chat window with a pre-filled message (as seen below)
The checking command will work only if the bot finds the phone number from the received message from the client.
The third step:
divide the phrase into components with the help of the splitter command (instruction here)
set up an arrow with a regular expression (and check if the phone number is correct)
save the phone number from the message into the variable (like #{ref})
check the client’s (the one that clicked on the link) phone number to see if it already is someone’s referral (invited earlier by someone else and written down in our base). We do this with the column search function (instruction here)
Now let’s put the inviter and the invitee in the database (instruction here)
Let’s add a special command to the bot, a command that lets us see the list of referrals (instruction here)
In other messengers it’s even easier to create such a referral system, because the data on the inviter is shared via a hidden parameter when moving, and the new client doesn’t need to send the text like “I was invited by this number”.