How to build a Telegram referral bot with tracked invite links
By the Botable team
A Telegram referral bot gives every user their own tracked link, records who arrived through it, and credits the referrer once the person they invited does something real. Describe the reward and the action that unlocks it, and Botable builds the tracking, the fraud checks and the leaderboard.
What is a referral bot?
A Telegram referral bot is built on deep links: a start parameter appended to the bot's URL arrives with the new user's first message, which is what makes attribution possible without cookies or a landing page. Each user gets a link containing their own code; anyone who opens it and starts the bot is recorded against them. The whole design question is when a referral counts. Crediting on start is easy and worthless, because starting a bot costs nothing and self-referral farms appear within a day. Crediting on a real action — a purchase, a completed profile, a first bot built — costs more to implement and is the only version that survives contact with incentives. Alongside that, three defences do most of the work: refuse self-referral, refuse a referral from an account that arrived minutes ago, and cap rewards per referrer per day.
What commands does it have?
| Command | What it does |
|---|---|
/invite | The user's personal referral link |
/stats | Their referrals, qualified and pending |
/leaderboard | Top referrers this period |
/rewards | What has been earned and claimed |
/claim | Claims an unlocked reward |
What do you need before you start?
- A Telegram bot token from @BotFather
- A definition of a qualified referral — the action that actually counts
- A reward you can afford at ten times the volume you expect
How do you build it?
How does the tracking actually work?
Telegram deep links carry a start parameter: t.me/yourbot?start=CODE. When someone opens that link and starts the bot, the code arrives with their first message and the bot records the pairing. No cookies, no landing page, and it survives being shared as plain text.
When should a referral count?
On a real action, not on start. Crediting a bare start invites farms and rewards nothing of value. Pick the moment the referred user does something you actually wanted — that is the number your reward budget should be tied to.
How do you prevent self-referral?
Refuse a referral where referrer and referred are the same account, refuse one where the referred account was created moments earlier, and cap qualified referrals per referrer per day. Ask for all three: any one alone is routed around quickly.
Does a leaderboard help?
It substantially increases participation among the top few percent and does nothing for everyone else. Add it if referrals are a campaign; skip it if the reward is meant to be a quiet ongoing perk, where a public ranking mostly advertises how few people participate.
A prompt you can use as-is
Paste this into Botable and adjust the details. It is specific on purpose — a vague description produces a vague bot.
Build a referral bot. /invite returns the user's personal deep link in the form t.me/mybot?start=CODE. When a new user starts the bot with a code, record the pairing but mark it pending. A referral becomes qualified only when the referred user completes their first purchase. Reject self-referrals, reject referrals from accounts less than 24 hours old, and cap qualified referrals at 10 per referrer per day. /stats shows qualified and pending counts, /leaderboard shows the top 10 this month, /claim releases an unlocked reward.
Who is this bot for?
- Products whose users already talk to each other in Telegram
- Community growth campaigns that need attribution, not guesswork
- Anyone paying for referrals who wants to pay only for real ones
What goes wrong with this kind of bot?
- Crediting on /start rather than on an action is the single most exploited design here
- Deep-link codes are visible in the URL — never make them guessable or sequential
- Budget for the fraud case, not the honest one; caps are cheaper than clawbacks
Questions about referral bots
Can the same link work for a channel as well as the bot?
Deep links attribute to the bot. To attribute channel joins you need the bot to create per-user invite links for the channel, which is a different mechanism and needs the bot to be a channel admin. Describe which one you want.
Can rewards be credits rather than cash?
Yes, and they usually should be. Crediting something inside your own product costs less than cash, cannot be cashed out by a farm, and keeps the reward tied to using the thing you are promoting.