Telegram CoPilot icon

Telegram CoPilot

Your Personal Telegram CoPilot

Overview

The node provides integration with Telegram via the TelePilot API, enabling automation and interaction with Telegram chats, messages, users, groups, files, and login sessions. Specifically, for the Chat resource and Get Chat History operation, it fetches a list of messages from a specified chat starting from a given message ID, up to a defined limit.

This node is useful in scenarios such as:

  • Archiving or analyzing chat conversations.
  • Monitoring chat activity for specific keywords or events.
  • Building bots that respond based on recent chat history.
  • Synchronizing Telegram chat data with other systems.

Example: Retrieve the last 100 messages from a group chat to analyze user engagement or detect spam.

Properties

Name Meaning
Chat ID The unique identifier of the chat from which to retrieve the message history.
From Message ID The message ID to start fetching history from; use 0 to start from the latest message.
Limit Maximum number of messages to return (up to 100).

Output

The output is an array of JSON objects representing Telegram messages retrieved from the chat history. Each object contains detailed information about individual messages, including metadata such as sender, timestamp, content, and message type.

If binary data is involved (e.g., media files), the node handles them accordingly, but for this operation, the output primarily consists of JSON message data.

Dependencies

  • Requires a valid Telegram API authentication credential (an API key credential) configured in n8n.
  • Uses the TelePilot Node Connection Manager internally to manage Telegram client sessions.
  • No additional external dependencies beyond the Telegram API access.

Troubleshooting

  • Error: "Please login"
    This indicates the Telegram session is not authenticated. Resolve by using the login flow with the appropriate login node or commands as described in the guide at https://telepilot.co/login-howto.

  • Error: "A closed client cannot be reused"
    The Telegram client session was closed unexpectedly. Re-authenticate or restart the session.

  • Limit Exceeded
    The maximum number of messages retrievable per request is 100. If you need more, implement pagination by adjusting the from_message_id parameter in subsequent calls.

  • Invalid Chat ID
    Ensure the Chat ID is correct and accessible by the authenticated Telegram account.

Links and References

Discussion