pedroslopez /whatsapp-web.js

A WhatsApp client library for NodeJS that connects through the WhatsApp Web browser app

★ 22,883⑂ 5,200
JavaScriptCreated 2019-02-17wwebjs.dev
22,883
stars
+32+41+176
5,200
forks
–
watchers
–
prs
–
issues
–
releases
–
discussions

README

About

whatsapp‑web.js is a powerful [Node.js][nodejs] library that lets you interact with WhatsApp Web, making it easy to build a dynamic WhatsApp API with nearly all features of the web client. It uses [Puppeteer][puppeteer] to access WhatsApp Web’s internal functions and runs them in a managed browser instance to reduce the risk of being blocked.

 Links

- [GitHub][gitHub]
- [Guide][guide] ([source][guide-source])
- [Documentation][documentation] ([source][documentation-source])
- [Discord Server][discord]
- [npm][npm]

 Installation

Node.js v18.0.0 or higher, is required.

sh
npm install whatsapp-web.js
yarn add whatsapp-web.js
pnpm add whatsapp-web.js


Having trouble installing? Take a peak at the [Guide][guide] for more detailed instructions.

 Example usage

js
const { Client } = require('whatsapp-web.js');
const qrcode = require('qrcode-terminal');

const client = new Client();

client.on('qr', (qr) = {
    qrcode.generate(qr, { small: true });
});

client.on('ready', () = {
    console.log('Client is ready!');
});

client.on('message', (msg) = {
    if (msg.body == '!ping') {
        msg.reply('pong');
    }
});

client.initialize();


Take a look at [example.js][examples] for additional examples and use cases.  
For more details on saving and restoring sessions, check out the [Authentication Strategies][auth-strategies].

 Supported features

| Feature                                          | Status                                       |
| ------------------------------------------------ | -------------------------------------------- |
| Multi Device                                     | ✅                                           |
| Send messages                                    | ✅                                           |
| Receive messages                                 | ✅                                           |
| Send media (images/audio/documents)              | ✅                                           |
| Send media (video)                               | ✅ [(requires Google Chrome)][google-chrome] |
| Send stickers                                    | ✅                                           |
| Receive media (images/audio/video/documents)     | ✅                                           |
| Send contact cards                               | ✅                                           |
| Send location                                    | ✅                                           |
| Send buttons                                     | ❌ [(DEPRECATED)][deprecated-video]          |
| Send lists                                       | ❌ [(DEPRECATED)][deprecated-video]          |
| Receive location                                 | ✅                                           |
| Message replies                                  | ✅                                           |
| Join groups by invite                            | ✅                                           |
| Get invite for group              

Snapshot: 2026-11-10T09:35:25Z · Data license Apache-2.0 · JSON