Telegram MTProto Client icon

Telegram MTProto Client

Use Telegram Client API with MTProto protocol

Overview

The "Leave Chat" operation in this Telegram MTProto Client node allows a user to leave a specified Telegram chat or channel. This is useful when you want to programmatically remove the bot or user from a group, supergroup, or channel that they no longer wish to participate in or monitor.

Common scenarios include:

  • Automatically leaving inactive or unwanted chats.
  • Managing membership of multiple channels by leaving some based on certain conditions.
  • Cleaning up after completing tasks in specific groups or channels.

For example, if your workflow involves monitoring messages in various Telegram groups but you want to leave a particular group once a task is done, this operation can be used to automate that exit.

Properties

Name Meaning
Chat ID The unique identifier or username of the chat or channel to leave (e.g., @username or -100xxxx).

Output

The output JSON object for the "Leave Chat" operation contains:

  • success: A boolean indicating whether the leave operation was successful (true).
  • left: A boolean confirming that the client has left the chat (true).
  • chatId: The ID or username of the chat/channel that was left.

Example output:

{
  "success": true,
  "left": true,
  "chatId": "@examplechannel"
}

This confirms the node successfully left the specified chat or channel.

Dependencies

  • Requires an active Telegram API session authenticated via the MTProto protocol.
  • Needs credentials including an API ID, API hash, and a valid session string.
  • Uses the Telegram MTProto Client SDK internally to connect and perform operations.
  • The node must be configured with these credentials before executing.

Troubleshooting

  • No credentials provided: The node will throw an error if the required Telegram API credentials are missing. Ensure you have set up and selected valid credentials.
  • Invalid Chat ID: If the chat ID or username is incorrect or inaccessible, the operation may fail. Verify the chat/channel exists and the account has permission to leave it.
  • Connection issues: Network problems or invalid session tokens can cause connection failures. Re-authenticate or check network connectivity.
  • Unexpected errors: The node attempts to disconnect cleanly after execution; errors during disconnect are logged but do not affect the main operation result.

Links and References

Discussion