This endpoint iterates through all subscribed channel messages using Telethon’sDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/OPENNOVA2026/telegram-connector/llms.txt
Use this file to discover all available pages before exploring further.
iter_messages, collecting every message that falls within the specified time window. It filters out MessageService objects (e.g. join/leave events, pin notifications) and direct messages (PeerUser), returning only channel messages. Each message dict is enriched with a meta.channel_name field containing the @username of the source channel. Media fields are stripped from every message before the response is returned.
Endpoint
Authentication
Requires an active, authenticated Telethon session on the server. When the server is started withAPI_ID=0, the endpoint automatically falls back to FakeClient, which generates a synthetic stream of messages useful for local development and testing.
Query Parameters
ISO 8601 datetime string representing the beginning of the time window. Messages whose
date is less than or equal to start_time are excluded — the iteration loop breaks as soon as such a message is encountered.Example: 2025-01-01T00:00:00ZISO 8601 datetime string representing the end of the time window. Passed directly to Telethon’s
iter_messages as offset_date, so iteration begins at this point and proceeds backwards in time. Defaults to the current time when omitted.Example: 2025-01-02T00:00:00ZHow the Time Range Works
Telethon’siter_messages streams messages in reverse chronological order, starting from end_time and moving backwards toward older messages. The endpoint breaks out of the loop the moment it encounters a message whose date is less than or equal to start_time.
The practical result is:
- Set
end_timeto the upper bound of your window (newest messages you want). - Set
start_timeto the lower bound of your window (oldest messages you want). - All messages with
start_time < date <= end_timeare returned.
end_time, iteration starts from the current moment, so you will receive all recent messages up until start_time.
Filtering Behavior
The following items are silently skipped and will never appear in the response:
MessageServiceobjects — system events such as member join/leave notifications, message pin events, call records, and similar service entries generated by Telegram itself.PeerUsermessages — any message originating from a direct message (DM) conversation. Only messages belonging to channels are returned.- Media content — the
mediafield is removed from every message dict before the response is serialized. Other message fields that reference media metadata may still be present.
Response
Array of raw Telethon message dicts. Each element corresponds to one channel message that falls within the requested time window. An extra
meta field is injected by the Telegram Connector before the response is returned.Status Codes
| Status | Description |
|---|---|
200 OK | Request succeeded. The data array contains all matching messages (may be empty if no messages fall within the window). |
Example Request
Example Response
When
API_ID=0, the server uses FakeClient instead of a real Telethon session. FakeClient generates an infinite stream of synthetic messages and only stops when the loop encounters a message whose date falls at or before start_time. Always provide a start_time that is close to end_time (e.g., within a few minutes) in FakeClient mode to prevent the loop from running indefinitely.In FakeClient mode, meta.channel_name values are "Channel 1" through "Channel 10" — these are raw string identifiers, not valid @username handles. Message text is randomly drawn from three fixed strings:"FAKE: I'm on vacations next week! Can't wait!""FAKE: Burned myself yesterday, but love correfocs""FAKE: To speak my truth, I love pizza over any other meal"