On this page
β οΈ Why DM policies matter
Your OpenClaw agent can read files, execute commands, browse the web, and send messages. Anyone who can talk to your agent can potentially command it to do these things. DM policies are the front door lock.
dmPolicy: "open" β meaning anyone could send commands. Don't be that person.π DM policy modes
| Mode | Who can message | Risk | Use case |
|---|---|---|---|
"pairing" | Anyone who completes the pairing code | π‘ Medium | Default β good for personal use |
"allowlist" | Only IDs in allowFrom array | π’ Low | Locked-down production |
"open" | Anyone | π΄ High | β οΈ Public bots only, with extreme caution |
"disabled" | Nobody (DMs off) | π’ None | Groups-only bot |
π Pairing mode (default)
Unknown senders receive a 6-digit pairing code. They're ignored until you approve:
# When someone DMs your bot, they get:
# "Send pairing code to continue: 482917"
# You approve from CLI:
openclaw pairing approve telegram 482917
# The sender is added to the local allowlist
# Codes expire after 1 hour
How it works:
- Unknown sender messages the bot β bot replies with pairing code
- You receive a notification (check logs or heartbeat)
- You run
openclaw pairing approve <channel> <code> - Sender is added to persistent allowlist
- Pairing codes expire after 1 hour (configurable)
π Allowlist mode
Only specific IDs can talk. Everyone else is silently ignored:
{
"channels": {
"telegram": {
"dmPolicy": "allowlist",
"allowFrom": ["123456789", "987654321"]
},
"whatsapp": {
"dmPolicy": "allowlist",
"allowFrom": ["+40712345678"]
},
"discord": {
"dmPolicy": "allowlist",
"allowFrom": ["discord_user_id"]
},
"signal": {
"dmPolicy": "allowlist",
"allowFrom": ["uuid:123e4567-e89b-12d3-a456-426614174000"]
}
}
}
π‘ Finding your ID:
Telegram: message @userinfobot or check gateway logs
WhatsApp: your phone number with + country code
Discord: enable Developer Mode β right-click yourself β Copy User ID
Signal: UUID from pairing output (check logs for uuid:<id>)
π΄ Open mode (dangerous)
{
"channels": {
"telegram": {
"dmPolicy": "open",
"allowFrom": ["*"]
}
}
}
If you must use open mode, also:
- Disable exec tools entirely
- Disable filesystem write access
- Disable browser tools
- Run in Docker sandbox
- Set rate limits per sender
π₯ Group policies
Group policies work separately from DM policies:
{
"channels": {
"telegram": {
"groupPolicy": "allowlist",
"groups": {
"*": {
"requireMention": true
},
"-100123456789": {
"requireMention": false
}
}
}
}
}
| Setting | Purpose |
|---|---|
groupPolicy | Controls which groups the bot responds in (allowlist, open, disabled) |
groups.* | Wildcard β default settings for all groups |
groups.<id> | Per-group override by numeric group ID |
requireMention | If true, bot only responds when @mentioned (prevents noise) |
π Per-channel overrides
Each channel can have its own DM policy:
{
"channels": {
"telegram": { "dmPolicy": "pairing" },
"whatsapp": { "dmPolicy": "allowlist", "allowFrom": ["+40712345678"] },
"discord": { "dmPolicy": "disabled" },
"slack": { "dmPolicy": "open" },
"signal": { "dmPolicy": "allowlist", "allowFrom": ["uuid:abc123"] }
}
}
This lets you run different security postures per channel β strict on Discord (public), open on Slack (trusted workspace).
π©Ί openclaw doctor
The doctor command audits your DM policies and flags risky configurations:
openclaw doctor
# Example output:
# β οΈ channels.telegram.dmPolicy is "open" β anyone can message
# β οΈ channels.discord.dmPolicy is "open" with exec tools enabled
# β
channels.whatsapp.dmPolicy is "allowlist" (2 entries)
# β
channels.signal.dmPolicy is "pairing"
openclaw doctor after every config change. It catches misconfigurations that leave your agent exposed.π§ Troubleshooting
| Problem | Fix |
|---|---|
| Bot doesn't respond to anyone | Check dmPolicy isn't "disabled". Check allowFrom has your ID. |
| Pairing code not received | Bot must be running. Check openclaw gateway status. Codes expire after 1 hour. |
| Wrong user ID format | Telegram: numeric only. WhatsApp: +country prefix. Signal: uuid:<id> format. |
| Bot responds to everyone in group | Set requireMention: true on the group. Bot only responds when @mentioned. |
| βnot authorizedβ error | Your ID isn't in allowFrom. Check format matches (e.g., +40 vs 40 for WhatsApp). |
openclaw doctor shows warnings | Fix each warning. Switch "open" to "pairing" or "allowlist" where possible. |