Features
- Direct messaging and group chats
- Channel posting and thread support
- Media support (images, videos, documents)
- Polls and reactions
- Native bot commands
- Webhook or polling mode
- Markdown formatting
Setup
Create a Telegram Bot
Open Telegram and message @BotFather:
- Send
/newbot - Choose a name for your bot
- Choose a username (must end in
bot) - Copy the bot token provided by BotFather
Verify Connection
Check that Telegram is running:You should see the bot username and status as “running”.
Configuration
Basic Configuration
Environment Variable
Token File
Store your token in a separate file:Multi-Account Setup
Security
DM Policy
Group Policy
Pairing Workflow
- User sends
/startor any message - With
dmPolicy: pairing, you approve the user: - User receives approval notification
Advanced Features
Webhook Mode
Use webhooks instead of polling for better performance:Proxy Support
Reply Threading
Native Commands
Telegram supports bot commands that appear in the UI:Message Features
Sending Messages
Markdown Formatting
Telegram supports Markdown in messages:Polls
Create polls with up to 10 options:Reactions
React to messages:Group Management
Adding Bot to Groups
- Add your bot to a Telegram group
- Get the group chat ID (use
/statuscommand or check logs) - Configure the group in SimpleClaw:
Mention Detection
WithrequireMention: true, the bot only responds when mentioned:
@YourBot hello✓hello✗ (ignored)
Group Auditing
Check if your bot is still in configured groups:Troubleshooting
Bot Not Responding
Bot Not Responding
Check the bot token is valid:Verify the bot is running:
Duplicate Token Error
Duplicate Token Error
If you see “Duplicate Telegram bot token”, ensure each bot token is only used once:
Group Messages Not Received
Group Messages Not Received
Ensure:
- Bot is added to the group
- Group ID is in your
groupsallowlist (if usinggroupPolicy: allowlist) - Bot has permission to read messages
Webhook Not Working
Webhook Not Working
Verify:
- Webhook URL is publicly accessible
- SSL certificate is valid (required by Telegram)
- Webhook secret matches configuration
CLI Commands
API Reference
Telegram channel implementation:extensions/telegram/src/channel.ts
Channel ID
telegram
Target ID Format
- User DMs: Numeric user ID (e.g.,
123456789) - Groups: Negative chat ID (e.g.,
-1001234567890) - Channels: Channel username (e.g.,
@channelname) or ID
Capabilities
- Chat types:
direct,group,channel,thread - Features:
reactions,threads,media,polls,nativeCommands - Delivery mode:
direct - Text chunk limit: 4000 characters (Markdown)
- Poll max options: 10
- Block streaming: Supported with coalescing
Configuration Schema
SeeTelegramConfigSchema in source for full schema.
Best Practices
Use Token Files
Store tokens in separate files instead of config:
Enable Pairing
Use
dmPolicy: pairing to control access:Restrict Groups
Use allowlist mode for group access:
Use Webhooks
Webhooks are more efficient than polling for high-traffic bots
Next Steps
Security Guide
Configure DM policies and allowlists
Multi-Channel
Add more messaging platforms