get_messages
Retrieve messages from a Telegram chat newest first, with paging by offset or keyset cursor using before_date/before_id for older messages and after_id for newer ones.
Instructions
Get messages from a Telegram chat, newest first. Page with offset, or with the keyset cursor: pass the date and id of the last message you received as before_date and before_id to get the older ones (constant time on huge chats). after_id returns messages newer than an id. Dates are naive UTC.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum messages to return (default 50, max 500) | |
| offset | No | Pagination offset (default 0). Ignored when a cursor is given. | |
| chat_id | Yes | Chat ID to retrieve messages from | |
| after_id | No | Returns messages with an id greater than this one (newer). | |
| before_id | No | Keyset cursor: message id. Returns messages with a smaller id; pair with before_date. | |
| before_date | No | Keyset cursor: ISO 8601 date-time, naive values are UTC (e.g. 2026-06-10T18:04:17). Returns messages older than this instant; pair with before_id. |