Prerequisites
Before setting up a Telegram channel, you need:- A Telegram account
- Access to @BotFather bot
- A bot token from BotFather
Creating a Telegram Bot
Open BotFather
Start a chat with @BotFather on Telegram.
Keep your bot token secret. Anyone with the token can control your bot.
Connecting to Chatbot Platform
Features
Native Typing Indicators
Telegram supports native typing indicators via thesendChatAction API:
Group Chats
Bots work in Telegram groups with per-user context:- Each user has separate conversation history
- Bot can respond to @mentions or all messages
- Group context is maintained per user
- Add bot as group member
- Grant admin permissions if needed
- Configure group privacy settings in BotFather
Private Chats
Direct 1:1 conversations with users:- Simple conversation context
- Full message history
- Native features like buttons and media
Inline Buttons
Future support for inline buttons and actions:Configuration
Bot Privacy Settings
Configure in BotFather with/setprivacy:
Privacy Mode Disabled:
- Bot receives all group messages
- Can respond to any message
- Required for full conversation context
- Bot only receives messages with @mention
- Or commands starting with /
- Limited context awareness
Group Permissions
For groups, the bot needs:- Read Messages: Receive messages
- Send Messages: Reply to users
- Send Media: Images, files, etc.
Testing
Troubleshooting
Bot Not Responding
Check:- Token is correct
- Channel is enabled
- Bot has integration configured
- Webhook is registered (check platform logs)
Bot Not Receiving Group Messages
Possible causes:- Privacy mode is enabled (disable in BotFather)
- Bot needs @mention
- Bot not added to group
- Use
/setprivacyin BotFather - Set to disabled
- Re-add bot to group if needed
Webhook Errors
If webhook registration fails:- Verify token is valid
- Check token has no extra spaces
- Regenerate token in BotFather if needed
Advanced Features
Commands
Register bot commands in BotFather:/setcommands in BotFather.
Custom Keyboard
Future support for custom keyboards with predefined buttons.Media Messages
Bot can receive and process:- Photos
- Documents
- Audio
- Video
- Location (latitude, longitude, and optional metadata)
Security
Token Security
Never share or expose your bot token publicly
Webhook Validation
Platform validates all requests are from Telegram
Rate Limiting
Telegram enforces rate limits on bot API calls
Spam Protection
Implement spam detection in your integration if needed
Rate Limits
Telegram enforces these limits:| Action | Limit |
|---|---|
| Messages to same chat | 1 per second |
| Messages to different chats | 30 per second |
| Messages to same group | 20 per minute |
Best Practices
Test your bot in a private chat before adding to groups to ensure it works correctly.
- Set clear bot description in BotFather
- Configure bot commands for better UX
- Use typing indicators for longer responses
- Handle media messages gracefully
- Share bot token publicly
- Spam users with messages
- Forget to test group behavior
- Leave privacy mode enabled if you need full context
Next Steps
Slack Channel
Also deploy to Slack
Bot Behaviors
Configure typing and detection