Presence states
Subscribe to presence updates
CallpresenceSubscribe with a chat JID to request that WhatsApp start sending you presence notifications for that chat. You then listen for the presence.update event to receive the data.
Full subscribe and listen pattern
Assumingsock was created elsewhere via makeWASocket(...):
For group chats,
presences is a map of individual participant JIDs to their presence data. For one-on-one chats, it will contain a single entry for the contact.Broadcast your own presence
UsesendPresenceUpdate to tell WhatsApp what you are currently doing. You can optionally scope it to a specific chat JID; omitting jid broadcasts to all open subscriptions.
WAPresence values are:
Receiving push notifications on the phone
When your Baileys client is marked asavailable, WhatsApp treats it as an active desktop session and suppresses push notifications to the paired phone. If you want the phone to keep receiving push notifications, mark your client as offline on connect:
unavailable presence after connecting: