N8N Tools Telegram icon

N8N Tools Telegram

Interact with Telegram Bot API

Overview

The node "N8N Tools Telegram" integrates with the Telegram Bot API, enabling automation of various Telegram bot-related tasks. Specifically for the Chats resource and the Ban Chat Member operation, this node allows you to ban a user from a specified Telegram chat. This is useful in scenarios where you want to programmatically moderate group chats or channels by removing disruptive members.

Practical examples include:

  • Automatically banning users who post spam messages.
  • Enforcing community guidelines by banning users based on certain triggers.
  • Integrating with external moderation tools to ban users flagged for inappropriate behavior.

Properties

Name Meaning
Chat ID The unique identifier for the Telegram chat where the member will be banned.
User ID The unique identifier of the Telegram user to ban from the chat.
Options Additional optional parameters for the ban operation, provided as a JSON object.

The Options property can include any extra parameters supported by the Telegram Bot API's banChatMember method, such as until_date, revoke_messages, etc., allowing fine control over the ban duration and effects.

Output

The node outputs a JSON object representing the response from the Telegram Bot API after attempting to ban the chat member. This typically includes a boolean indicating success or failure of the ban operation.

If the operation fails and "Continue On Fail" is enabled, the output will contain an error message describing the issue.

No binary data output is involved in this operation.

Dependencies

  • Requires a valid Telegram Bot API token configured as credentials in n8n.
  • Requires an active subscription and API key for the "N8N Tools API" service, which validates usage before forwarding requests to Telegram.
  • The node uses HTTP POST requests to the Telegram Bot API endpoints via the N8N Tools API proxy.

Troubleshooting

  • Invalid Subscription or API Key: If the node throws an error about invalid subscription or API key, verify that your API key credential for the N8N Tools API is correct and active.
  • Missing Required Parameters: Ensure that both Chat ID and User ID are provided; otherwise, the Telegram API will reject the request.
  • Permission Errors: The bot must have appropriate admin rights in the chat to ban members. Lack of permissions will cause errors.
  • JSON Parsing Errors: The Options field expects valid JSON. Malformed JSON will cause parsing errors.
  • Unknown Operation Error: If the operation name is incorrect or unsupported, the node will throw an error.

Links and References

Discussion