Telegram#
Use the Telegram node to automate work in Telegram and integrate Telegram with other applications. n8n has built-in support for a wide range of Telegram features, including getting files as well as deleting and editing messages.
On this page, you'll find a list of operations the Telegram node supports and links to more resources.
Credentials
Refer to Telegram credentials for guidance on setting up authentication.
Operations#
- Chat operations
- Get up-to-date information about a chat.
- Get Administrators: Get a list of all administrators in a chat.
- Get Member: Get the details of a chat member.
- Leave a chat.
- Set Description of a chat.
- Set Title of a chat.
- Callback operations
- Answer Query: Send answers to callback queries sent from inline keyboards.
- Answer Inline Query: Send answers to callback queries sent from inline queries.
- File operations
- Get File from Telegram.
-
- Delete Chat Message.
- Edit Message Text: Edit the text of an existing message.
- Pin Chat Message for the chat.
- Send Animation to the chat.
- For use with GIFs or H.264/MPEG-4 AVC videos without sound up to 50 MB in size.
- Send Audio file to the chat and display it in the music player.
- Send Chat Action: Tell the user that something is happening on the bot's side. The status is set for 5 seconds or less.
- Send Document to the chat.
- Send Location: Send a geolocation to the chat.
- Send Media Group: Send a group of photos and/or videos.
- Send Message to the chat.
- Send Photo to the chat.
- Send Sticker to the chat.
- For use with static .WEBP, animated .TGS, or video .WEBM stickers.
- Send Video to the chat.
- Unpin Chat Message from the chat.
Add bot to channel
To use most of the Message operations, you must add your bot to a channel so that it can send messages to that channel. Refer to Add a bot to a Telegram channel for more information.
Templates and examples#
Related resources#
Refer to Telegram's API documentation for more information about the service.
n8n provides a trigger node for Telegram. Refer to the trigger node docs here for more information.
Add a bot to a Telegram channel#
For a bot to send a message to a channel, you must add the bot to the channel. If you haven't added the bot to the channel, you'll see an error with a description like:
Error: Forbidden: bot is not a participant of the channel
.
To add a bot to a channel:
- In the Telegram app, access the target channel and select the channel name.
- Label the channel name as public channel.
- Select Administrators > Add Admin.
- Search for the bot's username and select it.
- Select the checkmark on the top-right corner to add the bot to the channel.
Get the Chat ID#
Use the Telegram Trigger node in your workflow to get a Chat ID. This node can trigger on different events and returns a Chat ID on successful execution.
Send more than 30 messages per second#
The Telegram API has a limitation of sending only 30 messages per second. Follow these steps to send more than 30 messages:
- Loop Over Items node: Use the Loop Over Items node to get at most 30 chat IDs from your database.
- Telegram node: Connect the Telegram node with the Loop Over Items node. Use the Expression Editor to select the Chat IDs from the Loop Over Items node.
- Code node: Connect the Code node with the Telegram node. Use the Code node to wait for a few seconds before fetching the next batch of chat IDs. Connect this node with the Loop Over Items node.
You can also use this workflow.