Telegram Referral Bot With Personal Invite Links
Give every member their own invite link, credit whoever brought each newcomer in, and let members check their count with one command.
The Referral Program template builds the whole thing for you: two flows and a table called referrals. You import it, share your bot, and the rows fill up as people join.
What a referral bot does
A referral bot hands each person a link that is theirs alone. When a friend opens the bot through that link, the bot records who sent them. Later, anyone can ask the bot how many people joined through their link, and you can see the whole picture in one table.
That is the backbone of a giveaway entry system, a community that grows by word of mouth, a shop that thanks customers for bringing friends, or an affiliate-style program where you settle rewards yourself.
Set it up in five minutesPro
- Connect a bot. Paste the token you get from @BotFather into the dashboard.
- Import the template. Open Templates, find Referral Program and press Import. You get two flows, Referral: invite links and Referral: my link, plus the referrals collection.
- Get your link. Send
/myrefto your bot. It replies with your personal invite link and your count so far. Share that link, and ask members to send/myreffor theirs.
If your bot already has a flow on /myref, the import picks the next free command, such as /myref2, and tells you which one it used.
How the invite link works
Every member gets a code of 8 letters and digits, drawn at random and checked against the codes already saved. Letters and digits that are easy to confuse — 0, O, 1, I and L — are left out. A member's link looks like this:
t.me/yourbot?start=K7M2QX9P
This is a Telegram deep link. When someone opens it and taps Start, Telegram sends your bot /start K7M2QX9P instead of a plain /start. The part after the space is the code, and the template looks it up in the referrals collection to find out who shared the link.
A code is created once and saved. After that it is always read back from the member's row, so a member's link never changes. Counts are not kept in a separate number either: /myref counts the rows whose referred_by holds that member's code.
The two flows
Referral: invite links
This flow answers a /start that carries a code, and nothing else. A plain /start keeps going to your bot's usual welcome flow.
For a newcomer, referred_by is set to the code from the link when that code belongs to a member, and left empty when it does not.
Referral: my link
This flow answers /myref. Anyone who is not in the collection yet is added on the spot with an empty referred_by, so they can start sharing straight away.
What you see on the Data tab
Open Data in the dashboard and pick the referrals collection. It is a shared collection, so every member's row sits in the same table.
| Column | What it holds |
|---|---|
user_id | The member's Telegram user id |
username | Their Telegram @username, empty when they have none |
name | Their Telegram first name |
code | Their personal 8-character code |
referred_by | The code of the member who invited them, or empty |
joined | The date they were added, as YYYY-MM-DD in UTC |
To see who brought whom, match a row's referred_by with another row's code.
Pro feature: the template saves and reads rows with storage blocks, which are part of Pro. Pro is $4.99/month, and a free 14-day trial starts when you connect a bot — no credit card. If your plan returns to Free, the two referral flows stop replying.
Ways to use it
Giveaways
Give extra entries to people who bring friends, using the counts from /myref and the Data tab.
Communities
Let members grow a group or channel by sharing their own link, and see who is doing the inviting.
Shops
Thank customers who send friends your way. The referred_by column shows exactly who to thank.
Affiliate-style programs
Track which partner brought each new member, then settle rewards on your own terms.
Questions
What happens if an existing member opens someone else's invite link?
They get a welcome-back message with their own link, and nothing is saved. The person who shared the link is not credited, because that member had already joined.
Can a member refer themselves?
No. A newcomer's code is created after the link has been checked, so it can never match their own code, and a member who already has a row is never registered again.
What if someone opens a link with a code that does not exist?
They still join and get their own code and link. The referred_by column is simply left empty.
Does a plain /start register people in the referrals collection?
No. A plain /start still goes to your bot's usual /start flow. People are added when they open an invite link or send /myref.
How high does the /myref count go?
The count covers up to 100 referrals per member. The referrals collection itself holds up to 50,000 rows, and every row stays visible on the Data tab.
Start your referral program
Connect a bot, import Referral Program, and send /myref to get the link you will share.
Start with a free 14-day Pro trial — no credit card, it begins when you connect your bot.
Get Started Free