PouCode

A WebSockets library for interacting with WhatsApp Web, maintained under the PouCode brand.
This project is a fork built on top of Baileys by WhiskeySockets.
Installation
Requires Node.js 20+ (this package is ESM-only; see Import).
From the npm registry (once published):
npm install @poucode/baileys
Directly from GitHub:
npm install github:pou-code/Baileys
Or add it to your package.json manually:
"dependencies": {
"@poucode/baileys": "github:pou-code/Baileys"
}
Already have a bot built on the original @whiskeysockets/baileys and don't want to change every
require/import in your codebase? Alias the dependency name instead, so the original package
name points to this fork:
"dependencies": {
"@whiskeysockets/baileys": "github:pou-code/Baileys"
}
With this alias, keep using require('@whiskeysockets/baileys') in your code as-is — npm will
resolve it to this fork under the hood.
You can also pin to a specific branch or commit:
npm install github:pou-code/Baileys
Import
ESM (works on every supported Node.js version):
import makeWASocket, { Browsers, DisconnectReason } from '@poucode/baileys';
CommonJS: the package is ESM-only, so require() only works on Node.js 22.12+ or 20.19+
(Node's require(esm) support). On older versions use import instead.
const {
default: makeWASocket,
} = require('@poucode/baileys');
Connecting To WhatsApp
With QR Code
const {
default: makeWASocket,
Browsers
} = require('@poucode/baileys');
const client = makeWASocket({
browser: Browsers.poucode('Chrome')
});
client.ev.on('connection.update', ({ connection, qr }) => {
if (qr) console.log('Scan this QR string:', qr);
if (connection === 'open') console.log('Connected');
});
Connect With Pairing Code
const {
default: makeWASocket,
fetchLatestWaWebVersion,
Browsers
} = require('@poucode/baileys');
async function start() {
const { version } = await fetchLatestWaWebVersion();
const client = makeWASocket({
browser: Browsers.poucode('Chrome'),
printQRInTerminal: false,
version,
aiLabel: false
});
const number = "628XXXXXXXXXX";
const code = await client.requestPairingCode(number.trim());
console.log("Your pairing code: " + code);
}
start();
Storing Data
const {
default: makeWASocket,
makeInMemoryStore
} = require('@poucode/baileys');
const pino = require('pino');
const store = makeInMemoryStore({
logger: pino().child({ level: 'silent', stream: 'store' })
});
const client = makeWASocket({
});
store.bind(client.ev);
client.ev.on('contacts.upsert', () => {
console.log('New contact: ' + Object.values(store.contacts()));
});
Sending Messages
Send / relay a message with noSelfSync
noSelfSync is a relayMessage option (private/1-on-1 chats only) that controls whether the
message is also synced to your other own linked devices (other phones/WhatsApp Web sessions
logged into the same account). It does not affect delivery to the recipient.
noSelfSync: true — the message is sent to the recipient as normal, but is not synced
to your other own devices. Useful when you don't want a message to show up on your other
linked sessions (e.g. silent/automated sends from a bot account).
noSelfSync: false (default) — normal behavior. The message is sent to the recipient and
also synced to your other own devices, so it appears everywhere you're logged in, just like
sending from the official WhatsApp app.
await client.relayMessage(m.chat, {
conversation: "Hello from PouCode"
}, {
noSelfSync: true
});
await client.relayMessage(m.chat, {
conversation: "Hello from PouCode"
}, {
noSelfSync: false
});
await client.sendMessage(m.chat, {
text: "Hello from PouCode"
}, {
noSelfSync: true
});
Send an orderMessage
const fs = require('fs');
const thumbnail = fs.readFileSync('./pouthumb.jpg');
await client.sendMessage(m.chat, {
thumbnail,
message: "Order summary",
orderTitle: "My Store",
totalAmount1000: 72502,
totalCurrencyCode: "IDR"
}, { quoted: m });
Send a pollResultSnapshotMessage
await client.sendMessage(m.chat, {
pollResultMessage: {
name: "My Poll",
options: [
{ optionName: "Option 1" },
{ optionName: "Option 2" }
],
newsletter: {
newsletterName: "0X8 - Society",
newsletterJid: "120363424944937940@newsletter"
}
}
});
Send a productMessage
await client.relayMessage(m.chat, {
productMessage: {
title: "Product.pdf",
description: "Product description",
thumbnail: { url: "./pouthumb.jpg" },
productId: "EXAMPLE_TOKEN",
retailerId: "EXAMPLE_RETAILER_ID",
url: "https://example.com",
body: "Body text",
footer: "Footer",
buttons: [
{
name: "cta_url",
buttonParamsJson: "{\"display_text\":\"Visit\",\"url\":\"https://example.com\"}"
}
],
priceAmount1000: 72502,
currencyCode: "IDR"
}
});
Send an interactiveMessage
await client.sendMessage(m.chat, {
image: { url: "./pouimg.jpg" },
text: "body",
title: "title",
footer: "footer",
interactiveButtons: [
{
name: "single_select",
buttonParamsJson: JSON.stringify({
title: "\0"
})
}
],
messageParams: JSON.stringify({
bottom_sheet: {
}
})
});
Send a member label
await client.sendMessage(m.chat, {
groupLabel: {
labelText: "Tagged members appear here"
}
});
Send a message to group members
await client.sendMessageMembers(m.chat, {
extendedTextMessage: {
text: "Hello members"
}
}, {});
Simple sendMessage Helpers
Send text
await client.sendText(m.chat, "Hello!", {
contextInfo: {
mentionedJid: [m.chat]
}
}, {
key: {
remoteJid: "status@broadcast",
participant: m.sender,
fromMe: true
},
message: {
conversation: "\0"
}
});
Send image
await client.sendImage(m.chat, { url: "./pouimg.jpg" }, "Caption", {
contextInfo: {
mentionedJid: [m.chat]
}
}, {
key: {
remoteJid: "status@broadcast",
participant: m.sender,
fromMe: true
},
message: {
conversation: "\0"
}
});
Send video
await client.sendVideo(m.chat, { url: "./video.mp4" }, "Caption", {
contextInfo: {
mentionedJid: [m.chat]
}
}, {
key: {
remoteJid: "status@broadcast",
participant: m.sender,
fromMe: true
},
message: {
conversation: "\0"
}
});
Send audio
await client.sendAudio(m.chat, { url: "./pouaudio.mp3" }, {
contextInfo: {
mentionedJid: [m.chat]
}
}, {
key: {
remoteJid: "status@broadcast",
participant: m.sender,
fromMe: true
},
message: {
conversation: "\0"
}
});
Send location
await client.sendLocation(m.chat, "Caption", 90.0, 90.0, "https://example.com", "1234567890", {
contextInfo: {
mentionedJid: [m.chat]
}
}, {
key: {
remoteJid: "status@broadcast",
participant: m.sender,
fromMe: true
},
message: {
conversation: "\0"
}
});
Send poll
await client.sendPoll(m.chat, "Pick one", ["1", "2", "3"], true, {
contextInfo: {
mentionedJid: [m.chat]
}
}, {
key: {
remoteJid: "status@broadcast",
participant: m.sender,
fromMe: true
},
message: {
conversation: "\0"
}
});
Send quiz
await client.sendQuiz(m.chat, "Quiz question", ["1", "2", "3"], "2", {
contextInfo: {
mentionedJid: [m.chat]
}
}, {
key: {
remoteJid: "status@broadcast",
participant: m.sender,
fromMe: true
},
message: {
conversation: "\0"
}
});
Send status mention
await client.statusMention(m.chat, {
extendedTextMessage: {
text: "Mentioned in status"
}
});
Credits
PouCode is a fork of Baileys, originally created by
Adhiraj Singh and maintained by the WhiskeySockets community.
All credit for the underlying protocol implementation goes to the original authors and contributors.
See LICENSE for the full license text and copyright notices.
Contributing
See CONTRIBUTING.md for guidelines on reporting issues and submitting pull requests.
Disclaimer
This is not an official WhatsApp product. Use of this library to send bulk or unsolicited messages
may violate WhatsApp's Terms of Service and can result in your number being banned. Use responsibly.