Telegram Setup
Telegram bots are easy to set up and highly customizable. Your ClawBook AI assistant can work in private chats, groups, and channels.
Prerequisites
- Active ClawBook subscription
- LLM provider configured
- Telegram account
Creating Your Bot
Step 1: Talk to BotFather
- Open Telegram
- Search for @BotFather (verified with blue checkmark)
- Start a conversation
- Send
/newbot
Step 2: Configure Your Bot
BotFather will ask:
- Bot name:
My Claw Assistant(display name) - Bot username:
MyClaw_bot(must end inbot)
You'll receive:
Done! Congratulations on your new bot. You will find it at t.me/MyClaw_bot.
Use this token to access the HTTP API:
7123456789:AAHxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Keep your token secure and store it safely.
Step 3: Connect to ClawBook
- Go to Integrations → Telegram
- Enter your bot token
- Click Connect
Bot Token: 7123456789:AAHxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Bot Username: @MyClaw_bot
Step 4: Test Connection
✓ Bot Connected
Username: @MyClaw_bot
Name: My Claw Assistant
Status: Online
Open your bot in Telegram and send a message!
Bot Configuration
Bot Settings via BotFather
Send these commands to @BotFather:
/setdescription - Bot description shown on profile
/setabouttext - Shown when users view bot info
/setuserpic - Upload bot avatar
/setcommands - Define bot commands menu
Setting Commands
Send /setcommands to BotFather, then:
help - Show available commands
settings - View your settings
clear - Clear conversation history
model - Switch AI model
status - Check system status
Integration Settings
Trigger Modes
| Mode | Behavior |
|---|---|
| Always On | Respond to every message |
| Command Only | Only respond to /commands |
| Mention | Respond when @mentioned |
Group Settings
Allow Groups: Yes
Allow Channels: Yes
Require Admin for Groups: No
Group Privacy Mode: Disabled (sees all messages)
Privacy Mode
Telegram bots have two privacy modes:
| Mode | Bot Sees |
|---|---|
| Enabled (default) | Only /commands and @mentions |
| Disabled | All messages in group |
To disable privacy mode:
- Message @BotFather
- Send
/setprivacy - Select your bot
- Choose Disable
Message Settings
Max Message Length: 4096
Parse Mode: Markdown
Disable Web Preview: No
Disable Notification: No
Markdown Formatting
Your bot can send formatted messages:
*bold* → **bold**
_italic_ → *italic*
`code` → `code`
```code block``` → code block
[link](url) → hyperlink
Inline Mode
Enable inline queries to use your bot in any chat:
- Message @BotFather:
/setinline - Select your bot
- Enter placeholder text:
Ask Claw anything...
Now in any chat, type @YourBot_bot your question to get AI responses.
Inline Settings in ClawBook
Inline Mode: Enabled
Inline Cache: 300 seconds
Results per Query: 5
Show Usage Button: Yes
Webhooks vs Polling
Polling (Default)
Bot periodically checks for new messages.
Method: Polling
Interval: 1 second
Pros: Simple, works behind firewalls Cons: Slight delay, more resource usage
Webhooks (Recommended)
Telegram pushes messages to your server instantly.
Method: Webhook
Webhook URL: https://your-domain.com/webhook/telegram
Pros: Instant delivery, lower resource usage Cons: Requires public HTTPS URL
Setting Up Webhooks
- Ensure you have a domain with SSL
- In ClawBook: Integrations → Telegram → Webhook Settings
- Enter your webhook URL
- Click Set Webhook
Verify:
curl "https://api.telegram.org/bot<TOKEN>/getWebhookInfo"
Advanced Features
Bot Commands in ClawBook
Define custom commands:
| Command | Response Type | Description |
|---|---|---|
/start | Welcome | Greet new users |
/help | Static | Show help text |
/clear | Action | Clear history |
/settings | Interactive | Open settings menu |
Keyboards
Reply Keyboard
Persistent buttons below chat:
Reply Keyboard:
- ["Help", "Settings"]
- ["Clear History"]
Resize: Yes
One Time: No
Inline Keyboard
Buttons attached to messages:
Inline Keyboard:
- [{"text": "👍 Helpful", "callback": "feedback_good"}]
- [{"text": "👎 Not helpful", "callback": "feedback_bad"}]
Conversation Context
Context Settings:
Max History: 20 messages
Context Window: 24 hours
Per-User Memory: Yes
Group Shared Context: No
Multi-Bot Setup
Run multiple bots with different configurations:
- Create additional bots via BotFather
- In ClawBook: Integrations → Add Telegram Bot
- Configure each with different settings:
Bot 1: @GeneralAssistant_bot
- Model: Claude 3.5 Sonnet
- Purpose: General questions
Bot 2: @CodeHelper_bot
- Model: Claude 3.5 Sonnet (code-focused prompt)
- Purpose: Programming help
Bot 3: @QuickAnswers_bot
- Model: Claude 3 Haiku
- Purpose: Fast, simple queries
Troubleshooting
Bot Not Responding
- Check bot token is correct
- Verify bot isn't blocked
- Check ClawBook logs:
tail -f /var/log/openclaw/telegram.log
"Unauthorized" Error
- Token may be revoked
- Generate new token via BotFather
- Update in ClawBook settings
Messages Delayed
- Switch from polling to webhooks
- Check VPS network latency
- Verify no rate limiting
Bot Kicked from Groups
- Enable group privacy mode
- Ensure bot has correct permissions
- Check for spam-like behavior
Rate Limits
Telegram limits:
- 30 messages/second to same chat
- 20 messages/minute to same user in groups
ClawBook auto-handles these limits.
Security
Token Security
- Never share your bot token
- Regenerate if compromised via BotFather
/revoke - Store only in ClawBook's encrypted storage
User Verification
Allowed Users:
- 123456789 # Telegram user IDs
- 987654321
Allow Unknown Users: Yes
Require /start First: Yes
Rate Limiting
Per-User Limits:
Messages per minute: 10
Messages per hour: 100
Cooldown on limit: 60 seconds
Next Steps
- Discord Setup - Add Discord integration
- Advanced Settings - Fine-tune behavior
- Troubleshooting - Get help