Refer 3 Friends Giveaway


This guide will help you build a Flow using one of AhaChat’s Viral template. Rule:

  • A (invitee) invites B (referral) to receive gifts, if A invites 3 people, it will send a gift message to A.

  • Every time A successfully invites 1 person, there will also be a notification sent to A so that A knows how many more people to invite.


To create this scenario there should be: attribute ref (to know who was invited), “referred” attribute (increased by 1 on every successful invitations), “participant” attribute (to record the names of participants to A), “joined” attribute (to limit each person to only 1 time), the “list” attribute (to limit each person can only receive gifts at a time) Broadcast API (to notify A when he/she successfully invited or is eligible to receive gift).

In this tutorial, you will create a Viral campaign in the keyword that you can use by sending an invite link or clicking the share button. At the same time you can turn on / off the campaign as you like without affecting the old customers of the page.

Note: A FREE account running a viral campaign can invite up to 1,000 participants. While PRO is not limited.

Step 1. Go to to login and create a bot according to the instructions.

Step 2. Copy the script by clicking on this link

Step 3. Fix “giveaway” block to match your page’s promo gift.

Step 4. Go to Audience Menu > Properties> Manage to check if there are 3 attributes (if not, you must create)

participant -> Text value
joined -> Number value
referred -> Number value
list -> Number value

Step 5. If you want to change the condition without having to invite 3 people, then edit the block b_check and a_check (otherwise skip).

Explanation of this condition:

[AND] {{joined}}} = 0

That means B has not participated in receiving gifts.

[AND] {{referred}} = 0

B has participated to receive gifts but has not invited anyone

[AND] {{referred}} < 3

B has participated to receive gifts but has not invited enough 3 people

[AND] {{referred}}> = 3
[AND] {{list}} = 0

B has invited 3 people, but has not yet filled in information to receive gifts

Default branch

B has filled in information to receive gifts, so he/she can not receive gifts anymore.

Explanation of this condition:

[AND] {{damoi}} < 3

This means that A has not yet invited 3 people

[AND] {{damoi}}> = 3
[AND] {{danhanqua}} = 0

A has invited 3 people but has not yet filled in the information to receive gifts

Step 6. Check if the block b_notify_a is the same as the content below

Note that the url will be (POST):<BOT_ID>/users/{{split(ref,”.”)[1]}}/send

And the parameters are:

ahachat_token: <AHACHAT_TOKEN>
ahachat_block_name: a_check
participant: {{full_name}}

Purpose of using Broadcasting API Token:

To inform A that B has joined the program/promo.

Step 7. Modify the conditions at the Welcome Script. Check if the ref link contains viral link, then add + Start Another Flow to the viral script.

Note: If you want anyone who presses the "Send message" button on the page to enter the viral program, add the conditions as shown below.

{{ref}}: has any value

Last step. Create ref link to activate the game

Note: this is the most basic form of viral chatbot, if you want to edit the number of invitees, viral parallel, viral multilayer or combined with other mini games, please upgrade to PRO version. You can check out the list at