DepayDev Baileys

A high-performance, feature-rich WebSockets library for interacting with WhatsApp Web, maintained by DepayDev.\
Built on top of Baileys with extended support for LID JIDs, interactive buttons, newsletters, native media processing, and custom helper methods.
Key Features
- Modern WhatsApp Protocol: Full support for
@lid JIDs, newsletter channels, and noSelfSync.
- Enhanced Pairing: Stable pairing code generation with custom pairing code support.
- Rich Interactive Messages: Native flow buttons, carousels, product catalogs, payment requests, and sticker packs.
- Built-in Helpers: Simplified socket methods for reactions, message editing, revoking, type detection, and group labeling.
- Zero-Temp Media Utilities: Fast image resizing, format conversion, sticker creation, compression, and metadata extraction via
sharp and ffmpeg.
- Flexible Storage: Includes in-memory store persistence and lazy-loaded SQLite auth state (
Node 22.5+).
Installation
Requires Node.js 20+ (ESM-only package).
npm install @depaynika/baileys
Or install directly via GitHub:
npm install github:depaynika/Baileys
Package Alias (Drop-in Replacement):
If you are migrating from @whiskeysockets/baileys, alias the package in your package.json:
"dependencies": {
"@whiskeysockets/baileys": "npm:@depaynika/baileys"
}
Import
ESM:
import makeWASocket, { Browsers, DisconnectReason, fetchLatestWaWebVersion } from '@depaydev/baileys';
CommonJS (Node.js 20.19+ / 22.12+):
const { default: makeWASocket, Browsers } = require('@depaynika/baileys');
Connecting to WhatsApp
Using Pairing Code
async function connectToWhatsApp() {
const { version } = await fetchLatestWaWebVersion();
const sock = makeWASocket({
browser: Browsers.ubuntu('Chrome'),
printQRInTerminal: false,
version,
aiLabel: false
});
if (!sock.authState.creds.registered) {
const phoneNumber = '628XXXXXXXXXX';
const code = await sock.requestPairingCode(phoneNumber.trim()); // Optional 2nd param: custom 8-char code
console.log('Pairing Code:', code);
}
}
connectToWhatsApp();
Using QR Code
const sock = makeWASocket({
browser: Browsers.ubuntu('Chrome')
});
sock.ev.on('connection.update', ({ connection, qr }) => {
if (qr) console.log('QR String:', qr);
if (connection === 'open') console.log('Connected to WhatsApp');
});
Socket Helper Methods
| Method |
Description |
Example |
sock.delay(sec) |
Pause execution for $N$ seconds |
await sock.delay(3) |
sock.react(m, emoji) |
React to a message |
await sock.react(m, '👍') |
sock.unreact(m) |
Remove reaction from a message |
await sock.unreact(m) |
sock.edit(m, text) |
Edit your previously sent message |
await sock.edit(m, 'Updated text') |
sock.del(m) |
Revoke/delete a message |
await sock.del(m) |
sock.detect(m) |
Detect normalized message type |
const type = sock.detect(m) |
sock.setLabelGroup(jid, label) |
Set member label in a group |
await sock.setLabelGroup(jid, 'VIP') |
sock.cekIDSaluran(url) |
Fetch newsletter metadata & ID from URL |
await sock.cekIDSaluran(url) |
sock.newsletterMultipleFollow(jids) |
Follow multiple newsletters (space-separated) |
await sock.newsletterMultipleFollow('id1@newsletter id2@newsletter') |
sock.checkBanned(jid) |
Check account restriction/ban status |
await sock.checkBanned(jid) |
Sending Messages
Silent Send (noSelfSync)
Prevent 1-on-1 messages from syncing to your other linked devices:
await sock.sendMessage(jid, { text: 'Silent message' }, { noSelfSync: true });
Interactive & Native Flow Buttons
await sock.sendMessage(jid, {
interactiveMessage: {
header: 'Header Title',
title: 'Main Title',
footer: 'DepayDev',
image: { url: 'https://example.com/banner.jpg' },
buttons: [
{
name: 'cta_copy',
buttonParamsJson: JSON.stringify({
display_text: 'Copy Code',
id: 'copy_1',
copy_code: 'DEPAYDEV2026'
})
},
{
name: 'cta_url',
buttonParamsJson: JSON.stringify({
display_text: 'Visit Website',
url: 'https://example.com'
})
}
]
}
}, { quoted: m });
Carousel Message
await sock.sendMessage(jid, {
text: 'Body Message',
title: 'Title Message',
footer: 'DepayDev',
cards: [
{
image: { url: 'https://example.com/card1.jpg' },
title: 'Card 1',
body: 'Description 1',
footer: 'Footer 1',
buttons: [
{
name: 'quick_reply',
buttonParamsJson: JSON.stringify({ display_text: 'Select', id: 'card_1' })
}
]
}
]
}, { quoted: m });
Album, Event, Poll Result & Product Messages
// Album (Multiple Media)
await sock.sendMessage(jid, {
albumMessage: [
{ image: buffer, caption: 'First image' },
{ image: { url: 'https://example.com/2.jpg' }, caption: 'Second image' }
]
}, { quoted: m });
// Event Invitation
await sock.sendMessage(jid, {
eventMessage: {
isCanceled: false,
name: 'Community Meetup',
description: 'Hosted by DepayDev',
startTime: '1763019000',
endTime: '1763026200',
extraGuestsAllowed: false
}
}, { quoted: m });
// Poll Result Snapshot
await sock.sendMessage(jid, {
pollResultMessage: {
name: 'Poll Results',
pollVotes: [
{ optionName: 'Option A', optionVoteCount: '150' },
{ optionName: 'Option B', optionVoteCount: '45' }
]
}
}, { quoted: m });
// Product Catalog
await sock.sendMessage(jid, {
productMessage: {
title: 'Sample Product',
description: 'Product description',
thumbnail: { url: 'https://example.com/product.jpg' },
productId: 'PROD001',
retailerId: 'RETAIL001',
priceAmount1000: 50000,
currencyCode: 'IDR',
buttons: [
{
name: 'cta_url',
buttonParamsJson: JSON.stringify({ display_text: 'Buy Now', url: 'https://example.com/buy' })
}
]
}
}, { quoted: m });
Sticker Pack & Group Status
// Sticker Pack
await sock.sendMessage(jid, {
stickerPack: {
name: 'DepayDev Pack',
publisher: 'DepayDev',
description: 'Custom stickers',
cover: { url: 'https://example.com/cover.png' },
stickers: [
{ sticker: fs.readFileSync('./sticker1.webp'), emojis: ['😎'] },
{ sticker: fs.readFileSync('./sticker2.webp'), isAnimated: true }
]
}
}, { quoted: m });
// Group Status V2 & Status Mention
await sock.sendMessage(jid, { groupStatusMessage: { text: 'Group Status Update' } });
await sock.sendStatusMention({ text: 'Mentioned in status' }, jid);
Media Utilities
Built-in media processing powered by sharp and ffmpeg streams without creating temporary files:
// Resize image (preserves aspect ratio)
const resized = await sock.resize(buffer, 200, 200);
// Convert format ('jpeg', 'jpg', 'png', 'webp', 'mp3', 'mp4')
const mp4 = await sock.convert(buffer, { to: 'mp4' });
const mp3 = await sock.convert(buffer, { to: 'mp3' });
// Convert image to 512x512 WebP WhatsApp sticker
const sticker = await sock.toSticker(buffer, { quality: 90 });
// Compress image or video
const compressed = await sock.compress(buffer, { quality: 50 });
// Extract media metadata
const info = await sock.metadata(buffer);
Important Implementation Notes
- JID Handling: Always reply to
msg.key.remoteJid directly. In private chats, this may use the @lid format while the standard phone number JID is available in msg.key.remoteJidAlt.
- Group Senders: Group message senders are located in
msg.key.participant (with alternative format in msg.key.participantAlt).
- Device Resolution: If
relayMessage cannot resolve any active devices for a recipient, it throws a 421 error instead of failing silently.
Maintainer & Credits
- Maintained by: DepayDev
- Upstream Base: Forked from WhiskeySockets/Baileys, originally created by Adhiraj Singh.
Disclaimer
This project is not affiliated with, authorized, maintained, sponsored, or endorsed by WhatsApp or any of its affiliates. Use of this library to send automated, bulk, or unsolicited messages may violate WhatsApp's Terms of Service and result in account suspension. Use responsibly.