App Logo
web.telegram.org

Telegram — Read a conversation's messages

Open one Telegram conversation by its peer id (the id get_inbox returns) and read its messages in chronological order: message id, text, the time shown on the bubble, whether it carries media, and — for channel posts — the exact view and forward counts. Scrolls upward to load older messages up to the requested count. Returns an empty list for a conversation with no messages, which is a real answer rather than a failure.

Input

peerId required

The conversation's peer id, as returned by get_inbox (e.g. "-1001928149680"). Passed straight to Telegram's own deep link, so it must be the id and not a display name.

count optional

How many of the most recent messages to return, scrolling upward to load older ones.

Default: 30

Output

count required

How many messages were returned.

state required

"ready" when message bubbles rendered; "empty" for a conversation that resolved (it has a title) but holds no messages. An unresolvable peer id throws instead, so it can never be confused with either.

peerId required

The peer id that was actually opened, read back from the address bar so the caller can confirm it matches the request.

messages required

Messages oldest-first, as the conversation displays them. Empty for a conversation that exists but holds no messages.

chatTitle optional

The conversation title shown in the header, for a human-readable cross-check against peerId.

Start building not clicking