Overview
This guide will help you create a Telegram bot and connect it to Clawdbot, enabling:
- Automatic AI replies to messages
- Group chat AI integration
- Voice message processing
- Image and file handling
Prerequisites
- Clawdbot installed on your machine
- A Telegram account
- Telegram app installed (mobile or desktop)
Step 1: Create a Telegram Bot
First, you need to create a bot through Telegram’s BotFather:
- Open Telegram and search for @BotFather
- Start a chat and send
/newbot - Follow the prompts:
- Enter a name for your bot (e.g., “My AI Assistant”)
- Enter a username (must end in “bot”, e.g., “myai_assistant_bot”)
- BotFather will give you an API token — copy this token
⚠️ Important: Keep your bot token secret. Anyone with the token can control your bot.
Step 2: Add the Bot to Clawdbot
Run this command in your terminal:
clawdbot channels add telegram
When prompted, paste your bot token.
Alternatively, use the setup wizard:
clawdbot onboard
Select Add messaging channel → Telegram, then enter your token.
Step 3: Configure Bot Settings
After adding the bot, you can configure its behavior:
# Set who can use the bot (optional but recommended)
clawdbot config set telegram.allowList "123456789,987654321"
Replace the numbers with Telegram user IDs of people allowed to use the bot.
Finding Your Telegram User ID
- Search for @userinfobot on Telegram
- Start a chat — it will reply with your user ID
Step 4: Start the Gateway
Launch Clawdbot:
clawdbot gateway
Your Telegram bot is now active! Send it a message to test.
Group Chat Setup
To use your bot in group chats:
Enable Group Mode
clawdbot config set telegram.groups.enabled true
Add Bot to Group
- Open your Telegram group
- Click on the group name → Add Members
- Search for your bot’s username and add it
- Make the bot an admin (required for reading messages)
Trigger Behavior
By default, the bot responds when:
- It’s mentioned with @username
- Someone replies to one of its messages
To make it respond to all messages:
clawdbot config set telegram.groups.replyToAll true
Advanced Configuration
Custom Commands
Add custom bot commands that appear in Telegram’s menu:
clawdbot config set telegram.commands '[
{"command": "help", "description": "Show help message"},
{"command": "reset", "description": "Reset conversation"}
]'
Webhook Mode (for Servers)
If running on a server with a public IP:
clawdbot config set telegram.mode webhook
clawdbot config set telegram.webhookUrl "https://your-domain.com/telegram/webhook"
Troubleshooting
Bot Not Responding
- Check the gateway is running:
clawdbot status - Verify the token:
clawdbot config get telegram.token - Make sure you’re in the allow list (if configured)
“Unauthorized” Error
Your bot token may be invalid. Get a new token from @BotFather:
- Chat with @BotFather
- Send
/mybots - Select your bot
- Click API Token → Revoke current token
- Get the new token and update Clawdbot
Bot Can’t Read Group Messages
Make sure the bot is an admin in the group. In Telegram:
- Open group settings
- Go to Administrators
- Add your bot and enable at least “Read messages”
Next Steps
- Connect WhatsApp — Add another messaging channel
- Configure AI Providers — Switch AI models
- Voice Assistant Setup — Enable voice features