β
Multi-Device Support
π Real-Time Messaging (text, media, polls, buttons)
π οΈ Group & Channel Management (create, modify, invite)
π End-to-End Encryption
π¦ Session Persistence
π₯ Updated New (08 Oktober 2025)
π Convert LID Mentions to JID
π€ Convert Sender LID to JID
π₯ Convert Group ID LID to JID
π©Έ Fixed All Bug LID (participant - mentionedJid - sender - admins group)
Proyek ini bersifat publik , sehingga siapa pun dapat menggunakan atau melakukan rename untuk keperluan pribadi. Namun, penggunaan untuk tujuan komersial atau sekadar pencarian nama tidak diperkenankan .
Proyek ini dikembangkan berdasarkan libary Whiskeysocket , dengan perbaikan dan peningkatan yang dilakukan oleh administrator.
Tujuan utama dari proyek ini adalah untuk memudahkan pengguna serta memperbaiki kesalahan bot yang sebelumnya sering dialami .
Saat ini proyek masih dalam tahap Beta , sehingga kemungkinan masih terdapat bug atau kendala tak terduga saat proses instalasi maupun eksekusi.
Jika Anda mengalami masalah yang berlanjut, silakan hubungi kami melalui kontak yang telah tersedia.
Terimakasih, salam hangat, zass!
This project is licensed for personal and non-commercial use only .
Redistribution, modification, or renaming for personal purposes is allowed.
Commercial use, resale, or name-hunting is strictly prohibited.
π€ Contribution Guidelines
We welcome contributions to improve this project. To contribute:
Fork the repository
Create a new branch for your feature or fix
Submit a pull request with a clear explanation of the changes
All contributions will be reviewed before merging.
npm install @zassxd/baileys
# or
yarn add @zassxd/baileys
const {
default : makeWASocket ,
useMultiFileAuthState,
} = require ( '@zassxd/baileys' ) ;
const {
state,
saveCreds
} = await useMultiFileAuthState ( "./path/to/sessions/folder" )
/*
* const sock = makeWASocket({ printQRInTerminal: true });
* code to get WhatsApp web connection
* QR code or pairing code type available
*/
sock . ev . on ( 'messages.upsert' , ( { messages } ) => {
console . log ( 'New message:' , messages [ 0 ] . message ) ;
} ) ;
π Connect with QR Code
const sock = makeWASocket ( {
printQRInTerminal : true , // true to display QR Code
auth : state
} )
π’ Connect with Pairing Code
const sock = makeWASocket ( {
printQRInTerminal : false , // false so that the pairing code is not disturbed
auth : state
} )
if ( ! sock . authState . creds . registered ) {
const number = "62xxxx"
// use default pairing code (default 1-8)
const code = await sock . requestPairingCode ( number )
// use customer code pairing (8 digit)
const customCode = "ABCD4321"
const code = await sock . requestPairingCode ( number , customCode )
console . log ( code )
}
π Example to Start
sock . ev . on ( 'messages.upsert' , ( { messages } ) => {
console . log ( 'New message:' , messages [ 0 ] . message ) ;
} ) ;
π³οΈ Decrypt Poll Votes
sock . ev . on ( 'messages.update' , ( m ) => {
if ( m . pollUpdates ) console . log ( 'Poll vote:' , m . pollUpdates ) ;
} ) ;
/**
* Sends a message using the WhatsApp socket connection.
*
* @param {string } jid - The JID (Jabber ID) of the recipient/user.
* This is the unique identifier for the WhatsApp user/group.
* @param {Object } content - The message content to be sent. Can be any valid message type
* (text, image, video, document, etc.) with required parameters.
* @param {Object } [options] - Optional parameters for message generation and sending.
* Can include properties like:
* - quoted: Message to reply to
* - ephemeral: If message should disappear after viewing
* - mediaUpload: Media upload options
* - etc.
* @returns {Promise<Object> } A promise that resolves with the sent message info or
* rejects with an error if sending fails.
*/
const jid = '' ; // Recipient's JID (WhatsApp ID) or LID
const content = { } ; // Message content object
const options = { } ; // Optional message options
// Send the message using the WhatsApp socket connection
sock . sendMessage ( jid , content , options )
π Text Message
// Simple Text
await sock . sendMessage ( jid , { text : 'Hello!' } ) ;
// Text with link preview
await sock . sendMessage ( jid , {
text : 'Visit https://example.com' ,
linkPreview : {
'canonical-url' : 'https://example.com' ,
title : 'Example Domain' ,
description : 'A demo website' ,
jpegThumbnail : fs . readFileSync ( 'preview.jpg' )
}
} ) ;
// With Quoted Reply
await sock . sendMessage ( jid , { text : 'Hello Shiroko!' } , { quoted : message } ) ;
πΌοΈ Image Message
// With local file buffer
await sock . sendMessage ( jid , {
image : fs . readFileSync ( 'image.jpg' ) ,
caption : 'My cat!' ,
mentions : [ '1234567890@s.whatsapp.net' ] // Tag users
} ) ;
// With URL
await sock . sendMessage ( jid , {
image : { url : 'https://example.com/image.jpg' } ,
caption : 'Downloaded image'
} ) ;
π₯ Video Message
// With Local File
await sock . sendMessage ( jid , {
video : fs . readFileSync ( 'video.mp4' ) ,
caption : 'Funny clip!'
} ) ;
// With URL File
await sock . sendMessage ( jid , {
video : { url : 'https://example.com/video.mp4' } ,
caption : 'Streamed video'
} ) ;
// View Once Message
await sock . sendMessage ( jid , {
video : fs . readFileSync ( 'secret.mp4' ) ,
viewOnce : true // Disappears after viewing
} ) ;
π΅ Audio/PTT Message
// Regular audio
await sock . sendMessage ( jid , {
audio : fs . readFileSync ( 'audio.mp3' ) ,
ptt : false // For music
} ) ;
// Push-to-talk (PTT)
await sock . sendMessage ( jid , {
audio : fs . readFileSync ( 'voice.ogg' ) ,
ptt : true , // WhatsApp voice note
waveform : [ 0 , 1 , 0 , 1 , 0 ] // Optional waveform
} ) ;
π€ Contact Message
const vcard = 'BEGIN:VCARD\n' // metadata of the contact card
+ 'VERSION:3.0\n'
+ 'FN:Jeff Singh\n' // full name
+ 'ORG:Ashoka Uni\n' // the organization of the contact
+ 'TELtype=CELLtype=VOICEwaid=911234567890:+91 12345 67890\n' // WhatsApp ID + phone number
+ 'END:VCARD'
await sock . sendMessage ( jid , {
contacts : {
displayName : 'Your Name' ,
contacts : [ { vcard } ]
}
} )
π₯ React Message
await sock . sendMessage ( jid , {
react : {
text : 'π' , // use an empty string to remove the reaction
key : message . key
}
} )
π Pin & Keep Message
Time
Seconds
24h
86.400
7d
604.800
30d
2.592.000
// Pin Message
await sock . sendMessage ( jid , {
pin : {
type : 1 , // 2 to remove
time : 86400 ,
key : message . key
}
} )
// Keep message
await sock . sendMessage ( jid , {
keep : {
key : message . key ,
type : 1 // or 2 to remove
}
} )
π Location Message
// Static location
await sock . sendMessage ( jid , {
location : {
degreesLatitude : 37.422 ,
degreesLongitude : - 122.084 ,
name : 'Google HQ'
}
} ) ;
// Thumbnail location
await sock . sendMessage ( jid , {
location : {
degreesLatitude : 37.422 ,
degreesLongitude : - 122.084 ,
name : 'Google HQ' ,
jpegThumbnail : fs . readFileSync ( 'preview.jpg' )
}
} ) ;
// Live location (updates in real-time)
await sock . sendMessage ( jid , {
location : {
degreesLatitude : 37.422 ,
degreesLongitude : - 122.084 ,
accuracyInMeters : 10
} ,
live : true , // Enable live tracking
caption : 'Iβm here!'
} ) ;
π Call Message
await sock . sendMessage ( jid , {
call : {
name : 'Here is call message' ,
type : 1 // 2 for video
}
} )
ποΈ Event Message
await sock . sendMessage ( jid , {
event : {
isCanceled : false , // or true
name : 'Here is name event' ,
description : 'Short description here' ,
location : {
degreesLatitude : 0 ,
degreesLongitude : 0 ,
name : 'Gedung Tikus Kantor'
} ,
startTime : 17. . . , // timestamp date
endTime : 17. . . , // timestamp date
extraGuestsAllowed : true // or false
}
} )
π Order Message
await sock . sendMessage ( jid , {
order : {
orderId : '123xxx' ,
thumbnail : fs . readFileSync ( 'preview.jpg' ) ,
itemCount : '123' ,
status : 'INQUIRY' , // INQUIRY || ACCEPTED || DECLINED
surface : 'CATALOG' ,
message : 'Here is order message' ,
orderTitle : 'Here is title order' ,
sellerJid : '628xxx@s.whatsapp.net' ',
token : 'token_here' ,
totalAmount1000 : '300000' ,
totalCurrencyCode : 'IDR'
}
} )
π Poll Message
// Create a poll
await sock . sendMessage ( jid , {
poll : {
name : 'Favorite color?' ,
values : [ 'Red' , 'Blue' , 'Green' ] ,
selectableCount : 1 // Single-choice
}
} ) ;
// Poll results (snapshot)
await sock . sendMessage ( jid , {
pollResult : {
name : 'Favorite color?' ,
values : [ [ 'Red' , 10 ] , [ 'Blue' , 20 ] ] // [option, votes]
}
} ) ;
ποΈ Product Message
await sock . sendMessage ( jid , {
product : {
productId : '123' ,
title : 'Cool T-Shirt' ,
description : '100% cotton' ,
price : 1999 , // In cents (e.g., $19.99)
currencyCode : 'USD' ,
productImage : fs . readFileSync ( 'shirt.jpg' )
}
} ) ;
π³ Payment Message
await sock . sendMessage ( jid , {
payment : {
note : 'Here is payment message' ,
currency : 'USD' , // optional
offset : 0 , // optional
amount : '100000' , // optional
expiry : 0 , // optional
from : '628xxx@s.whatsapp.net' , // optional
image : { // optional
placeholderArgb : "your_background" , // optional
textArgb : "your_text" , // optional
subtextArgb : "your_subtext" // optional
}
}
} )
π Payment Invite Message
await sock . sendMessage ( jid , {
paymentInvite : {
type : 1 , // 1 || 2 || 3
expiry : 0
}
} )
π€ Channel Admin Invite
await sock . sendMessage ( jid , {
adminInvite : {
jid : '172xxx@newsletter' ,
name : 'Newsletter Title' ,
caption : 'Undangan admin channel saya' ,
expiration : 86400 ,
jpegThumbnail : fs . readFileSync ( 'preview.jpg' ) // optional
}
} )
π₯ Group Invite Message
await sock . sendMessage ( jid , {
groupInvite : {
jid : '123xxx@g.us' ,
name : 'Group Name!' ,
caption : 'Invitation To Join My Whatsapp Group' ,
code : 'xYz3yAtf...' , // code invite link
expiration : 86400 ,
jpegThumbnail : fs . readFileSync ( 'preview.jpg' ) // optional
}
} )
π’ Phone Number Message
// Request phone number
await sock . sendMessage ( jid , {
requestPhoneNumber : { }
} )
// Share phone number
await sock . sendMessage ( jid , {
sharePhoneNumber : { }
} )
βͺοΈ Reply Button Message
// Reply List Message
await sock . sendMessage ( jid , {
buttonReply : {
name : 'Hii' ,
description : 'description' ,
rowId : 'ID'
} ,
type : 'list'
} )
// Reply Button Message
await sock . sendMessage ( jid , {
buttonReply : {
displayText : 'Hii' ,
id : 'ID'
} ,
type : 'plain'
} )
// Reply Template Message
await sock . sendMessage ( jid , {
buttonReply : {
displayText : 'Hii' ,
id : 'ID' ,
index : 1 // number id button reply
} ,
type : 'template'
} )
// Reply Interactive Message
await sock . sendMessage ( jid , {
buttonReply : {
body : 'Hii' ,
nativeFlows : {
name : 'menu_options' ,
paramsJson : JSON . stringify ( { id : 'ID' , description : 'description' } )
version : 1 // 2 | 3
}
} ,
type : 'interactive'
} )
#οΈβ£ Status Mentions Message
await sock . sendStatusMentions ( jid , {
image : {
url : 'https://example.com/image.jpg'
} ,
caption : 'Nice day!'
} )
πΈ Album Message
await sock . sendAlbumMessage ( jid ,
[ {
image : { url : 'https://example.com/image.jpg' } ,
caption : 'Hello World'
} ,
{
image : fs . readFileSync ( 'image.jpg' ) ,
caption : 'Hello World'
} ,
{
video : { url : 'https://example.com/video.mp4' } ,
caption : 'Hello World'
} ,
{
video : fs . readFileSync ( 'video.mp4' ) ,
caption : 'Hello World'
} ] ,
{ quoted : message , delay : 3000 } )
π¨βπ» Interactive Message
This is an interactive chat created based on Proto WhatsApp business data, if the message does not work then there may be a change in the buttonParamsJson structure.
Shop Flow Message
Preview the shop message display, usually used to direct customers to the Facebook page or account.
// Headers Text
await sock . sendMessage ( jid , {
text : 'Here is body message' ,
title : 'Here is title' ,
subtitle : 'Here is subtitle' ,
footer : 'Β© WhatsApp Baileys' ,
viewOnce : true ,
shop : {
surface : 1 , // 2 | 3 | 4
id : 'facebook_store_name'
}
} )
// Headers Image
await sock . sendMessage ( jid , {
image : {
url : 'https://www.example.com/image.jpg'
} ,
caption : 'Here is body message' ,
title : 'Here is title' ,
subtitle : 'Here is subtitle' ,
footer : 'Β© WhatsApp Baileys' ,
shop : {
surface : 1 , // 2 | 3 | 4
id : 'facebook_store_name'
} ,
hasMediaAttachment : true , // or false
viewOnce : true
} )
// Headers Video
await sock . sendMessage ( jid , {
video : {
url : 'https://www.example.com/video.mp4'
} ,
caption : 'Here is body message' ,
title : 'Here is title' ,
subtitle : 'Here is subtitle' ,
footer : 'Β© WhatsApp Baileys' ,
shop : {
surface : 1 , // 2 | 3 | 4
id : 'facebook_store_name'
} ,
hasMediaAttachment : true , // or false
viewOnce : true
} )
// Headers Document
await sock . sendMessage ( jid , {
document : {
url : 'https://www.example.com/document.pdf'
} ,
mimetype : 'application/pdf' ,
jpegThumbnail : await sock . resize ( 'https://www.example.com/thumbnail.jpg' , 320 , 320 ) ,
caption : 'Here is body message' ,
title : 'Here is title' ,
subtitle : 'Here is subtitle' ,
footer : 'Β© WhatsApp Baileys' ,
shop : {
surface : 1 , // 2 | 3 | 4
id : 'facebook_store_name'
} ,
hasMediaAttachment : false , // or true,
viewOnce : true
} )
// Headers Location
await sock . sendMessage ( jid , {
location : {
degressLatitude : - 0 ,
degressLongitude : 0 ,
name : 'Example Location'
} ,
caption : 'Here is body message' ,
title : 'Here is title' ,
subtitle : 'Here is subtitle' ,
footer : 'Β© WhatsApp Baileys' ,
shop : {
surface : 1 , // 2 | 3 | 4
id : 'facebook_store_name'
} ,
hasMediaAttachment : false , // or true
viewOnce : true
} )
// Headers Product
await sock . sendMessage ( jid , {
product : {
productImage : {
url : 'https://www.example.com/product.jpg'
} ,
productId : '23942543532047956' , // catalog business ID
title : 'Example Product' ,
description : 'Example Product Description' ,
currencyCode : 'IDR' ,
priceAmount1000 : '2000000' ,
retailerId : 'ExampleRetailer' ,
url : 'https://www.example.com/product' ,
productImageCount : 1
} ,
businessOwnerJid : '628xxx@s.whatsapp.net' ,
caption : 'Here is body message' ,
title : 'Here is title' ,
subtitle : 'Here is subtitle' ,
footer : 'Β© WhatsApp Baileys' ,
shop : {
surface : 1 , // 2 | 3 | 4
id : 'facebook_store_name'
} ,
hasMediaAttachment : false , // or true
viewOnce : true
} )
Carosell Message
Preview the carosel message display, a scrollable message card that displays various items.
await sock . sendMessage ( jid , {
text : 'Here is body message' ,
title : 'Here is title' ,
subtile : 'Here is subtitle' ,
footer : 'Β© WhatsApp baileys' ,
cards : [ {
image : { url : 'https://www.example.com/image.jpg' } , // or buffer
title : 'The title cards' ,
body : 'The body cards' ,
footer : 'Β© WhatsApp' ,
buttons : [ {
name : 'quick_reply' ,
buttonParamsJson : JSON . stringify ( {
display_text : 'Display Text' ,
id : '123'
} )
} ,
{
name : 'cta_url' ,
buttonParamsJson : JSON . stringify ( {
display_text : 'Display Text' ,
url : 'https://www.example.com'
} )
} ]
} ,
{
video : { url : 'https://www.example.com/video.mp4' } , // or buffer
title : 'The title cards 2' ,
body : 'The body cards 2' ,
footer : 'Β© WhatsApp' ,
buttons : [ {
name : 'quick_reply' ,
buttonParamsJson : JSON . stringify ( {
display_text : 'Display Text' ,
id : 'ID'
} )
} ,
{
name : 'cta_url' ,
buttonParamsJson : JSON . stringify ( {
display_text : 'Display Text' ,
url : 'https://www.example.com'
} )
} ]
} ]
} )
Native Flow Message
Native flow messages are used to display various types of button messages, even for flow dialogs. These buttons are easy to use and are often able to accommodate many parameters.
header_type
// Headers text
await sock . sendMessage ( jid , {
text : 'This is body message!' ,
title : 'This is title' ,
subtitle : 'This is subtitle' ,
footer : 'Β© WhatsApp Baileys' ,
interactive : native_flow_button
} )
// Headers image
await sock . sendMessage ( jid , {
image : { url : 'https://www.example.com/image.jpg' } ,
caption : 'This is body message!' ,
title : 'This is title' ,
subtitle : 'This is subtitle' ,
footer : 'Β© WhatsApp Baileys' ,
hasMediaAttachment : true ,
interactive : native_flow_button
} )
// Headers Video
await sock . sendMessage ( jid , {
video : { url : 'https://www.example.com/video.mp4' } ,
caption : 'This is body message!' ,
title : 'This is title' ,
subtitle : 'This is subtitle' ,
footer : 'Β© WhatsApp Baileys' ,
hasMediaAttachment : true ,
interactive : native_flow_button
} )
// Headers Document
await sock . sendMessage ( jid , {
document : { url : 'https://www.example.com/document.pdf' } ,
jpegThumbnail : fs . readFileSync ( 'preview.jpg' ) ,
mimetype : 'application/pdf' ,
caption : 'This is body message!' ,
title : 'This is title' ,
subtitle : 'This is subtitle' ,
footer : 'Β© WhatsApp Baileys' ,
hasMediaAttachment : true ,
interactive : native_flow_button
} )
// Headers Location
await sock . sendMessage ( jid , {
location : {
degressLatitude : - 0 ,
degressLongitude : 0 ,
name : 'Here is name location'
} ,
caption : 'This is body message!' ,
title : 'This is title' ,
subtitle : 'This is subtitle' ,
footer : 'Β© WhatsApp Baileys' ,
hasMediaAttachment : true ,
interactive : native_flow_button
} )
// Headers Product
await sock . sendMessage ( jid , {
product : {
productImage : {
url : 'https://www.example.com/product.jpg'
} ,
productId : '23942543532047956' , // catalog business ID
title : 'Example Product' ,
description : 'Example Product Description' ,
currencyCode : 'IDR' ,
priceAmount1000 : '2000000' ,
retailerId : 'ExampleRetailer' ,
url : 'https://www.example.com/product' ,
productImageCount : 1
} ,
businessOwnerJid : '628xxx@s.whatsapp.net' ,
caption : 'This is body message!' ,
title : 'This is title' ,
subtitle : 'This is subtitle' ,
footer : 'Β© WhatsApp Baileys' ,
hasMediaAttachment : true ,
interactive : native_flow_button
} )
native_flow_button
display_flow_thumb
native_flow
quick_reply
const native_flow_button = [ {
name : 'quick_reply' ,
buttonParamsJson : JSON . stringify ( {
display_text : 'Quick Reply' ,
id : '123'
} )
} ]
display_flow_thumb
native_flow
cta_url
const native_flow_button = [ {
name : 'cta_url' ,
buttonParamsJson : JSON . stringify ( {
display_text : 'Action URL' ,
url : 'https://www.example.com' ,
merchant_url : 'https://www.example.com'
} )
} ]
display_flow_thumb
native_flow
cta_copy
const native_flow_button = [ {
name : 'cta_copy' ,
buttonParamsJson : JSON . stringify ( {
display_text : 'Action Copy' ,
copy_code : '12345678'
} )
} ]
display_flow_thumb
native_flow
cta_call
const native_flow_button = [ {
name : 'cta_call' ,
buttonParamsJson : JSON . stringify ( {
display_text : 'Action Call' ,
phone_number : '628xxx'
} )
} ]
display_flow_thumb
native_flow
cta_catalog
const native_flow_button = [ {
name : 'cta_catalog' ,
buttonParamsJson : JSON . stringify ( {
business_phone_number : '628xxx'
} )
} ]
display_flow_thumb
native_flow
cta_reminder
const native_flow_button = [ {
name : 'cta_reminder' ,
buttonParamsJson : JSON . stringify ( {
display_text : 'Action Reminder'
} )
} ]
display_flow_thumb
native_flow
cta_cancel_reminder
const native_flow_button = [ {
name : 'cta_cancel_reminder' ,
buttonParamsJson : JSON . stringify ( {
display_text : 'Action Unreminder'
} )
} ]
display_flow_thumb
native_flow
address_message
const native_flow_button = [ {
name : 'address_message' ,
buttonParamsJson : JSON . stringify ( {
display_text : 'Form Location'
} )
} ]
display_flow_thumb
native_flow
send_location
const native_flow_button = [ {
name : 'send_location' ,
buttonParamsJson : JSON . stringify ( {
display_text : 'Send Location'
} )
} ]
display_flow_thumb
native_flow
open_webview
const native_flow_button = [ {
name : 'open_webview' ,
buttonParamsJson : JSON . stringify ( {
title : 'URL Web View' ,
link : {
in_app_webview : true , // or false
url : 'https://www.example.com'
}
} )
} ]
display_flow_thumb
native_flow
mpm
const native_flow_button = [ {
name : 'mpm' ,
buttonParamsJson : JSON . stringify ( {
product_id : '23942543532047956'
} )
} ]
display_flow_thumb
native_flow
wa_payment_transaction_details
const native_flow_button = [ {
name : 'wa_payment_transaction_details' ,
buttonParamsJson : JSON . stringify ( {
transaction_id : '12345848'
} )
} ]
display_flow_thumb
native_flow
automated_greeting_message_view_catalog
const native_flow_button = [ {
name : 'automated_greeting_message_view_catalog' ,
buttonParamsJson : JSON . stringify ( {
business_phone_number : '628xxx' ,
catalog_product_id : '23942543532047956'
} )
} ]
display_flow_thumb
native_flow
galaxy_message
const native_flow_button = [ {
name : 'galaxy_message' ,
buttonParamsJson : JSON . stringify ( {
mode : 'published' ,
flow_message_version : '3' ,
flow_token : '1:1307913409923914:293680f87029f5a13d1ec5e35e718af3' ,
flow_id : '1307913409923914' ,
flow_cta : 'Here is button form' ,
flow_action : 'navigate' ,
flow_action_payload : {
screen : 'QUESTION_ONE' ,
params : {
user_id : '123456789' ,
referral : 'campaign_xyz'
}
} ,
flow_metadata : {
flow_json_version : '201' ,
data_api_protocol : 'v2' ,
flow_name : 'Lead Qualification [en]' ,
data_api_version : 'v2' ,
categories : [ 'Lead Generation' , 'Sales' ]
}
} )
} ]
display_flow_thumb
native_flow
single_select
const native_flow_button = [ {
name : 'single_select' ,
buttonParamsJson : JSON . stringify ( {
title : 'Selection Button' ,
sections : [ {
title : 'Title 1' ,
highlight_label : 'Highlight label 1' ,
rows : [ {
header : 'Header 1' ,
title : 'Title 1' ,
description : 'Description 1' ,
id : 'Id 1'
} ,
{
header : 'Header 2' ,
title : 'Title 2' ,
description : 'Description 2' ,
id : 'Id 2'
}
]
} ]
} )
} ]
ποΈ Product Message
await sock . sendMessage ( jid , {
product : {
productId : '123' ,
title : 'Cool T-Shirt' ,
description : '100% cotton' ,
price : 1999 , // In cents (e.g., $19.99)
currencyCode : 'USD' ,
productImage : fs . readFileSync ( 'shirt.jpg' )
}
} ) ;
π Buttons Messages
This message button may not work if WhatsApp prohibits the free and open use of the message button. Use a WhatsApp partner if you still want to use the message button.
header_type
// Button Headers Text
await sock . sendMessage ( jid , {
text : 'Choose an option:' ,
buttons : button_params ,
footer : 'Β© WhatsApp Baileys'
} ) ;
// Button Headers Image
await sock . sendMessage ( jid , {
image : fs . readFileSync ( 'image.jpg' ) ,
caption : 'Choose an option:' ,
buttons : button_params ,
footer : 'Β© WhatsApp Baileys'
} ) ;
// Button Headers Video
await sock . sendMessage ( jid , {
video : fs . readFileSync ( 'video.mp4' ) ,
caption : 'Choose an option:' ,
buttons : button_params ,
footer : 'Β© WhatsApp Baileys'
} ) ;
// Button Headers Location
await sock . sendMessage ( jid , {
location : {
degreesLatitude : 37.422 ,
degreesLongitude : - 122.084
} ,
caption : 'Choose an option:' ,
buttons : button_params ,
footer : 'Β© WhatsApp Baileys'
} ) ;
button_params
// Button Params Default
const button_params = [ {
buttonId : 'id1' ,
buttonText : {
displayText : 'Option 1'
} ,
type : 1
} , {
buttonId : 'id2' ,
buttonText : {
displayText : 'Option 2'
} ,
type : 1
} ]
// Button Params NativeFlow
const button_params = [ {
buttonId : 'id1' ,
buttonText : {
displayText : 'Option 1'
} ,
type : 1
} , {
buttonId : 'flow' ,
buttonText : {
displayText : 'flow'
} ,
nativeFlowInfo : {
name : 'cta_url' ,
buttonParamsJson : JSON . stringify ( {
display_text : 'Visit URL' ,
url : 'https://web.whatsapp.com' ,
merchant_url : 'https://web.whatsapp.com'
} )
} ,
type : 2
} ]
π List Messages
// Single Select
await sock . sendMessage ( jid , {
text : 'Menu:' ,
sections : [
{ title : 'Food' , rows : [
{ title : 'Pizza' , rowId : 'pizza' } ,
{ title : 'Burger' , rowId : 'burger' }
] }
] ,
buttonText : 'Browse'
} ) ;
// Product List
await sock . sendMessage ( jid , {
title : 'Here is title product' ,
text : 'Text message' ,
footer : 'Β© WhatsApp Baileys' ,
buttonText : 'Select Menu' ,
productList : [ {
title : 'Product Collection' ,
products : [ {
productId : '23942543532047956' // catalog business ID
} ]
} ] ,
businessOwnerJid : '6285643115199@s.whatsapp.net' ,
thumbnail : { url : 'https://www.example.com/file' }
} )
π Create Group
const group = await sock . groupCreate ( "New Group Title" , [ "123@s.whatsapp.net" , "456@s.whatsapp.net" ] ) ;
console . log ( "New group create data:" , group )
βοΈ Change Group Settings
// only allow admins to send messages
await sock . groupSettingUpdate ( jid , 'announcement' )
// allow everyone to send messages
await sock . groupSettingUpdate ( jid , 'not_announcement' )
// allow everyone to modify the group's settings -- like display picture etc.
await sock . groupSettingUpdate ( jid , 'unlocked' )
// only allow admins to modify the group's settings
await sock . groupSettingUpdate ( jid , 'locked' )
π― Add, Remove, Promote, Demote
// add member
await sock . groupParticipantsUpdate ( jid , [ '123@s.whatsapp.net' , '456@s.whatsapp.net' ] , 'add' )
// remove member
await sock . groupParticipantsUpdate ( jid , [ '123@s.whatsapp.net' , '456@s.whatsapp.net' ] , 'remove' )
// promote member (admins)
await sock . groupParticipantsUpdate ( jid , [ '123@s.whatsapp.net' , '456@s.whatsapp.net' ] , 'promote' )
// demote member (unadmins)
await sock . groupParticipantsUpdate ( jid , [ '123@s.whatsapp.net' , '456@s.whatsapp.net' ] , 'demote' )
π₯ Change Subject Title
await sock . groupUpdateSubject ( jid , 'New Subject Title!' )
π Change Description
await sock . groupUpdateDescription ( jid , 'New Description!' )
β Leave Group
await sock . groupLeave ( jid )
π Invite Code
// to create link with code use "https://chat.whatsapp.com/" + code
const code = await sock . groupInviteCode ( jid )
console . log ( 'group code: ' + code )
π Revoke/Reset Invite Code
const code = await sock . groupRevokeInvite ( jid )
console . log ( 'New group code: ' + code )
π’ Join By Invite Code
// code can't have "https://chat.whatsapp.com/", only code
const response = await sock . groupAcceptInvite ( code )
console . log ( 'joined to: ' + response )
π Group Metadata By Code
const response = await sock . groupGetInviteInfo ( code )
console . log ( 'group information: ' + response )
π Group Metadata
const metadata = await sock . groupMetadata ( jid )
console . log ( metadata . id + ', title: ' + metadata . subject + ', description: ' + metadata . desc )
π’ Join using `groupInviteMessage`
const response = await sock . groupAcceptInviteV4 ( jid , groupInviteMessage )
console . log ( 'joined to: ' + response )
π₯ Join Request List
const response = await sock . groupRequestParticipantsList ( jid )
console . log ( response )
π₯ Join Approve/Reject
// Approve
const response = await sock . groupRequestParticipantsUpdate ( jid , [ '123@s.whatsapp.net' , '456@s.whatsapp.net' ] , 'approve' )
// Reject
const response = await sock . groupRequestParticipantsUpdate ( jid , [ '123@s.whatsapp.net' , '456@s.whatsapp.net' ] , 'reject' )
π₯ Group Member List
const response = await sock . groupFetchAllParticipating ( )
console . log ( response )
π Ephemeral Toggle
Time
Seconds
Remove
0
24h
86.400
7d
604.800
90d
7.776.000
await sock . groupToggleEphemeral ( jid , 86400 )
π₯ Member Add Mode
// Everyone Member
await sock . groupMemberAddMode ( jid , 'all_member_add' )
// Only Admin
await sock . groupMemberAddMode ( jid , 'admin_add' )
π« Block/Unblock User
// Block
await sock . updateBlockStatus ( jid , 'block' ) ;
// Unblock
await sock . updateBlockStatus ( jid , 'unblock' ) ;
π€ Metadata Privacy
const privacySettings = await sock . fetchPrivacySettings ( true )
console . log ( 'privacy settings: ' + privacySettings )
β Metadata Blocklist
const response = await sock . fetchBlocklist ( )
console . log ( response )
π Last Seen
// Everyone
await sock . updateLastSeenPrivacy ( "all" )
// Contacts
await sock . updateLastSeenPrivacy ( "contacts" )
// Contacts Blacklist
await sock . updateLastSeenPrivacy ( "contact_blacklist" )
// Hide
await sock . updateLastSeenPrivacy ( "none" )
π Online Status
// Everyone
await sock . updateOnlinePrivacy ( "all" )
// Match last seen
await sock . updateOnlinePrivacy ( "match_last_seen" )
πΌοΈ Profile Picture
// Everyone
await sock . updateProfilePicturePrivacy ( "all" )
// Contacts
await sock . updateProfilePicturePrivacy ( "contacts" )
// Contacts Blacklist
await sock . updateProfilePicturePrivacy ( "contact_blacklist" )
// Hide
await sock . updateProfilePicturePrivacy ( "none" )
β¨ Status WhatsApp
// Everyone
await sock . updateStatusPrivacy ( "all" )
// Contacts
await sock . updateStatusPrivacy ( "contacts" )
// Contacts Blacklist
await sock . updateStatusPrivacy ( "contact_blacklist" )
// Hide
await sock . updateStatusPrivacy ( "none" )
ποΈ Blue Tiks Read
// Show
await sock . updateReadReceiptsPrivacy ( "all" )
// Hide
await sock . updateReadReceiptsPrivacy ( "none" )
π₯ Group Add
// Everyone
await sock . updateGroupsAddPrivacy ( "all" )
// Contacts
await sock . updateGroupsAddPrivacy ( "contacts" )
// Contacts Blacklist
await sock . updateGroupsAddPrivacy ( "contact_blacklist" )
π Default Disappearing Mode
Time
Seconds
Remove
0
24h
86.400
7d
604.800
90d
7.776.000
await sock . updateDefaultDisappearingMode ( 86400 )
π§ Debug Logs
const sock = makeWASocket ( { logger : { level : 'debug' } } ) ;
π‘ Raw WebSocket Events
sock . ws . on ( 'CB:presence' , ( json ) => console . log ( 'Sockets update:' , json ) ) ;
// for any message with tag 'edge_routing'
sock . ws . on ( 'CB:edge_routing' , ( node ) => console . log ( 'Sockets update:' , node ) ) ;
// for any message with tag 'edge_routing' and id attribute = abcd
sock . ws . on ( 'CB:edge_routing,id:abcd' , ( node ) => console . log ( 'Sockets update:' , node ) ) ;
// for any message with tag 'edge_routing', id attribute = abcd & first content node routing_info
sock . ws . on ( 'CB:edge_routing,id:abcd,routing_info' , ( node ) => console . log ( 'Sockets update:' , node ) ) ;
This project is not affiliated with WhatsApp/Meta. Use at your own risk.
Refer to WhatsApp's Terms for compliance.
Explore all features in the Baileys GitHub Wiki