WhatsApp Bot Setup
Deploy your OpenClaw AI agent on WhatsApp using the Baileys library with QR pairing.
Overview
OpenClaw integrates with WhatsApp via WhatsApp Web using the Baileys library. This is the most popular channel for OpenClaw deployments.
Quick Setup
1. Configure WhatsApp Channel
{
"channels": {
"whatsapp": {
"enabled": true,
"allowFrom": ["+15555550123"],
"groups": {
"*": {
"requireMention": true
}
}
}
}
}2. Pair via QR Code
openclaw channels loginThis will display a QR code. Scan it with your WhatsApp mobile app:
- Open WhatsApp on your phone
- Go to Settings → Linked Devices
- Tap Link a Device
- Scan the QR code
3. Start the Gateway
openclaw gatewayAccess Control
Direct Messages
{
"channels": {
"whatsapp": {
"allowFrom": ["+15555550123", "+15555550456"]
}
}
}Group Mentions
{
"messages": {
"groupChat": {
"mentionPatterns": ["@openclaw"]
}
}
}Features
- ✅ Direct messages
- ✅ Group chats with mention activation
- ✅ Image and media sending/receiving
- ✅ Document sharing
- ✅ Voice note transcription
- ✅ QR code pairing (no API key needed)
Session Persistence
WhatsApp sessions are stored in ~/.openclaw/state/. Back up this directory to preserve your WhatsApp connection across restarts.
Troubleshooting
QR code expired
Run openclaw channels login again to generate a new QR code.
Disconnected frequently
- Ensure your phone has a stable internet connection
- Keep the WhatsApp app running in the background
- Check
openclaw gateway statusfor errors
Messages not sending
- Verify the phone number format includes country code
- Check
allowFromconfiguration
Next Steps
- Telegram Deployment — Telegram setup
- AI Agent — Configure agent behavior
- Security — Access control best practices