wwebjs/whatsapp-web.js

Node.js WhatsApp client driving WhatsApp Web via Puppeteer

JavaScriptโ˜… 23.0k๐Ÿ’ฌ WhatsApp & Chatbots

What

Unofficial library that logs into WhatsApp Web in a headless browser and exposes events and methods for messages, media, groups and more.

How to use

javascript
// npm i whatsapp-web.js qrcode-terminal
const { Client, LocalAuth } = require('whatsapp-web.js');
const qrcode = require('qrcode-terminal');

const client = new Client({ authStrategy: new LocalAuth() });
client.on('qr', (qr) => qrcode.generate(qr, { small: true }));
client.on('message', (msg) => { if (msg.body === '!ping') msg.reply('pong'); });
client.initialize();

Reach for it when

Quick WhatsApp bots or automations in Node. Unofficial, so accounts can be banned; use the Cloud API for production.