Tg:// and t.me keyboard buttons do not work as intended

(Fabio) #1

I tried using a telegram channel invite link (format https://t.me/+XXXXXXXXX) 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?

thanks
fabio

(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”: “https://t.me/+XXXX
}
],
“reply_markup”: {
“inline_keyboard”: [
[
{
“text”: “Get Token”,
“callback_data”: “url:https://t.me/+XXXX
}
]
]
}
}
}

(Nathan Stults) #4

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

He solved it by using telegram.me instead of t.me

(Fabio) #5

yes!
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!