Skip to content

feat(client): add sendPresenceUpdate to Client#201843

Open
dolav wants to merge 2 commits into
wwebjs:mainfrom
dolav:feat/send-presence-update
Open

feat(client): add sendPresenceUpdate to Client#201843
dolav wants to merge 2 commits into
wwebjs:mainfrom
dolav:feat/send-presence-update

Conversation

@dolav

@dolav dolav commented Jul 16, 2026

Copy link
Copy Markdown

Description

This PR adds a sendPresenceUpdate(chatId, state) method directly to the Client to allow sending presence states (like 'typing' or 'recording') without needing to fetch the full Chat object from the database first.

Currently, users must run client.getChatById(chatId).then(chat => chat.sendStateTyping()). This forces an IndexedDB lookup for the chat, which is incredibly slow and notoriously causes Chromium database locks and crashes in headless Docker/Cloud VM environments with strict --shm-size or volume limits. By exposing the direct internal window.WWebJS.sendChatstate call, we can natively bypass the DB overhead entirely.

Related Issue(s)

Testing Summary

Test Details

  • Wrote a new Mocha test suite under Presence Updates in tests/client.js.
  • Verified sendPresenceUpdate(remoteId, 'typing') evaluates successfully in the Puppeteer context and correctly dispatches the chatstate packet natively.
  • Ensured ESLint and Prettier auto-formatters pass cleanly.
  • Regenerated JSdocs using the npm run generate-docs command to include the new method.

Environment

  • Machine OS: macOS 15.0 / Ubuntu 24.04 (Docker)
  • Phone OS: Android 16
  • Library Version: 1.34.7
  • WhatsApp Web Version:
  • Browser Type and Version: Default Puppeteer Chromium
  • Node Version: 18.20.8

Type of Change

  • Dependency change (package changes such as removals, upgrades, or additions)
  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Non-code change (documentation, README, etc.)

Checklist

  • My code follows the style guidelines of this project.
  • All new and existing tests pass (npm test).
  • Typings (e.g. index.d.ts) have been updated if necessary.
  • Usage examples (e.g. example.js) / documentation have been updated if applicable.

@github-actions github-actions Bot added docs Documentation changes api changes API modifications typings Type definitions tests Test related labels Jul 16, 2026
@dolav dolav changed the title Feat/send presence update feat(client): add sendPresenceUpdate to Client Jul 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api changes API modifications docs Documentation changes tests Test related typings Type definitions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant