N8N Tools Telegram icon

N8N Tools Telegram

Interact with Telegram Bot API

Overview

This node integrates with the Telegram Bot API to perform various operations related to Telegram chats, messages, updates, bots, files, inline queries, and callback queries. Specifically, for the Chats resource and the Get Chat Member Count operation, it retrieves the number of members in a specified Telegram chat.

This functionality is useful when you want to monitor or analyze group sizes dynamically within your workflows. For example, you might use this node to:

  • Track the growth of a Telegram group by periodically fetching member counts.
  • Trigger actions based on the size of a chat (e.g., send notifications if a group reaches a certain number of members).
  • Aggregate statistics about multiple chats managed by your bot.

Properties

Name Meaning
Chat ID The unique identifier for the Telegram chat whose member count is fetched. This is required.
Options Additional optional parameters as a JSON object to customize the request.

Output

The node outputs a JSON object containing the response from the Telegram Bot API for the requested operation. For the Get Chat Member Count operation, the output JSON will include the total number of members in the specified chat.

Example output structure (simplified):

{
  "result": 1234
}

Where result is the integer count of chat members.

No binary data output is produced by this operation.

Dependencies

  • Requires an active Telegram Bot API token configured as credentials in n8n.
  • Requires a valid subscription and API key for the "N8N Tools API" service, which acts as a validation layer before making Telegram API calls.
  • The node uses HTTP requests to the Telegram Bot API endpoints via the helper class internally.

Troubleshooting

  • Invalid subscription or API key error: If you receive an error indicating invalid subscription or API key, verify that your API key credential for the external validation service is correct and active.
  • Unknown operation error: Ensure that the operation name matches one of the supported operations for the Chats resource; otherwise, the node will throw an error.
  • Missing required parameters: The Chat ID must be provided; missing this will cause the node to fail.
  • API rate limits: Telegram enforces rate limits; excessive requests may result in temporary blocking. Implement retry logic or delays if needed.
  • JSON parsing errors: When providing additional options or other JSON inputs, ensure the JSON syntax is valid to avoid parsing errors.

Links and References

Discussion