Inline buttons in Telegram differ from regular buttons, which are used to select response options in a bot dialog. Inline buttons allow users to:
The Telegram API supports two types of inline buttons:
To maintain the correct message order, make sure there are no Information blocks before this section.
text
β the message text.bot_token
β the bot token obtained in BotFather.chat_id
β the chat ID where the message will be sent.{messengerUserId}
to send a message to the current chat.curl 'https://api.telegram.org/bot{bot_token}/sendMessage?chat_id={chat_id}&text={text}' -X 'POST' -H 'Content-Type: application/json' --data-raw '{"reply_markup":{"inline_keyboard":[[{"text":"Button Text","url":"Link that opens when clicked"}]]}}'
Key | Value |
---|---|
reply_markup.inline_keyboard.0.0.text |
Button text. |
reply_markup.inline_keyboard.0.0.url |
The link that opens when clicked. |
url
with web_app.url
if the button should open a WebApp inside Telegram:reply_markup.inline_keyboard.0.0.web_app.url
0
). Example keys:reply_markup.inline_keyboard.0.0.text
reply_markup.inline_keyboard.0.0.url
reply_markup.inline_keyboard.0.1.text
reply_markup.inline_keyboard.0.1.url
0
). Example keys:reply_markup.inline_keyboard.0.0.text
reply_markup.inline_keyboard.0.0.url
reply_markup.inline_keyboard.1.0.text
reply_markup.inline_keyboard.1.0.url
Now the inline buttons have been added to the scenario and are ready for use.