Overview
This node acts as a Telegram trigger using long polling to listen for various types of updates from the Telegram Bot API. It continuously polls Telegram servers for new updates such as messages, edited messages, channel posts, inline queries, poll answers, and more. When an update matching the selected types arrives, it triggers the workflow with the update data.
Common scenarios where this node is beneficial include:
- Automating responses or actions based on incoming Telegram messages or commands.
- Monitoring chat member status changes to manage group memberships.
- Handling callback queries from inline buttons in Telegram bots.
- Processing payments or shipping queries related to Telegram invoices.
- Reacting to polls and poll answers within chats.
Practical example: A bot that listens for new messages and automatically replies with a welcome message or forwards certain messages to another service.
Properties
| Name | Meaning |
|---|---|
| Updates | The types of Telegram updates to listen for. Options include all updates (*), messages, edited messages, channel posts, callback queries, chat member updates, inline queries, polls, pre-checkout queries, shipping queries, and more. |
| Limit | The maximum number of updates to fetch per polling request. Must be at least 1. Default is 50. |
| Timeout | The timeout in seconds for each long polling request to Telegram. Determines how long the request waits for new updates before returning. Default is 60 seconds. |
Output
The node outputs an array of JSON objects, each representing a Telegram update received from the API. Each object contains the full update data structure as provided by Telegram, which varies depending on the update type (e.g., message, edited_message, callback_query).
The output does not include binary data; it only provides JSON-formatted update information.
Dependencies
- Requires a valid Telegram Bot API token credential configured in n8n.
- Uses Telegram's
getUpdatesAPI endpoint via HTTP POST requests. - No additional external dependencies beyond standard HTTP requests.
Troubleshooting
- Network errors (ETIMEDOUT, ECONNRESET, ENOTFOUND, ECONNREFUSED): These indicate connectivity issues with Telegram servers. The node automatically retries after 5 seconds.
- Telegram API server errors (HTTP 5xx): Temporary server-side problems cause retries after 10 seconds.
- Rate limiting (HTTP 429): If too many requests are made, the node respects the
retry-afterheader and waits accordingly before retrying. - Error 409 Conflict: Occurs if multiple clients use the same bot token simultaneously. The node ignores this error during shutdown but otherwise throws it.
- Ensure the bot has appropriate permissions for certain update types (e.g., administrator rights for chat member updates).
- Selecting
*for updates disables filtering, so all updates are received. - Setting very low limits or timeouts may affect performance or responsiveness.