WA-JS can be built and tested locally against any WhatsApp Web version listed in theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/wppconnect-team/wa-js/llms.txt
Use this file to discover all available pages before exploring further.
@wppconnect/wa-version package. This is the primary workflow for adding new features, fixing bindings that break after a WhatsApp update, and verifying that patches work across multiple WA versions before shipping a release.
Prerequisites
- Node.js 24 — the repository pins this version in
.nvmrc. Usenvm installto switch to it automatically if you have nvm installed. - npm — bundled with Node.js.
Build commands
WA-JS is bundled by Webpack into a single UMD file atdist/wppconnect-wa.js. Three build modes are available:
build:dev while iterating on a fix. Source maps make stack traces readable in the browser’s DevTools. Switch to build:prd before opening a pull request or testing final behaviour.
Launching a local browser session
After building, inject the local bundle into a real WhatsApp Web tab:https://web.whatsapp.com/ and injects dist/wppconnect-wa.js automatically on every page load. The browser caches WhatsApp’s source bundles inside the wa-source/ directory for later inspection.
Targeting a specific WhatsApp Web version
Pass theWA_VERSION environment variable to load a particular version:
Downloading and inspecting WA source bundles
WA-JS reads WhatsApp’s internal module names and function signatures from the source bundles distributed by WhatsApp. Thewa-source:populate script downloads and caches these bundles locally:
Comparing WhatsApp Web versions
When a binding breaks after a WA update, the quickest way to find what changed is to diff the two versions side by side:wa-source:populate and formatted with wa-source:format before the script can compare them. The script shows modules that exist only in the older version, modules that are new in the newer version, and a diff of a specific module when one is named.
Running tests
WA-JS ships a Playwright test suite undertests/. Smoke tests run unauthenticated and catch the most common breakage — a WhatsApp update renames or removes a module that WA-JS patches:
loggedPage fixture. Bootstrap the session once by running:
wa-js-test-<browser>) and reused by all subsequent npm test runs without requiring another scan.
Linting
The project uses ESLint with strict TypeScript rules, Prettier formatting, and enforced import ordering:lint-staged also runs ESLint automatically on staged .ts files, but running it explicitly first gives you the full output in one go.
Debugging a broken binding
When aWPP.* function stops working after a WhatsApp Web update, the root cause is almost always one of three things:
- The function was moved to a different internal module.
- The function was renamed.
- Arguments changed from positional to named parameters, or vice versa.
Identify the target version
Find the WhatsApp Web version that introduced the regression. Check the
@wppconnect/wa-version release notes or compare the versions that pass and fail in CI.Download and format both versions
Download the bundles for the working version and the broken version, then format them both:
Compare the module
Use the compare script to diff the specific internal module that the broken WA-JS binding wraps:The diff shows exactly what changed between the two versions of that module.
Update the binding in src/whatsapp/
WA-JS low-level bindings live in
src/whatsapp/. Find the file that imports the function that changed and update the module name, function name, or argument mapping to match the new WA version.Test against both versions
Run
build:dev and launch locally against both the old and new WA version to confirm the fix works on both:Fixes must work across all WhatsApp Web versions still listed in
node_modules/@wppconnect/wa-version/html/, not just the latest one. If a workaround is only needed for older versions, mark it with a TODO comment so it can be cleaned up once those versions are retired.Generating API docs
TypeDoc generates the public API reference from TypeScript source:docs/ directory. Run this after adding or changing JSDoc comments on exported functions.