get_history
Read Telegram chat history by date range or fetch recent messages across chats, folders, and forum topics, with cursor-based pagination for complete results.
Instructions
Read history over [date_from, date_to), or a chat's recent messages if dates are omitted.
Supply exactly one of chat_id, chat_ref (numeric ID, @username, or t.me[/s]/username),
chat_ids or folder_ids. chat_ids/folder_ids read several permitted sources in one
traversal and require both dates. They default to ordering=page (early results,
sorted within each page), max_sources=20 and max_messages=100; a larger selection
returns SOURCE_LIMIT_EXCEEDED before reading. budget reports emitted messages;
exhausted=true keeps next_cursor, and only an explicitly larger max_messages
continues it. ordering=global waits for every source to keep strict order.
Omit topic_id for chat-wide history, or supply a positive forum topic ID (General is 1)
with a single chat. Topics require ordinary access to a supported forum supergroup.
Follow next_cursor for a complete period, repeating the original arguments.
Public channels outside the allowlist require allow_public_channel_reads and an
explicit chat selector. Temporary failures retain next_cursor; respect
retry_after_seconds before continuing.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | ||
| order | No | newest_first | |
| cursor | No | ||
| chat_id | No | ||
| date_to | No | ||
| chat_ids | No | ||
| chat_ref | No | ||
| ordering | No | ||
| topic_id | No | ||
| date_from | No | ||
| folder_ids | No | ||
| max_sources | No | ||
| max_messages | No |