My bot sends messages to groups with inline button, what I want, is when the button is clicked, chat with the bot page should open, i.e. somehow redirect the user to the private chat with the bot.

I'm using this wrapper.

What I have tried so far is to set a url in answer_callback method, equal to the url of my bot i.e. url="https://t.me/my_sample_bot but I keep getting URL_INVALID response from telegram, I tried http(since I read somewhere in the api documentation that the urls should be HTTP), but that did not work either.

My question is am I doing it right? I mean do I have to set the url in answer_callback method to redirect the user, or I should try another way?

1

There are 1 best solutions below

3
On BEST ANSWER

Well I figured it out myself, setting the url was the right way to do it, and though the Wrappers documentation is not detailed, I took a look at source code and there was a docstring for the method answer_callback_query that said this about the url:

:param url: (Optional) URL that will be opened by the user's client. If you have created a Game and accepted the conditions via @Botfather, specify the URL that opens your game – note that this will only work if the query comes from a callback_game button. Otherwise, you may use links like telegram.me/your_bot?start=XXXX that open your bot with a parameter.

so all I had to do was to give it a link with of my bot, with a start query