3

I am working on an telegram bot, and looking for the exact URL schema to popup the "Share / Select Group / Send to" dialogue in the telegram client.

I have seen this link in @pollbot, for which I took following screenshots.

When click this link, Telegram client will popup send to dialogue


A bit more details:

  1. What I want is to give end-user an easy way to add the bot to their group, just like what PollBot does: When a poll being created, PollBot will return a special like to the user. Any by clicking that link, the user could easily add PollBot to a group. So I'm looking for the exact URL schema of that link.
  2. I then check that link PollBot sent to me in telegram web client, and found out it's a tg protocol url: tg://resolve?domain=PollBot&startgroup=5148bed5f90678b93246464b3e132052. So I tried to resend this url via bot.sendMessage. But it turned out Telegram api server won't parse the tg://resolve url.
  3. So, how could the bot manage to send such a link to the user?
teleme.io
  • 815
  • 3
  • 10
  • 21
  • What do you want to send? Text? URL? Bot start token? – Sean Wei Jul 01 '18 at 23:39
  • what your question is? you are about [deep linking](https://core.telegram.org/bots#deep-linking)? `https://telegram.me/BOT_USER_NAME?startgroup=vCH1vGWJxfSeofSAs0K5PA` where hash was generated by yourself to identified user who are open the link. – dzNET Jul 02 '18 at 04:46
  • @Sean: I want to give end-user an easy way to add the bot to their group, just like what PollBot does: When a poll being created, PollBot will return a special like to the user. Any by clicking that link, the user could easily add PollBot to a group. So I'm looking for the exact URL schema of that link. – teleme.io Jul 02 '18 at 06:06
  • @dzNET I don't think that is deep linking. Because a link that can open the "share" dialogue on telegram client is of such a URL schema: "tg://resolve?domain=PollBot&startgroup=5148bed5f90678b93246464b3e132052" . I have tried send such url through bot.sendMessage, and found telegram api server will parse the tg protocol. – teleme.io Jul 02 '18 at 06:09
  • I'm sure it's a deep linking. you should use `https` protocol, not `tg`. can you checkout this thing? – dzNET Jul 02 '18 at 08:48
  • Also you can try `tg://t.me/` – dzNET Jul 02 '18 at 08:56
  • How are you doing, @teleme.io? I have just re-read and clearly understand your question. have you found a solution to this problem? – dzNET Nov 15 '20 at 16:40

1 Answers1

8

The link there works with deeplinking, please read about it here: https://core.telegram.org/bots#deep-linking

the url has the following scheme:

https://telegram.me/<YourBotUsername>?startgroup=<Payload>

the startgroup part (parameter) of the url tells telegram to open the 'add to group' dialog. when you choose a group there (and you can add bot's to it) the bot will be added to the group and /start PAYLOAD will be send to that group. The Payload is what you defined as value of the startgroup parameter, so your bot can assosiate it with something and send the matching reply.

please mind, that the Payload can only contain certain characters and don't mind that the telegram clients might internaly convert that link to an tg:// url.

you can also use start instead of startgroup to open a private chat.

Iulian Onofrei
  • 9,188
  • 10
  • 67
  • 113
Thorbijoern
  • 356
  • 2
  • 11
  • This is the exact answer I'm looking for, thank you so much. – teleme.io Jul 11 '18 at 16:38
  • Hi @teleme.io! I know `tg://resolve?domain=dznet` that link will be handled by your system preference application. you can edit this settings in your window manager configuration. – dzNET Feb 25 '19 at 10:10
  • 1
    @dzNET yes, but these tg:// links are platform/client-specific and meant for client-internal use... they don't work with every client, so better don't use them... also teleme.io wanted to use deep-linking... these tg:// links don't work for deep-linking... – Thorbijoern Feb 26 '19 at 14:29
  • i has been used this auth link today: `tg://resolve?domain=someone_bot&start=auth_abcd90ef` – dzNET Feb 27 '19 at 16:56
  • and? that doesn't change the fact... why not just use the officially supported way of making such urls (deep-linking) instead of urls which is may not be supportet by every client?!? using such a `tg://resolve` url has no benefit at all... it is just more confusing, probably not compatible with every client and not user-friendly at all... – Thorbijoern Feb 28 '19 at 09:42