Skip to main content

Core API parameters: getMe, getUpdates, and sendMessage

Parameter-level detail for getMe, getUpdates, and sendMessage—including reply_markup for inline buttons, Reply Keyboard, and MiniApp entry.

These three methods carry most early MPChat bot integrations. Other methods follow the same envelope; see the method matrix and the official reference for their fields.


Overview

getMe verifies identity, getUpdates gets a chat_id, and sendMessage delivers. sendMessage is an MP difference: reply_markup supports inline buttons (url / web_app / callback_data / copy_text) and Reply Keyboard; MiniApp client return flows (web_app_data / sendData / answerWebAppQuery) remain unavailable.

getMe

GET or POST, no body. Ideal as a health check with no side effects.

curl --silent --show-error "https://call.mp.net/bot/getMe" \
-H "Authorization: Bearer ${MPCHAT_BOT_TOKEN}"
{ "ok": true, "result": { "id": 123456789, "is_bot": true, "username": "my_mpbot" } }

401 means the token is invalid or revoked.

getUpdates

Body fields: offset, limit (1-100), timeout (0-50), allowed_updates.

{ "offset": 0, "limit": 50, "timeout": 30, "allowed_updates": ["message", "callback_query"] }
{
"ok": true,
"result": [{
"update_id": 10001,
"message": { "message_id": 42, "chat": { "id": 987654321, "type": "private" }, "text": "hi" }
}]
}

Empty result: [] means no new message or the batch was already consumed; 409 means a webhook is enabled.

sendMessage

Field

Required

Description

chat_id

yes

Integer or decimal string.

text

yes

Message body.

parse_mode

no

Markdown or HTML.

reply_to_message_id

no

Reply to a message.

entities

no

Structured text entities, including supported mentions. If omitted, the server can detect mentions in the text.

link_preview_options

no

Set is_disabled to true to suppress both kinds of preview card.

reply_markup

no

InlineKeyboardMarkup (url / web_app / callback_data / copy_text) or ReplyKeyboardMarkup / Remove / ForceReply.

Send a MiniApp button to a group

Ordinary inline web_app buttons are for private chats. With sendMessage, a bot that has joined the target group or supergroup can send a single MiniApp button. The inline keyboard must have exactly one row and one button, with only text and web_app on that button. Use the registered entry URL or MPChat direct link of an enabled MiniApp belonging to this bot.

{
"chat_id": "987654321",
"text": "Open Demo MiniApp",
"reply_markup": {
"inline_keyboard": [[
{ "text": "Open", "web_app": { "url": "https://mp.net/MyBot/demo" } }
]]
}
}

This example leaves the MiniApp sharing card enabled. To send without the card, set link_preview_options.is_disabled to true. This also suppresses ordinary link previews.

The server resolves web_app.url against the current bot's MiniApp; you do not send miniapp_id. Full web_app_data / sendData / answerWebAppQuery return flows are not supported yet.

Related

Save the returned message_id for later editMessageText. deleteMessage is L3 DocOnly.

Did this answer your question?