What do OpenClaw's four `dmPolicy` values do, and why does `open` need `"*"` in `allowFrom`?
answer
- four values, one default
- code, block, admit, ignore
- the wildcard as an opt-in
- empty allowlist admits nobody
- pairing store read under pairing only
basics
~20 spairing (default) sends unknown senders a code to approve, allowlist blocks anyone not in allowFrom, open admits everyone, and disabled ignores all DMs. open is public only when allowFrom includes "*", so opening a bot is an explicit opt-in.
solid answer
~30 s`dmPolicy` is checked by the Gateway before a DM is processed. `pairing`, the default, gives unknown senders a code the operator approves; `allowlist` blocks anyone not in `allowFrom` with no handshake; `open` admits anyone; `disabled` ignores every inbound DM. `open` only becomes public when `allowFrom` includes `"*"`, and setup and validation require that wildcard, so a public bot is a deliberate choice; with concrete entries and no wildcard, only those senders get in. One trap: approvals made by pairing code are read only under `pairing`, so switching to `allowlist` cuts those senders off unless you copy them into `allowFrom` first.
code
json · 14 lines{
"channels": {
"telegram": {
"dmPolicy": "allowlist",
"allowFrom": ["123456789", "987654321"]
},
"whatsapp": {
"dmPolicy": "pairing"
},
"signal": {
"dmPolicy": "disabled"
}
}
}go deeper
Know the four values by name and that pairing is the default; be able to say which one blocks strangers silently.
Explain why open needs "*" in allowFrom, what an empty allowlist does, and which policy fits a personal bot versus a fixed team.
Call out the migration trap: pairing-store approvals are only read under pairing, so a policy change can cut users off; copy them into allowFrom first.
Treat the DM policy as part of the trust boundary: everyone admitted shares the agent's tools, so choose the policy together with what the agent can do.
## The four values of `dmPolicy` Every DM-capable OpenClaw channel has a `dmPolicy` (set at `channels.<channel>.dmPolicy`, or per account under `channels.<channel>.accounts.<id>`). It is checked by the Gateway before a direct message is processed, so it is an **enforcement** layer, not a hint to the model. | Value | What happens to a sender not already allowed | | --- | --- | | `pairing` (default) | Gets a pairing code; the message is ignored until the operator approves | | `allowlist` | Blocked, with no pairing handshake | | `open` | Admitted, but only when `allowFrom` includes `"*"` | | `disabled` | Every inbound DM is ignored, listed or not | The companion key is **`allowFrom`**: the channel's DM allowlist of sender IDs in that platform's format (phone numbers for WhatsApp, numeric user IDs for Telegram). Entries can also reference a reusable sender list with `accessGroup:<name>`, defined once under top-level `accessGroups`. ## When to choose each - **`pairing`** suits a personal assistant whose operator meets new contacts now and then: strangers can ask, nobody gets in unapproved. - **`allowlist`** suits a fixed, known set of people — a team, a family — written into reviewed config. There is no queue to watch and nothing for strangers to request. - **`open`** is for a deliberately public bot. It is an explicit opt-in, which is why the wildcard is required. - **`disabled`** suits an account that should only work in groups, or a channel you want to silence without unlinking it. ## Why `open` needs `"*"` `open` alone does not open anything. The bot is public only when the **effective DM allowlist includes `"*"`**, and setup and config validation require that wildcard for public-open configs. The point is to make "anyone on the internet can talk to my agent" something an operator types on purpose, not something a one-word typo produces. The runtime behaves consistently with that rule: 1. `open` with `"*"` in `allowFrom`: every sender is admitted. 2. `open` with concrete entries but no `"*"`: only those listed senders are admitted — the list keeps its narrowing effect. 3. Pairing-store approvals do **not** widen `open`. `openclaw security audit` reports open DMs as a finding of their own, so a public policy stays visible in reviews. ## The trap in `allowlist` `allowlist` with an empty `allowFrom` admits nobody. Validation flags it because every inbound DM would be dropped, but the subtler trap is a policy change on a running install: - Under `pairing`, senders you approved by code live in the Gateway's pairing store, separate from `openclaw.json`, and are honoured alongside `allowFrom`. - Under `allowlist` and `open`, the runtime does not consult the pairing store at all. So switching a channel from `pairing` to `allowlist` silently cuts off everyone who was admitted by code rather than written into `allowFrom`. Before you switch, copy those senders into `allowFrom` (or an access group). ## Per-account policies and shared lists A channel can carry several accounts — two WhatsApp numbers, a personal and a work Telegram bot. Each account can set its own `dmPolicy` and `allowFrom` under `channels.<channel>.accounts.<id>`. When an account leaves `allowFrom` unset it inherits the channel-level list, and the same rules apply to the result: an account on `open` still needs `"*"` in whichever list it ends up with, and an account on `allowlist` still needs at least one entry. Pairing approvals are keyed by channel **and** account, so a sender approved on the work bot is not thereby approved on the personal one. When the same trusted people should reach the bot on several channels, an **access group** avoids copying IDs around: - define it once under top-level `accessGroups` with `type: "message.senders"` and members keyed by channel; - reference it from any allowlist as `accessGroup:<name>`; - remember that the group grants nothing until an allowlist references it. ## What none of the four controls `dmPolicy` decides **who can trigger** the agent by direct message. It does not: - decide who can trigger it in groups — that is `groupPolicy` and the group allowlists; - separate one sender's conversation from another's — by default all DMs share the agent's main session, and per-sender isolation is a session setting; - limit what the agent can do once triggered — that is tool policy and the sandbox. Everyone you admit shares the agent's tool authority, and OpenClaw's trust model supports one operator or a mutually trusting team per Gateway. A wide DM policy on an agent with shell or file tools is therefore a security decision, not only a convenience setting.
- Why do Telegram allowFrom entries written as @username not work?Telegram sender allowlists match numeric user IDs only. `@username` entries do not match at runtime and the Gateway logs a warning; setup resolves usernames to IDs, so re-run setup or replace them by hand. A `telegram:` or `tg:` prefix on an ID is stripped and is fine.
- How do you keep the same trusted people allowed across WhatsApp, Telegram and Discord without repeating the list?Define a top-level `accessGroups` entry with `type: "message.senders"` and members keyed by channel, then reference it as `accessGroup:<name>` in each channel's `allowFrom` or `groupAllowFrom`. The group grants nothing by itself; it only matters where an allowlist references it.
- Setting dmPolicy to open makes the bot public even without a wildcard.
- Senders approved by pairing code keep access after switching to allowlist.
- An empty allowFrom under allowlist means anyone may message the bot.
- dmPolicy also decides who can trigger the bot in group chats.
- disabled only blocks strangers and still lets listed senders through.