Flow Preview
Referral MenuReferral Welcome
Overview
Personal invite links with referred-user attribution: every signup is tagged, the inviter is recorded, and the owner gets an alert. Rewards are granted manually from the alerts.
Who It's For
The user wants a bot where members share personal invite links, new users are attributed to their inviter, and the owner is alerted about every referral.
Setup Requirements
- What reward do referrers get, and after how many invites?
- Who should receive new-referral alerts?
- What is the bot's username, for building the invite links?
- If you deferred the bot username during setup, set the botUsername variable to your bot's username without the @ (for example mycompany_bot) — invite links are built from it and will not work until then.
- Tag everyone who should receive referral alerts with the tag you chose during setup on the Contacts page — the Notify referral owner action messages every contact carrying that tag.
- Grant rewards manually from the alerts: each one shows the new user's ID and the inviter's platform ID, so you can find the inviter on the Contacts page and deliver the reward. Automatic per-referrer reward counting is not part of this template.
Node Breakdown
- Member starts the bot and sees the reward pitch
- Taps Invite friends and receives a personal deep link built from the bot username and their platform ID
- A friend opens the link; the ref-prefixed payload routes them into the Referral Welcome flow
- The trigger strips the ref prefix and stores the inviter's platform ID into referredBy
- The invitee is tagged referred and welcomed with the reward mention
- The owner is notified by tag with the new user's ID and who invited them
- The invitee taps Get started and lands in the main menu
Details
Good to know
- The invitee flow starts from a deep-link trigger with an explicit payload match { mode: "starts_with", value: "ref" }; the runtime strips the matched prefix and exposes the remainder as the start_param output field, which this template captures into the referredBy variable.
- An explicit starts_with prefix out-ranks both the plain /start command and an empty-config deep-link catch-all in trigger specificity, so referral links reliably open the invitee flow while a bare /start opens the menu. Do not remove the payload match — an empty-config deep-link trigger can shadow /start or be shadowed itself.
- There is no bot-username system variable, so the personal link is built as https://t.me/{{var|var_bot_username}}?start=ref{{sysvar|platformId}} from the botUsername variable collected during setup.
- Telegram limits the ?start= payload to 64 characters of A-Za-z0-9_-; the ref + platform ID payload is well within that.
- Attribution is per-contact (referredBy) plus an owner alert per signup; there is no per-referrer counter or leaderboard in this template.
Keep in mind
- Do not promise automatic reward counting, per-referrer totals, or leaderboards — this template records who invited whom and alerts the owner; rewards are granted manually from those alerts.
- Do not use an empty-config deep-link trigger as the invitee entry — it can shadow the plain /start welcome (or be shadowed); keep the explicit starts_with "ref" payload match.
- Do not build the invite link from a bot-username system variable — none exists; use the botUsername variable collected during setup.
- Do not put anything outside A-Za-z0-9_- into the ?start= payload; Telegram rejects other characters.
