Package Information
Documentation
n8n-nodes-telegram-bot
This is a community node for n8n that provides two nodes for working with Telegram:
- Telegram Bot - uses Bot API (simple setup, limitations on messages from bots)
- Telegram MTProto - uses MTProto API (complex setup, receives ALL messages including from bots)
Installation
- Open n8n
- Go to Settings > Community Nodes
- Install package:
n8n-nodes-telegram-bot-gridasov
Setup
Creating a Telegram bot
- Find @BotFather in Telegram
- Send the
/newbotcommand - Follow the instructions to create a bot
- Save the received token
Setting up credentials in n8n
- In n8n, create new credentials of type "Telegram Bot API"
- Enter your bot token in the "Bot Token" field
- Test the connection
Usage
Basic workflow
- Add a "Schedule Trigger" for periodic execution
- Add a "Telegram Bot" node
- Select "Get Updates" operation
- Configure parameters:
- Limit: number of messages to receive (default 100)
- Offset: ID of the first update to receive
- Timeout: timeout for long polling
Parameters
- Limit: Maximum number of updates to receive (1-100)
- Timeout: Timeout in seconds for long polling (0-50). Higher values reduce the number of API requests
- Auto Confirm Updates: Automatically confirm received updates (recommended)
- Include Bot Messages: Include messages from other bots in groups (requires disabling bot privacy)
- Debug Mode: Enable debug information in output (shows API request details)
Example workflow
Schedule Trigger (every 5 minutes)
↓
Telegram Bot (Get New Updates)
↓
IF (check message type)
↓
Process messages
Automatic offset management
The node automatically tracks the last processed messages:
- ✅ No need to manually configure offset
- ✅ Automatically avoids message duplication
- ✅ Preserves state between workflow runs
- ✅ Confirms processed updates in Telegram
Data structure
When new messages are available:
{
"update_id": 123456789,
"message": {
"message_id": 1,
"from": {
"id": 123456789,
"is_bot": false,
"first_name": "John",
"username": "john_doe"
},
"chat": {
"id": 123456789,
"first_name": "John",
"username": "john_doe",
"type": "private"
},
"date": 1640995200,
"text": "Hello, bot!"
}
}
When no new messages are available:
{
"message": "No new updates available",
"last_offset": 123456790,
"timestamp": "2025-07-16T08:30:00.000Z"
}
Receiving messages from bots in groups
⚠️ IMPORTANT LIMITATION: Telegram Bot API has server-side restrictions on receiving messages from other bots. This is a Telegram-level limitation and cannot be fully bypassed through Bot API.
What you can try:
- Add your bot to a group with other bots
- Disable bot privacy via @BotFather:
- Send
/mybots - Select your bot
- Go to Bot Settings → Group Privacy
- Select "Turn off"
- Send
- Give the bot administrator rights in the group
- Enable the "Include Bot Messages" option in the node settings
Alternative solutions:
- Use the Telegram MTProto node (included in this package) - receives ALL messages
- Webhook approach: Set up webhook instead of polling
- Intermediate bot: Create a relay bot that forwards messages from other bots
Telegram MTProto (New node!)
🚀 Solution for bot messages problem
The Telegram MTProto node uses MTProto API and can receive ALL messages, including messages from other bots in groups.
MTProto setup
Get API credentials:
- Go to https://my.telegram.org/apps
- Log in with your phone number
- Create a new application
- Save the
api_idandapi_hash
Create credentials in n8n:
- Type: "Telegram MTProto API"
- API ID: your api_id
- API Hash: your api_hash
- Phone Number: your phone number (for initial authentication)
- Session String: leave empty on first use
First run:
- Authentication will be required on first run
- Enable Debug Mode to get the session string
- Save the session string in credentials for future use
Using MTProto node
Schedule Trigger (every 5 minutes)
↓
Telegram MTProto (Get Chat Messages)
↓
Process messages (including from bots!)
MTProto node parameters
- Chat ID or Username: Chat ID or @username
- Limit: Number of messages to receive
- Offset ID: Message ID to start from (0 = latest)
- Include Bot Messages: Include messages from bots (default true)
- Debug Mode: Debug information
MTProto advantages
✅ Receives ALL messages including from bots
✅ No Telegram server limitations
✅ More powerful API with extended capabilities
✅ Works with any chats where you have access
MTProto disadvantages
❌ Complex setup - requires API credentials
❌ Authentication - requires phone number
❌ More dependencies - uses telegram library
Troubleshooting
If messages from bots are not coming:
- Enable "Debug Mode" in node settings to get debug information
- Check bot settings via @BotFather with
/mybots→ select bot → Bot Settings - Ensure Group Privacy = OFF
- Check bot permissions in the group (must be administrator)
- Ask another bot to write a test message in the group
Testing API directly
You can test the API directly using a test script:
# Download test script
curl -O https://raw.githubusercontent.com/your-repo/test-telegram-api.js
# Run test
node test-telegram-api.js YOUR_BOT_TOKEN
Recommendations
- Use timeout > 0 for long polling - this reduces API load
- Keep Auto Confirm enabled - this prevents message reprocessing
- Configure Schedule Trigger with an interval greater than timeout for optimal operation
- Handle different types of updates (messages, callback queries, inline queries)
- To receive messages from bots be sure to disable privacy via @BotFather
License
MIT