Skip to main content

Inline keyboard buttons: url, web_app, callback_data, and copy_text

Four inline button types on sendMessage reply_markup: url, web_app, callback_data, and copy_text; layout limits, style colors, and trailing icons.

In short

Inline keyboards ride on the message bubble via sendMessage reply_markup.inline_keyboard. Four button kinds: url, web_app, callback_data, and copy_text. They are not configured in BotFather.


Overview

Use an Inline Keyboard when actions should stay attached to a message. For a bottom input keyboard, see the Reply Keyboard guide. Parameter truth: core.mp.net/bots.

Buttons travel with the message

  • You attach buttons only through message reply_markup (typically sendMessage).

  • BotFather Menu Button / description settings do not create inline rows on chat bubbles.

  • Editing later uses editMessageReplyMarkup (see the callback guide).

Four button kinds

Field

Behavior

url

Opens an HTTP/HTTPS link in the client browser / in-app browser.

web_app

Opens an enabled MiniApp owned by this bot (entryUrl or https://mp.net/{botUsername}/{shortName}; may include ?startapp=). MiniApp client return (web_app_data / sendData / answerWebAppQuery) remains closed.

callback_data

Sends a callback_query Update to your backend (you must answerCallbackQuery).

copy_text

Object form copy_text: { "text": "…" } — client copies locally; no Update.

Layout limits

  • Buttons in the same row share equal width (independent of label length).

  • Typical row gap ≈ 2pt (client layout).

  • At most 8 buttons per row; at most 100 buttons per keyboard.

  • Button text max length 64; longer labels are truncated.

style colors

Optional style on each InlineKeyboardButton: success (green), danger (red), primary (blue). Omit it for the client default. Other Telegram-only button fields return 400.

Trailing icons

The client picks the trailing icon from the button kind (MiniApp / URL / copy / navigate). You do not pass an icon URL.

Minimal JSON (one of each)

{
"chat_id": 12345,
"text": "Choose",
"reply_markup": {
"inline_keyboard": [[
{ "text": "Docs", "url": "https://core.mp.net/bots" },
{ "text": "App", "web_app": {
"url": "https://mp.net/MyBot/shop?startapp=home" } },
{ "text": "OK", "callback_data": "ok:1", "style": "success" },
{ "text": "Copy", "copy_text": { "text": "ORDER-42" } }
]]
}
}

Related

  • Callback buttons and in-place updates (answerCallbackQuery)

  • Core message methods: sendMessage reply_markup

  • MiniApp identifiers, direct links, and startapp

Source of truth

Prefer core.mp.net/bots over PRD wording when they disagree.

Did this answer your question?