Deep links: start, startgroup, startchannel and startapp
What it is
A deep link is a `t.me` link to a bot with a parameter at the end, so the bot knows where a person came from or what to open. `start` opens a private chat, `startgroup` adds the bot to a group, `startchannel` adds it to a channel as an admin, and `startapp` opens its Mini App.
How to do it
- Private chat: `https://t.me/your_bot?start=spring_sale`. A Start button… Private chat: `https://t.me/your_bot?start=spring_sale`. A Start button replaces the input bar, even for people who already started the bot; tapping it sends `/start spring_sale`.
- Group: `https://t.me/your_bot?startgroup=spring_sale`. The person picks a… Group: `https://t.me/your_bot?startgroup=spring_sale`. The person picks a group; the bot gets `/start@your_bot spring_sale`. Add `&admin=delete_messages+pin_messages` to ask for admin rights.
- Channel: `https://t.me/your_bot?startchannel&admin=post_messages+edit_messages`.… Channel: `https://t.me/your_bot?startchannel&admin=post_messages+edit_messages`. The person picks a channel; the bot joins as an admin.
- Mini App: `https://t.me/your_bot?startapp=spring_sale` opens the bot's main… Mini App: `https://t.me/your_bot?startapp=spring_sale` opens the bot's main Mini App, which reads the value as `start_param`. Add `&mode=compact` for half height or `&mode=fullscreen`.
Watch out
- `start` and `startgroup` parameters take up to 64 characters, only A–Z, a–z, 0–9, _ and -. Telegram suggests base64url for anything else.
- In links to a named Mini App (`t.me/your_bot/app?startapp=`), the parameter can be up to 512 characters.
- Anyone can read and change the parameter: keep passwords and personal data out.
- `startgroup` lists only groups where the person can add members; with `admin`, only groups where they can add admins.
- `startchannel` requires `admin` and takes no parameter.
- Without a main Mini App, a `startapp` link just opens the bot.
With Gem
Gem makes these links for every project: `t.me/gembot?startapp=<name>` opens its Mini App page, and `t.me/gembot?start=<name>` its chat in @gembot. Invites go out as `gem.bot/<name>?i=<code>` or through Telegram's share box, and the first invite counts.
Sources
- https://core.telegram.org/bots/features#deep-linking
- https://core.telegram.org/api/links#bot-links
- https://core.telegram.org/bots/webapps
- https://core.telegram.org/bots/api-changelog