Link to a telegram bot with pre-written command
Asked Answered
E

1

8

I'm writing a telegram bot now and I have a question. As I know any user can link to a bot using "@" symbol, like this @my_bot. Is there any possibility to make such a link, that when a user click on it, not only he is redirected to this bot, but also a specific command is sent to this bot by a user automatically. Something like this @my_bot/my_command. I've tried this link, but it doesn't work. I don't know, if it is possible, maybe you do. Thanks in advance!

Estellaestelle answered 21/8, 2020 at 20:50 Comment(0)
H
9

You can use a deep link adding an additional parameter

https://t.me/mybot?start=task_name

The deep link opens the bot with the start command, the additional parameter is passed to your handler to customise what the start command_handler should do.

Hardihood answered 22/8, 2020 at 8:8 Comment(5)
Ok^ thank you, and is it possible to make it running any other command?Estellaestelle
It looks like the start command is the only option when deep linking core.telegram.org/bots#deep-linkingHardihood
@BeppeC according to the mentioned docs, there is also a "startgroup" parameter for deep linking.Savdeep
Current docs URL is core.telegram.org/api/links#bot-linksOleic
Not working if telergam is running in backgroundAlexandro

© 2022 - 2024 — McMap. All rights reserved.