N8N Tools Telegram icon

N8N Tools Telegram

Interact with Telegram Bot API

Overview

The node "N8N Tools Telegram" enables interaction with the Telegram Bot API, allowing users to perform a wide range of operations related to Telegram bots, messages, chats, updates, files, inline queries, and callback queries. Specifically, for the Bots resource and the Set My Commands operation, this node allows you to set the list of commands that your Telegram bot supports. This is useful for defining custom commands that users can see and use when interacting with your bot.

Common scenarios where this node is beneficial include:

  • Automating the setup or update of bot commands as part of a deployment or configuration workflow.
  • Dynamically changing bot commands based on external data or user input.
  • Managing multiple bots' commands centrally via n8n workflows.

Practical example:

  • You want to update your Telegram bot's command list to include new features. Using this node, you provide a JSON array of commands (each with a command and description), and the node sets these commands for your bot automatically.

Properties

Name Meaning
Commands A JSON array representing the Telegram Bot Commands to set. Each command typically includes a command string and a description. Example: [{"command":"start","description":"Start the bot"},{"command":"help","description":"Get help"}]
Options Additional options as a JSON object to customize the command setting behavior. These options correspond to Telegram Bot API parameters such as scope and language_code.

Output

The node outputs an array of JSON objects, each corresponding to the result of the Telegram API call for the respective input item. For the Set My Commands operation, the output JSON contains the response from the Telegram Bot API confirming the commands were set successfully.

The output does not include binary data for this operation.

Example output JSON snippet:

{
  "ok": true,
  "result": true
}

This indicates the commands were set successfully.

Dependencies

  • Requires an active Telegram Bot API token credential configured in n8n.
  • Requires a valid subscription and API key for the "N8N Tools API" service, which validates usage before forwarding requests to Telegram.
  • The node uses the external Telegram Bot API endpoints via HTTP POST requests.
  • No additional environment variables are required beyond the credentials mentioned.

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 N8N Tools API is correct and active.
  • Malformed JSON in Commands or Options: Ensure that the JSON provided in the "Commands" and "Options" properties is well-formed. Invalid JSON will cause parsing errors.
  • Unknown operation error: This node supports only predefined operations. Make sure the operation parameter is set to "setMyCommands" when working with the Bots resource.
  • Telegram API errors: Errors returned by Telegram (e.g., due to invalid commands format or permissions) will be passed through. Check the Telegram Bot API documentation for error meanings and ensure your bot has the necessary rights.

Links and References

Discussion