Registry / messaging / baileys-xpro

baileys-xpro

JSON →
library8.4.3jsnpmunverified

Baileys XPRO is a fork of the Baileys WhatsApp WebSocket library for Node.js, providing an unofficial API to interact with WhatsApp Web. Current stable version is 8.4.3, updated on an ad-hoc basis following WhatsApp's changes. It supports multi-device and uses WebSocket connections, protobuf serialization, and media handling. Compared to other WhatsApp libraries, it is more up-to-date with WhatsApp's protocol and supports newer features, but compatibility with upstream Baileys APIs is not guaranteed.

npm install baileys-xpro
INSTALL
IMPORT
SIG · BAILEYS-XPRO
B
baileys-xpro
messagingjavascriptv8.4.3
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import makeWASocket from 'baileys-xpro'
const { default: makeWASocket } = require('baileys-xpro')
Primary function to create a WhatsApp socket; ESM default import works, but some users try named import.
Browsers
import { Browsers } from 'baileys-xpro'
import Browsers from 'baileys-xpro'
Browsers is a named export containing browser configurations; common mistake is default import.
makeWASocket
const { makeWASocket } = require('baileys-xpro')
const makeWASocket = require('baileys-xpro')
In CommonJS, destructure the named export; using require directly gives the whole module.

Connects to WhatsApp using multi-file auth, logs QR code, listens for messages, and replies with a greeting.

import makeWASocket, { useMultiFileAuthState, DisconnectReason } from 'baileys-xpro'; async function startBot() { const { state, saveCreds } = await useMultiFileAuthState('auth_info'); const sock = makeWASocket({ auth: state, printQRInTerminal: true }); sock.ev.on('creds.update', saveCreds); sock.ev.on('messages.upsert', async ({ messages }) => { const msg = messages[0]; if (!msg.key.fromMe && msg.message?.conversation) { await sock.sendMessage(msg.key.remoteJid, { text: 'Hello!' }); } }); sock.ev.on('connection.update', ({ connection, lastDisconnect }) => { if (connection === 'close') { const shouldReconnect = lastDisconnect?.error?.output?.statusCode !== DisconnectReason.loggedOut; if (shouldReconnect) startBot(); } }); } startBot();
Debug
Known issues
breakingVersion 8.0.0 removed support for Node.js <20.0.0.
fix
Update Node.js to version 20.0.0 or later.
affects: >=8.0.0
breakingThe default export changed from a class to a function in version 6.0.0.
fix
Use makeWASocket() instead of new Baileys()
affects: >=6.0.0
deprecateduseSingleFileAuthState is deprecated; use useMultiFileAuthState instead.
fix
Replace useSingleFileAuthState with useMultiFileAuthState.
affects: >=7.0.0
gotchaThe library may be blocked by WhatsApp if used too aggressively; respect rate limits.
fix
Implement proper message sending delays and avoid spamming.
affects: >=0.0.0
gotchajimp is a required peer dependency; missing it causes image processing to fail silently.
fix
Install jimp (npm install jimp) and ensure it is in your project's dependencies.
affects: >=8.0.0
Errors
Common errors & fixes
Cannot find module 'baileys-xpro'
Package not installed or npm registry is incorrect (fork vs upstream).
fix
npm install baileys-xpro or check package name spelling.
TypeError: makeWASocket is not a function
Attempting to use a named import as a default export.
fix
Use import makeWASocket from 'baileys-xpro' (not { makeWASocket })
Error: QR code scan timed out
Not scanning QR code within the timeout period.
fix
Increase timeout or ensure you scan the QR quickly.
Upgrade
Version history
8.4.3latest on npm
Audit
Dependencies
link-preview-jsoptionalRequired for generating link previews in messages.
audio-decodeoptionalRequired for decoding audio messages.
jimprequiredRequired for image processing, e.g., thumbnails.
Agent activity
29 hits · last 30 days
node
28
OpenAI (training)
1
Resources
baileys-xpro — npm install baileys-xpro · libregistry