Overview
This node acts as a trigger for n8n workflows, starting the workflow whenever specified updates are received from a Telegram bot via long polling. It connects to the Telegram Bot API and listens for various types of updates (such as new messages, edited messages, callback queries, etc.) according to user configuration. This is useful for automating actions in response to Telegram events, such as processing incoming messages, handling inline queries, or reacting to chat member changes.
Practical examples:
- Start a workflow when your bot receives a new message.
- Trigger automation when someone joins a group or channel.
- React to poll answers or pre-checkout queries in payment flows.
Properties
| Name | Meaning |
|---|---|
| Updates | The update types to listen to. Options include: - All updates - Bot Chat Member Updated - Callback Query - Channel Post - Chat Join Request - Chosen Inline Result - Edited Channel Post - Edited Message - Inline Query - Message - Poll - Poll Answer - Pre-Checkout Query - Shipping Query - User Chat Member Updated |
| Limit | Limit the number of messages to be polled per request. Minimum value is 1. Default is 50. |
| Timeout | Timeout (in seconds) for the polling request. Minimum value is 0. Default is 60. |
Output
The output consists of an array of items, each with a json field containing the raw Telegram update object. The structure of this object depends on the type of update received (e.g., message, callback_query, etc.), and matches the Telegram Bot API Update object.
Example output:
[
{
"json": {
"update_id": 123456789,
"message": {
"message_id": 1,
"from": { /* ... */ },
"chat": { /* ... */ },
"date": 1609459200,
"text": "Hello!"
}
}
}
]
No binary data is produced by this node.
Dependencies
- External Service: Requires access to the Telegram Bot API.
- API Key: You must provide a valid Telegram bot token via n8n credentials (
telegramApi). - n8n Configuration: No special environment variables required beyond standard credential setup.
Troubleshooting
Common issues:
- Invalid or missing credentials: If the Telegram bot token is incorrect or not provided, the node will fail to connect.
- 409 Conflict error: This can occur if another process is already polling updates for the same bot. Only one polling process can run at a time per bot token.
- No updates received: Ensure that the bot is added to the relevant chats and has the necessary permissions for the selected update types.
Error messages:
error 409, ignoring because execution is on final cleanup...: Indicates a conflict due to multiple polling processes. Stop other polling instances before running this node.- Other errors may relate to network issues or invalid parameters; check the error details for guidance.