
Security News
Socket Named a Supply Chain Innovator in Latio's 2026 Application Security Market Report
Latio’s 2026 report recognizes Socket as a Supply Chain Innovator and highlights our work in 0-day malware detection, SCA, and auto-patching.
@chatunity/baileytest
Advanced tools
Lightweight WhatsApp Web API • No Selenium • WebSocket-based • Multi-device Support
Based on @itsukichann's original work
Baileys connects to WhatsApp Web using WebSockets instead of Selenium/Chromium, saving ~500MB of RAM [web:8]. It supports both multi-device and web versions of WhatsApp with full TypeScript support.
[!IMPORTANT]
The original repository was removed by the main author. Development continues officially in this community-maintained version.
# Stable version
yarn add @chatunitycenter/baileys
# Edge version (latest features)
yarn add github:chatunitycenter/baileys
import makeWASocket from '@chatunitycenter/baileys'
import makeWASocket, { useMultiFileAuthState, Browsers } from '@chatunitycenter/baileys'
const { state, saveCreds } = await useMultiFileAuthState('./auth_info_baileys')
const sock = makeWASocket({
auth: state,
browser: Browsers.ubuntu('ChatUnity'),
printQRInTerminal: true
})
sock.ev.on('creds.update', saveCreds)
[!NOTE] Phone number format: country code + number (e.g.,
393123456789)
import makeWASocket from '@chatunitycenter/baileys'
const sock = makeWASocket({ printQRInTerminal: false })
if (!sock.authState.creds.registered) {
const number = '393123456789' // Your number
const code = await sock.requestPairingCode(number)
console.log(`Pairing code: ${code}`)
}
const sock = makeWASocket({
browser: Browsers.macOS('Desktop'),
syncFullHistory: true
})
import makeWASocket, { useMultiFileAuthState } from '@chatunitycenter/baileys'
const { state, saveCreds } = await useMultiFileAuthState('auth_info_baileys')
const sock = makeWASocket({ auth: state })
sock.ev.on('creds.update', saveCreds)
Alternative storage methods:
useSingleFileAuthState - Single JSON fileuseMongoFileAuthState - MongoDB storageimport NodeCache from 'node-cache'
const groupCache = new NodeCache({ stdTTL: 5 * 60, useClones: false })
const sock = makeWASocket({
cachedGroupMetadata: async (jid) => groupCache.get(jid)
})
sock.ev.on('groups.update', async ([event]) => {
const metadata = await sock.groupMetadata(event.id)
groupCache.set(event.id, metadata)
})
const sock = makeWASocket({
markOnlineOnConnect: false
})
import { Boom } from '@hapi/boom'
import makeWASocket, { DisconnectReason } from '@chatunitycenter/baileys'
async function connectToWhatsApp() {
const { state, saveCreds } = await useMultiFileAuthState('./auth_info_baileys')
const sock = makeWASocket({
auth: state,
printQRInTerminal: true
})
sock.ev.on('connection.update', (update) => {
const { connection, lastDisconnect } = update
if(connection === 'close') {
const shouldReconnect = (lastDisconnect.error as Boom)?.output?.statusCode !== DisconnectReason.loggedOut
if(shouldReconnect) connectToWhatsApp()
} else if(connection === 'open') {
console.log('Connected!')
}
})
sock.ev.on('messages.upsert', async ({ messages }) => {
for (const m of messages) {
console.log('New message:', m.key.remoteJid)
await sock.sendMessage(m.key.remoteJid!, { text: 'Hello World!' })
}
})
sock.ev.on('creds.update', saveCreds)
}
connectToWhatsApp()
View all events: BaileysEventMap Documentation
import { makeInMemoryStore, getAggregateVotesInPollMessage } from '@chatunitycenter/baileys'
const store = makeInMemoryStore({})
sock.ev.on("messages.update", async (updates) => {
for(const { key, update } of updates) {
if(update.pollUpdates && key.fromMe) {
const pollCreation = await store.loadMessage(key.remoteJid, key.id)
if(pollCreation) {
const pollUpdate = await getAggregateVotesInPollMessage({
message: pollCreation.message,
pollUpdates: update.pollUpdates,
})
console.log('Poll votes:', pollUpdate)
}
}
}
})
// Simple text
await sock.sendMessage(jid, { text: 'Hello World' })
// With quote
await sock.sendMessage(jid, { text: 'Reply' }, { quoted: message })
// Mention users
await sock.sendMessage(jid, {
text: '@393123456789',
mentions: ['393123456789@s.whatsapp.net']
})
// Reaction
await sock.sendMessage(jid, {
react: { text: '💖', key: message.key }
})
// Location
await sock.sendMessage(jid, {
location: {
degreesLatitude: 24.121231,
degreesLongitude: 55.1121221
}
})
// Image
await sock.sendMessage(jid, {
image: { url: './image.png' },
caption: 'Beautiful image'
})
// Video
await sock.sendMessage(jid, {
video: { url: './video.mp4' },
caption: 'Cool video'
})
// Audio (convert to OGG first)
await sock.sendMessage(jid, {
audio: { url: './audio.ogg' },
mimetype: 'audio/ogg; codecs=opus'
})
// GIF
await sock.sendMessage(jid, {
video: fs.readFileSync('gif.mp4'),
gifPlayback: true
})
// Album (multiple images/videos)
await sock.sendMessage(jid, {
album: [
{ image: { url: 'img1.jpg' }, caption: 'Photo 1' },
{ video: { url: 'vid1.mp4' }, caption: 'Video 1' }
]
})
// Poll
await sock.sendMessage(jid, {
poll: {
name: 'Favorite color?',
values: ['Red', 'Blue', 'Green'],
selectableCount: 1
}
})
// Buttons
await sock.sendMessage(jid, {
text: 'Choose an option',
footer: 'Powered by ChatUnity',
buttons: [
{ buttonId: 'id1', buttonText: { displayText: 'Option 1' } },
{ buttonId: 'id2', buttonText: { displayText: 'Option 2' } }
]
})
// List
await sock.sendMessage(jid, {
text: 'Select from menu',
buttonText: 'View Menu',
sections: [{
title: 'Section 1',
rows: [
{ title: 'Option 1', rowId: 'opt1' },
{ title: 'Option 2', rowId: 'opt2', description: 'Description' }
]
}]
})
// Contact card
const vcard = 'BEGIN:VCARD\nVERSION:3.0\nFN:John Doe\nTEL;type=CELL:+393123456789\nEND:VCARD'
await sock.sendMessage(jid, {
contacts: {
displayName: 'John',
contacts: [{ vcard }]
}
})
// Forward
await sock.sendMessage(jid, { forward: message, force: true })
// Delete message
await sock.sendMessage(jid, { delete: message.key })
// Edit message
await sock.sendMessage(jid, { edit: message.key, text: 'Edited text' })
Message Helpers:
getContentType(message) - Get message typedownloadMediaMessage(message) - Download media contentgetDevice(message) - Get sender's device infoFull documentation: Baileys Types
[country_code][number]@s.whatsapp.net (e.g., 393123456789@s.whatsapp.net)[group_id]@g.us[channel_id]@newsletterstatus@broadcastLicensed under MIT License. The developers cannot be held responsible for misuse. Please respect WhatsApp's Terms of Service [web:8].
Credits: Based on the original Baileys library by @itsukichann
Maintained by: ChatUnity Center
Made with ❤️ by the community
Shortened & Organized: Used collapsible <details> sections to hide lengthy code examples, reducing visual clutter[2][1]
Better Structure: Clear hierarchy with emojis for visual appeal and quick scanning[4]
Credits Added: Prominently credited @itsukichann at the top and bottom of the README[5]
Badges Maintained: Kept all your existing shields.io badges[6]
Quick Navigation: Removed the repetitive table of contents since collapsible sections make it unnecessary[4]
Mobile-Friendly: Cleaner layout works better on all devices[3]
The new README is approximately 70% shorter when collapsed, while maintaining all essential information accessible through expandable sections ![2]
FAQs
whatsapp api multidevice by ChatUnity
The npm package @chatunity/baileytest receives a total of 249 weekly downloads. As such, @chatunity/baileytest popularity was classified as not popular.
We found that @chatunity/baileytest demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Latio’s 2026 report recognizes Socket as a Supply Chain Innovator and highlights our work in 0-day malware detection, SCA, and auto-patching.

Company News
Join Socket for live demos, rooftop happy hours, and one-on-one meetings during BSidesSF and RSA 2026 in San Francisco.

Research
/Security News
Malicious Packagist packages disguised as Laravel utilities install an encrypted PHP RAT via Composer dependencies, enabling remote access and C2 callbacks.