Get one chat's history
telegram_get_messagesRead or summarize one Telegram conversation or channel, recover agreements, or gather context for a reply. Returns message text/captions and available voice/video transcripts, not just links. Resolve the chat with telegram_find_chat first. The tools choose the account archive or connected Session. Use source/coverage/partial and message dates to interpret the result. Set since inclusively and before exclusively for a time range. When has_more=true, pass next_cursor as cursor with the same chat_id, since and before; never construct a cursor or page by subtracting time. Equal-second messages are preserved. Archive pages contain at most 200 messages; Session pages at most 50. Use effective_limit. A short or empty visible page can still have has_more=true; continue only when needed for the question. Stop at range_exhausted=true, sufficient context, or an error/no progress. range_exhausted means this traversal of the selected source reached its end, not that the archive contains all Telegram history. Results are not a fixed snapshot or an edit/deletion change log. Cursors expire after 15 minutes and can be invalidated by restart, cache eviction, account/route changes or Session replacement. Explain the interruption and restart the range explicitly; do not silently switch source or reconnect a working account. State the dates and coverage actually read; do not claim an exhaustive review from a limited sample. Archive history is limited to saved/imported messages; Session can read older messages accessible to that Telegram account without importing them. Reading through Session does not require channel ownership or a bot administrator. Existing readable archive content needs no new connection. Reading does not mark messages as read or send a reply. Messages include is_forwarded and forward_origin (original author/channel and Unix date when available). For forwards, from identifies who forwarded it in this chat, not the original author. Missing origin data does not prove authorship; never infer a hidden author's identity. Interpret errors and empty results separately, and explain the relevant next step briefly in the user's language. A thrown tool error or an error field in the response is not a successful empty read. Explain only the reported cause; respect retry delays and do not describe a timeout or temporary service failure as missing chats or lost permissions. If the cause is unknown, say so and suggest retrying or support at https://t.me/hellolemma. If the chat is missing from the archive or Session reports chat_not_available, resolve it again with telegram_find_chat using the known name, @username or public link. For a name lookup miss, follow telegram_find_chat guidance: try at most 3 untried name variants before asking for an exact reference. Confirm candidates found via a changed name before reading history or sending. Clarify ambiguous matches; do not invent a chat_id or claim that the chat does not exist in Telegram. If discovery still fails, follow that tool's recovery guidance. If the chat is found but count=0, check the requested since/before range and returned history_notice, setup_required, source, coverage and partial when present. For this read, use the user's known timezone; if none is known, silently use UTC without asking or adding a timezone caveat. Do not infer timezone from language. For calendar days such as today or yesterday, calculate since as inclusive midnight and before as the exclusive next midnight in that timezone, passing ISO 8601 timestamps with the correct UTC offset at each boundary rather than literal today/yesterday or offset-free dates. Keep rolling windows such as the last 24 hours distinct from calendar days. Do not silently broaden an explicitly requested period. Say that no messages were returned in the available history for that range, not that the conversation has never had messages. Use returned connection/history facts to distinguish an empty period, limited saved history and missing or disabled setup; a missing field does not establish a cause. For limited Bot API history, explain that only new messages delivered from included chats after connection are collected. Offer /import in https://t.me/lemma_telepath_bot for older exported history. Do not claim imports never happened if history_notice says otherwise. When setup is actually needed, offer only the relevant route: private chats via Telegram Chat Automation with @lemma_telepath_bot, selected chats and saved settings (/setup in the bot for device steps); channels you own or administer via /channels and adding the bot as administrator; groups via an administrator adding the bot as group administrator while the user is a member. Do not require reconnecting a working Session or connecting again to read usable archive content. Do not repeat identical empty requests or offer import/setup for every empty page. Use an already connected Session where supported; preserve source, coverage and actual errors. Do not suggest connecting or reconnecting Session unless the user explicitly asks for Session setup. Never switch sender automatically or request login codes/passwords in chat.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"chat_id": "<chat_id>"
},
"name": "telegram_get_messages"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | How many messages to return. Default 50; archive maximum 200, Session maximum 50 even when a larger limit is requested. | |
| since | No | Only messages at or after this time. Accepts an ISO 8601 timestamp, unix seconds, 'today', 'yesterday', or a relative window like '24h' / '7d'. | |
| before | No | Exclusive upper date bound. Keep unchanged with cursor. Accepts an ISO 8601 timestamp, unix seconds, 'today', 'yesterday', or a relative window like '24h' / '7d'. | |
| cursor | No | Opaque next_cursor from the previous history page. Keep chat_id, since and before unchanged. | |
| chat_id | Yes | Chat id, from telegram_find_chat or telegram_list_chats. |