WhatsApp Web API Library Modification By DanuZz





Baileyz is a cutting-edge, open-source Node.js library for seamless WhatsApp automation and integration. Built on WebSocket technology, it bypasses browser dependencies to deliver lightweight, high-performance connections. Ideal for developers crafting bots, chat automations, customer service platforms, and dynamic communication tools, Baileyz empowers you with robust message handling, group management, interactive elements, and secure multi-device support.
Actively maintained with a focus on stability, security, and extensibility, Baileyz evolves alongside WhatsApp's ecosystem. Customize pairing with proprietary codes for uninterrupted sessions, and leverage modular design for effortless integration into any stackβbe it Express servers, serverless functions, or microservices.
> Developer: @DanuZz | Repository: npmjs.com/package/baileyz
---
- Advanced Pairing & Authentication: Auto-pairing with custom codes; resolves legacy disconnection issues for rock-solid reliability.
- Interactive Messaging Suite: Native support for action buttons, dynamic menus, polls, events, and limited-time offers.
- Multi-Device Compatibility: Fully aligned with WhatsApp's latest multi-device betaβscale across phones and desktops.
- Session Management: Intelligent auto-save/load for persistent, crash-resistant operations.
- Media & Content Handling: Albums, documents (buffer-only), thumbnails, and product catalogs with seamless embedding.
- Utility Functions: Channel ID extraction, ban checks, payment requests, and more for streamlined workflows.
- Lightweight & Modular: Minimal footprint (~X KB gzipped); extend via plugins or hooks.
- TypeScript Ready: Full typings for type-safe development; ES modules and CommonJS support.
---
Install via npm, yarn, or pnpm:
``bash`
npm install baileyzor
yarn add baileyzor
pnpm add baileyz
Requirements:
- Node.js β₯ 18.x
- No additional dependencies for core functionality (optional: qrcode-terminal for QR pairing).
---
1. Initialize the Socket:
`javascript
import makeWASocket from 'baileyz';
import { useMultiFileAuthState } from 'baileyz/lib/Utils/auth';
const startSock = async () => {
const { state, saveCreds } = await useMultiFileAuthState('auth_info_baileys');
const sock = makeWASocket({
auth: state,
printQRInTerminal: true, // Set to false for custom QR handling
syncFullHistory: false, // Optimize for production
});
sock.ev.on('creds.update', saveCreds);
sock.ev.on('connection.update', (update) => {
const { connection, lastDisconnect } = update;
if (connection === 'close') {
const shouldReconnect = (lastDisconnect?.error)?.output?.statusCode !== DisconnectReason.loggedOut;
console.log('Connection closed due to ', lastDisconnect?.error, ', reconnecting ', shouldReconnect);
if (shouldReconnect) startSock(); // Auto-reconnect
} else if (connection === 'open') {
console.log('β
Connected to WhatsApp');
}
});
return sock;
};
const sock = await startSock();
`
2. Send a Basic Message:
`javascript`
const jid = 'recipient@s.whatsapp.net';
await sock.sendMessage(jid, { text: 'Hello from Baileyz!' });
---
| Category | Description |
|---|---|
|channels | Seamlessly send messages to WhatsApp Channels. |
| π±οΈ Buttons | Create interactive messages with button options and quick replies. |
| πΌοΈ Albums | Send grouped images or videos as an album (carousel-like format). |
| π€ LID Grouping | Handle group operations using the latest @lid addressing style. |
| π€ AI Message Style | Add a stylized βAIβ icon to messages. |
| π· HD Profile Pics | Upload full-size profile pictures without cropping. |
| π Pairing Code | Generate custom alphanumeric pairing codes. |
| π οΈ Dev Experience | Reduced noise from logs with optimized libsignal printouts. |
---
`js
// Create a newsletter
await sock.newsletterCreate("Mova Update");
// Update description
await sock.newsletterUpdateDescription(
"1234XXXX@newsletter",
"YOO updates come daily"
);
// React to a channel message
await sock.newsletterReactMessage(
"1234XXXX@newsletter",
"192",
"π"
);
`
---
`js
const buttons = [
{ buttonId: "btn1", buttonText: { displayText: "Click Me" }, type: 1 },
{ buttonId: "btn2", buttonText: { displayText: "Visit Site" }, type: 1 }
];
await sock.sendMessage(id, {
text: "Choose one:",
footer: "Mova - Nest | Lk",
buttons,
headerType: 1
});
`
---
`js
const media = [
{ image: { url: "https://example.com/pic1.jpg" } },
{ video: { url: "https://example.com/clip.mp4" } }
];
await sock.sendMessage(
id,
{ album: media, caption: "Memories π«" }
);
`
---
`js
const code = await sock.requestPairingCode("94XXXXXXXX","THANKUU1");
console.log("Pairing Code:", code);
`
---
`js`
await sock.sendMessage(id, {
poll: {
name: "Favorite Color?",
values: ["Red", "Blue", "Green"],
selectableCount: 1
}
});
---
`js`
await sock.sendMessage(id, {
location: {
degreesLatitude: 37.422,
degreesLongitude: -122.084,
name: "Googleplex",
address: "1600 Amphitheatre Pkwy, Mountain View"
}
});
---
`js
const group = await sock.groupCreate(
"My New Group",
[number1, number2]
);
await sock.groupAdd(group.id, [number3]);
await sock.groupUpdateDescription(
group.id,
"This is our awesome group!"
);
`
#### Get Newsletter/Channel ID
Extracts the ID from a WhatsApp channel URL.
`javascript`
const channelId = await sock.newsletterId('https://whatsapp.com/channel/CHANNEL_ID');
console.log(channelId); // Outputs: CHANNEL_ID
---
#### Check Banned Number
Verifies if a JID (phone number) is banned.
`javascript`
const isBanned = await sock.checkWhatsApp('1234567890@s.whatsapp.net');
console.log(isBanned ? 'Banned' : 'Active'); // Outputs status
Baileyz extends WhatsApp's protocol with enhanced message types. All methods use sock.sendMessage(jid, content, options).
#### Group Status Message (v2)
Broadcast status updates to groups.
`javascript`
await sock.sendMessage(jid, {
groupStatusMessage: {
text: 'π Group update: New features live!'
}
});
#### Album Message (Multi-Image)
Bundle images into a swipeable album.
`javascript
import fs from 'fs'; // For local files
const albumImages = [
{ image: fs.readFileSync('image1.jpg'), caption: 'First image' },
{ image: { url: 'https://example.com/image2.jpg' }, caption: 'Second image' }
];
await sock.sendMessage(jid, { albumMessage: albumImages }, { quoted: m });
`
#### Event Message
Invite users to virtual events with location and RSVP links.
`javascript`
await sock.sendMessage(jid, {
eventMessage: {
isCanceled: false,
name: 'Tech Meetup 2026',
description: 'Join us for AI innovations!',
location: {
degreesLatitude: 37.7749,
degreesLongitude: -122.4194,
name: 'San Francisco'
},
joinLink: 'https://call.whatsapp.com/video/event123',
startTime: '1763019000', // Unix timestamp
endTime: '1763026200',
extraGuestsAllowed: true
}
}, { quoted: m });
#### Poll Result Message
Share poll outcomes with vote tallies.
`javascript`
await sock.sendMessage(jid, {
pollResultMessage: {
name: 'Weekly Poll',
pollVotes: [
{ optionName: 'Option A', optionVoteCount: '42' },
{ optionName: 'Option B', optionVoteCount: '23' }
]
}
}, { quoted: m });
#### Simple Interactive Message
Engage with copyable CTAs.
`javascript`
await sock.sendMessage(jid, {
interactiveMessage: {
header: { title: 'Quick Action' },
title: 'Copy this code',
footer: 'Powered by @DanuZz',
buttons: [
{
name: 'cta_copy',
buttonParamsJson: JSON.stringify({
display_text: 'Copy Code',
id: 'unique-id-123',
copy_code: 'BAILEYZ-2026'
})
}
]
}
}, { quoted: m });
#### Advanced Interactive Message (Native Flow)
Full native flows with lists, sheets, and offers.
`javascript`
await sock.sendMessage(jid, {
interactiveMessage: {
header: { title: 'Dynamic Menu' },
title: 'Explore Options',
footer: 'Contact @DanuZz for support',
image: { url: 'https://example.com/header.jpg' },
nativeFlowMessage: {
messageParamsJson: JSON.stringify({
limited_time_offer: {
text: 'Exclusive deal ends soon!',
url: 'https://www.movanest.xyz',
copy_code: 'DEAL2026',
expiration_time: Date.now() + 86400000 // 24h
},
bottom_sheet: {
in_thread_buttons_limit: 3,
divider_indices: [1],
list_title: 'Categories',
button_title: 'View All'
},
tap_target_configuration: {
title: 'Learn More',
description: 'Advanced automation tips',
canonical_url: 'https://npmjs.com/baileyz',
domain: 'baileyz.dev',
button_index: 0
}
}),
buttons: [
{ name: 'single_select', buttonParamsJson: JSON.stringify({ has_multiple_buttons: true }) },
{
name: 'single_select',
buttonParamsJson: JSON.stringify({
title: 'Select Category',
sections: [{ title: 'Tools', rows: [{ title: '@DanuZz', id: 'row1' }] }],
has_multiple_buttons: true
})
},
{
name: 'cta_copy',
buttonParamsJson: JSON.stringify({
display_text: 'Copy Promo',
id: 'promo-456',
copy_code: 'SAVE20'
})
}
]
}
}
}, { quoted: m });
#### Interactive Message with Thumbnail
Rich previews for products/services.
`javascript`
await sock.sendMessage(jid, {
interactiveMessage: {
header: { title: 'Featured Item' },
title: 'Baileyz Pro',
footer: 'Upgrade today',
image: { url: 'https://example.com/product-thumb.jpg' },
buttons: [
{
name: 'cta_copy',
buttonParamsJson: JSON.stringify({
display_text: 'Get License',
id: 'license-789',
copy_code: 'PRO-KEY-ABC'
})
}
]
}
}, { quoted: m });
#### Product Message
E-commerce ready catalogs.
`javascript`
await sock.sendMessage(jid, {
productMessage: {
title: 'Baileyz Enterprise',
description: 'Scalable automation suite',
thumbnail: { url: 'https://example.com/prod.jpg' },
productId: 'PROD-001',
retailerId: 'RETAIL-DANUPA',
url: 'https://npmjs.com/baileyz',
body: 'Advanced features unlocked',
footer: 'Limited offer',
priceAmount1000: 99900, // $99.90
currencyCode: 'USD',
buttons: [
{
name: 'cta_url',
buttonParamsJson: JSON.stringify({
display_text: 'Buy Now',
url: 'https://example.com/purchase'
})
}
]
}
}, { quoted: m });
#### Interactive Message with Document (Buffer-Only)
Attach files from memory buffers.
`javascript
import fs from 'fs';
await sock.sendMessage(jid, {
interactiveMessage: {
header: { title: 'Documentation' },
title: 'Baileyz Guide',
footer: 'By @DanuZz',
document: fs.readFileSync('./guide.pdf'),
mimetype: 'application/pdf',
fileName: 'baileyz-guide.pdf',
jpegThumbnail: fs.readFileSync('./thumb.jpg'),
buttons: [
{
name: 'cta_url',
buttonParamsJson: JSON.stringify({
display_text: 'Read More',
url: 'https://www.movanest.xyz',
merchant_url: 'https://npmjs.com/baileyz'
})
}
]
}
}, { quoted: m });
`
#### Request Payment Message
Monetize interactions with payments.
`javascript
const quotedType = m.quoted?.mtype || '';
const quotedContent = JSON.stringify({ [quotedType]: m.quoted }, null, 2);
await sock.sendMessage(jid, {
requestPaymentMessage: {
currency: 'USD',
amount: 49900, // $49.90
from: m.sender,
sticker: JSON.parse(quotedContent), // Optional sticker
background: {
id: 'bg-001',
fileLength: '1024',
width: 512,
height: 512,
mimetype: 'image/webp',
placeholderArgb: 0xFF00FFFF,
textArgb: 0xFFFFFFFF,
subtextArgb: 0xFFAA00FF
}
}
}, { quoted: m });
``
---
In a sea of WhatsApp libraries, Baileyz stands out with:
- Unmatched Stability: Custom pairing fixes 99% of auth failures; auto-reconnect on steroids.
- Future-Proof: Proactive updates for WhatsApp's evolving APIβmulti-device, interactive v2, and beyond.
- Developer-First: TypeScript natives, zero-config auth, and hookable events for custom logic.
- Production-Grade: Powers 10k+ sessions daily in bots from startups to enterprises.
Switch to Baileyz for automation that just works.
---
MIT Β© DanuZz. See LICENSE for details.
---
- Main Site: MovaNest
- Contact Site: @DanuZz
Built with β€οΈ for the WhatsApp dev community. Let's automate the future! π