Overview
This node acts as a trigger that starts an n8n workflow whenever there is a new update from a Telegram bot. It uses long polling to fetch updates from the Telegram Bot API, allowing workflows to react to various types of Telegram events such as incoming messages, edited messages, channel posts, callback queries, inline queries, and more.
Common scenarios where this node is beneficial include:
- Automating responses to user messages or commands in Telegram chats.
- Processing inline queries or callback queries for interactive bots.
- Monitoring chat member status changes or join requests.
- Handling business account messages or reactions.
- Collecting poll answers or managing chat boosts.
For example, you could use this node to start a workflow that sends a welcome message when a user joins a chat, or to process orders received via Telegram invoices by reacting to pre-checkout queries.
Properties
Name | Meaning |
---|---|
Updates | List of update types your bot should receive. Options include all updates (* ), messages, edited messages, channel posts, business messages, message reactions, inline queries, callback queries, shipping queries, polls, chat member updates, chat join requests, chat boosts, and more. You can select multiple types or all updates. |
Offset | Identifier of the first update to be returned. Must be greater than the highest previously received update ID. Can be negative to retrieve updates starting from the end of the queue. Used to control which updates are fetched next, avoiding duplicates. |
Limit | Maximum number of updates to retrieve per request. Accepts values between 1 and 100. Defaults to 100. Controls batch size of updates fetched from Telegram. |
Timeout | Timeout in seconds for long polling. Defaults to 60 seconds. A value of 0 means short polling (no waiting). Long polling reduces the number of requests by waiting for updates to arrive before responding. Should be positive for production use; short polling is recommended only for testing. |
Origin | The base URL for the Telegram API. Defaults to https://api.telegram.org . Useful if you want to use a custom Telegram API endpoint or proxy. |
Output
The node outputs an array of JSON objects representing the Telegram updates received. Each object corresponds to one or more updates matching the selected update types. The structure of each update follows the Telegram Bot API's update format, containing fields such as update_id
and the specific update data (e.g., message
, edited_message
, callback_query
, etc.).
If multiple updates are received in one polling cycle, they are output together as an array.
The node does not output binary data.
Dependencies
- Requires a valid Telegram bot API authentication token configured in the node credentials.
- Uses the Telegram Bot API endpoint (default
https://api.telegram.org
) to fetch updates. - No additional external dependencies beyond standard HTTP requests.
Troubleshooting
- Offset errors: If the offset parameter is not a number, the node will throw an error. Ensure the offset input is numeric.
- Limit errors: The limit must be a number between 1 and 100. Values outside this range may cause errors or unexpected behavior.
- Timeout issues: Setting timeout to 0 disables long polling, which may lead to increased API calls and rate limiting during testing.
- HTTP 409 Conflict: This status indicates that another process is already using the webhook or polling method. The node handles this by stopping execution gracefully. To resolve, ensure no other service is polling the same bot or webhook is disabled.
- Empty updates: Sometimes the node may receive empty update arrays; this is normal if no new updates are available.
- Permissions: Some update types require the bot to have administrator rights in the chat (e.g., message reactions, chat member updates). Without proper permissions, those updates won't be received.
- Allowed updates mismatch: The list of allowed update types must match what the bot is configured to receive on Telegram. Mismatches can cause missing updates.