Telegram CoPilot icon

Telegram CoPilot

Your Personal Telegram CoPilot

Overview

This node integrates with Telegram via the TelePilot API, enabling automation and interaction with Telegram chats, users, messages, files, and groups. Specifically, for the Chat resource and Get Chat History operation, it fetches the message history of a specified chat starting from a given message ID.

Common scenarios where this node is beneficial include:

  • Retrieving recent or historical messages from a Telegram chat for analysis or archiving.
  • Automating workflows that depend on chat history, such as monitoring conversations or extracting data.
  • Building bots or integrations that respond based on past messages in a chat.

Example: Fetching the last message in a chat to check for new updates or commands before triggering further actions.

Properties

Name Meaning
Chat ID The unique identifier of the Telegram chat whose history you want to retrieve.
From Message ID The message ID from which to start fetching history; use 0 to start from the latest message available.

Output

The output is a JSON array containing the result of the invoked Telegram API method _:"getChatHistory". This includes details about the messages retrieved from the chat history, such as message content, sender info, timestamps, and other metadata.

If binary data were involved (not in this operation), it would represent files or media downloaded or sent, but for "Get Chat History," the output is purely JSON describing messages.

Dependencies

  • Requires an active Telegram API credential configured in n8n, including necessary authentication tokens.
  • Depends on the TelePilot Node Connection Manager to handle client sessions and API calls.
  • The node requires the user to be logged in to Telegram via the node’s login mechanism before performing operations.

Troubleshooting

  • Session Not Logged In: If the Telegram session is not logged in or has expired, errors like "Please login" or "Session was closed or terminated" will occur. Resolve by running the login operation using the node’s login commands or following the guide at https://telepilot.co/login-howto.
  • Unauthorized Errors: These indicate invalid or expired credentials. Re-authenticate your Telegram account.
  • Invalid Chat ID: Providing a wrong or inaccessible chat ID may cause the API call to fail or return empty results.
  • From Message ID Usage: Using an incorrect from_message_id might result in no messages returned if the ID is beyond the current message range.

Links and References

Discussion