@anuragwhatsapppapi22/whatsapp-api
v1.0.0
Published
A WebSockets based WhatsApp Web API by Anurag Mishra (rebranded fork of Baileys) for building bots and automations.
Downloads
126
Maintainers
Readme
@anuragmishra/whatsapp-api
A WebSockets based WhatsApp Web API by Anurag Mishra for building bots, automations and integrations on top of WhatsApp.
This package is a rebranded fork of the excellent Baileys library by Rajeh Taher / WhiskeySockets, repackaged and maintained by Anurag Mishra for personal and project use. Full credit for the original implementation goes to the Baileys team.
✨ Features
- Connects to WhatsApp Web directly via WebSockets — no Selenium / Puppeteer / Chromium required, so it is fast and lightweight.
- Multi-device login via QR code or pairing code.
- Send & receive text, images, videos, audio, documents, stickers, contacts, locations.
- Group create / update / participants management.
- Status (story) viewing & posting.
- Reactions, polls, read receipts, typing & presence updates.
- Newsletters / channels support.
- Pluggable auth state (multi-file, custom store) and signal key store.
- Fully typed in TypeScript.
📦 Installation
npm install @anuragmishra/whatsapp-api
# or
yarn add @anuragmishra/whatsapp-api
# or
pnpm add @anuragmishra/whatsapp-apiRequires Node.js >= 20.
Optional peer dependencies
Depending on what you use, install:
npm install sharp jimp link-preview-js audio-decode🚀 Quick Start
import makeWASocket, {
DisconnectReason,
useMultiFileAuthState,
fetchLatestBaileysVersion
} from '@anuragmishra/whatsapp-api'
import { Boom } from '@hapi/boom'
async function startBot() {
const { state, saveCreds } = await useMultiFileAuthState('auth_info')
const { version } = await fetchLatestBaileysVersion()
const sock = makeWASocket({
version,
auth: state,
printQRInTerminal: true
})
sock.ev.on('creds.update', saveCreds)
sock.ev.on('connection.update', (update) => {
const { connection, lastDisconnect } = update
if (connection === 'close') {
const shouldReconnect =
(lastDisconnect?.error as Boom)?.output?.statusCode !==
DisconnectReason.loggedOut
console.log('connection closed, reconnecting:', shouldReconnect)
if (shouldReconnect) startBot()
} else if (connection === 'open') {
console.log('✅ Connected to WhatsApp')
}
})
sock.ev.on('messages.upsert', async ({ messages }) => {
const msg = messages[0]
if (!msg.message || msg.key.fromMe) return
const text =
msg.message.conversation || msg.message.extendedTextMessage?.text || ''
if (text.toLowerCase() === 'ping') {
await sock.sendMessage(msg.key.remoteJid!, { text: 'pong 🏓' })
}
})
}
startBot()📤 Sending messages
// Text
await sock.sendMessage(jid, { text: 'Hello from Anurag Mishra WA API!' })
// Image
await sock.sendMessage(jid, {
image: { url: './photo.jpg' },
caption: 'Look at this 📸'
})
// Document
await sock.sendMessage(jid, {
document: { url: './report.pdf' },
mimetype: 'application/pdf',
fileName: 'report.pdf'
})
// Reply
await sock.sendMessage(jid, { text: 'reply!' }, { quoted: originalMsg })
// Reaction
await sock.sendMessage(jid, {
react: { text: '🔥', key: originalMsg.key }
})👥 Group helpers
const group = await sock.groupCreate('My Group', ['[email protected]'])
await sock.groupParticipantsUpdate(group.id, ['[email protected]'], 'add')
await sock.groupUpdateSubject(group.id, 'New Group Name')🔐 Auth — pairing code (no QR)
const sock = makeWASocket({ auth: state })
if (!sock.authState.creds.registered) {
const code = await sock.requestPairingCode('9198xxxxxxxx')
console.log('Pairing code:', code)
}⚠️ Disclaimer
- This library is NOT affiliated with, endorsed by, or sponsored by WhatsApp / Meta.
- Using unofficial WhatsApp clients can violate WhatsApp's Terms of Service. Your number may be banned if it is used for spam or abuse.
- Use at your own risk. For business / production grade messaging, prefer the official WhatsApp Business Cloud API by Meta.
- This is a personal rebrand by Anurag Mishra of the open-source Baileys library, distributed under the same MIT license.
🙏 Credits
Massive thanks to:
- Rajeh Taher and the WhiskeySockets/Baileys team — the entire protocol implementation is theirs.
- The original @adiwajshing/Baileys authors who started it all.
📝 License
MIT © 2026 Anurag Mishra Originally based on Baileys © 2025 Rajeh Taher / WhiskeySockets.
