Skip to main content

Core message methods in detail: getMe, getUpdates, sendMessage (with web_app button)

Parameter-level detail for the three methods every bot needs first—getMe, getUpdates, and sendMessage—plus the web_app button that opens a MiniApp.

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: it supports a web_app button but not full return flows.

getMe

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

curl -s "https://call.mp.net/bot/bot${MPCHAT_BOT_TOKEN}/getMe"

{ "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"] }

{
  "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.

reply_markup

no

Inline keyboard; web_app type opens a MiniApp.

web_app button example

{
  "chat_id": "987654321",
  "text": "Open Demo MiniApp",
  "reply_markup": {
    "inline_keyboard": [
      [{ "text": "Open", "web_app": { "url": "https://mini.example.com/demo" } }]
    ]
  }
}

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?