@nexustechpro/baileys 1.0.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/README.md +1573 -0
- package/WAProto/fix-imports.js +29 -0
- package/WAProto/index.js +169659 -0
- package/lib/Defaults/index.js +115 -0
- package/lib/Signal/Group/ciphertext-message.js +12 -0
- package/lib/Signal/Group/group-session-builder.js +30 -0
- package/lib/Signal/Group/group_cipher.js +82 -0
- package/lib/Signal/Group/index.js +12 -0
- package/lib/Signal/Group/keyhelper.js +18 -0
- package/lib/Signal/Group/sender-chain-key.js +26 -0
- package/lib/Signal/Group/sender-key-distribution-message.js +63 -0
- package/lib/Signal/Group/sender-key-message.js +66 -0
- package/lib/Signal/Group/sender-key-name.js +48 -0
- package/lib/Signal/Group/sender-key-record.js +41 -0
- package/lib/Signal/Group/sender-key-state.js +84 -0
- package/lib/Signal/Group/sender-message-key.js +26 -0
- package/lib/Signal/libsignal.js +342 -0
- package/lib/Signal/lid-mapping.js +171 -0
- package/lib/Socket/Client/index.js +3 -0
- package/lib/Socket/Client/types.js +11 -0
- package/lib/Socket/Client/websocket.js +91 -0
- package/lib/Socket/business.js +376 -0
- package/lib/Socket/chats.js +963 -0
- package/lib/Socket/communities.js +431 -0
- package/lib/Socket/groups.js +328 -0
- package/lib/Socket/index.js +19 -0
- package/lib/Socket/messages-recv.js +1240 -0
- package/lib/Socket/messages-send.js +1370 -0
- package/lib/Socket/mex.js +42 -0
- package/lib/Socket/newsletter.js +202 -0
- package/lib/Socket/nexus-handler.js +667 -0
- package/lib/Socket/socket.js +871 -0
- package/lib/Store/index.js +4 -0
- package/lib/Store/make-cache-manager-store.js +81 -0
- package/lib/Store/make-in-memory-store.js +416 -0
- package/lib/Store/make-ordered-dictionary.js +82 -0
- package/lib/Store/object-repository.js +31 -0
- package/lib/Types/Auth.js +2 -0
- package/lib/Types/Bussines.js +2 -0
- package/lib/Types/Call.js +2 -0
- package/lib/Types/Chat.js +8 -0
- package/lib/Types/Contact.js +2 -0
- package/lib/Types/Events.js +2 -0
- package/lib/Types/GroupMetadata.js +2 -0
- package/lib/Types/Label.js +25 -0
- package/lib/Types/LabelAssociation.js +7 -0
- package/lib/Types/Message.js +11 -0
- package/lib/Types/Newsletter.js +31 -0
- package/lib/Types/Product.js +2 -0
- package/lib/Types/Signal.js +2 -0
- package/lib/Types/Socket.js +3 -0
- package/lib/Types/State.js +13 -0
- package/lib/Types/USync.js +2 -0
- package/lib/Types/index.js +26 -0
- package/lib/Utils/auth-utils.js +257 -0
- package/lib/Utils/baileys-event-stream.js +56 -0
- package/lib/Utils/browser-utils.js +28 -0
- package/lib/Utils/business.js +231 -0
- package/lib/Utils/chat-utils.js +763 -0
- package/lib/Utils/crypto.js +142 -0
- package/lib/Utils/decode-wa-message.js +279 -0
- package/lib/Utils/event-buffer.js +548 -0
- package/lib/Utils/generics.js +381 -0
- package/lib/Utils/history.js +84 -0
- package/lib/Utils/index.js +20 -0
- package/lib/Utils/link-preview.js +85 -0
- package/lib/Utils/logger.js +3 -0
- package/lib/Utils/lt-hash.js +48 -0
- package/lib/Utils/make-mutex.js +40 -0
- package/lib/Utils/message-retry-manager.js +149 -0
- package/lib/Utils/messages-media.js +685 -0
- package/lib/Utils/messages.js +820 -0
- package/lib/Utils/noise-handler.js +147 -0
- package/lib/Utils/pre-key-manager.js +106 -0
- package/lib/Utils/process-message.js +413 -0
- package/lib/Utils/signal.js +159 -0
- package/lib/Utils/use-multi-file-auth-state.js +121 -0
- package/lib/Utils/validate-connection.js +195 -0
- package/lib/WABinary/constants.js +1301 -0
- package/lib/WABinary/decode.js +238 -0
- package/lib/WABinary/encode.js +216 -0
- package/lib/WABinary/generic-utils.js +111 -0
- package/lib/WABinary/index.js +6 -0
- package/lib/WABinary/jid-utils.js +96 -0
- package/lib/WABinary/types.js +2 -0
- package/lib/WAM/BinaryInfo.js +10 -0
- package/lib/WAM/constants.js +22853 -0
- package/lib/WAM/encode.js +150 -0
- package/lib/WAM/index.js +4 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +29 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +54 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +27 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +38 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +51 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +29 -0
- package/lib/WAUSync/Protocols/index.js +5 -0
- package/lib/WAUSync/USyncQuery.js +94 -0
- package/lib/WAUSync/USyncUser.js +23 -0
- package/lib/WAUSync/index.js +4 -0
- package/lib/index.js +24 -0
- package/package.json +113 -0
package/README.md
ADDED
|
@@ -0,0 +1,1573 @@
|
|
|
1
|
+
# 🚀 NexusTechPro Baileys
|
|
2
|
+
|
|
3
|
+
<div align="center">
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
**Advanced WhatsApp Web API Built on WhiskeySockets/Baileys**
|
|
8
|
+
|
|
9
|
+
[](https://www.npmjs.com/package/@nexustechpro/baileys)
|
|
10
|
+
[](https://www.npmjs.com/package/@nexustechpro/baileys)
|
|
11
|
+
[](./LICENSE)
|
|
12
|
+
[](https://nodejs.org)
|
|
13
|
+
|
|
14
|
+
*Modern, feature-rich, and developer-friendly WhatsApp automation library*
|
|
15
|
+
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## 📋 Table of Contents
|
|
21
|
+
|
|
22
|
+
- [✨ Features](#-features)
|
|
23
|
+
- [📦 Installation](#-installation)
|
|
24
|
+
- [🔌 Quick Start](#-quick-start)
|
|
25
|
+
- [🔐 Authentication](#-authentication)
|
|
26
|
+
- [💡 Socket Configuration](#-socket-configuration)
|
|
27
|
+
- [💾 Session Management](#-session-management)
|
|
28
|
+
- [📡 Event Handling](#-event-handling)
|
|
29
|
+
- [🛠️ Data Store](#️-data-store)
|
|
30
|
+
- [🔑 WhatsApp IDs](#-whatsapp-ids)
|
|
31
|
+
- [💬 Sending Messages](#-sending-messages)
|
|
32
|
+
- [Non-Media Messages](#non-media-messages)
|
|
33
|
+
- [Media Messages](#media-messages)
|
|
34
|
+
- [Interactive Messages](#interactive-messages)
|
|
35
|
+
- [✏️ Message Modifications](#️-message-modifications)
|
|
36
|
+
- [📥 Media Operations](#-media-operations)
|
|
37
|
+
- [👥 Group Management](#-group-management)
|
|
38
|
+
- [📱 User Operations](#-user-operations)
|
|
39
|
+
- [🔒 Privacy Controls](#-privacy-controls)
|
|
40
|
+
- [💬 Chat Operations](#-chat-operations)
|
|
41
|
+
- [📢 Broadcast & Stories](#-broadcast--stories)
|
|
42
|
+
- [🧩 Advanced Features](#-advanced-features)
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## ✨ Features
|
|
47
|
+
|
|
48
|
+
<table>
|
|
49
|
+
<tr>
|
|
50
|
+
<td>
|
|
51
|
+
|
|
52
|
+
### Core Features
|
|
53
|
+
- 🔥 **Multi-Device Support** - Connect without phone always online
|
|
54
|
+
- ⚡ **WebSocket Based** - Fast and efficient communication
|
|
55
|
+
- 💾 **Session Management** - Save and restore authentication
|
|
56
|
+
- 🎯 **Event-Driven** - Reactive message handling
|
|
57
|
+
- 📦 **TypeScript Ready** - Full type definitions included
|
|
58
|
+
- 🚀 **Built on WhiskeySockets** - Latest Baileys implementation
|
|
59
|
+
|
|
60
|
+
</td>
|
|
61
|
+
<td>
|
|
62
|
+
|
|
63
|
+
### Extended Features
|
|
64
|
+
- 🎨 **Interactive Messages** - Buttons, lists, and native flows
|
|
65
|
+
- 📸 **Media Handling** - Images, videos, audio, documents
|
|
66
|
+
- 🤖 **Poll Support** - Create and manage polls
|
|
67
|
+
- 📍 **Location Sharing** - Share locations with metadata
|
|
68
|
+
- 🔔 **Newsletter Support** - Manage WhatsApp channels
|
|
69
|
+
- 🎪 **Carousel Messages** - Multi-card interactive displays
|
|
70
|
+
|
|
71
|
+
</td>
|
|
72
|
+
</tr>
|
|
73
|
+
</table>
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## 📦 Installation
|
|
78
|
+
|
|
79
|
+
### NPM
|
|
80
|
+
```bash
|
|
81
|
+
npm install @nexustechpro/baileys
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Yarn
|
|
85
|
+
```bash
|
|
86
|
+
yarn add @nexustechpro/baileys
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Using Different Package Name
|
|
90
|
+
Add to your `package.json`:
|
|
91
|
+
```json
|
|
92
|
+
{
|
|
93
|
+
"dependencies": {
|
|
94
|
+
"@whiskeysockets/baileys": "npm:@nexustechpro/baileys"
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Import
|
|
100
|
+
```javascript
|
|
101
|
+
// ESM
|
|
102
|
+
import makeWASocket from '@nexustechpro/baileys'
|
|
103
|
+
|
|
104
|
+
// CommonJS
|
|
105
|
+
const { default: makeWASocket } = require('@nexustechpro/baileys')
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## 🔌 Quick Start
|
|
111
|
+
|
|
112
|
+
```javascript
|
|
113
|
+
import makeWASocket, { DisconnectReason, useMultiFileAuthState } from '@nexustechpro/baileys'
|
|
114
|
+
|
|
115
|
+
async function connectToWhatsApp() {
|
|
116
|
+
const { state, saveCreds } = await useMultiFileAuthState('auth_session')
|
|
117
|
+
|
|
118
|
+
const sock = makeWASocket({
|
|
119
|
+
auth: state,
|
|
120
|
+
printQRInTerminal: true,
|
|
121
|
+
browser: ['NexusTechPro', 'Chrome', '1.0.0']
|
|
122
|
+
})
|
|
123
|
+
|
|
124
|
+
sock.ev.on('connection.update', (update) => {
|
|
125
|
+
const { connection, lastDisconnect } = update
|
|
126
|
+
if(connection === 'close') {
|
|
127
|
+
const shouldReconnect = lastDisconnect?.error?.output?.statusCode !== DisconnectReason.loggedOut
|
|
128
|
+
if(shouldReconnect) {
|
|
129
|
+
connectToWhatsApp()
|
|
130
|
+
}
|
|
131
|
+
} else if(connection === 'open') {
|
|
132
|
+
console.log('✅ Connected to WhatsApp!')
|
|
133
|
+
}
|
|
134
|
+
})
|
|
135
|
+
|
|
136
|
+
sock.ev.on('messages.upsert', async ({ messages }) => {
|
|
137
|
+
for(const msg of messages) {
|
|
138
|
+
if(!msg.key.fromMe && msg.message) {
|
|
139
|
+
await sock.sendMessage(msg.key.remoteJid, {
|
|
140
|
+
text: 'Hello from NexusTechPro Baileys!'
|
|
141
|
+
})
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
})
|
|
145
|
+
|
|
146
|
+
sock.ev.on('creds.update', saveCreds)
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
connectToWhatsApp()
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## 🔐 Authentication
|
|
155
|
+
|
|
156
|
+
### QR Code Authentication
|
|
157
|
+
```javascript
|
|
158
|
+
import makeWASocket from '@nexustechpro/baileys'
|
|
159
|
+
|
|
160
|
+
const sock = makeWASocket({
|
|
161
|
+
auth: state,
|
|
162
|
+
printQRInTerminal: true,
|
|
163
|
+
browser: ['NexusTechPro Bot', 'Chrome', '1.0.0']
|
|
164
|
+
})
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### Pairing Code Authentication
|
|
168
|
+
```javascript
|
|
169
|
+
const sock = makeWASocket({
|
|
170
|
+
auth: state,
|
|
171
|
+
printQRInTerminal: false
|
|
172
|
+
})
|
|
173
|
+
|
|
174
|
+
if(!sock.authState.creds.registered) {
|
|
175
|
+
const phoneNumber = '1234567890' // without + or spaces
|
|
176
|
+
const code = await sock.requestPairingCode(phoneNumber)
|
|
177
|
+
console.log(`Pairing code: ${code}`)
|
|
178
|
+
}
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### Custom Pairing Code
|
|
182
|
+
```javascript
|
|
183
|
+
const phoneNumber = "628XXXXX"
|
|
184
|
+
const code = await sock.requestPairingCode(phoneNumber.trim(), "NEXUS01")
|
|
185
|
+
console.log("Your pairing code: " + code)
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## 💡 Socket Configuration
|
|
191
|
+
|
|
192
|
+
### Cache Group Metadata (Recommended)
|
|
193
|
+
```javascript
|
|
194
|
+
const groupCache = new NodeCache({ stdTTL: 5 * 60, useClones: false })
|
|
195
|
+
|
|
196
|
+
const sock = makeWASocket({
|
|
197
|
+
cachedGroupMetadata: async (jid) => groupCache.get(jid)
|
|
198
|
+
})
|
|
199
|
+
|
|
200
|
+
sock.ev.on('groups.update', async ([event]) => {
|
|
201
|
+
const metadata = await sock.groupMetadata(event.id)
|
|
202
|
+
groupCache.set(event.id, metadata)
|
|
203
|
+
})
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### Improve Retry & Poll Decryption
|
|
207
|
+
```javascript
|
|
208
|
+
const sock = makeWASocket({
|
|
209
|
+
getMessage: async (key) => await getMessageFromStore(key)
|
|
210
|
+
})
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### Receive Notifications in WhatsApp App
|
|
214
|
+
```javascript
|
|
215
|
+
const sock = makeWASocket({
|
|
216
|
+
markOnlineOnConnect: false
|
|
217
|
+
})
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
---
|
|
221
|
+
|
|
222
|
+
## 💾 Session Management
|
|
223
|
+
|
|
224
|
+
Avoid scanning QR every time:
|
|
225
|
+
```javascript
|
|
226
|
+
import makeWASocket, { useMultiFileAuthState } from '@nexustechpro/baileys'
|
|
227
|
+
|
|
228
|
+
const { state, saveCreds } = await useMultiFileAuthState('auth_info_baileys')
|
|
229
|
+
const sock = makeWASocket({ auth: state })
|
|
230
|
+
|
|
231
|
+
sock.ev.on('creds.update', saveCreds)
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
> 💡 **Tip:** For production, store auth in a database instead of files.
|
|
235
|
+
|
|
236
|
+
---
|
|
237
|
+
|
|
238
|
+
## 📡 Event Handling
|
|
239
|
+
|
|
240
|
+
### Connection Updates
|
|
241
|
+
```javascript
|
|
242
|
+
sock.ev.on('connection.update', (update) => {
|
|
243
|
+
const { connection, lastDisconnect } = update
|
|
244
|
+
if(connection === 'close') {
|
|
245
|
+
const shouldReconnect = lastDisconnect?.error?.output?.statusCode !== DisconnectReason.loggedOut
|
|
246
|
+
console.log('Connection closed, reconnecting:', shouldReconnect)
|
|
247
|
+
if(shouldReconnect) connectToWhatsApp()
|
|
248
|
+
} else if(connection === 'open') {
|
|
249
|
+
console.log('Connection opened')
|
|
250
|
+
}
|
|
251
|
+
})
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
### New Messages
|
|
255
|
+
```javascript
|
|
256
|
+
sock.ev.on('messages.upsert', async ({ messages }) => {
|
|
257
|
+
for(const msg of messages) {
|
|
258
|
+
console.log('New message:', msg)
|
|
259
|
+
}
|
|
260
|
+
})
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
### Message Updates
|
|
264
|
+
```javascript
|
|
265
|
+
sock.ev.on('messages.update', async (updates) => {
|
|
266
|
+
for(const update of updates) {
|
|
267
|
+
console.log('Message updated:', update)
|
|
268
|
+
}
|
|
269
|
+
})
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
### Decrypt Poll Votes
|
|
273
|
+
```javascript
|
|
274
|
+
sock.ev.on('messages.update', async (event) => {
|
|
275
|
+
for(const { key, update } of event) {
|
|
276
|
+
if(update.pollUpdates) {
|
|
277
|
+
const pollCreation = await getMessage(key)
|
|
278
|
+
if(pollCreation) {
|
|
279
|
+
console.log('Poll update:', getAggregateVotesInPollMessage({
|
|
280
|
+
message: pollCreation,
|
|
281
|
+
pollUpdates: update.pollUpdates,
|
|
282
|
+
}))
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
})
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
---
|
|
290
|
+
|
|
291
|
+
## 🛠️ Data Store
|
|
292
|
+
|
|
293
|
+
```javascript
|
|
294
|
+
import makeWASocket, { makeInMemoryStore } from '@nexustechpro/baileys'
|
|
295
|
+
|
|
296
|
+
const store = makeInMemoryStore({})
|
|
297
|
+
store.readFromFile('./baileys_store.json')
|
|
298
|
+
|
|
299
|
+
setInterval(() => {
|
|
300
|
+
store.writeToFile('./baileys_store.json')
|
|
301
|
+
}, 10_000)
|
|
302
|
+
|
|
303
|
+
const sock = makeWASocket({})
|
|
304
|
+
store.bind(sock.ev)
|
|
305
|
+
|
|
306
|
+
sock.ev.on('chats.upsert', () => {
|
|
307
|
+
console.log('Got chats:', store.chats.all())
|
|
308
|
+
})
|
|
309
|
+
|
|
310
|
+
sock.ev.on('contacts.upsert', () => {
|
|
311
|
+
console.log('Got contacts:', Object.values(store.contacts))
|
|
312
|
+
})
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
> ⚠️ **Important:** Build your own data store for production. In-memory storage wastes RAM.
|
|
316
|
+
|
|
317
|
+
---
|
|
318
|
+
|
|
319
|
+
## 🔑 WhatsApp IDs
|
|
320
|
+
|
|
321
|
+
- **Personal Chats**: `[country code][phone number]@s.whatsapp.net`
|
|
322
|
+
- Example: `1234567890@s.whatsapp.net`
|
|
323
|
+
- **Groups**: `[group id]@g.us`
|
|
324
|
+
- Example: `123456789-987654321@g.us`
|
|
325
|
+
- **Broadcast Lists**: `[timestamp]@broadcast`
|
|
326
|
+
- **Status**: `status@broadcast`
|
|
327
|
+
|
|
328
|
+
---
|
|
329
|
+
|
|
330
|
+
## 💬 Sending Messages
|
|
331
|
+
|
|
332
|
+
### Non-Media Messages
|
|
333
|
+
|
|
334
|
+
#### Text Message
|
|
335
|
+
```javascript
|
|
336
|
+
await sock.sendMessage(jid, { text: 'Hello World!' })
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
#### Quote Message (works with all types)
|
|
340
|
+
```javascript
|
|
341
|
+
await sock.sendMessage(jid, { text: 'This is a reply' }, { quoted: message })
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
#### Mention User (works with most types)
|
|
345
|
+
```javascript
|
|
346
|
+
await sock.sendMessage(jid, {
|
|
347
|
+
text: '@12345678901',
|
|
348
|
+
mentions: ['12345678901@s.whatsapp.net']
|
|
349
|
+
})
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
#### Mention Status
|
|
353
|
+
```javascript
|
|
354
|
+
await sock.sendStatusMentions(
|
|
355
|
+
{
|
|
356
|
+
text: "Hello", // or image / video / audio (url or buffer)
|
|
357
|
+
},
|
|
358
|
+
[
|
|
359
|
+
"123456789123456789@g.us",
|
|
360
|
+
"123456789@s.whatsapp.net",
|
|
361
|
+
// Enter jid chat here
|
|
362
|
+
]
|
|
363
|
+
)
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
#### Result Poll From Newsletter
|
|
367
|
+
```javascript
|
|
368
|
+
await sock.sendMessage(jid, {
|
|
369
|
+
pollResult: {
|
|
370
|
+
name: "Text poll",
|
|
371
|
+
votes: [["Options 1", 10], ["Options 2", 10]], // 10 for fake polling count results
|
|
372
|
+
}
|
|
373
|
+
}, { quoted: message })
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
#### Send Album Message
|
|
377
|
+
```javascript
|
|
378
|
+
await sock.sendAlbumMessage(
|
|
379
|
+
jid,
|
|
380
|
+
[
|
|
381
|
+
{
|
|
382
|
+
image: { url: "https://example.jpg" }, // or buffer
|
|
383
|
+
caption: "Hello World",
|
|
384
|
+
},
|
|
385
|
+
{
|
|
386
|
+
video: { url: "https://example.mp4" }, // or buffer
|
|
387
|
+
caption: "Hello World",
|
|
388
|
+
},
|
|
389
|
+
],
|
|
390
|
+
{
|
|
391
|
+
quoted: message,
|
|
392
|
+
delay: 2000 // number in milliseconds
|
|
393
|
+
}
|
|
394
|
+
)
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
#### Request Payment
|
|
398
|
+
```javascript
|
|
399
|
+
// Example non media sticker
|
|
400
|
+
await sock.sendMessage(jid, {
|
|
401
|
+
requestPayment: {
|
|
402
|
+
currency: "IDR",
|
|
403
|
+
amount: "10000000",
|
|
404
|
+
from: "123456@s.whatsapp.net",
|
|
405
|
+
note: "Payment Request",
|
|
406
|
+
background: { /* background of the message */ }
|
|
407
|
+
}
|
|
408
|
+
}, { quoted: message })
|
|
409
|
+
|
|
410
|
+
// With media sticker buffer
|
|
411
|
+
await sock.sendMessage(jid, {
|
|
412
|
+
requestPayment: {
|
|
413
|
+
currency: "IDR",
|
|
414
|
+
amount: "10000000",
|
|
415
|
+
from: "123456@s.whatsapp.net",
|
|
416
|
+
sticker: buffer,
|
|
417
|
+
background: { /* background of the message */ }
|
|
418
|
+
}
|
|
419
|
+
}, { quoted: message })
|
|
420
|
+
|
|
421
|
+
// With media sticker url
|
|
422
|
+
await sock.sendMessage(jid, {
|
|
423
|
+
requestPayment: {
|
|
424
|
+
currency: "IDR",
|
|
425
|
+
amount: "10000000",
|
|
426
|
+
from: "123456@s.whatsapp.net",
|
|
427
|
+
sticker: { url: "https://example.com/sticker.webp" },
|
|
428
|
+
background: { /* background of the message */ }
|
|
429
|
+
}
|
|
430
|
+
}, { quoted: message })
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
#### Event Message
|
|
434
|
+
```javascript
|
|
435
|
+
await sock.sendMessage(jid, {
|
|
436
|
+
event: {
|
|
437
|
+
isCanceled: false, // or true for cancel event
|
|
438
|
+
name: "Event Name",
|
|
439
|
+
description: "Event Description",
|
|
440
|
+
location: {
|
|
441
|
+
degreesLatitude: -0,
|
|
442
|
+
degreesLongitude: -0
|
|
443
|
+
},
|
|
444
|
+
link: "https://call-link.example.com",
|
|
445
|
+
startTime: m.messageTimestamp.low,
|
|
446
|
+
endTime: m.messageTimestamp.low + 86400, // 86400 is day in seconds
|
|
447
|
+
extraGuestsAllowed: true // or false
|
|
448
|
+
}
|
|
449
|
+
}, { quoted: message })
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
#### Product Message
|
|
453
|
+
```javascript
|
|
454
|
+
await sock.sendMessage(jid, {
|
|
455
|
+
productMessage: {
|
|
456
|
+
title: "Product Title",
|
|
457
|
+
description: "Product Description",
|
|
458
|
+
thumbnail: "https://example.png",
|
|
459
|
+
productId: "123456789",
|
|
460
|
+
retailerId: "STORE",
|
|
461
|
+
url: "https://example.png",
|
|
462
|
+
body: "Product Body",
|
|
463
|
+
footer: "Product Footer",
|
|
464
|
+
buttons: [
|
|
465
|
+
{
|
|
466
|
+
name: "cta_url",
|
|
467
|
+
buttonParamsJson: JSON.stringify({
|
|
468
|
+
display_text: "Visit Site",
|
|
469
|
+
url: "https://example.com"
|
|
470
|
+
})
|
|
471
|
+
}
|
|
472
|
+
]
|
|
473
|
+
}
|
|
474
|
+
}, { quoted: message })
|
|
475
|
+
```
|
|
476
|
+
|
|
477
|
+
#### Carousel Message
|
|
478
|
+
```javascript
|
|
479
|
+
await sock.sendMessage(jid, {
|
|
480
|
+
carouselMessage: {
|
|
481
|
+
caption: "Click URL",
|
|
482
|
+
footer: "Powered By NexusTechPro",
|
|
483
|
+
cards: [
|
|
484
|
+
// Card Mode Product
|
|
485
|
+
{
|
|
486
|
+
headerTitle: "`</> Owner Bot </>`",
|
|
487
|
+
imageUrl: "https://example.com/image.jpg",
|
|
488
|
+
productTitle: "Premium Bot",
|
|
489
|
+
productDescription: "Get premium access",
|
|
490
|
+
bodyText: "[NexusTechPro]\n- Important chat only\n- Don't call owner",
|
|
491
|
+
buttons: [
|
|
492
|
+
{
|
|
493
|
+
name: "cta_call",
|
|
494
|
+
params: {
|
|
495
|
+
display_text: "Contact Owner",
|
|
496
|
+
phone_number: "+1234567890"
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
]
|
|
500
|
+
},
|
|
501
|
+
// Card Mode Image
|
|
502
|
+
{
|
|
503
|
+
headerTitle: "`</> Bot Assistant </>`",
|
|
504
|
+
imageUrl: "https://example.com/image2.jpg",
|
|
505
|
+
bodyText: "[AI Assistant]\n- Don't spam bot\n- Don't call bot",
|
|
506
|
+
buttons: [
|
|
507
|
+
{
|
|
508
|
+
name: "cta_url",
|
|
509
|
+
params: {
|
|
510
|
+
display_text: "Chat Bot",
|
|
511
|
+
url: "https://wa.me/1234567890",
|
|
512
|
+
merchant_url: "https://wa.me/1234567890"
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
]
|
|
516
|
+
}
|
|
517
|
+
]
|
|
518
|
+
}
|
|
519
|
+
}, { quoted: message })
|
|
520
|
+
```
|
|
521
|
+
|
|
522
|
+
#### Interactive Message with Native Flow
|
|
523
|
+
```javascript
|
|
524
|
+
await sock.sendMessage(jid, {
|
|
525
|
+
interactiveMessage: {
|
|
526
|
+
title: "Hello World",
|
|
527
|
+
footer: "NexusTechPro",
|
|
528
|
+
image: { url: "https://example.com/image.jpg" },
|
|
529
|
+
nativeFlowMessage: {
|
|
530
|
+
messageParamsJson: JSON.stringify({
|
|
531
|
+
limited_time_offer: {
|
|
532
|
+
text: "Limited offer!",
|
|
533
|
+
url: "https://nexustechpro.com",
|
|
534
|
+
copy_code: "NEXUS2025",
|
|
535
|
+
expiration_time: Date.now() + (24 * 60 * 60 * 1000)
|
|
536
|
+
},
|
|
537
|
+
bottom_sheet: {
|
|
538
|
+
in_thread_buttons_limit: 2,
|
|
539
|
+
divider_indices: [1, 2, 3, 4, 5],
|
|
540
|
+
list_title: "Select Option",
|
|
541
|
+
button_title: "Click Here"
|
|
542
|
+
},
|
|
543
|
+
tap_target_configuration: {
|
|
544
|
+
title: "Tap Target",
|
|
545
|
+
description: "Description here",
|
|
546
|
+
canonical_url: "https://nexustechpro.com",
|
|
547
|
+
domain: "nexustechpro.com",
|
|
548
|
+
button_index: 0
|
|
549
|
+
}
|
|
550
|
+
}),
|
|
551
|
+
buttons: [
|
|
552
|
+
{
|
|
553
|
+
name: "single_select",
|
|
554
|
+
buttonParamsJson: JSON.stringify({
|
|
555
|
+
has_multiple_buttons: true
|
|
556
|
+
})
|
|
557
|
+
},
|
|
558
|
+
{
|
|
559
|
+
name: "call_permission_request",
|
|
560
|
+
buttonParamsJson: JSON.stringify({
|
|
561
|
+
has_multiple_buttons: true
|
|
562
|
+
})
|
|
563
|
+
},
|
|
564
|
+
{
|
|
565
|
+
name: "single_select",
|
|
566
|
+
buttonParamsJson: JSON.stringify({
|
|
567
|
+
title: "Select Option",
|
|
568
|
+
sections: [
|
|
569
|
+
{
|
|
570
|
+
title: "Section Title",
|
|
571
|
+
highlight_label: "Popular",
|
|
572
|
+
rows: [
|
|
573
|
+
{
|
|
574
|
+
title: "Option 1",
|
|
575
|
+
description: "Description 1",
|
|
576
|
+
id: "row_1"
|
|
577
|
+
},
|
|
578
|
+
{
|
|
579
|
+
title: "Option 2",
|
|
580
|
+
description: "Description 2",
|
|
581
|
+
id: "row_2"
|
|
582
|
+
}
|
|
583
|
+
]
|
|
584
|
+
}
|
|
585
|
+
],
|
|
586
|
+
has_multiple_buttons: true
|
|
587
|
+
})
|
|
588
|
+
},
|
|
589
|
+
{
|
|
590
|
+
name: "cta_copy",
|
|
591
|
+
buttonParamsJson: JSON.stringify({
|
|
592
|
+
display_text: "Copy Code",
|
|
593
|
+
id: "123456789",
|
|
594
|
+
copy_code: "NEXUS2025"
|
|
595
|
+
})
|
|
596
|
+
}
|
|
597
|
+
]
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
}, { quoted: message })
|
|
601
|
+
```
|
|
602
|
+
|
|
603
|
+
#### Interactive Buttons
|
|
604
|
+
```javascript
|
|
605
|
+
// Example non header media
|
|
606
|
+
await sock.sendMessage(jid, {
|
|
607
|
+
text: "Description of Message",
|
|
608
|
+
title: "Title of Message",
|
|
609
|
+
subtitle: "Subtitle Message",
|
|
610
|
+
footer: "Footer Message",
|
|
611
|
+
interactiveButtons: [
|
|
612
|
+
{
|
|
613
|
+
name: "quick_reply",
|
|
614
|
+
buttonParamsJson: JSON.stringify({
|
|
615
|
+
display_text: "Quick Reply",
|
|
616
|
+
id: "button_1"
|
|
617
|
+
})
|
|
618
|
+
},
|
|
619
|
+
{
|
|
620
|
+
name: "cta_url",
|
|
621
|
+
buttonParamsJson: JSON.stringify({
|
|
622
|
+
display_text: "Visit Website",
|
|
623
|
+
url: "https://nexustechpro.com"
|
|
624
|
+
})
|
|
625
|
+
}
|
|
626
|
+
]
|
|
627
|
+
}, { quoted: message })
|
|
628
|
+
|
|
629
|
+
// Example with media
|
|
630
|
+
await sock.sendMessage(jid, {
|
|
631
|
+
image: { url: "https://example.jpg" }, // or buffer
|
|
632
|
+
caption: "Description of Message",
|
|
633
|
+
title: "Title of Message",
|
|
634
|
+
subtitle: "Subtitle Message",
|
|
635
|
+
footer: "Footer Message",
|
|
636
|
+
media: true,
|
|
637
|
+
interactiveButtons: [
|
|
638
|
+
{
|
|
639
|
+
name: "quick_reply",
|
|
640
|
+
buttonParamsJson: JSON.stringify({
|
|
641
|
+
display_text: "Quick Reply",
|
|
642
|
+
id: "button_1"
|
|
643
|
+
})
|
|
644
|
+
},
|
|
645
|
+
{
|
|
646
|
+
name: "cta_url",
|
|
647
|
+
buttonParamsJson: JSON.stringify({
|
|
648
|
+
display_text: "Visit Website",
|
|
649
|
+
url: "https://nexustechpro.com"
|
|
650
|
+
})
|
|
651
|
+
}
|
|
652
|
+
]
|
|
653
|
+
}, { quoted: message })
|
|
654
|
+
|
|
655
|
+
// Example with header product
|
|
656
|
+
await sock.sendMessage(jid, {
|
|
657
|
+
product: {
|
|
658
|
+
productImage: { url: "https://example.jpg" }, // or buffer
|
|
659
|
+
productImageCount: 1,
|
|
660
|
+
title: "Product Title",
|
|
661
|
+
description: "Product Description",
|
|
662
|
+
priceAmount1000: 20000 * 1000,
|
|
663
|
+
currencyCode: "USD",
|
|
664
|
+
retailerId: "Retail",
|
|
665
|
+
url: "https://example.com",
|
|
666
|
+
},
|
|
667
|
+
businessOwnerJid: "1234@s.whatsapp.net",
|
|
668
|
+
caption: "Description of Message",
|
|
669
|
+
title: "Title of Message",
|
|
670
|
+
footer: "Footer Message",
|
|
671
|
+
media: true,
|
|
672
|
+
interactiveButtons: [
|
|
673
|
+
{
|
|
674
|
+
name: "quick_reply",
|
|
675
|
+
buttonParamsJson: JSON.stringify({
|
|
676
|
+
display_text: "Quick Reply",
|
|
677
|
+
id: "button_1"
|
|
678
|
+
})
|
|
679
|
+
},
|
|
680
|
+
{
|
|
681
|
+
name: "cta_url",
|
|
682
|
+
buttonParamsJson: JSON.stringify({
|
|
683
|
+
display_text: "Visit Website",
|
|
684
|
+
url: "https://nexustechpro.com"
|
|
685
|
+
})
|
|
686
|
+
}
|
|
687
|
+
]
|
|
688
|
+
}, { quoted: message })
|
|
689
|
+
```
|
|
690
|
+
|
|
691
|
+
#### Forward Messages
|
|
692
|
+
```javascript
|
|
693
|
+
const msg = getMessageFromStore() // implement this on your end
|
|
694
|
+
await sock.sendMessage(jid, { forward: msg })
|
|
695
|
+
```
|
|
696
|
+
|
|
697
|
+
#### Location Message
|
|
698
|
+
```javascript
|
|
699
|
+
await sock.sendMessage(jid, {
|
|
700
|
+
location: {
|
|
701
|
+
degreesLatitude: 24.121231,
|
|
702
|
+
degreesLongitude: 55.1121221,
|
|
703
|
+
name: "Location Name",
|
|
704
|
+
address: "Location Address"
|
|
705
|
+
}
|
|
706
|
+
})
|
|
707
|
+
```
|
|
708
|
+
|
|
709
|
+
#### Contact Message
|
|
710
|
+
```javascript
|
|
711
|
+
const vcard = 'BEGIN:VCARD\n'
|
|
712
|
+
+ 'VERSION:3.0\n'
|
|
713
|
+
+ 'FN:John Doe\n'
|
|
714
|
+
+ 'ORG:NexusTechPro;\n'
|
|
715
|
+
+ 'TEL;type=CELL;type=VOICE;waid=1234567890:+1 234 567 890\n'
|
|
716
|
+
+ 'END:VCARD'
|
|
717
|
+
|
|
718
|
+
await sock.sendMessage(jid, {
|
|
719
|
+
contacts: {
|
|
720
|
+
displayName: 'John Doe',
|
|
721
|
+
contacts: [{ vcard }]
|
|
722
|
+
}
|
|
723
|
+
})
|
|
724
|
+
```
|
|
725
|
+
|
|
726
|
+
#### Reaction Message
|
|
727
|
+
```javascript
|
|
728
|
+
await sock.sendMessage(jid, {
|
|
729
|
+
react: {
|
|
730
|
+
text: '💖', // use empty string to remove reaction
|
|
731
|
+
key: message.key
|
|
732
|
+
}
|
|
733
|
+
})
|
|
734
|
+
```
|
|
735
|
+
|
|
736
|
+
#### Pin Message
|
|
737
|
+
```javascript
|
|
738
|
+
await sock.sendMessage(jid, {
|
|
739
|
+
pin: {
|
|
740
|
+
type: 1, // 0 to remove
|
|
741
|
+
time: 86400, // 24 hours in seconds
|
|
742
|
+
key: message.key
|
|
743
|
+
}
|
|
744
|
+
})
|
|
745
|
+
```
|
|
746
|
+
|
|
747
|
+
**Pin Time Options:**
|
|
748
|
+
|
|
749
|
+
| Time | Seconds |
|
|
750
|
+
|------|-----------|
|
|
751
|
+
| 24h | 86,400 |
|
|
752
|
+
| 7d | 604,800 |
|
|
753
|
+
| 30d | 2,592,000 |
|
|
754
|
+
|
|
755
|
+
#### Keep Message
|
|
756
|
+
```javascript
|
|
757
|
+
await sock.sendMessage(jid, {
|
|
758
|
+
keep: message.key,
|
|
759
|
+
type: 1, // 2 to unpin
|
|
760
|
+
time: 86400
|
|
761
|
+
})
|
|
762
|
+
```
|
|
763
|
+
|
|
764
|
+
**Keep Time Options:**
|
|
765
|
+
|
|
766
|
+
| Time | Seconds |
|
|
767
|
+
|------|-----------|
|
|
768
|
+
| 24h | 86,400 |
|
|
769
|
+
| 7d | 604,800 |
|
|
770
|
+
| 30d | 2,592,000 |
|
|
771
|
+
|
|
772
|
+
#### Poll Message
|
|
773
|
+
```javascript
|
|
774
|
+
await sock.sendMessage(jid, {
|
|
775
|
+
poll: {
|
|
776
|
+
name: 'Favorite Color?',
|
|
777
|
+
values: ['Red', 'Blue', 'Green', 'Yellow'],
|
|
778
|
+
selectableCount: 1,
|
|
779
|
+
toAnnouncementGroup: false
|
|
780
|
+
}
|
|
781
|
+
})
|
|
782
|
+
```
|
|
783
|
+
|
|
784
|
+
#### Link Preview
|
|
785
|
+
```javascript
|
|
786
|
+
await sock.sendMessage(jid, {
|
|
787
|
+
text: 'Check out https://github.com/nexustechpro/baileys'
|
|
788
|
+
})
|
|
789
|
+
```
|
|
790
|
+
|
|
791
|
+
---
|
|
792
|
+
|
|
793
|
+
### Media Messages
|
|
794
|
+
|
|
795
|
+
> 📝 **Note:** You can pass `{ stream: Stream }`, `{ url: Url }`, or `Buffer` directly
|
|
796
|
+
|
|
797
|
+
#### Image Message
|
|
798
|
+
```javascript
|
|
799
|
+
// From URL
|
|
800
|
+
await sock.sendMessage(jid, {
|
|
801
|
+
image: { url: 'https://example.com/image.jpg' },
|
|
802
|
+
caption: 'Beautiful image!'
|
|
803
|
+
})
|
|
804
|
+
|
|
805
|
+
// From Buffer
|
|
806
|
+
await sock.sendMessage(jid, {
|
|
807
|
+
image: buffer,
|
|
808
|
+
caption: 'Image from buffer'
|
|
809
|
+
})
|
|
810
|
+
|
|
811
|
+
// From File
|
|
812
|
+
await sock.sendMessage(jid, {
|
|
813
|
+
image: fs.readFileSync('./image.jpg'),
|
|
814
|
+
caption: 'Local image'
|
|
815
|
+
})
|
|
816
|
+
```
|
|
817
|
+
|
|
818
|
+
#### Video Message
|
|
819
|
+
```javascript
|
|
820
|
+
await sock.sendMessage(jid, {
|
|
821
|
+
video: { url: './video.mp4' },
|
|
822
|
+
caption: 'Check this out!',
|
|
823
|
+
gifPlayback: false, // set true for GIF
|
|
824
|
+
ptv: false // set true for video note
|
|
825
|
+
})
|
|
826
|
+
```
|
|
827
|
+
|
|
828
|
+
#### GIF Message
|
|
829
|
+
```javascript
|
|
830
|
+
await sock.sendMessage(jid, {
|
|
831
|
+
video: fs.readFileSync('Media/gif.mp4'),
|
|
832
|
+
caption: 'Funny GIF',
|
|
833
|
+
gifPlayback: true
|
|
834
|
+
})
|
|
835
|
+
```
|
|
836
|
+
|
|
837
|
+
#### Audio Message
|
|
838
|
+
```javascript
|
|
839
|
+
await sock.sendMessage(jid, {
|
|
840
|
+
audio: { url: './audio.mp3' },
|
|
841
|
+
mimetype: 'audio/mp4',
|
|
842
|
+
ptt: true // voice message
|
|
843
|
+
})
|
|
844
|
+
```
|
|
845
|
+
|
|
846
|
+
> 💡 **Audio Conversion Tip:**
|
|
847
|
+
> ```bash
|
|
848
|
+
> ffmpeg -i input.mp4 -avoid_negative_ts make_zero -ac 1 output.ogg
|
|
849
|
+
> ```
|
|
850
|
+
|
|
851
|
+
#### Document
|
|
852
|
+
```javascript
|
|
853
|
+
await sock.sendMessage(jid, {
|
|
854
|
+
document: { url: './document.pdf' },
|
|
855
|
+
fileName: 'document.pdf',
|
|
856
|
+
mimetype: 'application/pdf'
|
|
857
|
+
})
|
|
858
|
+
```
|
|
859
|
+
|
|
860
|
+
#### Sticker
|
|
861
|
+
```javascript
|
|
862
|
+
await sock.sendMessage(jid, {
|
|
863
|
+
sticker: { url: './sticker.webp' }
|
|
864
|
+
})
|
|
865
|
+
```
|
|
866
|
+
|
|
867
|
+
#### View Once Message
|
|
868
|
+
```javascript
|
|
869
|
+
await sock.sendMessage(jid, {
|
|
870
|
+
image: { url: './secret.jpg' },
|
|
871
|
+
viewOnce: true,
|
|
872
|
+
caption: 'View once only!'
|
|
873
|
+
})
|
|
874
|
+
```
|
|
875
|
+
|
|
876
|
+
---
|
|
877
|
+
|
|
878
|
+
### Interactive Messages
|
|
879
|
+
|
|
880
|
+
All button types available in NexusTechPro Baileys:
|
|
881
|
+
|
|
882
|
+
#### Quick Reply Button
|
|
883
|
+
```javascript
|
|
884
|
+
{
|
|
885
|
+
name: "quick_reply",
|
|
886
|
+
buttonParamsJson: JSON.stringify({
|
|
887
|
+
display_text: "Quick Reply",
|
|
888
|
+
id: "button_id"
|
|
889
|
+
})
|
|
890
|
+
}
|
|
891
|
+
```
|
|
892
|
+
|
|
893
|
+
#### URL Button
|
|
894
|
+
```javascript
|
|
895
|
+
{
|
|
896
|
+
name: "cta_url",
|
|
897
|
+
buttonParamsJson: JSON.stringify({
|
|
898
|
+
display_text: "Visit Website",
|
|
899
|
+
url: "https://nexustechpro.com",
|
|
900
|
+
merchant_url: "https://nexustechpro.com"
|
|
901
|
+
})
|
|
902
|
+
}
|
|
903
|
+
```
|
|
904
|
+
|
|
905
|
+
#### Call Button
|
|
906
|
+
```javascript
|
|
907
|
+
{
|
|
908
|
+
name: "cta_call",
|
|
909
|
+
buttonParamsJson: JSON.stringify({
|
|
910
|
+
display_text: "Call Us",
|
|
911
|
+
phone_number: "+1234567890"
|
|
912
|
+
})
|
|
913
|
+
}
|
|
914
|
+
```
|
|
915
|
+
|
|
916
|
+
#### Copy Button
|
|
917
|
+
```javascript
|
|
918
|
+
{
|
|
919
|
+
name: "cta_copy",
|
|
920
|
+
buttonParamsJson: JSON.stringify({
|
|
921
|
+
display_text: "Copy Code",
|
|
922
|
+
id: "copy_id",
|
|
923
|
+
copy_code: "PROMO2025"
|
|
924
|
+
})
|
|
925
|
+
}
|
|
926
|
+
```
|
|
927
|
+
|
|
928
|
+
#### Single Select (List)
|
|
929
|
+
```javascript
|
|
930
|
+
{
|
|
931
|
+
name: "single_select",
|
|
932
|
+
buttonParamsJson: JSON.stringify({
|
|
933
|
+
title: "Select Option",
|
|
934
|
+
sections: [{
|
|
935
|
+
title: "Section 1",
|
|
936
|
+
highlight_label: "Popular",
|
|
937
|
+
rows: [
|
|
938
|
+
{ title: "Option 1", description: "Description 1", id: "opt1" },
|
|
939
|
+
{ title: "Option 2", description: "Description 2", id: "opt2" }
|
|
940
|
+
]
|
|
941
|
+
}]
|
|
942
|
+
})
|
|
943
|
+
}
|
|
944
|
+
```
|
|
945
|
+
|
|
946
|
+
#### Call Permission Request
|
|
947
|
+
```javascript
|
|
948
|
+
{
|
|
949
|
+
name: "call_permission_request",
|
|
950
|
+
buttonParamsJson: JSON.stringify({
|
|
951
|
+
has_multiple_buttons: true
|
|
952
|
+
})
|
|
953
|
+
}
|
|
954
|
+
```
|
|
955
|
+
|
|
956
|
+
---
|
|
957
|
+
|
|
958
|
+
## ✏️ Message Modifications
|
|
959
|
+
|
|
960
|
+
### Delete Message (for everyone)
|
|
961
|
+
```javascript
|
|
962
|
+
const msg = await sock.sendMessage(jid, { text: 'hello' })
|
|
963
|
+
await sock.sendMessage(jid, { delete: msg.key })
|
|
964
|
+
```
|
|
965
|
+
|
|
966
|
+
### Edit Message
|
|
967
|
+
```javascript
|
|
968
|
+
await sock.sendMessage(jid, {
|
|
969
|
+
text: 'Updated message text',
|
|
970
|
+
edit: originalMessage.key
|
|
971
|
+
})
|
|
972
|
+
```
|
|
973
|
+
|
|
974
|
+
---
|
|
975
|
+
|
|
976
|
+
## 📥 Media Operations
|
|
977
|
+
|
|
978
|
+
### Download Media
|
|
979
|
+
```javascript
|
|
980
|
+
import { downloadMediaMessage, getContentType } from '@nexustechpro/baileys'
|
|
981
|
+
|
|
982
|
+
sock.ev.on('messages.upsert', async ({ messages }) => {
|
|
983
|
+
const msg = messages[0]
|
|
984
|
+
if(!msg.message) return
|
|
985
|
+
|
|
986
|
+
const messageType = getContentType(msg.message)
|
|
987
|
+
|
|
988
|
+
if(messageType === 'imageMessage') {
|
|
989
|
+
const buffer = await downloadMediaMessage(
|
|
990
|
+
msg,
|
|
991
|
+
'buffer',
|
|
992
|
+
{},
|
|
993
|
+
{
|
|
994
|
+
logger: console,
|
|
995
|
+
reuploadRequest: sock.updateMediaMessage
|
|
996
|
+
}
|
|
997
|
+
)
|
|
998
|
+
// Save buffer to file
|
|
999
|
+
fs.writeFileSync('./download.jpeg', buffer)
|
|
1000
|
+
}
|
|
1001
|
+
})
|
|
1002
|
+
```
|
|
1003
|
+
|
|
1004
|
+
### Re-upload Media
|
|
1005
|
+
```javascript
|
|
1006
|
+
await sock.updateMediaMessage(msg)
|
|
1007
|
+
```
|
|
1008
|
+
|
|
1009
|
+
---
|
|
1010
|
+
|
|
1011
|
+
## 👥 Group Management
|
|
1012
|
+
|
|
1013
|
+
### Create Group
|
|
1014
|
+
```javascript
|
|
1015
|
+
const group = await sock.groupCreate('Group Name', [
|
|
1016
|
+
'1234567890@s.whatsapp.net',
|
|
1017
|
+
'0987654321@s.whatsapp.net'
|
|
1018
|
+
])
|
|
1019
|
+
console.log('Group created:', group.id)
|
|
1020
|
+
```
|
|
1021
|
+
|
|
1022
|
+
### Add/Remove Participants
|
|
1023
|
+
```javascript
|
|
1024
|
+
// Add
|
|
1025
|
+
await sock.groupParticipantsUpdate(groupJid, ['1234567890@s.whatsapp.net'], 'add')
|
|
1026
|
+
|
|
1027
|
+
// Remove
|
|
1028
|
+
await sock.groupParticipantsUpdate(groupJid, ['1234567890@s.whatsapp.net'], 'remove')
|
|
1029
|
+
|
|
1030
|
+
// Promote to admin
|
|
1031
|
+
await sock.groupParticipantsUpdate(groupJid, ['1234567890@s.whatsapp.net'], 'promote')
|
|
1032
|
+
|
|
1033
|
+
// Demote from admin
|
|
1034
|
+
await sock.groupParticipantsUpdate(groupJid, ['1234567890@s.whatsapp.net'], 'demote')
|
|
1035
|
+
```
|
|
1036
|
+
|
|
1037
|
+
### Update Group Subject
|
|
1038
|
+
```javascript
|
|
1039
|
+
await sock.groupUpdateSubject(groupJid, 'New Group Name')
|
|
1040
|
+
```
|
|
1041
|
+
|
|
1042
|
+
### Update Group Description
|
|
1043
|
+
```javascript
|
|
1044
|
+
await sock.groupUpdateDescription(groupJid, 'New group description')
|
|
1045
|
+
```
|
|
1046
|
+
|
|
1047
|
+
### Group Settings
|
|
1048
|
+
```javascript
|
|
1049
|
+
// Only admins can send messages
|
|
1050
|
+
await sock.groupSettingUpdate(groupJid, 'announcement')
|
|
1051
|
+
|
|
1052
|
+
// Everyone can send messages
|
|
1053
|
+
await sock.groupSettingUpdate(groupJid, 'not_announcement')
|
|
1054
|
+
|
|
1055
|
+
// Only admins can edit group info
|
|
1056
|
+
await sock.groupSettingUpdate(groupJid, 'locked')
|
|
1057
|
+
|
|
1058
|
+
// Everyone can edit group info
|
|
1059
|
+
await sock.groupSettingUpdate(groupJid, 'unlocked')
|
|
1060
|
+
```
|
|
1061
|
+
|
|
1062
|
+
### Get Group Metadata
|
|
1063
|
+
```javascript
|
|
1064
|
+
const metadata = await sock.groupMetadata(groupJid)
|
|
1065
|
+
console.log('Group:', metadata.subject)
|
|
1066
|
+
console.log('Participants:', metadata.participants.length)
|
|
1067
|
+
```
|
|
1068
|
+
|
|
1069
|
+
### Get Invite Code
|
|
1070
|
+
```javascript
|
|
1071
|
+
const code = await sock.groupInviteCode(groupJid)
|
|
1072
|
+
console.log('Invite link:', `https://chat.whatsapp.com/${code}`)
|
|
1073
|
+
```
|
|
1074
|
+
|
|
1075
|
+
### Revoke Invite Code
|
|
1076
|
+
```javascript
|
|
1077
|
+
const newCode = await sock.groupRevokeInvite(groupJid)
|
|
1078
|
+
console.log('New invite code:', newCode)
|
|
1079
|
+
```
|
|
1080
|
+
|
|
1081
|
+
### Join Group via Invite Code
|
|
1082
|
+
```javascript
|
|
1083
|
+
await sock.groupAcceptInvite('INVITE_CODE_HERE')
|
|
1084
|
+
```
|
|
1085
|
+
|
|
1086
|
+
### Leave Group
|
|
1087
|
+
```javascript
|
|
1088
|
+
await sock.groupLeave(groupJid)
|
|
1089
|
+
```
|
|
1090
|
+
|
|
1091
|
+
### Get Group Invite Info
|
|
1092
|
+
```javascript
|
|
1093
|
+
const info = await sock.groupGetInviteInfo('INVITE_CODE')
|
|
1094
|
+
console.log('Group info:', info)
|
|
1095
|
+
```
|
|
1096
|
+
|
|
1097
|
+
---
|
|
1098
|
+
|
|
1099
|
+
## 📱 User Operations
|
|
1100
|
+
|
|
1101
|
+
### Check if Number Exists
|
|
1102
|
+
```javascript
|
|
1103
|
+
const [result] = await sock.onWhatsApp('1234567890')
|
|
1104
|
+
if(result?.exists) {
|
|
1105
|
+
console.log('Number exists:', result.jid)
|
|
1106
|
+
}
|
|
1107
|
+
```
|
|
1108
|
+
|
|
1109
|
+
### Get Profile Picture
|
|
1110
|
+
```javascript
|
|
1111
|
+
// Low resolution
|
|
1112
|
+
const ppUrl = await sock.profilePictureUrl(jid)
|
|
1113
|
+
|
|
1114
|
+
// High resolution
|
|
1115
|
+
const ppUrlHD = await sock.profilePictureUrl(jid, 'image')
|
|
1116
|
+
```
|
|
1117
|
+
|
|
1118
|
+
### Update Profile Picture
|
|
1119
|
+
```javascript
|
|
1120
|
+
await sock.updateProfilePicture(jid, {
|
|
1121
|
+
url: './profile.jpg'
|
|
1122
|
+
})
|
|
1123
|
+
```
|
|
1124
|
+
|
|
1125
|
+
### Remove Profile Picture
|
|
1126
|
+
```javascript
|
|
1127
|
+
await sock.removeProfilePicture(jid)
|
|
1128
|
+
```
|
|
1129
|
+
|
|
1130
|
+
### Get Status
|
|
1131
|
+
```javascript
|
|
1132
|
+
const status = await sock.fetchStatus(jid)
|
|
1133
|
+
console.log('Status:', status)
|
|
1134
|
+
```
|
|
1135
|
+
|
|
1136
|
+
### Update Profile Status
|
|
1137
|
+
```javascript
|
|
1138
|
+
await sock.updateProfileStatus('Available 24/7')
|
|
1139
|
+
```
|
|
1140
|
+
|
|
1141
|
+
### Update Profile Name
|
|
1142
|
+
```javascript
|
|
1143
|
+
await sock.updateProfileName('NexusTech Bot')
|
|
1144
|
+
```
|
|
1145
|
+
|
|
1146
|
+
### Get Business Profile
|
|
1147
|
+
```javascript
|
|
1148
|
+
const profile = await sock.getBusinessProfile(jid)
|
|
1149
|
+
console.log('Business:', profile.description)
|
|
1150
|
+
```
|
|
1151
|
+
|
|
1152
|
+
### Presence Updates
|
|
1153
|
+
```javascript
|
|
1154
|
+
// Subscribe to presence updates
|
|
1155
|
+
await sock.presenceSubscribe(jid)
|
|
1156
|
+
|
|
1157
|
+
// Send presence
|
|
1158
|
+
await sock.sendPresenceUpdate('available', jid) // available, unavailable, composing, recording, paused
|
|
1159
|
+
```
|
|
1160
|
+
|
|
1161
|
+
### Read Messages
|
|
1162
|
+
```javascript
|
|
1163
|
+
await sock.readMessages([message.key])
|
|
1164
|
+
```
|
|
1165
|
+
|
|
1166
|
+
---
|
|
1167
|
+
|
|
1168
|
+
## 🔒 Privacy Controls
|
|
1169
|
+
|
|
1170
|
+
### Block/Unblock User
|
|
1171
|
+
```javascript
|
|
1172
|
+
// Block
|
|
1173
|
+
await sock.updateBlockStatus(jid, 'block')
|
|
1174
|
+
|
|
1175
|
+
// Unblock
|
|
1176
|
+
await sock.updateBlockStatus(jid, 'unblock')
|
|
1177
|
+
```
|
|
1178
|
+
|
|
1179
|
+
### Get Privacy Settings
|
|
1180
|
+
```javascript
|
|
1181
|
+
const settings = await sock.fetchPrivacySettings()
|
|
1182
|
+
console.log(settings)
|
|
1183
|
+
```
|
|
1184
|
+
|
|
1185
|
+
### Update Privacy Settings
|
|
1186
|
+
```javascript
|
|
1187
|
+
// Last seen: 'all', 'contacts', 'contact_blacklist', 'none'
|
|
1188
|
+
await sock.updateLastSeenPrivacy('contacts')
|
|
1189
|
+
|
|
1190
|
+
// Online: 'all', 'match_last_seen'
|
|
1191
|
+
await sock.updateOnlinePrivacy('all')
|
|
1192
|
+
|
|
1193
|
+
// Profile picture: 'all', 'contacts', 'contact_blacklist', 'none'
|
|
1194
|
+
await sock.updateProfilePicturePrivacy('contacts')
|
|
1195
|
+
|
|
1196
|
+
// Status: 'all', 'contacts', 'contact_blacklist', 'none'
|
|
1197
|
+
await sock.updateStatusPrivacy('contacts')
|
|
1198
|
+
|
|
1199
|
+
// Read receipts: 'all', 'none'
|
|
1200
|
+
await sock.updateReadReceiptsPrivacy('all')
|
|
1201
|
+
|
|
1202
|
+
// Groups add: 'all', 'contacts', 'contact_blacklist'
|
|
1203
|
+
await sock.updateGroupsAddPrivacy('contacts')
|
|
1204
|
+
```
|
|
1205
|
+
|
|
1206
|
+
### Get Block List
|
|
1207
|
+
```javascript
|
|
1208
|
+
const blocklist = await sock.fetchBlocklist()
|
|
1209
|
+
console.log('Blocked users:', blocklist)
|
|
1210
|
+
```
|
|
1211
|
+
|
|
1212
|
+
---
|
|
1213
|
+
|
|
1214
|
+
## 💬 Chat Operations
|
|
1215
|
+
|
|
1216
|
+
### Archive/Unarchive Chat
|
|
1217
|
+
```javascript
|
|
1218
|
+
const lastMsg = await getLastMessageInChat(jid)
|
|
1219
|
+
|
|
1220
|
+
await sock.chatModify({
|
|
1221
|
+
archive: true,
|
|
1222
|
+
lastMessages: [lastMsg]
|
|
1223
|
+
}, jid)
|
|
1224
|
+
```
|
|
1225
|
+
|
|
1226
|
+
### Mute/Unmute Chat
|
|
1227
|
+
```javascript
|
|
1228
|
+
// Mute for 8 hours
|
|
1229
|
+
await sock.chatModify({
|
|
1230
|
+
mute: 8 * 60 * 60 * 1000
|
|
1231
|
+
}, jid)
|
|
1232
|
+
|
|
1233
|
+
// Unmute
|
|
1234
|
+
await sock.chatModify({
|
|
1235
|
+
mute: null
|
|
1236
|
+
}, jid)
|
|
1237
|
+
```
|
|
1238
|
+
|
|
1239
|
+
### Pin/Unpin Chat
|
|
1240
|
+
```javascript
|
|
1241
|
+
// Pin
|
|
1242
|
+
await sock.chatModify({ pin: true }, jid)
|
|
1243
|
+
|
|
1244
|
+
// Unpin
|
|
1245
|
+
await sock.chatModify({ pin: false }, jid)
|
|
1246
|
+
```
|
|
1247
|
+
|
|
1248
|
+
### Delete Chat
|
|
1249
|
+
```javascript
|
|
1250
|
+
const lastMsg = await getLastMessageInChat(jid)
|
|
1251
|
+
|
|
1252
|
+
await sock.chatModify({
|
|
1253
|
+
delete: true,
|
|
1254
|
+
lastMessages: [{
|
|
1255
|
+
key: lastMsg.key,
|
|
1256
|
+
messageTimestamp: lastMsg.messageTimestamp
|
|
1257
|
+
}]
|
|
1258
|
+
}, jid)
|
|
1259
|
+
```
|
|
1260
|
+
|
|
1261
|
+
### Mark Chat as Read/Unread
|
|
1262
|
+
```javascript
|
|
1263
|
+
// Mark as read
|
|
1264
|
+
await sock.chatModify({ markRead: true }, jid)
|
|
1265
|
+
|
|
1266
|
+
// Mark as unread
|
|
1267
|
+
await sock.chatModify({ markRead: false }, jid)
|
|
1268
|
+
```
|
|
1269
|
+
|
|
1270
|
+
---
|
|
1271
|
+
|
|
1272
|
+
## 📢 Broadcast & Stories
|
|
1273
|
+
|
|
1274
|
+
### Send Broadcast Message
|
|
1275
|
+
```javascript
|
|
1276
|
+
await sock.sendMessage(jid, {
|
|
1277
|
+
text: 'Broadcast message',
|
|
1278
|
+
statusJidList: [
|
|
1279
|
+
'1234567890@s.whatsapp.net',
|
|
1280
|
+
'0987654321@s.whatsapp.net'
|
|
1281
|
+
],
|
|
1282
|
+
broadcast: true
|
|
1283
|
+
})
|
|
1284
|
+
```
|
|
1285
|
+
|
|
1286
|
+
### Send Story/Status
|
|
1287
|
+
```javascript
|
|
1288
|
+
await sock.sendMessage('status@broadcast', {
|
|
1289
|
+
image: { url: './story.jpg' },
|
|
1290
|
+
caption: 'My story update!'
|
|
1291
|
+
})
|
|
1292
|
+
```
|
|
1293
|
+
|
|
1294
|
+
### Newsletter/Channel Management
|
|
1295
|
+
```javascript
|
|
1296
|
+
// Create newsletter
|
|
1297
|
+
await sock.newsletterCreate('Newsletter Name', {
|
|
1298
|
+
description: 'Newsletter description',
|
|
1299
|
+
picture: buffer // optional
|
|
1300
|
+
})
|
|
1301
|
+
|
|
1302
|
+
// Update newsletter metadata
|
|
1303
|
+
await sock.newsletterUpdateMetadata(newsletterJid, {
|
|
1304
|
+
name: 'New Name',
|
|
1305
|
+
description: 'New description'
|
|
1306
|
+
})
|
|
1307
|
+
|
|
1308
|
+
// Update newsletter picture
|
|
1309
|
+
await sock.newsletterUpdatePicture(newsletterJid, buffer)
|
|
1310
|
+
|
|
1311
|
+
// React to newsletter message
|
|
1312
|
+
await sock.newsletterReactMessage(newsletterJid, messageId, '👍')
|
|
1313
|
+
|
|
1314
|
+
// Follow newsletter
|
|
1315
|
+
await sock.newsletterFollow(newsletterJid)
|
|
1316
|
+
|
|
1317
|
+
// Unfollow newsletter
|
|
1318
|
+
await sock.newsletterUnfollow(newsletterJid)
|
|
1319
|
+
|
|
1320
|
+
// Mute newsletter
|
|
1321
|
+
await sock.newsletterMute(newsletterJid)
|
|
1322
|
+
|
|
1323
|
+
// Unmute newsletter
|
|
1324
|
+
await sock.newsletterUnmute(newsletterJid)
|
|
1325
|
+
```
|
|
1326
|
+
|
|
1327
|
+
---
|
|
1328
|
+
|
|
1329
|
+
## 🧩 Advanced Features
|
|
1330
|
+
|
|
1331
|
+
### Disappearing Messages
|
|
1332
|
+
```javascript
|
|
1333
|
+
// Enable (86400 = 24 hours, 604800 = 7 days, 7776000 = 90 days)
|
|
1334
|
+
await sock.sendMessage(jid, {
|
|
1335
|
+
disappearingMessagesInChat: 86400
|
|
1336
|
+
})
|
|
1337
|
+
|
|
1338
|
+
// Disable
|
|
1339
|
+
await sock.sendMessage(jid, {
|
|
1340
|
+
disappearingMessagesInChat: false
|
|
1341
|
+
})
|
|
1342
|
+
```
|
|
1343
|
+
|
|
1344
|
+
### Query Message
|
|
1345
|
+
```javascript
|
|
1346
|
+
const msg = await sock.loadMessage(jid, messageId)
|
|
1347
|
+
console.log('Message:', msg)
|
|
1348
|
+
```
|
|
1349
|
+
|
|
1350
|
+
### Get Message Info
|
|
1351
|
+
```javascript
|
|
1352
|
+
const info = await sock.messageInfo(jid, messageId)
|
|
1353
|
+
console.log('Read by:', info.readBy.length)
|
|
1354
|
+
console.log('Played by:', info.playedBy.length)
|
|
1355
|
+
```
|
|
1356
|
+
|
|
1357
|
+
### App State Sync
|
|
1358
|
+
```javascript
|
|
1359
|
+
// Sync app state
|
|
1360
|
+
await sock.appPatch(['regular', 'critical_block', 'critical_unblock_low'])
|
|
1361
|
+
```
|
|
1362
|
+
|
|
1363
|
+
### WABrowserId
|
|
1364
|
+
```javascript
|
|
1365
|
+
const browserId = sock.generateBrowserId()
|
|
1366
|
+
console.log('Browser ID:', browserId)
|
|
1367
|
+
```
|
|
1368
|
+
|
|
1369
|
+
---
|
|
1370
|
+
|
|
1371
|
+
## 🎯 Best Practices
|
|
1372
|
+
|
|
1373
|
+
### 1. Session Management
|
|
1374
|
+
```javascript
|
|
1375
|
+
import { useMultiFileAuthState } from '@nexustechpro/baileys'
|
|
1376
|
+
|
|
1377
|
+
const { state, saveCreds } = await useMultiFileAuthState('auth_folder')
|
|
1378
|
+
const sock = makeWASocket({ auth: state })
|
|
1379
|
+
|
|
1380
|
+
sock.ev.on('creds.update', saveCreds)
|
|
1381
|
+
```
|
|
1382
|
+
|
|
1383
|
+
### 2. Store Implementation
|
|
1384
|
+
```javascript
|
|
1385
|
+
import { makeInMemoryStore } from '@nexustechpro/baileys'
|
|
1386
|
+
|
|
1387
|
+
const store = makeInMemoryStore({})
|
|
1388
|
+
store.readFromFile('./store.json')
|
|
1389
|
+
|
|
1390
|
+
setInterval(() => {
|
|
1391
|
+
store.writeToFile('./store.json')
|
|
1392
|
+
}, 10_000)
|
|
1393
|
+
|
|
1394
|
+
store.bind(sock.ev)
|
|
1395
|
+
```
|
|
1396
|
+
|
|
1397
|
+
### 3. Error Handling
|
|
1398
|
+
```javascript
|
|
1399
|
+
try {
|
|
1400
|
+
await sock.sendMessage(jid, { text: 'Hello' })
|
|
1401
|
+
} catch(error) {
|
|
1402
|
+
if(error.output?.statusCode === 401) {
|
|
1403
|
+
console.log('Not authorized')
|
|
1404
|
+
} else {
|
|
1405
|
+
console.error('Send failed:', error)
|
|
1406
|
+
}
|
|
1407
|
+
}
|
|
1408
|
+
```
|
|
1409
|
+
|
|
1410
|
+
### 4. Reconnection Logic
|
|
1411
|
+
```javascript
|
|
1412
|
+
sock.ev.on('connection.update', async (update) => {
|
|
1413
|
+
const { connection, lastDisconnect } = update
|
|
1414
|
+
|
|
1415
|
+
if(connection === 'close') {
|
|
1416
|
+
const shouldReconnect = lastDisconnect?.error?.output?.statusCode !== DisconnectReason.loggedOut
|
|
1417
|
+
|
|
1418
|
+
if(shouldReconnect) {
|
|
1419
|
+
console.log('Reconnecting...')
|
|
1420
|
+
await connectToWhatsApp()
|
|
1421
|
+
} else {
|
|
1422
|
+
console.log('Logged out')
|
|
1423
|
+
}
|
|
1424
|
+
}
|
|
1425
|
+
})
|
|
1426
|
+
```
|
|
1427
|
+
|
|
1428
|
+
### 5. Rate Limiting
|
|
1429
|
+
```javascript
|
|
1430
|
+
const queue = []
|
|
1431
|
+
const sending = false
|
|
1432
|
+
|
|
1433
|
+
async function queueMessage(jid, message) {
|
|
1434
|
+
queue.push({ jid, message })
|
|
1435
|
+
if(!sending) processQueue()
|
|
1436
|
+
}
|
|
1437
|
+
|
|
1438
|
+
async function processQueue() {
|
|
1439
|
+
sending = true
|
|
1440
|
+
while(queue.length > 0) {
|
|
1441
|
+
const { jid, message } = queue.shift()
|
|
1442
|
+
await sock.sendMessage(jid, message)
|
|
1443
|
+
await delay(1000) // 1 second delay between messages
|
|
1444
|
+
}
|
|
1445
|
+
sending = false
|
|
1446
|
+
}
|
|
1447
|
+
```
|
|
1448
|
+
|
|
1449
|
+
---
|
|
1450
|
+
|
|
1451
|
+
## 📝 Important Notes
|
|
1452
|
+
|
|
1453
|
+
### WhatsApp ID Formats
|
|
1454
|
+
- **Personal**: `[country_code][phone_number]@s.whatsapp.net`
|
|
1455
|
+
- **Group**: `[group_id]@g.us`
|
|
1456
|
+
- **Broadcast**: `[timestamp]@broadcast`
|
|
1457
|
+
- **Status**: `status@broadcast`
|
|
1458
|
+
- **Newsletter**: `[newsletter_id]@newsletter`
|
|
1459
|
+
|
|
1460
|
+
### Message Types
|
|
1461
|
+
All supported message types:
|
|
1462
|
+
- `conversation` - Text
|
|
1463
|
+
- `imageMessage` - Image
|
|
1464
|
+
- `videoMessage` - Video
|
|
1465
|
+
- `audioMessage` - Audio
|
|
1466
|
+
- `documentMessage` - Document
|
|
1467
|
+
- `stickerMessage` - Sticker
|
|
1468
|
+
- `locationMessage` - Location
|
|
1469
|
+
- `contactMessage` - Contact
|
|
1470
|
+
- `pollCreationMessage` - Poll
|
|
1471
|
+
- `reactionMessage` - Reaction
|
|
1472
|
+
- `editedMessage` - Edited message
|
|
1473
|
+
- `viewOnceMessage` - View once media
|
|
1474
|
+
- `extendedTextMessage` - Text with link preview
|
|
1475
|
+
|
|
1476
|
+
### Events Reference
|
|
1477
|
+
```javascript
|
|
1478
|
+
// Connection events
|
|
1479
|
+
'connection.update'
|
|
1480
|
+
'creds.update'
|
|
1481
|
+
|
|
1482
|
+
// Message events
|
|
1483
|
+
'messages.upsert'
|
|
1484
|
+
'messages.update'
|
|
1485
|
+
'messages.delete'
|
|
1486
|
+
'message-receipt.update'
|
|
1487
|
+
|
|
1488
|
+
// Chat events
|
|
1489
|
+
'chats.set'
|
|
1490
|
+
'chats.upsert'
|
|
1491
|
+
'chats.update'
|
|
1492
|
+
'chats.delete'
|
|
1493
|
+
|
|
1494
|
+
// Contact events
|
|
1495
|
+
'contacts.set'
|
|
1496
|
+
'contacts.upsert'
|
|
1497
|
+
'contacts.update'
|
|
1498
|
+
|
|
1499
|
+
// Group events
|
|
1500
|
+
'groups.upsert'
|
|
1501
|
+
'groups.update'
|
|
1502
|
+
'group-participants.update'
|
|
1503
|
+
|
|
1504
|
+
// Presence events
|
|
1505
|
+
'presence.update'
|
|
1506
|
+
|
|
1507
|
+
// Call events
|
|
1508
|
+
'call'
|
|
1509
|
+
|
|
1510
|
+
// Blocklist events
|
|
1511
|
+
'blocklist.set'
|
|
1512
|
+
'blocklist.update'
|
|
1513
|
+
```
|
|
1514
|
+
|
|
1515
|
+
---
|
|
1516
|
+
|
|
1517
|
+
## 🤝 Contributing
|
|
1518
|
+
|
|
1519
|
+
Contributions are welcome! Please follow these guidelines:
|
|
1520
|
+
|
|
1521
|
+
1. Fork the repository
|
|
1522
|
+
2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
|
|
1523
|
+
3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
|
|
1524
|
+
4. Push to the branch (`git push origin feature/AmazingFeature`)
|
|
1525
|
+
5. Open a Pull Request
|
|
1526
|
+
|
|
1527
|
+
---
|
|
1528
|
+
|
|
1529
|
+
## 📄 License
|
|
1530
|
+
|
|
1531
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
1532
|
+
|
|
1533
|
+
---
|
|
1534
|
+
|
|
1535
|
+
## ⚠️ Disclaimer
|
|
1536
|
+
|
|
1537
|
+
This project is **NOT** officially affiliated with WhatsApp or Meta. This is an independent project and should be used responsibly. The authors and maintainers are not responsible for any misuse of this library.
|
|
1538
|
+
|
|
1539
|
+
**Important**:
|
|
1540
|
+
- Follow WhatsApp's Terms of Service
|
|
1541
|
+
- Don't spam or send unsolicited messages
|
|
1542
|
+
- Respect user privacy
|
|
1543
|
+
- Use for legitimate purposes only
|
|
1544
|
+
- Be aware of WhatsApp's rate limits
|
|
1545
|
+
|
|
1546
|
+
---
|
|
1547
|
+
|
|
1548
|
+
## 🙏 Acknowledgments
|
|
1549
|
+
|
|
1550
|
+
Special thanks to:
|
|
1551
|
+
- [WhiskeySockets](https://github.com/WhiskeySockets) for the original Baileys library
|
|
1552
|
+
- All contributors who have helped improve this project
|
|
1553
|
+
- The open-source community for their continuous support
|
|
1554
|
+
|
|
1555
|
+
---
|
|
1556
|
+
|
|
1557
|
+
## 📞 Support
|
|
1558
|
+
|
|
1559
|
+
- **Issues**: [GitHub Issues](https://github.com/nexustechpro/baileys/issues)
|
|
1560
|
+
- **Discussions**: [GitHub Discussions](https://github.com/nexustechpro/baileys/discussions)
|
|
1561
|
+
- **NPM**: [@nexustechpro/baileys](https://www.npmjs.com/package/@nexustechpro/baileys)
|
|
1562
|
+
|
|
1563
|
+
---
|
|
1564
|
+
|
|
1565
|
+
<div align="center">
|
|
1566
|
+
|
|
1567
|
+
**Made with ❤️ by [NexusTechPro](https://github.com/nexustechpro)**
|
|
1568
|
+
|
|
1569
|
+
⭐ **Star us on GitHub!** ⭐
|
|
1570
|
+
|
|
1571
|
+
[GitHub](https://github.com/nexustechpro/baileys) • [NPM](https://www.npmjs.com/package/@nexustechpro/baileys) • [Documentation](https://github.com/nexustechpro/baileys/wiki)
|
|
1572
|
+
|
|
1573
|
+
</div>
|