Telegram CoPilot icon

Telegram CoPilot

Your Personal Telegram CoPilot

Overview

The node "Telegram CoPilot" provides an interface to interact with Telegram via the TelePilot API. It supports various Telegram resources and operations, including managing chats, messages, users, groups, files, and login sessions.

Specifically, the Close Chat operation under the Chat resource allows users to programmatically close a chat session in Telegram. This can be useful for automating chat management tasks such as cleaning up inactive chats or closing chats after certain workflows complete.

Practical examples:

  • Automatically close a customer support chat once the issue is resolved.
  • Close temporary group chats created for specific events or projects.
  • Manage chat lifecycle in bulk by closing multiple chats based on criteria.

Properties

Name Meaning
Chat ID The unique identifier of the chat to close. This is required to specify which chat session should be closed. Example: "122323".

Output

The output of the node is a JSON array containing the response from the TelePilot API after invoking the closeChat method. The structure typically includes details about the closed chat or confirmation of the action.

Example output (simplified):

[
  {
    "_": "chatClosed",
    "chat_id": 122323,
    "status": "closed"
  }
]

No binary data output is involved in this operation.

Dependencies

  • Requires an active Telegram API authentication credential (an API key/token) configured in n8n.
  • Depends on the TelePilotNodeConnectionManager to manage Telegram client sessions.
  • The node requires the user to be logged in to Telegram via the TelePilot API before performing chat operations.
  • Network access to Telegram's API endpoints is necessary.

Troubleshooting

  • Error: "Session was closed or terminated. Please login again"
    This indicates that the Telegram client session has expired or been closed. The user must re-authenticate using the login flow before retrying.

  • Error: "Please login"
    The node detected no active Telegram session. Use the login operation first to establish a session.

  • Invalid Chat ID or Chat Not Found
    If the provided Chat ID does not exist or is invalid, the API call will fail. Verify the Chat ID is correct.

  • Unauthorized Errors
    Usually caused by invalid or expired credentials. Reconfigure the API authentication token.

  • Network Issues
    Ensure stable internet connection and that Telegram API endpoints are reachable.

Links and References

Discussion