Repository navigation
Conversation
…notifications By default, Baileys announces the client as 'available' on connect. WhatsApp treats any active online session as a desktop client and suppresses push notifications on the phone for all chats. Changing the initial presence update to 'unavailable' tells WhatsApp this is a background/passive linked device, restoring normal phone notification behavior without affecting gateway functionality. This matches the approach used by Beeper and is documented in Baileys: 'By default, Baileys sets your presence as online on connect. This will stop sending notifications to your phone.' Fixes: openclaw#30286
Greptile SummaryThis PR fixes a well-known Baileys/WhatsApp Web issue where announcing
Confidence Score: 5/5Safe to merge — minimal, well-reasoned change with correct tests and no regressions. The change is a single-line fix with clear documentation, matches the official Baileys guidance and an established precedent (Beeper), and both affected test files are updated consistently. No logic is altered beyond the initial presence announcement, and all downstream functionality (per-chat composing, read receipts, message delivery) remains intact. No files require special attention. Reviews (1): Last reviewed commit: "fix(whatsapp): send unavailable presence..." | Re-trigger Greptile |
This comment was marked as spam.
This comment was marked as spam.
|
Thanks for the PR and for working on this — the root cause analysis in #30286 was spot-on and directly informed the fix that landed. We checked the current main branch and implemented a targeted fix via #59410, which gates the connect-time presence on the existing selfChatMode flag: personal-phone setups (selfChatMode: true) now send "unavailable" to preserve phone notifications, while dedicated bot numbers keep "available" so the bot shows as online. This avoids both a new config field and a blanket behavior change for all users. Because #59410 covers this, I'm closing this PR as superseded. Thanks again for the work here. If you think this closure is mistaken and your PR still fixes something meaningfully different on current main, feel free to reopen or open a new PR with that explanation. |
Problem
When OpenClaw connects via WhatsApp Web (Baileys), it announces presence as
availableon connect. WhatsApp treats this as an active desktop session and suppresses all push notifications on the phone — not just chats the gateway is monitoring.This affects 100% of personal WhatsApp users running OpenClaw. Closes #30286.
Root cause
In
extensions/whatsapp/src/inbound/monitor.ts:Baileys documents this behavior explicitly:
Fix
Change the initial presence update to
unavailable:This tells WhatsApp the linked device is passive/background, restoring normal phone notification behavior. The gateway continues to receive and process all messages normally.
Precedent
Beeper (which also uses Baileys) applies exactly this fix — their users receive phone notifications normally while the bot remains connected.
Changes
extensions/whatsapp/src/inbound/monitor.ts: changeavailable→unavailablewith explanatory commentunavailableinstead ofavailableTesting
Manually verified: with this patch applied, phone notifications resume immediately after gateway restart while the WhatsApp channel continues to function normally.