Tg:// and keyboard buttons do not work as intended

(Fabio) #1

I tried using a telegram channel invite link (format as a link in a button in the telegram inline keyboard. This was part of a “send a message” action in a direct bot chat.
It seems it is not working as intended. The very same link as part of the same “send a message” action leads to the channel as I expected, while the button seems to just cause an unintended callback to the same bot, which catches it as a catch-all.
I tested the same behaviour also with tg://XXX links.

What am I doing wrong?


(Nathan Stults) #2

Make sure you set the type of the button to URL:

Telegram Keyboards

(Fabio) #3

thanks for the quick reply Nathan.
I cannot find a reference to a “url:” type in the Telegram Keyboards documentation page. I ddi try using the “login_url:” one, in case that is what you were referring to, but that did not work either.

This is what the response data looks like (using the “url:” qualifier). Please note I replaced all sensitive data with “XXXX”.

Response Data
“ok”: true,
“result”: {
“message_id”: XXXX,
“from”: {
“id”: XXXX,
“is_bot”: true,
“first_name”: “XXXX”,
“username”: “XXXXBot”
“chat”: {
“id”: XXXX,
“first_name”: “XXXX”,
“username”: “XXXX”,
“type”: “private”
“date”: 1690992360,
“text”: “The sale was successful :+1:\n\nGet the token”,
“entities”: [
“offset”: 28,
“length”: 13,
“type”: “text_link”,
“url”: “
“reply_markup”: {
“inline_keyboard”: [
“text”: “Get Token”,
“callback_data”: “url:

(Nathan Stults) #4

Hmm, I wonder if this is the same problem you are having?

He solved it by using instead of

(Fabio) #5

That solved it, indeed!

Thanks Nathan, amazing as usual :slight_smile:

ps: I had looked for answers, clearly not well enough. Thanks for the pointer!