Actions12
Overview
The node provides integration with the Telegram Client API, enabling various chat-related operations such as sending messages, managing chat membership, and retrieving chat data. Specifically, the "Leave Chat" operation allows a user or bot to leave a specified Telegram chat or channel. This is useful in scenarios where automated workflows need to manage group memberships dynamically, for example, leaving a chat after completing a task or unsubscribing from notifications.
Practical example: An automation that monitors certain events and leaves a Telegram group once the event is resolved, helping keep the user's chat list clean.
Properties
| Name | Meaning |
|---|---|
| Chat ID | The identifier of the chat or channel to leave. Can be a numeric ID (e.g., -100xxxx) or username (e.g., @username). |
Note: The "Options" property exists but is not applicable for the "Leave Chat" operation based on the provided definitions.
Output
The output JSON object for the "Leave Chat" operation includes:
success(boolean): Indicates if the operation was successful.left(boolean): Confirms that the chat was left (true).chatId(string): The ID of the chat that was left.
Example output:
{
"success": true,
"left": true,
"chatId": "@examplechannel"
}
No binary data output is produced by this operation.
Dependencies
- Requires an active Telegram Client API session authenticated via credentials containing API ID, API hash, and a valid session string.
- The node uses the Telegram Client SDK internally to connect and perform actions.
- Proper n8n credential configuration is necessary to provide these authentication details securely.
Troubleshooting
Common issues:
- Missing or invalid credentials will cause the node to throw an error indicating no credentials were provided.
- If the session string is missing or expired, connection to Telegram may fail.
- Invalid or incorrect Chat ID can result in errors when attempting to leave the chat.
Error messages:
"No credentials provided": Ensure that the Telegram API credentials are correctly set up in n8n."Operation 'leaveChat' is not supported": This should not occur if the operation is selected properly; otherwise, verify the operation parameter.- Connection errors: Check network connectivity and validity of the Telegram session.
Resolution tips:
- Verify that the API ID, API hash, and session are correct and active.
- Confirm the Chat ID is accurate and accessible by the authenticated user/bot.
- Enable "Continue On Fail" in the node settings to handle errors gracefully during batch executions.
Links and References
- Telegram Client API Documentation
- Telegram Bot API Overview (for general understanding, though this node uses the client API)
- n8n Documentation on Credentials