src/gateway/channels/whatsapp/README.md
Chat with Dexter through WhatsApp by linking your phone to the gateway. Messages you send to yourself (self-chat) are processed by Dexter and responses are sent back to the same chat.
Link your WhatsApp account to Dexter by scanning a QR code:
bun run gateway:login
This will:
After linking, you'll be asked how you want to use Dexter:
Use your own WhatsApp to talk to Dexter by messaging yourself. The linked phone number is added to allowFrom and self-chat mode is activated automatically.
If Dexter has its own phone number (e.g. a separate SIM), choose this option and enter the phone number(s) allowed to message it. The gateway will be configured with dmPolicy: "allowlist" so other people can DM the bot.
Credentials are saved to .dexter/credentials/whatsapp/default/.
Start the gateway to begin receiving messages:
bun run gateway
You should see:
[whatsapp] Connected
Dexter gateway running. Press Ctrl+C to stop.
The gateway will now listen for incoming WhatsApp messages and respond using Dexter.
Once the gateway is running:
Example conversation:
You: What was NVIDIA's revenue in 2024?
Dexter: NVIDIA's revenue for fiscal year 2024 was $60.9 billion...
The gateway configuration is stored at .dexter/gateway.json. It's auto-created when you run gateway:login.
Self-chat configuration (personal phone, message yourself):
{
"gateway": {
"accountId": "default",
"logLevel": "info"
},
"channels": {
"whatsapp": {
"enabled": true,
"allowFrom": ["+1234567890"]
}
},
"bindings": []
}
Bot phone configuration (dedicated Dexter phone, others message it):
{
"gateway": {
"accountId": "default",
"logLevel": "info"
},
"channels": {
"whatsapp": {
"enabled": true,
"accounts": {
"default": {
"dmPolicy": "allowlist",
"allowFrom": ["+1555YOURNUM"],
"groupPolicy": "disabled",
"groupAllowFrom": []
}
},
"allowFrom": ["+1555YOURNUM"]
}
},
"bindings": []
}
Key settings:
| Setting | Description |
|---|---|
channels.whatsapp.allowFrom | Phone numbers allowed to message Dexter (E.164 format) |
channels.whatsapp.enabled | Enable/disable the WhatsApp channel |
accounts.<id>.dmPolicy | DM access policy: pairing (default), allowlist, open, or disabled |
accounts.<id>.allowFrom | Per-account allowed senders (overrides top-level allowFrom) |
gateway.logLevel | Log verbosity: silent, error, info, debug |
Dexter can participate in WhatsApp group chats, responding only when @-mentioned.
Add group policy to your account in .dexter/gateway.json:
{
"channels": {
"whatsapp": {
"enabled": true,
"accounts": {
"default": {
"groupPolicy": "open", // "open", "allowlist", or "disabled"
"groupAllowFrom": ["*"] // no need to list individual group members
}
},
"allowFrom": ["+1234567890"] // existing DM allowlist (unrelated to groups)
}
}
}
| Setting | Description |
|---|---|
groupPolicy | "open" (any group), "allowlist" (restricted), or "disabled" (default) |
groupAllowFrom | Which groups Dexter can participate in (["*"] for any) |
You don't need to list individual group members — when groupPolicy is "open", Dexter will respond to @-mentions from anyone in any group it's added to.
@ and select from the picker) to get a responseNote: You must use WhatsApp's @-mention picker (tap @ then select the contact) — typing a phone number manually won't trigger a response.
If you need to relink your WhatsApp (e.g., after logging out or switching phones):
rm -rf .dexter/credentials/whatsapp/default
bun run gateway:login
Gateway shows "Disconnected":
Messages not being received:
allowFrom in .dexter/gateway.jsonDebug logs:
.dexter/gateway-debug.log for detailed logsIf you're experiencing persistent issues (connection problems, encryption errors, messages not sending), perform a full reset:
Stop the gateway (Ctrl+C if running)
Unlink from WhatsApp:
Clear all local data:
rm -rf .dexter/credentials/whatsapp/default
rm -rf .dexter/gateway.json
rm -rf .dexter/gateway-debug.log
Relink and start fresh:
bun run gateway:login
Scan the QR code and start the gateway:
bun run gateway
This clears all cached credentials and encryption sessions, which resolves most connection issues.