Skip to content

fix(whatsapp): send unavailable presence on connect to restore phone notifications - #58122

Closed
Hajir2005 wants to merge 1 commit into
openclaw:mainfrom
Hajir2005:fix/whatsapp-presence-unavailable-phone-notifications
Closed

Hajir2005 wants to merge 1 commit into
openclaw:mainfrom
Hajir2005:fix/whatsapp-presence-unavailable-phone-notifications

Conversation

@Hajir2005

Copy link
Copy Markdown

Problem

When OpenClaw connects via WhatsApp Web (Baileys), it announces presence as available on 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:

await sock.sendPresenceUpdate("available"); // ← suppresses phone notifications

Baileys documents this behavior explicitly:

"By default, Baileys sets your presence as online on connect. This will stop sending notifications to your phone."

Fix

Change the initial presence update to unavailable:

await sock.sendPresenceUpdate("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: change available → unavailable with explanatory comment
  • Two test files updated to assert unavailable instead of available

Testing

Manually verified: with this patch applied, phone notifications resume immediately after gateway restart while the WhatsApp channel continues to function normally.

…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
@openclaw-barnacle openclaw-barnacle Bot added channel: whatsapp-web Channel integration: whatsapp-web size: XS labels Mar 31, 2026
@greptile-apps

greptile-apps Bot commented Mar 31, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes a well-known Baileys/WhatsApp Web issue where announcing available presence on connect causes WhatsApp servers to suppress push notifications on the phone. The fix changes the single initial sendPresenceUpdate call from "available" to "unavailable", matching the documented Baileys recommendation and Beeper's established precedent.

  • Core change (extensions/whatsapp/src/inbound/monitor.ts): sendPresenceUpdate("available") → sendPresenceUpdate("unavailable") with a thorough inline comment linking to issue [Bug]: WhatsApp personal number connection (Baileys) announces online presence on connect, suppressing all phone push notifications #30286.
  • Tests updated: Both monitor-inbox.streams-inbound-messages.test.ts and monitor-inbox.captures-media-path-image-messages.test.ts are updated to assert "unavailable" instead of "available".
  • No functional regression: Per-chat "composing" presence updates, read receipts, message receipt, and all other gateway behavior are unaffected — only the global on-connect announcement changes.
  • The verbose log strings are kept accurate with the new value.

Confidence Score: 5/5

Safe 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

@byungsker

This comment was marked as spam.

@mcaxtr

mcaxtr commented Apr 2, 2026

Copy link
Copy Markdown
Member

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.

@mcaxtr mcaxtr closed this Apr 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: whatsapp-web Channel integration: whatsapp-web size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: WhatsApp personal number connection (Baileys) announces online presence on connect, suppressing all phone push notifications

3 participants