Actions72
- Messages Actions
- Bots Actions
- Updates Actions
- Chats Actions
- Get Chat
- Get Chat Administrators
- Get Chat Member
- Get Chat Member Count
- Leave Chat
- Set Chat Title
- Set Chat Description
- Set Chat Photo
- Delete Chat Photo
- Set Chat Permissions
- Export Chat Invite Link
- Create Chat Invite Link
- Edit Chat Invite Link
- Revoke Chat Invite Link
- Approve Chat Join Request
- Decline Chat Join Request
- Set Chat Administrator Custom Title
- Ban Chat Member
- Unban Chat Member
- Restrict Chat Member
- Promote Chat Member
- Set Chat Sticker Set
- Delete Chat Sticker Set
- Pin Chat Message
- Unpin Chat Message
- Unpin All Chat Messages
- Files Actions
- Inline Queries Actions
- Callback Queries Actions
Overview
The node provides integration with the Telegram Bot API, enabling various interactions with Telegram resources such as messages, updates, chats, bots, files, inline queries, and callback queries. Specifically for the Chats resource and the Leave Chat operation, this node allows a bot to leave a specified chat by its Telegram Chat ID.
This functionality is useful in scenarios where a bot needs to programmatically exit group chats or channels it is part of, for example:
- Automatically leaving inactive groups.
- Leaving chats after completing certain tasks.
- Managing bot participation dynamically based on workflow logic.
Properties
| Name | Meaning |
|---|---|
| Chat ID | The unique identifier of the Telegram chat that the bot will leave. |
| Options | Additional optional parameters as a JSON object (not used specifically in Leave Chat but available for other operations). |
Output
The output is a JSON object representing the response from the Telegram Bot API for the leave chat request. Typically, this will be a boolean indicating success (true) or failure (false), or an error message if the operation fails.
No binary data output is involved in this operation.
Example output JSON might look like:
{
"ok": true,
"result": true
}
Dependencies
- Requires an active Telegram Bot API token credential configured in n8n.
- Requires a subscription and valid API key for the external "N8N Tools API" service, which validates usage before forwarding requests to Telegram.
- The node uses HTTP requests to the Telegram Bot API endpoints via the helper class
TelegramApi.
Troubleshooting
- Invalid subscription or API key error: If the node throws an error about invalid subscription or API key, verify that the API key credential for the external validation service is correct and active.
- Permission errors: The bot must have permission to leave the chat; otherwise, the Telegram API will return an error.
- Chat ID issues: Ensure the Chat ID is correct and the bot is currently a member of the chat.
- Network or API downtime: Temporary failures may occur due to network issues or Telegram API outages.