For OpenClaw v2026.2 | This article assumes you have completed OpenClaw installation and have a valid Telegram Bot Token (free to obtain).
TL;DR: Telegram is the easiest channel to configure: create a Bot (@BotFather), get a Token, add it to ~/.openclaw/openclaw.json, and start the Gateway. DM pairing protection is enabled by default; groups require @mention to respond. Also covers WhatsApp (QR login), Discord (Bot Token), and Slack configuration.
Why Start with Telegram?
Channel Comparison
| Feature | Telegram | Discord | Slack | iMessage | |
|---|---|---|---|---|---|
| Setup Difficulty | ⭐ Easy | ⭐⭐ Medium | ⭐⭐ Medium | ⭐⭐ Medium | ⭐⭐⭐ Complex |
| Free to Use | ✅ | ✅ | ✅ | ✅ | ✅ |
| Bot API | ✅ Mature | ⚠️ Limited | ✅ Mature | ✅ Mature | ⚠️ Limited |
| Group Support | ✅ | ✅ | ✅ | ✅ | ⚠️ |
| File Support | ✅ 2GB | ✅ 100MB | ✅ 25MB | ✅ 1GB | ✅ |
| Available in China | ⚠️ Proxy needed | ✅ | ⚠️ Proxy needed | ⚠️ Proxy needed | ✅ |
| Recommendation | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐ | ⭐⭐⭐⭐ | ⭐⭐⭐ | ⭐⭐⭐ |
Reasons to Choose Telegram
- Simplest setup: Just create a Bot and get a Token
- Best documentation: Telegram Bot API is an industry benchmark
- Richest features: Supports commands, buttons, inline queries, and more
- Most active community: Easy to find solutions to problems
Creating a Telegram Bot
Step 1: Find BotFather
- Open the Telegram app
- Search for
@BotFather(official Bot management tool) - Tap to open the conversation
sequenceDiagram
participant U as You
participant BF as BotFather
participant TG as Telegram
U->>BF: /newbot
BF->>U: Enter Bot display name
U->>BF: My OpenClaw Assistant
BF->>U: Enter Bot username (must end with bot)
U->>BF: myclaw_bot
BF->>TG: Create Bot
TG-->>BF: Bot created successfully
BF->>U: Return API Token
Step 2: Create a New Bot
Send this command in BotFather:
/newbot
Follow the prompts:
- Bot display name: e.g.
My OpenClaw(spaces allowed) - Bot username: e.g.
myclaw_bot(must end withbot)
After creation, BotFather will return:
Done! Congratulations on your new bot...
Use this token to access the HTTP API:
7123456789:AAHxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Keep your token secure...
⚠️ Important: Keep your API Token secure; it has full control over your Bot.
Step 3: Configure Bot Info (Optional)
# Set Bot avatar in BotFather
/setuserpic
# Select your Bot, upload image
# Set Bot description
/setdescription
# Select your Bot, enter description text
# Set Bot about text
/setabouttext
# Select your Bot, enter about text
# Set Bot commands
/setcommands
# Enter command list, e.g.:
# start - Start using
# help - Get help
# status - View status
Configuring OpenClaw
Method A: Environment Variables (Quick Test)
# Set environment variable
export TELEGRAM_BOT_TOKEN="7123456789:AAHxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
# Start Gateway
openclaw gateway
Method B: Config File (Recommended for Production)
Edit ~/.openclaw/openclaw.json:
{
"agent": {
"model": "anthropic/claude-opus-4-6"
},
"channels": {
"telegram": {
"botToken": "7123456789:AAHxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
}
}
Method C: CLI Configuration
# Interactive configuration
openclaw config set channels.telegram.botToken "7123456789:AAH..."
# Or via onboard wizard
openclaw onboard
Verify Configuration
# Check configuration
openclaw config get channels.telegram.botToken
# Run diagnostics
openclaw doctor
# Start Gateway (debug mode)
openclaw gateway --verbose
After successful startup, you should see logs similar to:
[INFO] Gateway starting on port 18789
[INFO] Telegram channel connected
[INFO] Bot: @myclaw_bot
[INFO] Waiting for messages...
Security Configuration
DM Pairing Mechanism
By default, OpenClaw enables the DM pairing mechanism (dmPolicy: "pairing") to prevent strangers from abusing your Bot.
sequenceDiagram
participant S as Stranger
participant B as Bot
participant G as Gateway
participant O as You
S->>B: Send message "Hello"
B->>G: Message arrives
G->>G: Check pairing status
G-->>B: Not paired, return pairing code
B-->>S: "Please pair: Code ABC123"
S->>O: Tell you the pairing code
O->>G: openclaw pairing approve telegram ABC123
G->>G: Add to whitelist
G-->>S: Pairing successful, can chat
Configure DM Policy
{
"channels": {
"telegram": {
"botToken": "your_token",
"dmPolicy": "pairing",
"allowFrom": []
}
}
}
| Policy | Description | Risk Level |
|---|---|---|
pairing |
New users need pairing code | ⭐ Safe (default) |
open |
Anyone can send messages | ⭐⭐⭐ Dangerous |
Manage Pairing Requests
# View pending pairing list
openclaw pairing list
# Output example:
# Channel Code User Created
# telegram ABC123 @stranger 2026-02-26 10:30:00
# Approve pairing
openclaw pairing approve telegram ABC123
# Reject pairing
openclaw pairing reject telegram ABC123
# View paired users
openclaw pairing show telegram
Whitelist Mode
Only allow specific users to send messages:
{
"channels": {
"telegram": {
"botToken": "your_token",
"dmPolicy": "open",
"allowFrom": [123456789, 987654321]
}
}
}
💡 Get Telegram User ID: Send any message to
@userinfobot; it will return your numeric ID.
Group Configuration
Basic Group Settings
{
"channels": {
"telegram": {
"botToken": "your_token",
"groups": {
"*": {
"requireMention": true
}
}
}
}
}
| Config | Description |
|---|---|
"*" |
Match all groups |
requireMention |
Bot responds only when @mentioned in group |
Per-Group Configuration
{
"channels": {
"telegram": {
"botToken": "your_token",
"groups": {
"-100123456789": {
"requireMention": false,
"name": "Work Group"
},
"-100987654321": {
"requireMention": true,
"name": "Chat Group"
},
"*": {
"requireMention": true
}
}
}
}
}
💡 Get Group ID: After adding the Bot to a group, send any message in the group and check the Gateway logs for the group ID.
Add Bot to Group
- In group settings, tap “Add members”
- Search for your Bot username (e.g.
@myclaw_bot) - Select and add
- (Optional) Make the Bot an admin for more permissions
WhatsApp Configuration
Method: QR Code Login
WhatsApp uses the Web protocol and requires QR code binding:
# Start login flow
openclaw channels login whatsapp
# QR code displayed in terminal
# Scan with phone WhatsApp:
# Settings > Linked devices > Link a device > Scan QR code
sequenceDiagram
participant U as User
participant C as CLI
participant W as WhatsApp
participant G as Gateway
U->>C: openclaw channels login whatsapp
C->>W: Request QR code
W-->>C: Return QR code
C->>U: Display QR code
U->>W: Phone scans code
W-->>C: Authentication successful
C->>G: Save credentials
G-->>U: WhatsApp connected
Configuration Example
{
"channels": {
"whatsapp": {
"allowFrom": ["+8613800138000"],
"groups": {
"*": {
"requireMention": true
}
}
}
}
}
WhatsApp Limitations
| Limitation | Description |
|---|---|
| Phone Online | WhatsApp mobile must be online to maintain connection |
| Message Delay | May experience delays from seconds to minutes |
| File Size | Max 100MB |
| Number Risk | Heavy use may lead to account restrictions |
Discord Configuration
Create Discord Bot
- Visit Discord Developer Portal
- Click “New Application”
- Enter a name, e.g.
OpenClaw Assistant - Go to “Bot” page, click “Add Bot”
- Copy the Token (note: not the Application ID)
Configure OAuth2 Permissions
- Go to “OAuth2” > “URL Generator”
- Check the following permissions:
| Permission Category | Specific Permissions |
|---|---|
| Bot Permissions | |
| General | Read Messages/View Channels |
| General | Send Messages |
| General | Send Messages in Threads |
| General | Manage Messages |
| General | Embed Links |
| General | Attach Files |
| General | Read Message History |
| Text | Add Reactions |
| Text | Use Slash Commands |
- Copy the generated invite link
- Open the link in a browser to invite the Bot to your server
Configuration Example
{
"channels": {
"discord": {
"token": "MTk4NjIyNDgzNDc...",
"guilds": {
"*": {
"requireMention": true
}
}
}
}
}
Discord Feature Configuration
{
"channels": {
"discord": {
"token": "your_token",
"commands": {
"native": true,
"text": true
},
"mediaMaxMb": 25
}
}
}
| Config | Description |
|---|---|
commands.native |
Enable Discord native slash commands |
commands.text |
Enable text commands (e.g. /help) |
mediaMaxMb |
Media file size limit |
Slack Configuration
Create Slack App
- Visit Slack API
- Click “Create New App”
- Select “From scratch”
- Enter App name and select workspace
Configure OAuth Permissions
On the “OAuth & Permissions” page, add these Bot Token Scopes:
app_mentions:read
channels:history
channels:read
chat:write
files:read
files:write
groups:history
groups:read
im:history
im:read
im:write
mpim:history
mpim:read
mpim:write
reactions:read
reactions:write
users:read
Install to Workspace
- Click “Install to Workspace”
- Authorize permissions
- Copy the Bot User OAuth Token (starts with
xoxb-)
Configuration Example
{
"channels": {
"slack": {
"botToken": "xoxb-...",
"appToken": "xapp-...",
"signingSecret": "..."
}
}
}
Enable Socket Mode (Recommended)
- Enable on the “Socket Mode” page
- Generate App-Level Token
- Configure in OpenClaw:
{
"channels": {
"slack": {
"botToken": "xoxb-...",
"appToken": "xapp-...",
"socketMode": true
}
}
}
Enabling Multiple Channels
Full Configuration Example
{
"agent": {
"model": "anthropic/claude-opus-4-6"
},
"gateway": {
"port": 18789,
"bind": "loopback"
},
"channels": {
"telegram": {
"botToken": "telegram_bot_token",
"dmPolicy": "pairing",
"groups": {
"*": { "requireMention": true }
}
},
"whatsapp": {
"allowFrom": ["+8613800138000"]
},
"discord": {
"token": "discord_token",
"guilds": {
"*": { "requireMention": true }
}
},
"slack": {
"botToken": "xoxb-...",
"appToken": "xapp-..."
}
}
}
Message Routing Diagram
flowchart TB
subgraph Users["Users"]
WA[WhatsApp User]
TG[Telegram User]
DC[Discord User]
SL[Slack User]
end
subgraph Gateway["Gateway"]
MR[Message Router]
SM[Session Manager]
end
subgraph Agent["Pi Agent"]
AI[AI Core]
CTX[Shared Context]
end
WA --> MR
TG --> MR
DC --> MR
SL --> MR
MR --> SM
SM --> AI
AI --> CTX
All channels share the same Agent with unified context management. This means:
- Questions asked on Telegram can be continued on WhatsApp
- Users across channels can share the same memory
- Each channel can have its own session isolation policy
Session Management Commands
Universal commands for all channels (send in chat):
| Command | Function | Example |
|---|---|---|
/status |
View session status | Shows model, Token usage |
/new or /reset |
Reset session | Clear context, start new conversation |
/compact |
Compress context | Summarize history, free Tokens |
/think <level> |
Set thinking level | /think high |
/verbose on/off |
Toggle verbose output | /verbose on |
/usage off/tokens/full |
Usage display mode | /usage full |
Troubleshooting
Telegram Bot Not Responding
Symptom: No reply after sending a message
Troubleshooting steps:
# 1. Check if Gateway is running
curl http://127.0.0.1:18789/health
# 2. Check Bot Token
openclaw config get channels.telegram.botToken
# 3. View detailed logs
openclaw gateway --verbose
# 4. Run doctor diagnostics
openclaw doctor
Common causes:
| Error Message | Cause | Solution |
|---|---|---|
401 Unauthorized |
Invalid Token | Re-obtain Token |
409 Conflict |
Webhook conflict | Remove old Webhook |
403 Forbidden |
Bot banned | Contact Telegram support |
Connection refused |
Gateway not running | Start Gateway |
WhatsApp QR Scan Failed
Symptom: Scan fails or shows error
Solutions:
# Regenerate QR code
openclaw channels logout whatsapp
openclaw channels login whatsapp
# Check network
ping web.whatsapp.com
# Clear credential cache
rm -rf ~/.openclaw/credentials/whatsapp*
Discord Bot No Permissions
Symptom: Bot doesn’t respond or lacks permissions in server
Solutions:
- Check Bot role permissions
- Confirm Bot has been invited to the server
- Re-invite Bot (using correct OAuth URL)
# Check logs for permission errors
openclaw gateway --verbose 2>&1 | grep -i permission
Configuration Not Taking Effect
Symptom: Behavior unchanged after modifying config
Solutions:
# 1. Restart Gateway
openclaw gateway --restart
# 2. Clear cache
rm -rf ~/.openclaw/cache/*
# 3. Validate config file syntax
cat ~/.openclaw/openclaw.json | jq .
# 4. Check config priority
openclaw config list
Security Best Practices
1. Token Security
# Do not commit Tokens to version control
echo ".openclaw/" >> .gitignore
# Use environment variables for sensitive data
export TELEGRAM_BOT_TOKEN="your_token"
# Rotate Tokens periodically (in BotFather)
# /revoke command can regenerate Token
2. Access Control
{
"channels": {
"telegram": {
"dmPolicy": "pairing",
"allowFrom": [],
"groups": {
"*": { "requireMention": true }
}
}
},
"agents": {
"defaults": {
"sandbox": {
"mode": "non-main"
}
}
}
}
3. Log Auditing
# Enable verbose logging
openclaw gateway --verbose
# View session history
openclaw sessions list
openclaw sessions show <session-id>
# Audit command execution
grep "bash" ~/.openclaw/logs/gateway.log
Next Steps
Congratulations! You’ve completed your first channel setup. Now you can:
- Test the conversation → Send messages in your configured channel
- Install Skills → Extend AI capabilities
- Configure multiple channels → Add more channels
Summary:
- Mastered Telegram Bot creation and configuration
- Understood DM pairing and group configuration
- Learned configuration methods for WhatsApp, Discord, and Slack
- Learned how to enable multiple channels simultaneously
- Mastered troubleshooting for common issues
Changelog:
- 2026-02-26: Initial release, based on OpenClaw v2026.2
Series Navigation:
- ← Previous: Environment Setup and First Run
- → Next: Gateway Core Concepts