Actions12
Overview
The node provides integration with the Telegram Client API, enabling various chat-related operations within Telegram. Specifically, the Get Message History operation retrieves a list of messages from a specified chat or channel.
This operation is useful for scenarios such as:
- Archiving or backing up chat history.
- Analyzing past conversations for keywords or sentiment.
- Displaying recent messages in dashboards or reports.
- Automating responses based on message content history.
For example, you could use this node to fetch the last 100 messages from a support channel to analyze customer inquiries or to monitor a group chat's activity over time.
Properties
| Name | Meaning |
|---|---|
| Chat ID | The identifier of the chat or channel from which to retrieve message history. This can be a numeric ID (e.g., -100xxxx) or a username starting with @. |
| Options | Additional optional parameters: - Limit: Maximum number of messages to return (default 100). |
Output
The output JSON contains:
success: Boolean indicating if the operation was successful.messages: An array of message objects retrieved from the chat history. Each message object includes details such as message ID, date, sender, text, and any media or attachments.
Example output structure:
{
"success": true,
"messages": [
{
"id": 12345,
"date": "2024-06-01T12:34:56Z",
"senderId": 67890,
"text": "Hello, world!",
...
},
...
]
}
No binary data is output by this operation.
Dependencies
- Requires an active Telegram Client API credential with valid session, API ID, and API hash.
- The node uses the Telegram Client SDK internally to connect and interact with Telegram servers.
- Network connectivity to Telegram's servers is necessary.
- No additional environment variables are required beyond the configured credentials.
Troubleshooting
- No credentials provided: The node will throw an error if the Telegram Client API credentials are missing or invalid. Ensure that the API ID, API hash, and session string are correctly configured.
- Connection issues: Network problems or incorrect credentials may cause connection failures. Verify internet access and credential validity.
- Operation not supported: If an unsupported operation name is used, the node throws an error. Confirm the operation parameter is set to "getMessageHistory" for this functionality.
- Limit too high: Requesting an excessively large number of messages might lead to timeouts or rate limiting by Telegram. Use reasonable limits (e.g., 100 or fewer).
- Chat ID format: Providing an invalid chat ID or username will result in errors. Make sure the chat/channel identifier is correct and accessible by the authenticated user.
Links and References
- Telegram Client API Documentation
- Telegram Bot API Overview (for general Telegram messaging concepts)
- n8n Documentation on Credentials