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 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; the bot gets/start@your_bot spring_sale. Add&admin=delete_messages+pin_messagesto ask for admin rights. - 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_saleopens the bot's main Mini App, which reads the value asstart_param. Add&mode=compactfor half height or&mode=fullscreen.
Watch out
startandstartgroupparameters 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.
startgrouplists only groups where the person can add members; withadmin, only groups where they can add admins.startchannelrequiresadminand takes no parameter.- Without a main Mini App, a
startapplink 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