TamperMonkey and GreaseMonkey are browser extensions that run userscripts on pages you visit. Because they let you load external JavaScript before a page’s own scripts run, they are the fastest way to get WA-JS into WhatsApp Web without installing Node.js or building anything locally. Write your automation logic once, and it runs every time you openDocumentation 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.
web.whatsapp.com.
Prerequisites
Install one of these extensions in your browser before continuing:- TamperMonkey — Chrome, Firefox, Edge, Safari
- GreaseMonkey — Firefox only
The userscript
The following script is the minimal working example from the WA-JS README. Copy it exactly into a new userscript in TamperMonkey or GreaseMonkey:Header field reference
Each// @field line in the ==UserScript== block controls how and where the script runs:
| Field | Purpose |
|---|---|
@name | Display name shown in the TamperMonkey dashboard. |
@namespace | A unique URI that scopes the script. The value is arbitrary but must be present. |
@version | Script version. Increment this when you update the script so TamperMonkey detects the change. |
@description | Short description shown in the dashboard. |
@author | Your name or handle. |
@match | URL pattern where the script is injected. https://web.whatsapp.com/* covers every path on the WhatsApp Web domain. |
@icon | Icon shown in the TamperMonkey popup. |
@require | URL of an external script to load before your code runs. This is where WA-JS is pulled in. |
@grant | Grants access to TamperMonkey APIs. none runs the script in the page’s own context, which is required so your code shares the same window.WPP object. |
Using @require with a pinned version
The example above uses the nightly tag, which always resolves to the latest build. For a production userscript, pin a specific release to prevent unexpected breakage when a new version ships:
4.3.0 with the version you want. You can find all release tags on the GitHub releases page.
Installing and running the script
Open the TamperMonkey dashboard
Click the TamperMonkey icon in your browser toolbar, then select Dashboard.
Paste the userscript
Delete the placeholder content and paste the userscript from the section above. Replace the
alert inside WPP.loader.onReady with your own logic.Working with the WPP object
Inside WPP.loader.onReady, the full WPP API is available. Replace the alert in the example with real logic:
Common use cases
Userscripts are well suited for lightweight, browser-local automation:- Auto-responders — listen for
chat.new_messageand reply to specific keywords withWPP.chat.sendTextMessage. - Message logging — write incoming messages to
localStorageorIndexedDBfor later review. - Quick API exploration — run
Object.keys(WPP.chat).sort()in the DevTools console while the script is active to see every available function. - UI enhancements — inject custom buttons or styles into the WhatsApp Web interface alongside WA-JS calls.
Because the userscript runs inside the browser page, all data stays on your machine. Nothing is sent to an external server unless your own code does so explicitly.