forward inline keyboard along message in telegram
Asked Answered
M

2

5

I want to create a message with telegram api that users could share(forward) it along its inline keyboard buttons.
I know with telegram api you can create a message that contains inline keyboard by adding inline_keyboard array in replay_markup of a message but when I forward this message inside telegram just the text part of the message forwards and buttons wont.
In brief I want to know is it possible to create a message with telegram api that when someone forwards this message inline keyboard of that message forwards too.

Melba answered 15/10, 2017 at 15:21 Comment(0)
T
2

You can't attach inline keyboard in the forwarded message, but you can add a “Share” button, and use switch_inline_query in inline keyboard.

For instance: Users can use @Sean_Bot TeleBot to send a photo with inline buttons, if they want to keep inline buttons, they should click “Share” button instead of directly forward.

Tocharian answered 15/10, 2017 at 15:34 Comment(1)
Hi @sean, how to add "share" button? I know how to add inline keyboard but i don't know what URL to use so that the "share" inline keyboard will work.Kef
S
4

InlineKeyboardButton with "url" or "login_url" parameter can be forwarded. Note: if there is another button in keyboard without "url" or "login_url" parameter whole keyboard woudn't be shown

Styptic answered 5/1, 2020 at 14:41 Comment(1)
core.telegram.org/bots/api#inlinekeyboardbutton There are two optional fields for the InlineKeyboardButton such as url and login_url. If all keyboard buttons will be with one of these two fields, the whole keyboard will be preserved when forwardingStyptic
T
2

You can't attach inline keyboard in the forwarded message, but you can add a “Share” button, and use switch_inline_query in inline keyboard.

For instance: Users can use @Sean_Bot TeleBot to send a photo with inline buttons, if they want to keep inline buttons, they should click “Share” button instead of directly forward.

Tocharian answered 15/10, 2017 at 15:34 Comment(1)
Hi @sean, how to add "share" button? I know how to add inline keyboard but i don't know what URL to use so that the "share" inline keyboard will work.Kef

© 2022 - 2024 — McMap. All rights reserved.