supunmd-bail 2.1.4 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +466 -359
- package/lib/Defaults/denzy-baileys-version.json +3 -0
- package/lib/Defaults/index.js +1 -1
- package/lib/Signal/Group/telegram +1 -0
- package/lib/Socket/chats.js +15 -28
- package/lib/Socket/dugong.js +2 -6
- package/lib/Socket/newsletter.js +136 -96
- package/lib/Socket/socket.js +1 -1
- package/lib/Types/telegram +1 -0
- package/lib/Utils/generics.js +3 -3
- package/lib/Utils/index.d.ts +1 -1
- package/lib/Utils/index.js +1 -1
- package/lib/Utils/messages.js +32 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +0 -1
- package/lib/index.js +11 -25
- package/package.json +10 -7
- package/lib/Defaults/baileys-version.json +0 -3
- /package/lib/Utils/{validate-connection.d.ts → Denzy-connection.d.ts} +0 -0
- /package/lib/Utils/{validate-connection.js → Denzy-connection.js} +0 -0
package/README.md
CHANGED
|
@@ -1,428 +1,535 @@
|
|
|
1
|
-
# <div align='center'>Baileys Modification - Supun Fernando</div>
|
|
2
|
-
|
|
3
1
|
<div align="center">
|
|
4
2
|
|
|
5
|
-
|
|
3
|
+
<img src="https://capsule-render.vercel.app/api?type=waving&height=220&color=0:ff6b6b,40:f06595,100:845ef7&text=@mr-supun-fernando/supunmd-bail&fontAlignY=40&fontSize=44&fontColor=ffffff&desc=Stable%20WhatsApp%20Web%20API%20Fork%20for%20Production%20Bots&descAlignY=60&descSize=16" alt="Header Banner" />
|
|
6
4
|
|
|
7
|
-
|
|
5
|
+
[](https://badge.fury.io/js/supunmd-bail)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
[](https://nodejs.org/)
|
|
8
|
+
[](https://npmjs.com/package/supunmd-bail)
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
<img src="https://img.shields.io/npm/v/supunmd-bail?color=red&label=Version&logo=npm" alt="npm version" />
|
|
11
|
-
</a>
|
|
10
|
+
</div>
|
|
12
11
|
|
|
13
|
-
|
|
14
|
-
<img src="https://img.shields.io/npm/dt/supunmd-bail?color=red&label=Downloads&logo=npm" alt="npm downloads" />
|
|
15
|
-
</a>
|
|
12
|
+
---
|
|
16
13
|
|
|
17
|
-
|
|
18
|
-
<img src="https://img.shields.io/badge/WhatsApp-Channel-25D366?logo=whatsapp&logoColor=white" alt="WhatsApp Channel" />
|
|
19
|
-
</a>
|
|
20
|
-
|
|
21
|
-
</div>
|
|
14
|
+
**supunmd-bail** is an open-source library designed to help developers build automation solutions and integrations with WhatsApp efficiently and directly. Using websocket technology without the need for a browser, this library supports a wide range of features such as message management, chat handling, group administration, as well as interactive messages and action buttons for a more dynamic user experience.
|
|
22
15
|
|
|
16
|
+
Actively developed and maintained, baileys continuously receives updates to enhance stability and performance. One of the main focuses is to improve the pairing and authentication processes to be more stable and secure. Pairing features can be customized with your own codes, making the process more reliable and less prone to interruptions.
|
|
23
17
|
|
|
24
|
-
|
|
18
|
+
This library is highly suitable for building business bots, chat automation systems, customer service solutions, and various other communication automation applications that require high stability and comprehensive features. With a lightweight and modular design, baileys is easy to integrate into different systems and platforms.
|
|
25
19
|
|
|
26
|
-
- [Important Note](#important-note)
|
|
27
|
-
- [Install](#install)
|
|
28
|
-
- [Added Features and Improvements](#-added-features-and-improvements)
|
|
29
|
-
- [Feature Examples](#feature-examples)
|
|
30
|
-
- [Newsletter Management](#newsletter-management)
|
|
31
|
-
- [Button and Interactive Message Management](#button-and-interactive-message-management)
|
|
32
|
-
- [Send Album Message](#send-album-message)
|
|
33
|
-
- [AI Message Icon Customization](#ai-message-icon-customization)
|
|
34
|
-
- [Custom Pairing Code Generation](#custom-pairing-code-generation)
|
|
35
|
-
- [Reporting Issues](#reporting-issues)
|
|
36
|
-
- [Notes](#notes)
|
|
37
20
|
---
|
|
38
21
|
|
|
39
|
-
|
|
22
|
+
### Main Features and Advantages
|
|
40
23
|
|
|
41
|
-
|
|
24
|
+
- Supports automatic and custom pairing processes
|
|
25
|
+
- Fixes previous pairing issues that often caused failures or disconnections
|
|
26
|
+
- Supports interactive messages, action buttons, and dynamic menus
|
|
27
|
+
- Efficient automatic session management for reliable operation
|
|
28
|
+
- Compatible with the latest multi-device features from WhatsApp
|
|
29
|
+
- Lightweight, stable, and easy to integrate into various systems
|
|
30
|
+
- Suitable for developing bots, automation, and complete communication solutions
|
|
31
|
+
- Comprehensive documentation and example codes to facilitate development
|
|
42
32
|
|
|
43
|
-
|
|
33
|
+
---
|
|
44
34
|
|
|
45
|
-
|
|
35
|
+
## 📦 Installation
|
|
36
|
+
|
|
37
|
+
### NPM
|
|
38
|
+
```bash
|
|
39
|
+
npm install supunmd-bail
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Yarn
|
|
43
|
+
```bash
|
|
44
|
+
yarn add supunmd-bail
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Using Different Package Name
|
|
48
|
+
Add to your `package.json`:
|
|
46
49
|
```json
|
|
47
|
-
|
|
50
|
+
{
|
|
51
|
+
"dependencies": {
|
|
48
52
|
"@whiskeysockets/baileys": "npm:supunmd-bail"
|
|
53
|
+
}
|
|
49
54
|
}
|
|
50
55
|
```
|
|
51
|
-
or install in terminal:
|
|
52
|
-
```
|
|
53
|
-
npm install @whiskeysockets/baileys@npm:supunmd-bail
|
|
54
|
-
```
|
|
55
56
|
|
|
56
|
-
|
|
57
|
-
```
|
|
58
|
-
//
|
|
59
|
-
import makeWASocket from '
|
|
60
|
-
```
|
|
57
|
+
### Import
|
|
58
|
+
```javascript
|
|
59
|
+
// ESM
|
|
60
|
+
import makeWASocket from 'supunmd-bail'
|
|
61
61
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
const { default: makeWASocket } = require("@whiskeysockets/baileys")
|
|
62
|
+
// CommonJS
|
|
63
|
+
const { default: makeWASocket } = require('supunmd-bail')
|
|
65
64
|
```
|
|
66
65
|
|
|
67
|
-
|
|
66
|
+
---
|
|
68
67
|
|
|
69
|
-
|
|
70
|
-
| :------------------------------------ | :---------------------------------------------------------------------------------------------------------------------------------------- |
|
|
71
|
-
| 💬 **Send Messages to Channels** | Supports sending text and media messages to channels. |
|
|
72
|
-
| 🔘 **Button & Interactive Messages** | Supports sending button messages and interactive messages on WhatsApp Messenger and WhatsApp Business. |
|
|
73
|
-
| 🖼️ **Send Album Messages** | Supports sending multiple images as an album (grouped media message), enabling richer and more organized media sharing. |
|
|
74
|
-
| 👥 **Group with LID Support** | Full support for group using `@lid`, ensuring compatibility with the latest WhatsApp group addressing format. |
|
|
75
|
-
| 🤖 **AI Message Icon** | Customize message appearances with an optional AI icon, adding a modern touch. |
|
|
76
|
-
| 🖼️ **Full-Size Profile Pictures** | Allows users to upload profile pictures in their original size without cropping, ensuring better quality and visual presentation. |
|
|
77
|
-
| 🔑 **Custom Pairing Codes** | Users can now create and customize pairing codes as they wish, enhancing convenience and security when connecting devices. |
|
|
78
|
-
| 🛠️ **Libsignal Fixes** | Enjoy a cleaner development experience with refined logs, providing more informative and less cluttered output from the libsignal library.|
|
|
68
|
+
<details>
|
|
79
69
|
|
|
80
|
-
|
|
70
|
+
<summary><strong>Click to expand: Bailey Some Usage Things</strong></summary>
|
|
81
71
|
|
|
82
|
-
## Feature Examples
|
|
83
72
|
|
|
84
|
-
|
|
73
|
+
## 📖 Quick Start
|
|
85
74
|
|
|
86
|
-
|
|
75
|
+
1. **Initialize the Socket**:
|
|
87
76
|
|
|
88
|
-
|
|
89
|
-
<summary style="font-weight: bold; cursor: pointer; padding: 8px; border-bottom: 1px solid #eee; margin-bottom: 5px;">Show Examples</summary>
|
|
90
|
-
<div style="padding: 10px 15px; background: #f9f9f9; border: 1px solid #eee; border-top: none; border-radius: 0 0 5px 5px;">
|
|
91
|
-
|
|
92
|
-
- **To get info newsletter**
|
|
93
|
-
```ts
|
|
94
|
-
const metadata = await sock.newsletterMetadata("invite", "xxxxx")
|
|
95
|
-
// or
|
|
96
|
-
const metadata = await sock.newsletterMetadata("jid", "abcd@newsletter")
|
|
97
|
-
console.log(metadata)
|
|
98
|
-
```
|
|
99
|
-
- **To update the description of a newsletter**
|
|
100
|
-
```ts
|
|
101
|
-
await sock.newsletterUpdateDescription("abcd@newsletter", "New Description")
|
|
102
|
-
```
|
|
103
|
-
- **To update the name of a newsletter**
|
|
104
|
-
```ts
|
|
105
|
-
await sock.newsletterUpdateName("abcd@newsletter", "New Name")
|
|
106
|
-
```
|
|
107
|
-
- **To update the profile picture of a newsletter**
|
|
108
|
-
```ts
|
|
109
|
-
await sock.newsletterUpdatePicture("abcd@newsletter", buffer)
|
|
110
|
-
```
|
|
111
|
-
- **To remove the profile picture of a newsletter**
|
|
112
|
-
```ts
|
|
113
|
-
await sock.newsletterRemovePicture("abcd@newsletter")
|
|
114
|
-
```
|
|
115
|
-
- **To mute notifications for a newsletter**
|
|
116
|
-
```ts
|
|
117
|
-
await sock.newsletterUnmute("abcd@newsletter")
|
|
118
|
-
```
|
|
119
|
-
- **To mute notifications for a newsletter**
|
|
120
|
-
```ts
|
|
121
|
-
await sock.newsletterMute("abcd@newsletter")
|
|
122
|
-
```
|
|
123
|
-
- **To create a newsletter**
|
|
124
|
-
```ts
|
|
125
|
-
const metadata = await sock.newsletterCreate("Newsletter Name")
|
|
126
|
-
console.log(metadata)
|
|
127
|
-
```
|
|
128
|
-
- **To delete a newsletter**
|
|
129
|
-
```ts
|
|
130
|
-
await sock.newsletterDelete("abcd@newsletter")
|
|
131
|
-
```
|
|
132
|
-
- **To follow a newsletter**
|
|
133
|
-
```ts
|
|
134
|
-
await sock.newsletterFollow("abcd@newsletter")
|
|
135
|
-
```
|
|
136
|
-
- **To unfollow a newsletter**
|
|
137
|
-
```ts
|
|
138
|
-
await sock.newsletterUnfollow("abcd@newsletter")
|
|
139
|
-
```
|
|
140
|
-
- **To send reaction**
|
|
141
|
-
```ts
|
|
142
|
-
// jid, id message & emoticon
|
|
143
|
-
// way to get the ID is to copy the message url from channel
|
|
144
|
-
// Example: [ https://whatsapp.com/channel/xxxxx/175 ]
|
|
145
|
-
// The last number of the URL is the ID
|
|
146
|
-
const id = "175"
|
|
147
|
-
await sock.newsletterReactMessage("abcd@newsletter", id, "🥳")
|
|
148
|
-
```
|
|
149
|
-
</div>
|
|
150
|
-
</details>
|
|
77
|
+
```javascript
|
|
151
78
|
|
|
152
|
-
|
|
79
|
+
import makeWASocket, { DisconnectReason, useMultiFileAuthState } from '@mr-supun-fernando/supunmd-bail'
|
|
153
80
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
81
|
+
const startSock = async () => {
|
|
82
|
+
const { state, saveCreds } = await useMultiFileAuthState('auth_info_baileys');
|
|
83
|
+
const sock = makeWASocket({
|
|
84
|
+
auth: state,
|
|
85
|
+
browser: ['SupunMd', 'Chrome', '1.0.0'],
|
|
86
|
+
printQRInTerminal: true, // Set to false for custom QR handling
|
|
87
|
+
syncFullHistory: false, // Optimize for production
|
|
88
|
+
});
|
|
157
89
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
90
|
+
sock.ev.on('creds.update', saveCreds);
|
|
91
|
+
|
|
92
|
+
sock.ev.on('connection.update', (update) => {
|
|
93
|
+
const { connection, lastDisconnect } = update;
|
|
94
|
+
if (connection === 'close') {
|
|
95
|
+
const shouldReconnect = (lastDisconnect?.error)?.output?.statusCode !== DisconnectReason.loggedOut;
|
|
96
|
+
console.log('Connection closed due to ', lastDisconnect?.error, ', reconnecting ', shouldReconnect);
|
|
97
|
+
if (shouldReconnect) startSock(); // Auto-reconnect
|
|
98
|
+
} else if (connection === 'open') {
|
|
99
|
+
console.log('✅ Connected to WhatsApp');
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
return sock;
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
const sock = await startSock();
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
2. **Send a Basic Message**:
|
|
110
|
+
```javascript
|
|
111
|
+
const jid = 'recipient@s.whatsapp.net';
|
|
112
|
+
await sock.sendMessage(jid, { text: 'Hello from SupunMd!' });
|
|
113
|
+
```
|
|
171
114
|
|
|
172
|
-
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
| Category | Description |
|
|
118
|
+
|---|---|
|
|
119
|
+
|channels | Seamlessly send messages to WhatsApp Channels. |
|
|
120
|
+
| 🖱️ Buttons | Create interactive messages with button options and quick replies. |
|
|
121
|
+
| 🖼️ Albums | Send grouped images or videos as an album (carousel-like format). |
|
|
122
|
+
| 👤 LID Grouping | Handle group operations using the latest @lid addressing style. |
|
|
123
|
+
| 🤖 AI Message Style | Add a stylized “AI” icon to messages. |
|
|
124
|
+
| 📷 HD Profile Pics | Upload full-size profile pictures without cropping. |
|
|
125
|
+
| 🔐 Pairing Code | Generate custom alphanumeric pairing codes. |
|
|
126
|
+
| 🛠️ Dev Experience | Reduced noise from logs with optimized libsignal printouts. |
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
## 🔧 API Reference
|
|
131
|
+
|
|
132
|
+
### Utility Functions
|
|
133
|
+
|
|
134
|
+
## 🚀 Features & Usage
|
|
135
|
+
|
|
136
|
+
### 📬 Newsletter Control
|
|
137
|
+
Manage WhatsApp Newsletters (Channels), from creation to message interactions.
|
|
138
|
+
|
|
139
|
+
```js
|
|
140
|
+
// Create a newsletter
|
|
141
|
+
await sock.newsletterCreate("SupunMd Update");
|
|
142
|
+
|
|
143
|
+
// Update description
|
|
144
|
+
await sock.newsletterUpdateDescription(
|
|
145
|
+
"1234XXXX@newsletter",
|
|
146
|
+
"YOO updates come daily"
|
|
147
|
+
);
|
|
148
|
+
|
|
149
|
+
// React to a channel message
|
|
150
|
+
await sock.newsletterReactMessage(
|
|
151
|
+
"1234XXXX@newsletter",
|
|
152
|
+
"192",
|
|
153
|
+
"💜"
|
|
154
|
+
);
|
|
173
155
|
```
|
|
174
|
-
- **To send button with image**
|
|
175
|
-
```ts
|
|
176
|
-
const buttons = [
|
|
177
|
-
{ buttonId: 'id1', buttonText: { displayText: 'Button 1' }, type: 1 },
|
|
178
|
-
{ buttonId: 'id2', buttonText: { displayText: 'Button 2' }, type: 1 }
|
|
179
|
-
]
|
|
180
|
-
|
|
181
|
-
const buttonMessage = {
|
|
182
|
-
image: { url: "https://example.com/abcd.jpg" }, // image: buffer or path
|
|
183
|
-
caption: "Hi it's button message with image",
|
|
184
|
-
footer: 'Hello World',
|
|
185
|
-
buttons,
|
|
186
|
-
headerType: 1
|
|
187
|
-
}
|
|
188
156
|
|
|
189
|
-
|
|
157
|
+
---
|
|
190
158
|
|
|
159
|
+
### Custom Pairing Code
|
|
160
|
+
```javascript
|
|
161
|
+
const phoneNumber = "947XXXXX"
|
|
162
|
+
const code = await sock.requestPairingCode(phoneNumber.trim(), "ABCDE01")
|
|
163
|
+
console.log("Your pairing code: " + code)
|
|
191
164
|
```
|
|
192
|
-
|
|
193
|
-
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
### 📌 Interactive Messaging
|
|
169
|
+
Send interactive messages using buttons to increase user engagement.
|
|
170
|
+
|
|
171
|
+
```js
|
|
194
172
|
const buttons = [
|
|
195
|
-
{ buttonId:
|
|
196
|
-
{ buttonId:
|
|
197
|
-
]
|
|
198
|
-
|
|
199
|
-
const buttonMessage = {
|
|
200
|
-
video: { url: "https://example.com/abcd.mp4" }, // video: buffer or path
|
|
201
|
-
caption: "Hi it's button message with video",
|
|
202
|
-
footer: 'Hello World',
|
|
203
|
-
buttons,
|
|
204
|
-
headerType: 1
|
|
205
|
-
}
|
|
173
|
+
{ buttonId: "btn1", buttonText: { displayText: "Click Me" }, type: 1 },
|
|
174
|
+
{ buttonId: "btn2", buttonText: { displayText: "Visit Site" }, type: 1 }
|
|
175
|
+
];
|
|
206
176
|
|
|
207
|
-
await sock.sendMessage(id,
|
|
177
|
+
await sock.sendMessage(id, {
|
|
178
|
+
text: "Choose one:",
|
|
179
|
+
footer: "Mova - Nest | Lk",
|
|
180
|
+
buttons,
|
|
181
|
+
headerType: 1
|
|
182
|
+
});
|
|
208
183
|
```
|
|
209
184
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
buttonParamsJson: JSON.stringify({
|
|
223
|
-
display_text: "Tap Here!",
|
|
224
|
-
url: "https://www.example.com/"
|
|
225
|
-
})
|
|
226
|
-
},
|
|
227
|
-
{
|
|
228
|
-
name: "cta_copy",
|
|
229
|
-
buttonParamsJson: JSON.stringify({
|
|
230
|
-
display_text: "Copy Code",
|
|
231
|
-
id: "12345",
|
|
232
|
-
copy_code: "12345"
|
|
233
|
-
})
|
|
234
|
-
}
|
|
235
|
-
]
|
|
236
|
-
|
|
237
|
-
const interactiveMessage = {
|
|
238
|
-
text: "Hello World!",
|
|
239
|
-
title: "this is the title",
|
|
240
|
-
footer: "this is the footer",
|
|
241
|
-
interactiveButtons
|
|
242
|
-
}
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
### 🖼️ Send Album
|
|
188
|
+
Send multiple media (images or videos) in a single album message.
|
|
189
|
+
|
|
190
|
+
```js
|
|
191
|
+
await sock.sendMessage(jid, {
|
|
192
|
+
albumMessage: [
|
|
193
|
+
{ image: { url: "https://example.com/pic1.jpg" }, caption: "Celon Memories" },
|
|
194
|
+
{ image: { url: "https://example.com/pic1.jpg" }, caption: "Celon Memories" }
|
|
195
|
+
]
|
|
196
|
+
}, { quoted: m });
|
|
243
197
|
|
|
244
|
-
await sock.sendMessage(id, interactiveMessage, { quoted: null })
|
|
245
198
|
```
|
|
246
|
-
- **To send interactive message with image**
|
|
247
|
-
```ts
|
|
248
|
-
const interactiveButtons = [
|
|
249
|
-
{
|
|
250
|
-
name: "quick_reply",
|
|
251
|
-
buttonParamsJson: JSON.stringify({
|
|
252
|
-
display_text: "Quick Reply",
|
|
253
|
-
id: "ID"
|
|
254
|
-
})
|
|
255
|
-
},
|
|
256
|
-
{
|
|
257
|
-
name: "cta_url",
|
|
258
|
-
buttonParamsJson: JSON.stringify({
|
|
259
|
-
display_text: "Tap Here!",
|
|
260
|
-
url: "https://www.example.com/"
|
|
261
|
-
})
|
|
262
|
-
},
|
|
263
|
-
{
|
|
264
|
-
name: "cta_copy",
|
|
265
|
-
buttonParamsJson: JSON.stringify({
|
|
266
|
-
display_text: "Copy Code",
|
|
267
|
-
id: "12345",
|
|
268
|
-
copy_code: "12345"
|
|
269
|
-
})
|
|
270
|
-
}
|
|
271
|
-
]
|
|
272
|
-
|
|
273
|
-
const interactiveMessage = {
|
|
274
|
-
image: { url: "https://example.com/abcd.jpg" }, // image: buffer or path
|
|
275
|
-
caption: "this is the caption",
|
|
276
|
-
title: "this is the title",
|
|
277
|
-
footer: "this is the footer",
|
|
278
|
-
interactiveButtons
|
|
279
|
-
}
|
|
280
199
|
|
|
281
|
-
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
### 🔐 Custom Pairing Code
|
|
203
|
+
Pair a WhatsApp device using a custom code.
|
|
204
|
+
|
|
205
|
+
```js
|
|
206
|
+
const code = await sock.requestPairingCode("94XXXXXXXX","ABCDE123");
|
|
207
|
+
console.log("Pairing Code:", code);
|
|
282
208
|
```
|
|
283
|
-
- **To send interactive message with video**
|
|
284
|
-
```ts
|
|
285
|
-
const interactiveButtons = [
|
|
286
|
-
{
|
|
287
|
-
name: "quick_reply",
|
|
288
|
-
buttonParamsJson: JSON.stringify({
|
|
289
|
-
display_text: "Quick Reply",
|
|
290
|
-
id: "ID"
|
|
291
|
-
})
|
|
292
|
-
},
|
|
293
|
-
{
|
|
294
|
-
name: "cta_url",
|
|
295
|
-
buttonParamsJson: JSON.stringify({
|
|
296
|
-
display_text: "Tap Here!",
|
|
297
|
-
url: "https://www.example.com/"
|
|
298
|
-
})
|
|
299
|
-
},
|
|
300
|
-
{
|
|
301
|
-
name: "cta_copy",
|
|
302
|
-
buttonParamsJson: JSON.stringify({
|
|
303
|
-
display_text: "Copy Code",
|
|
304
|
-
id: "12345",
|
|
305
|
-
copy_code: "12345"
|
|
306
|
-
})
|
|
307
|
-
}
|
|
308
|
-
]
|
|
309
|
-
|
|
310
|
-
const interactiveMessage = {
|
|
311
|
-
video: { url: "https://example.com/abcd.mp4" }, // video: buffer or path
|
|
312
|
-
caption: "this is the caption",
|
|
313
|
-
title: "this is the title",
|
|
314
|
-
footer: "this is the footer",
|
|
315
|
-
interactiveButtons
|
|
316
|
-
}
|
|
317
209
|
|
|
318
|
-
|
|
210
|
+
---
|
|
211
|
+
|
|
212
|
+
#### Event Message
|
|
213
|
+
Invite users to virtual events with location and RSVP links.
|
|
214
|
+
|
|
215
|
+
```javascript
|
|
216
|
+
await sock.sendMessage(jid, {
|
|
217
|
+
eventMessage: {
|
|
218
|
+
isCanceled: false,
|
|
219
|
+
name: "Technology Meetup 2026",
|
|
220
|
+
description: "Join us for AI innovations!",
|
|
221
|
+
location: {
|
|
222
|
+
degreesLatitude: 0,
|
|
223
|
+
degreesLongitude: 0,
|
|
224
|
+
name: "SUPUN MD"
|
|
225
|
+
},
|
|
226
|
+
joinLink: "https://call.whatsapp.com/video/event123",
|
|
227
|
+
startTime: "1763019000",
|
|
228
|
+
endTime: "1763026200",
|
|
229
|
+
extraGuestsAllowed: false
|
|
230
|
+
}
|
|
231
|
+
}, { quoted: m });
|
|
319
232
|
```
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
title: "title",
|
|
330
|
-
highlight_label: "label",
|
|
331
|
-
rows: [
|
|
233
|
+
|
|
234
|
+
#### Poll Result Message
|
|
235
|
+
Share poll outcomes with vote tallies.
|
|
236
|
+
|
|
237
|
+
```javascript
|
|
238
|
+
await sock.sendMessage(jid, {
|
|
239
|
+
pollResultMessage: {
|
|
240
|
+
name: "Hello World",
|
|
241
|
+
pollVotes: [
|
|
332
242
|
{
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
description: "DESCRIPTION",
|
|
336
|
-
id: "YOUR ID"
|
|
243
|
+
optionName: "TEST 1",
|
|
244
|
+
optionVoteCount: "112233"
|
|
337
245
|
},
|
|
338
246
|
{
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
description: "DESCRIPTION",
|
|
342
|
-
id: "YOUR ID"
|
|
247
|
+
optionName: "TEST 2",
|
|
248
|
+
optionVoteCount: "1"
|
|
343
249
|
}
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
}
|
|
349
|
-
];
|
|
250
|
+
]
|
|
251
|
+
}
|
|
252
|
+
}, { quoted: m });
|
|
253
|
+
```
|
|
350
254
|
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
title: "this is the title",
|
|
354
|
-
footer: "this is the footer",
|
|
355
|
-
interactiveButtons
|
|
356
|
-
};
|
|
255
|
+
#### Simple Interactive Message
|
|
256
|
+
Engage with copyable CTAs.
|
|
357
257
|
|
|
358
|
-
|
|
258
|
+
```javascript
|
|
259
|
+
await sock.sendMessage(jid, {
|
|
260
|
+
interactiveMessage: {
|
|
261
|
+
header: 'Quick Action',
|
|
262
|
+
title: 'Copy this code',
|
|
263
|
+
footer: 'Powered by @SupunFernando',
|
|
264
|
+
buttons: [
|
|
265
|
+
{
|
|
266
|
+
name: "cta_copy",
|
|
267
|
+
buttonParamsJson: JSON.stringify({
|
|
268
|
+
display_text: "copy code",
|
|
269
|
+
id: "123456789",
|
|
270
|
+
copy_code: "ABC123XYZ"
|
|
271
|
+
})
|
|
272
|
+
}
|
|
273
|
+
]
|
|
274
|
+
}
|
|
275
|
+
}, { quoted: m });
|
|
359
276
|
```
|
|
360
277
|
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
278
|
+
#### Advanced Interactive Message (Native Flow)
|
|
279
|
+
Full native flows with lists, sheets, and offers.
|
|
280
|
+
|
|
281
|
+
```javascript
|
|
282
|
+
await sock.sendMessage(jid, {
|
|
283
|
+
interactiveMessage: {
|
|
284
|
+
header: "Dynamic Menu",
|
|
285
|
+
title: "Explore Options",
|
|
286
|
+
footer: "Contact @SupunFernando for support",
|
|
287
|
+
image: { url: "https://example.com/image.jpg" },
|
|
288
|
+
nativeFlowMessage: {
|
|
289
|
+
messageParamsJson: JSON.stringify({
|
|
290
|
+
limited_time_offer: {
|
|
291
|
+
text: "Exclusive deal ends soon!",
|
|
292
|
+
url: "https://whatsapp.com/channel/0029Vb55cv41nozBTTIw1y07",
|
|
293
|
+
copy_code: "DEAL2026",
|
|
294
|
+
expiration_time: Date.now() * 86400000
|
|
295
|
+
},
|
|
296
|
+
bottom_sheet: {
|
|
297
|
+
in_thread_buttons_limit: 2,
|
|
298
|
+
divider_indices: [1, 2, 3, 4, 5, 999],
|
|
299
|
+
list_title: "Categories",
|
|
300
|
+
button_title: "View All"
|
|
301
|
+
},
|
|
302
|
+
tap_target_configuration: {
|
|
303
|
+
title: "Learn More",
|
|
304
|
+
description: "Advanced automation tips",
|
|
305
|
+
canonical_url: "https://www.npmjs.com/package/mr-supun-fernando",
|
|
306
|
+
domain: "supunmd.vercel.com",
|
|
307
|
+
button_index: 0
|
|
308
|
+
}
|
|
309
|
+
}),
|
|
310
|
+
buttons: [
|
|
311
|
+
{
|
|
312
|
+
name: "single_select",
|
|
313
|
+
buttonParamsJson: JSON.stringify({
|
|
314
|
+
has_multiple_buttons: true
|
|
315
|
+
})
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
name: "call_permission_request",
|
|
319
|
+
buttonParamsJson: JSON.stringify({
|
|
320
|
+
has_multiple_buttons: true
|
|
321
|
+
})
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
name: "single_select",
|
|
325
|
+
buttonParamsJson: JSON.stringify({
|
|
326
|
+
title: "Hello World",
|
|
327
|
+
sections: [
|
|
328
|
+
{
|
|
329
|
+
title: "title",
|
|
330
|
+
highlight_label: "label",
|
|
331
|
+
rows: [
|
|
332
|
+
{
|
|
333
|
+
title: "@SupunFernando",
|
|
334
|
+
description: "love you",
|
|
335
|
+
id: "row_2"
|
|
336
|
+
}
|
|
337
|
+
]
|
|
338
|
+
}
|
|
339
|
+
],
|
|
340
|
+
has_multiple_buttons: true
|
|
341
|
+
})
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
name: "cta_copy",
|
|
345
|
+
buttonParamsJson: JSON.stringify({
|
|
346
|
+
display_text: "copy code",
|
|
347
|
+
id: "123456789",
|
|
348
|
+
copy_code: "ABC123XYZ"
|
|
349
|
+
})
|
|
350
|
+
}
|
|
351
|
+
]
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
}, { quoted: m });
|
|
355
|
+
```
|
|
365
356
|
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
357
|
+
#### Interactive Message with Thumbnail
|
|
358
|
+
Rich previews for products/services.
|
|
359
|
+
|
|
360
|
+
```javascript
|
|
361
|
+
await sock.sendMessage(jid, {
|
|
362
|
+
interactiveMessage: {
|
|
363
|
+
header: { title: 'Featured Item' },
|
|
364
|
+
title: 'Supun Md',
|
|
365
|
+
footer: 'Upgrade today',
|
|
366
|
+
image: { url: 'https://example.com/product-thumb.jpg' },
|
|
367
|
+
buttons: [
|
|
368
|
+
{
|
|
369
|
+
name: 'cta_copy',
|
|
370
|
+
buttonParamsJson: JSON.stringify({
|
|
371
|
+
display_text: 'copy code',
|
|
372
|
+
id: '123456789',
|
|
373
|
+
copy_code: 'ABC123XYZ'
|
|
374
|
+
})
|
|
375
|
+
}
|
|
376
|
+
]
|
|
381
377
|
}
|
|
382
|
-
|
|
378
|
+
}, { quoted: m });
|
|
379
|
+
```
|
|
383
380
|
|
|
384
|
-
|
|
381
|
+
#### Product Message
|
|
382
|
+
E-commerce ready catalogs.
|
|
383
|
+
|
|
384
|
+
```javascript
|
|
385
|
+
await sock.sendMessage(jid, {
|
|
386
|
+
productMessage: {
|
|
387
|
+
title: "Produk Contoh",
|
|
388
|
+
description: "Ini adalah deskripsi produk",
|
|
389
|
+
thumbnail: { url: "https://example.com/image.jpg" },
|
|
390
|
+
productId: "PROD001",
|
|
391
|
+
retailerId: "RETAIL001",
|
|
392
|
+
url: "https://example.com/product",
|
|
393
|
+
body: "Detail produk",
|
|
394
|
+
footer: "Harga spesial",
|
|
395
|
+
priceAmount1000: 50000,
|
|
396
|
+
currencyCode: "USD",
|
|
397
|
+
buttons: [
|
|
398
|
+
{
|
|
399
|
+
name: "cta_url",
|
|
400
|
+
buttonParamsJson: JSON.stringify({
|
|
401
|
+
display_text: "Beli Sekarang",
|
|
402
|
+
url: "https://example.com/buy"
|
|
403
|
+
})
|
|
404
|
+
}
|
|
405
|
+
]
|
|
406
|
+
}
|
|
407
|
+
}, { quoted: m });
|
|
385
408
|
```
|
|
386
409
|
|
|
387
|
-
|
|
388
|
-
|
|
410
|
+
### Interactive Message with Document Buffer
|
|
411
|
+
Send interactive messages with document from buffer (file system) - **Note: Documents only support buffer**:
|
|
412
|
+
|
|
413
|
+
```javascript
|
|
414
|
+
await sock.sendMessage(jid, {
|
|
415
|
+
interactiveMessage: {
|
|
416
|
+
header: "Hello World",
|
|
417
|
+
title: "Hello World",
|
|
418
|
+
footer: "Powered by @SupunFernando",
|
|
419
|
+
document: fs.readFileSync("./package.json"),
|
|
420
|
+
mimetype: "application/pdf",
|
|
421
|
+
fileName: "pantatBegetar.pdf",
|
|
422
|
+
jpegThumbnail: fs.readFileSync("./document.jpeg"),
|
|
423
|
+
contextInfo: {
|
|
424
|
+
mentionedJid: [jid],
|
|
425
|
+
forwardingScore: 777,
|
|
426
|
+
isForwarded: false
|
|
427
|
+
},
|
|
428
|
+
externalAdReply: {
|
|
429
|
+
title: "Wabot",
|
|
430
|
+
body: "Z team",
|
|
431
|
+
mediaType: 3,
|
|
432
|
+
thumbnailUrl: "https://example.com/image.jpg",
|
|
433
|
+
mediaUrl: " X ",
|
|
434
|
+
sourceUrl: "https://t.me/pantatBegetar",
|
|
435
|
+
showAdAttribution: true,
|
|
436
|
+
renderLargerThumbnail: false
|
|
437
|
+
},
|
|
438
|
+
buttons: [
|
|
439
|
+
{
|
|
440
|
+
name: "cta_url",
|
|
441
|
+
buttonParamsJson: JSON.stringify({
|
|
442
|
+
display_text: "Telegram",
|
|
443
|
+
url: "https://t.me/pantatBegetar",
|
|
444
|
+
merchant_url: "https://t.me/pantatBegetar"
|
|
445
|
+
})
|
|
446
|
+
}
|
|
447
|
+
]
|
|
448
|
+
}
|
|
449
|
+
}, { quoted: m });
|
|
450
|
+
```
|
|
389
451
|
|
|
390
|
-
### AI Message Icon Customization
|
|
391
452
|
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
453
|
+
### Interactive Message with Document Buffer (Simple)
|
|
454
|
+
Send interactive messages with document from buffer (file system) without contextInfo and externalAdReply - **Note: Documents only support buffer**:
|
|
455
|
+
|
|
456
|
+
```javascript
|
|
457
|
+
await sock.sendMessage(jid, {
|
|
458
|
+
interactiveMessage: {
|
|
459
|
+
header: "Hello World",
|
|
460
|
+
title: "Hello World",
|
|
461
|
+
footer: "Powered by @SupunFernando",
|
|
462
|
+
document: fs.readFileSync("./package.json"),
|
|
463
|
+
mimetype: "application/pdf",
|
|
464
|
+
fileName: "pantatBegetar.pdf",
|
|
465
|
+
jpegThumbnail: fs.readFileSync("./document.jpeg"),
|
|
466
|
+
buttons: [
|
|
467
|
+
{
|
|
468
|
+
name: "cta_url",
|
|
469
|
+
buttonParamsJson: JSON.stringify({
|
|
470
|
+
display_text: "Telegram",
|
|
471
|
+
url: "https://t.me/pantatBegetar",
|
|
472
|
+
merchant_url: "https://t.me/pantatBegetar"
|
|
473
|
+
})
|
|
474
|
+
}
|
|
475
|
+
]
|
|
476
|
+
}
|
|
477
|
+
}, { quoted: m });
|
|
478
|
+
```
|
|
395
479
|
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
480
|
+
### Request Payment Message
|
|
481
|
+
Send payment request messages with custom background and sticker:
|
|
482
|
+
|
|
483
|
+
```javascript
|
|
484
|
+
let quotedType = m.quoted?.mtype || '';
|
|
485
|
+
let quotedContent = JSON.stringify({ [quotedType]: m.quoted }, null, 2);
|
|
486
|
+
|
|
487
|
+
await sock.sendMessage(jid, {
|
|
488
|
+
requestPaymentMessage: {
|
|
489
|
+
currency: "IDR",
|
|
490
|
+
amount: 10000000,
|
|
491
|
+
from: m.sender,
|
|
492
|
+
sticker: JSON.parse(quotedContent),
|
|
493
|
+
background: {
|
|
494
|
+
id: "100",
|
|
495
|
+
fileLength: "0",
|
|
496
|
+
width: 1000,
|
|
497
|
+
height: 1000,
|
|
498
|
+
mimetype: "image/webp",
|
|
499
|
+
placeholderArgb: 0xFF00FFFF,
|
|
500
|
+
textArgb: 0xFFFFFFFF,
|
|
501
|
+
subtextArgb: 0xFFAA00FF
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
}, { quoted: m });
|
|
399
505
|
```
|
|
400
506
|
|
|
401
|
-
|
|
507
|
+
---
|
|
508
|
+
|
|
402
509
|
</details>
|
|
403
510
|
|
|
404
|
-
|
|
511
|
+
## Why Choose WhatsApp Baileys?
|
|
405
512
|
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
513
|
+
Because this library offers high stability, full features, and an actively improved pairing process. It is ideal for developers aiming to create professional and secure WhatsApp automation solutions. Support for the latest WhatsApp features ensures compatibility with platform updates.
|
|
514
|
+
|
|
515
|
+
---
|
|
516
|
+
|
|
517
|
+
### Technical Notes
|
|
518
|
+
|
|
519
|
+
- Supports custom pairing codes that are stable and secure
|
|
520
|
+
- Fixes previous issues related to pairing and authentication
|
|
521
|
+
- Features interactive messages and action buttons for dynamic menu creation
|
|
522
|
+
- Automatic and efficient session management for long-term stability
|
|
523
|
+
- Compatible with the latest multi-device features from WhatsApp
|
|
524
|
+
- Easy to integrate and customize based on your needs
|
|
525
|
+
- Perfect for developing bots, customer service automation, and other communication applications
|
|
526
|
+
|
|
527
|
+
---
|
|
528
|
+
|
|
529
|
+
## 📞 Support
|
|
422
530
|
|
|
423
|
-
|
|
424
|
-
|
|
531
|
+
- **Issues**: [Whatsapp Channel](https://whatsapp.com/channel/0029Vb55cv41nozBTTIw1y07)
|
|
532
|
+
- **Discussions**: [Whatsapp Channel](https://whatsapp.com/channel/0029Vb55cv41nozBTTIw1y07)
|
|
533
|
+
- **NPM**: [@mr-supun-fernando/baileyz](https://www.npmjs.com/package/mr-supun-fernando/supunmd-bail)
|
|
425
534
|
|
|
426
|
-
|
|
427
|
-
Everything other than the modifications mentioned above remains the same as the original repository. You can check out the original repository at [WhiskeySockets](https://github.com/WhiskeySockets/Baileys)
|
|
428
|
-
Package Sidebar
|
|
535
|
+
**Built with ❤️ for the WhatsApp dev community. Let's automate the future!** 🚀
|