OpenClaw 多平台接入教程:连接Telegram/Discord/WhatsApp/Slack
🩺 摘要
Want to run OpenClaw on Telegram, Discord, WhatsApp and Slack? This complete step-by-step guide covers bot creation, YAML config, permissions, and fixing 401/rate-limit errors.
📝 详情
OpenClaw supports 20+ chat platforms, but the official docs spread config details across multiple pages. This guide consolidates everything into one workflow: create bots → configure YAML → set permissions → deploy. Covers Telegram (BotFather), Discord (Developer Portal), WhatsApp (Cloud API), and Slack (App Manifest).
How to Connect OpenClaw to Telegram, Discord, WhatsApp & Slack (2026 Complete Setup)
One AI assistant. Four chat platforms. Zero cloud lock-in. This guide takes you from zero to a fully deployed OpenClaw gateway on Telegram, Discord, WhatsApp, and Slack.
Before You Start
What You Need
| Requirement | Details |
|---|---|
| OpenClaw running | Follow the quick start first |
| Node.js 22.19+ | node --version to check |
| API key | Anthropic, OpenAI, or any supported provider |
| 10 minutes per channel | Bot creation takes 2-3 min each |
Quick Architecture
Telegram Bot ─┐
Discord Bot ──┤
WhatsApp ─────┼──▶ OpenClaw Gateway ──▶ AI Model (Claude/GPT/etc)
Slack Bot ────┘
Each platform sends messages to the same OpenClaw gateway. The assistant responds in the channel you messaged from.
1. Telegram Setup
Step 1: Create a Bot via BotFather
- Open Telegram and search for @BotFather
- Send
/newbotand follow the prompts - Save the token — it looks like
123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11
Step 2: Configure OpenClaw
openclaw config set channels.telegram.enabled true
openclaw config set channels.telegram.token "YOUR_BOT_TOKEN_HERE"
openclaw config set channels.telegram.name "My AI Assistant"
Step 3: Set Bot Commands (Optional but Recommended)
Send these to BotFather:
/help — Show available commands
/chat — Start a conversation
/reset — Clear conversation history
Step 4: Restart & Test
openclaw gateway restart
Open your bot in Telegram and send /start. If OpenClaw replies, you're set.
Troubleshooting: No Reply
| Problem | Fix |
|---|---|
| Bot doesn't reply | Check openclaw gateway status — is it running? |
| 401 Unauthorized | Did you copy the full token? It's bot_token in config |
| Rate limited | Telegram limits 30 messages/sec — set channels.telegram.rate_limit: 20 |
2. Discord Setup
Step 1: Create a Discord Application
- Go to Discord Developer Portal
- Click New Application — name it whatever you like
- Go to Bot → Add Bot
- Copy the Token (click Reset if needed)
Step 2: Enable Privileged Gateway Intents
Under the Bot settings, enable: - ✅ MESSAGE CONTENT INTENT — this is required or your bot cannot read messages - ✅ SERVER MEMBERS INTENT (optional) - ✅ PRESENCE INTENT (optional)
Step 3: Configure OpenClaw
openclaw config set channels.discord.enabled true
openclaw config set channels.discord.token "YOUR_DISCORD_BOT_TOKEN"
openclaw config set channels.discord.name "AI Assistant"
Step 4: Invite Bot to Your Server
Build the OAuth2 URL:
1. Go to OAuth2 → URL Generator
2. Scopes: ✅ bot ✅ applications.commands
3. Bot Permissions: ✅ Send Messages ✅ Read Message History ✅ Use Slash Commands
4. Copy the generated URL and open it in a browser
5. Select your server and authorize
Step 5: Restart & Test
openclaw gateway restart
In your Discord server, type @YourBot hello and it should reply.
Troubleshooting
| Problem | Fix |
|---|---|
| Bot sees messages but doesn't reply | Did you enable MESSAGE CONTENT INTENT? |
| "Bot requires code grant" | Disable "Requires OAuth2 Code Grant" in Bot settings |
| No response in DMs | Ensure channels.discord.allow_dm: true in config |
3. WhatsApp Setup
WhatsApp integration uses the WhatsApp Cloud API (Meta's official API). This is the only approach that works reliably — DO NOT use unofficial libraries (they get banned within days).
Step 1: Create a Meta Business Account
- Go to Meta Developer Portal
- Click Create App → Business → Next
- Add WhatsApp product to your app
- Navigate to WhatsApp → API Setup
Step 2: Get Your Credentials
You'll need: - Phone Number ID — found in API Setup - Access Token — generated in API Setup (valid for 24h, or create a permanent token) - Verify Token — any string you choose (used for webhook verification)
Step 3: Configure OpenClaw
openclaw config set channels.whatsapp.enabled true
openclaw config set channels.whatsapp.phone_number_id "YOUR_PHONE_NUMBER_ID"
openclaw config set channels.whatsapp.access_token "YOUR_ACCESS_TOKEN"
openclaw config set channels.whatsapp.verify_token "my_verify_token_123"
Step 4: Set Up the Webhook
- In Meta Dashboard → WhatsApp → Configuration
- Callback URL:
https://your-openclaw-domain.com/webhook/whatsapp - Verify Token: the same string you set above
- Click Verify and save
Step 5: Subscribe to Webhook Events
Under Webhook Fields, subscribe to:
- ✅ messages — required to receive messages
- ✅ message_deliveries — optional delivery receipts
Step 6: Restart
openclaw gateway restart
Send a message to your WhatsApp business number. You should get a reply.
Important: WhatsApp Requirements
| Requirement | Note |
|---|---|
| Business Verification | You must verify your business with Meta |
| Phone Number | Cannot be registered with WhatsApp Messenger |
| Message Template | First message to a user must use an approved template |
| 24h Session Window | Free-form replies only within 24h of user's last message |
4. Slack Setup
Step 1: Create a Slack App
- Go to Slack API
- Click Create New App → From Manifest
- Choose your workspace
Step 2: Define the App Manifest
Use this YAML manifest:
display_information:
name: OpenClaw Assistant
features:
bot_user:
display_name: OpenClaw
always_online: true
slash_commands:
- command: /ask
description: Ask OpenClaw a question
usage_hint: "[your question]"
oauth_config:
scopes:
bot:
- chat:write
- channels:history
- groups:history
- im:history
- mpim:history
- app_mentions:read
settings:
event_subscriptions:
request_url: https://your-openclaw-domain.com/webhook/slack
bot_events:
- message.channels
- message.groups
- message.im
- app_mention
interactivity:
is_enabled: true
Step 3: Install the App
- Go to OAuth & Permissions
- Click Install to Workspace
- Copy the Bot User OAuth Token (starts with
xoxb-)
Step 4: Configure OpenClaw
openclaw config set channels.slack.enabled true
openclaw config set channels.slack.token "xoxb-YOUR_SLACK_BOT_TOKEN"
openclaw config set channels.slack.signing_secret "YOUR_SIGNING_SECRET"
openclaw config set channels.slack.name "OpenClaw"
The signing secret is found under Basic Information → App Credentials.
Step 5: Restart & Test
openclaw gateway restart
In Slack, message your bot directly or @ it in a channel. Type /ask what's the weather today? to test slash commands.
5. Running All Channels Simultaneously
The Gateway Config
OpenClaw handles multi-channel natively. Once all channels are configured, your ~/.openclaw/config.yaml should include:
gateway:
port: 8080
host: 0.0.0.0
channels:
telegram:
enabled: true
token: "your_telegram_token"
discord:
enabled: true
token: "your_discord_token"
whatsapp:
enabled: true
phone_number_id: "your_phone_number_id"
access_token: "your_access_token"
slack:
enabled: true
token: "xoxb-your_slack_token"
signing_secret: "your_signing_secret"
Verify Everything is Running
openclaw gateway status --deep
You should see all four channels as connected.
Per-Channel Agent Configuration (Advanced)
Want different AI behavior per channel? Use the agent field:
channels:
telegram:
enabled: true
agent: "fast-reply" # Quick, concise responses
discord:
enabled: true
agent: "code-assist" # Code-focused with longer context
whatsapp:
enabled: true
agent: "default" # Balanced
Define agents in the agents section of your config.
Cost & Performance Notes
Token Usage by Platform
| Platform | Avg. Message Length | Daily Token Estimate |
|---|---|---|
| Telegram | ~50 words | ~5K-15K tokens |
| Discord | ~80 words | ~10K-20K tokens |
| ~40 words | ~3K-10K tokens | |
| Slack | ~100 words | ~15K-30K tokens |
Token-Saving Tips
- 预处理URL,提取关键内容后发送给AI,减少Token消耗
- Set
context_window: 4000to limit history per conversation - Enable
session_timeout: 3600to auto-clear idle conversations - Use a cheaper model (e.g., Claude Haiku or GPT-4o-mini) for high-volume channels
Pair with local caching to cut token costs on document-heavyent-heavy workflows.
Quick Reference: Channel Comparison
| Feature | Telegram | Discord | Slack | |
|---|---|---|---|---|
| Setup Time | 5 min | 10 min | 20 min | 10 min |
| Bot Creation | BotFather | Dev Portal | Meta Portal | API Dashboard |
| Cost | Free | Free | Free* | Free |
| Rate Limit | 30/s | 50/s | 80/s | 1/s per workspace |
| DMs Supported | ✅ | ✅ | ✅ | ✅ |
| Group Chats | ✅ | ✅ | ❌ | ✅ |
| File Support | ✅ | ✅ | ✅ | ✅ |
*WhatsApp requires business verification but no monthly fee
Summary
Running OpenClaw across all four platforms takes about 45 minutes of setup time. The key takeaways:
- Telegram is the easiest — 5 minutes, BotFather handles everything
- Discord needs MESSAGE CONTENT INTENT — the single biggest gotcha
- WhatsApp needs business verification — plan for 1-2 days of approval time
- Slack needs a public webhook URL — requires your gateway to be publicly accessible
Once configured, you have a single AI assistant accessible from any chat app you use. That's the entire point of OpenClaw.
Published: 2026-07-12 | Edit on GitHub
Related: OpenClaw Installation Guide · Cut 80% Token Cost with save2kb
💬 评论 (0)