Chat → History
AI-generatedOverview
This node interacts with Telegram using the GramJS library, enabling various operations on Telegram chats, messages, and users. Specifically, for the Chat - History operation, it retrieves a specified number of recent messages from a given chat's message history.
This is useful when you want to analyze past conversations, archive chat data, or trigger workflows based on historical chat content. For example, you could fetch the last 10 messages from a support group chat to summarize customer issues or monitor chat activity.
Properties
| Name | Meaning |
|---|---|
| Chat ID | The identifier of the chat (can be chat ID, username, or phone number) to retrieve history from. |
| Limit | Number of messages to retrieve from the chat history (default is 10). |
| Additional Options | Collection of optional settings: |
| Parse Mode | How to parse the message text. Options: None, Markdown, HTML. |
| Silent | Whether to send messages silently (not applicable for history retrieval but available in options). |
Output
The output is an array of JSON objects, each representing a Telegram message retrieved from the chat history. Each object contains the full message data as returned by the Telegram client library, including message text, sender info, timestamps, and any attached media metadata.
No binary data is output for this operation since it only fetches message history.
Example output structure (simplified):
[
{
"json": {
"id": 123,
"message": "Hello, world!",
"date": "2024-06-01T12:00:00Z",
"fromId": "...",
"media": null,
...
}
},
...
]
Dependencies
- Requires a valid Telegram API authentication via a session string credential.
- Uses the GramJS Telegram client library.
- No additional external services are required beyond Telegram itself.
- The node expects proper configuration of Telegram API credentials (API ID, API hash, session string).
Troubleshooting
- Authentication errors: If the session string is invalid or expired, the node will throw an authentication error. Recreate or refresh your Telegram session string credential.
- Invalid Chat ID: Providing an incorrect or inaccessible chat identifier will cause errors fetching messages. Verify the chat ID or username is correct and accessible by the authenticated user.
- Limit too high: Requesting an excessively large number of messages may lead to timeouts or rate limiting by Telegram. Use reasonable limits (e.g., 10-100).
- Unsupported authentication methods: The node does not support phone code or password authentication flows directly; use a session string instead.
- General errors: Any other errors from the Telegram API are wrapped and reported with their message.