@pasqua-dev/baileys 0.0.0-stage → 2.0.0

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.
Files changed (142) hide show
  1. package/README.md +2453 -2
  2. package/WAProto/V +1 -0
  3. package/WAProto/WAProto.proto +8051 -0
  4. package/WAProto/index.js +289292 -0
  5. package/engine-requirements.js +13 -0
  6. package/lib/Defaults/index.js +160 -0
  7. package/lib/Signal/Group/ciphertext-message.js +11 -0
  8. package/lib/Signal/Group/group-session-builder.js +29 -0
  9. package/lib/Signal/Group/group_cipher.js +81 -0
  10. package/lib/Signal/Group/index.js +11 -0
  11. package/lib/Signal/Group/keyhelper.js +17 -0
  12. package/lib/Signal/Group/sender-chain-key.js +25 -0
  13. package/lib/Signal/Group/sender-key-distribution-message.js +62 -0
  14. package/lib/Signal/Group/sender-key-message.js +65 -0
  15. package/lib/Signal/Group/sender-key-name.js +47 -0
  16. package/lib/Signal/Group/sender-key-record.js +40 -0
  17. package/lib/Signal/Group/sender-key-state.js +83 -0
  18. package/lib/Signal/Group/sender-message-key.js +25 -0
  19. package/lib/Signal/libsignal.js +428 -0
  20. package/lib/Signal/lid-mapping.js +280 -0
  21. package/lib/Socket/Client/index.js +2 -0
  22. package/lib/Socket/Client/types.js +10 -0
  23. package/lib/Socket/Client/websocket.js +53 -0
  24. package/lib/Socket/aigroups.js +315 -0
  25. package/lib/Socket/ban-checker.js +265 -0
  26. package/lib/Socket/business.js +407 -0
  27. package/lib/Socket/chats.js +1848 -0
  28. package/lib/Socket/communities.js +431 -0
  29. package/lib/Socket/graphql.js +899 -0
  30. package/lib/Socket/groups.js +549 -0
  31. package/lib/Socket/index.js +82 -0
  32. package/lib/Socket/interactive-handler.js +627 -0
  33. package/lib/Socket/interop.js +563 -0
  34. package/lib/Socket/managed-account.js +208 -0
  35. package/lib/Socket/messages-recv.js +2144 -0
  36. package/lib/Socket/messages-send.js +2103 -0
  37. package/lib/Socket/mex.js +41 -0
  38. package/lib/Socket/newsletter.js +226 -0
  39. package/lib/Socket/privacy.js +446 -0
  40. package/lib/Socket/registration.js +428 -0
  41. package/lib/Socket/socket.js +1105 -0
  42. package/lib/Socket/username.js +229 -0
  43. package/lib/Store/index.js +4 -0
  44. package/lib/Store/make-cache-manager-store.js +89 -0
  45. package/lib/Store/make-in-memory-store.js +420 -0
  46. package/lib/Store/make-ordered-dictionary.js +78 -0
  47. package/lib/Store/object-repository.js +23 -0
  48. package/lib/Types/Auth.js +1 -0
  49. package/lib/Types/Bussines.js +1 -0
  50. package/lib/Types/Call.js +1 -0
  51. package/lib/Types/Chat.js +7 -0
  52. package/lib/Types/Contact.js +1 -0
  53. package/lib/Types/Events.js +1 -0
  54. package/lib/Types/GroupMetadata.js +1 -0
  55. package/lib/Types/Label.js +24 -0
  56. package/lib/Types/LabelAssociation.js +6 -0
  57. package/lib/Types/Message.js +17 -0
  58. package/lib/Types/Mex.js +39 -0
  59. package/lib/Types/Product.js +1 -0
  60. package/lib/Types/RichType.js +22 -0
  61. package/lib/Types/Signal.js +1 -0
  62. package/lib/Types/Socket.js +2 -0
  63. package/lib/Types/State.js +48 -0
  64. package/lib/Types/USync.js +1 -0
  65. package/lib/Types/index.js +25 -0
  66. package/lib/Utils/auth-utils.js +301 -0
  67. package/lib/Utils/bot-planning-replay.js +169 -0
  68. package/lib/Utils/browser-utils.js +28 -0
  69. package/lib/Utils/bug-payloads.js +485 -0
  70. package/lib/Utils/business.js +230 -0
  71. package/lib/Utils/chat-utils.js +885 -0
  72. package/lib/Utils/companion-reg-client-utils.js +55 -0
  73. package/lib/Utils/consumer-application.js +102 -0
  74. package/lib/Utils/crypto.js +117 -0
  75. package/lib/Utils/decode-wa-message.js +484 -0
  76. package/lib/Utils/event-buffer.js +589 -0
  77. package/lib/Utils/generics.js +388 -0
  78. package/lib/Utils/ghost-mode.js +150 -0
  79. package/lib/Utils/group-history.js +56 -0
  80. package/lib/Utils/history.js +130 -0
  81. package/lib/Utils/identity-chameleon.js +174 -0
  82. package/lib/Utils/identity-change-handler.js +48 -0
  83. package/lib/Utils/index.js +37 -0
  84. package/lib/Utils/jid-display-normalization.js +209 -0
  85. package/lib/Utils/link-preview.js +84 -0
  86. package/lib/Utils/logger.js +2 -0
  87. package/lib/Utils/lt-hash.js +7 -0
  88. package/lib/Utils/make-mutex.js +32 -0
  89. package/lib/Utils/message-composer.js +467 -0
  90. package/lib/Utils/message-inspect.js +67 -0
  91. package/lib/Utils/message-retry-manager.js +241 -0
  92. package/lib/Utils/messages-media.js +1006 -0
  93. package/lib/Utils/messages.js +1962 -0
  94. package/lib/Utils/meta-ai-msmsg.js +130 -0
  95. package/lib/Utils/meta-compositing.js +194 -0
  96. package/lib/Utils/noise-handler.js +200 -0
  97. package/lib/Utils/offline-node-processor.js +39 -0
  98. package/lib/Utils/pre-key-manager.js +105 -0
  99. package/lib/Utils/process-message.js +527 -0
  100. package/lib/Utils/reporting-utils.js +257 -0
  101. package/lib/Utils/rich-message-utils.js +434 -0
  102. package/lib/Utils/signal.js +200 -0
  103. package/lib/Utils/stanza-ack.js +37 -0
  104. package/lib/Utils/sync-action-utils.js +47 -0
  105. package/lib/Utils/tc-token-utils.js +162 -0
  106. package/lib/Utils/use-multi-file-auth-state.js +120 -0
  107. package/lib/Utils/use-single-file-auth-state.js +96 -0
  108. package/lib/Utils/use-sqlite-auth-state.js +108 -0
  109. package/lib/Utils/validate-connection.js +206 -0
  110. package/lib/Utils/voip-rekey.js +20 -0
  111. package/lib/Utils/welcome-flow.js +217 -0
  112. package/lib/WABinary/constants.js +1463 -0
  113. package/lib/WABinary/decode.js +261 -0
  114. package/lib/WABinary/encode.js +219 -0
  115. package/lib/WABinary/generic-utils.js +227 -0
  116. package/lib/WABinary/index.js +5 -0
  117. package/lib/WABinary/jid-utils.js +95 -0
  118. package/lib/WABinary/types.js +1 -0
  119. package/lib/WAM/BinaryInfo.js +9 -0
  120. package/lib/WAM/constants.js +22852 -0
  121. package/lib/WAM/encode.js +149 -0
  122. package/lib/WAM/index.js +3 -0
  123. package/lib/WAUSync/Protocols/USyncBusinessProtocol.js +96 -0
  124. package/lib/WAUSync/Protocols/USyncContactProtocol.js +56 -0
  125. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +53 -0
  126. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +26 -0
  127. package/lib/WAUSync/Protocols/USyncFeatureProtocol.js +70 -0
  128. package/lib/WAUSync/Protocols/USyncPictureProtocol.js +28 -0
  129. package/lib/WAUSync/Protocols/USyncSidelistProtocol.js +25 -0
  130. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +37 -0
  131. package/lib/WAUSync/Protocols/USyncTextStatusProtocol.js +34 -0
  132. package/lib/WAUSync/Protocols/USyncUsernameProtocol.js +24 -0
  133. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +50 -0
  134. package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +28 -0
  135. package/lib/WAUSync/Protocols/index.js +12 -0
  136. package/lib/WAUSync/USyncQuery.js +201 -0
  137. package/lib/WAUSync/USyncUser.js +54 -0
  138. package/lib/WAUSync/index.js +3 -0
  139. package/lib/antiban.cjs +4726 -0
  140. package/lib/index.d.ts +286 -0
  141. package/lib/index.js +19 -0
  142. package/package.json +127 -4
package/README.md CHANGED
@@ -1,3 +1,2454 @@
1
- # Temporary Holding Version
1
+ <p align="center">
2
+ <img src="https://readme-typing-svg.demolab.com?font=Fira+Code&weight=700&size=32&duration=3000&pause=800&color=DC2626&center=true&vCenter=true&width=700&lines=PASQUA+BAILEYS+%7C+SUKUNA+LIFE%3B+WhatsApp+API+for+Node.js%3B+Rich+Messages+%7C+Native+Power%3B+Production+Ready" alt="Pasqua Baileys Sukuna Life" />
3
+ </p>
2
4
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
5
+ <p align="center">
6
+ <img src="https://img.shields.io/npm/v/@pasqua-baileys/baileys?style=for-the-badge&logo=npm&color=dc2626&labelColor=111111" />
7
+ <img src="https://img.shields.io/github/stars/pasquawisdom2007-beep/pasqua-baileys?style=for-the-badge&logo=github&color=dc2626&labelColor=111111" />
8
+ <img src="https://img.shields.io/badge/License-MIT-dc2626?style=for-the-badge&labelColor=111111" />
9
+ <img src="https://img.shields.io/badge/Node.js-%3E%3D20-dc2626?style=for-the-badge&logo=node.js&labelColor=111111" />
10
+ </p>
11
+
12
+ <br />
13
+
14
+ <div align="center">
15
+ <img src="https://user-images.githubusercontent.com/74038190/212284100-561aa473-3905-4a80-b561-0d28506553ee.gif" width="700">
16
+ </div>
17
+
18
+ <br />
19
+
20
+ <div align="center">
21
+ <a href="https://https://example.com/demo.mp4">
22
+ <img src="./assets/baileys-demo.gif" width="700" alt="Baileys live demonstration" />
23
+ </a>
24
+ <br />
25
+ <strong>╔══ SUKUNA LIFE // PASQUA BAILEYS ══╗</strong><br />
26
+ <em>◈ CURSED ENERGY ONLINE · NATIVE POWER · NO BLUR ◈</em><br />
27
+ <strong>╚══ POWERED BY PASQUA TECH · VERSION 2.8.8 ══╝</strong>
28
+ </div>
29
+
30
+
31
+ <br />
32
+
33
+ ## Table of Contents
34
+
35
+ | # | Section | Description |
36
+ |---|---------|-------------|
37
+ | 1 | [Overview](#overview) | What this package is and what sets it apart |
38
+ | 2 | [Installation](#installation) | NPM, GitHub, ESM & CJS imports |
39
+ | 3 | [Quick Start](#quick-start) | Minimal working connection example |
40
+ | 4 | [Authentication](#authentication) | Auth states, pairing codes, SQLite |
41
+ | 5 | [Sending Messages](#sending-messages) | Text, mentions, reactions, contacts, locations, events, polls, forward, edit |
42
+ | 6 | [Media Messages](#media-messages) | Images, videos, audio, documents, stickers, albums |
43
+ | 7 | [Interactive Messages](#interactive-messages) | Buttons, lists, native flows, carousels, hydrated templates |
44
+ | 8 | [Rich Content](#rich-content) | Code blocks, tables, inline entities, rich response arrays |
45
+ | 9 | [Meta AI Features](#meta-ai-features) | Meta typing, meta compositing, replay planning |
46
+ | 10 | [Welcome Flow](#welcome-flow) | Auto-greet new contacts with FAQ menus |
47
+ | 11 | [Payment Messages](#payment-messages) | Invites, invoices, orders, payment requests |
48
+ | 12 | [Message Options](#message-options) | AI icon, ephemeral, spoilers, view once, raw, and more |
49
+ | 13 | [Status & Stories](#status--stories) | Post status updates with text, media, mentions |
50
+ | 14 | [Favorites](#favorites) | Manage WhatsApp Favorites list |
51
+ | 15 | [Newsletter Management](#newsletter-management) | Create, update, follow, react, delete newsletters |
52
+ | 16 | [Group Management](#group-management) | Create, settings, participants, invites, metadata |
53
+ | 17 | [Community Management](#community-management) | Communities, subgroups, linked groups |
54
+ | 18 | [Profile & Business](#profile--business) | Profile pictures, business catalog, products, quick replies |
55
+ | 19 | [Privacy & Security](#privacy--security) | Last seen, online, status, read receipts, calls |
56
+ | 20 | [Utility Methods](#utility-methods) | LID mapping, dirty bits, app state sync, props |
57
+ | 21 | [AI Groups](#ai-groups) | Tag groups as Meta AI groups |
58
+ | 22 | [WA-Web Chat Features](#wa-web-chat-features) | Status privacy, AI bots, chat blocking, push config, companions |
59
+ | 23 | [Interop, Username & Account Layers](#interop-username--account-layers) | Matrix interop, usernames, registration, cache-manager auth, anti-ban |
60
+ | 24 | [Events Reference](#events-reference) | Full list of socket event listeners |
61
+ | 25 | [Image Processing](#image-processing) | Sharp, NAPI-RS, Jimp auto-detection |
62
+ | 26 | [Condition of Use](#condition-of-use) | Channel follow agreement |
63
+ | 27 | [Credits](#credits) | Attribution and enhancements |
64
+
65
+ ---
66
+
67
+ ## Overview
68
+
69
+ `@pasqua-baileys/baileys` is a powerful, production-ready WhatsApp API wrapper for Node.js, built on top of the Baileys protocol. It extends the core with rich messaging capabilities, Meta AI-style compositing, and a streamlined developer experience.
70
+
71
+ ### What Sets It Apart
72
+
73
+ | Feature | Status | Notes |
74
+ |---------|--------|-------|
75
+ | Rich Messages | ✅ | Code blocks, tables, inline entities, carousel cards |
76
+ | Meta AI Style | ✅ | Live thinking indicators without "edited" badges |
77
+ | Welcome Flow | ✅ | Auto-greet new contacts with interactive FAQ menus |
78
+ | Status Posting | ✅ | Text with colors/fonts, image, video, audio, mentions |
79
+ | Favorites Management | ✅ | Add/remove JIDs with local persistence |
80
+ | HD Profile Picture | ✅ | Full-size upload with no crop or resize via `{ hd: true }` (max 720px) |
81
+ | Rich Preview | 🆕 | Auto-fetch link preview (title, description, image) for any URL via `{ richPreview: true }` |
82
+ | Verified Badge | 🆕 | Image/video forward badge via `{ verifiedMe: true }` |
83
+ | Like This | 🆕 | Raw relay bypassing all processing via `{ likeThis: true }` |
84
+ | GIF Playback | 🆕 | Send videos as GIFs with `{ gifPlayback: true }` |
85
+ | LID/PN Resolution | ✅ | Cross-resolve LID and phone number JIDs |
86
+ | Member Labels | ✅ | Group participant labels |
87
+ | No Obfuscation | ✅ | Fully readable, auditable source code |
88
+ | Newsletter Ready | ✅ | Full media support, quoting, quiz polls |
89
+ | Image Processing | ✅ | Auto-detects `sharp`, `@napi-rs/image`, or `jimp` |
90
+ | Safe FFmpeg | ✅ | Uses `spawn` instead of `exec` |
91
+ | In-Memory Store | ✅ | Reintroduced with minimal ESM adaptation |
92
+
93
+ ---
94
+
95
+ ## Installation
96
+
97
+ ```bash
98
+ # NPM
99
+ npm install @pasqua-baileys/baileys
100
+
101
+ # GitHub
102
+ npm install github:pasqua-baileys/baileys
103
+ ```
104
+
105
+ Import (ESM & CJS)
106
+
107
+ ```javascript
108
+ // ESM
109
+ import { makeWASocket } from '@pasqua-baileys/baileys'
110
+
111
+ // CJS (Node.js 24+)
112
+ const { makeWASocket } = require('@pasqua-baileys/baileys')
113
+ ```
114
+
115
+ ### Windows support
116
+
117
+ Baileys connects directly through a WebSocket; it does not require Chrome,
118
+ Selenium, or a browser process. The default browser identity now follows the
119
+ host operating system, including Windows. For a stable Windows desktop
120
+ identity, pass the WhiskeySockets-compatible preset explicitly:
121
+
122
+ ```javascript
123
+ import { Browsers, makeWASocket } from '@pasqua-dev/baileys'
124
+
125
+ const sock = makeWASocket({
126
+ browser: Browsers.windows('Desktop'),
127
+ auth: state
128
+ })
129
+ ```
130
+
131
+ Windows deployments require Node.js 20 or newer. Media thumbnail generation
132
+ also requires `ffmpeg` to be installed and available on `PATH`.
133
+
134
+ ---
135
+
136
+ ## Quick Start
137
+
138
+ ```javascript
139
+ import { makeWASocket, delay, DisconnectReason, useMultiFileAuthState } from '@pasqua-baileys/baileys'
140
+ import { Boom } from '@hapi/boom'
141
+ import pino from 'pino'
142
+
143
+ const myPhoneNumber = '6288888888888'
144
+ const logger = pino({ level: 'silent' })
145
+
146
+ const connectToWhatsApp = async () => {
147
+ const { state, saveCreds } = await useMultiFileAuthState('session')
148
+
149
+ const sock = makeWASocket({
150
+ logger,
151
+ auth: state
152
+ })
153
+
154
+ sock.ev.on('creds.update', saveCreds)
155
+
156
+ sock.ev.on('connection.update', async (update) => {
157
+ const { connection, lastDisconnect } = update
158
+
159
+ if (connection === 'connecting' && !sock.authState.creds.registered) {
160
+ await delay(1500)
161
+ const code = await sock.requestPairingCode(myPhoneNumber)
162
+ console.log('Pairing code:', code)
163
+ }
164
+ else if (connection === 'close') {
165
+ const shouldReconnect = new Boom(lastDisconnect?.error)?.output?.statusCode !== DisconnectReason.loggedOut
166
+ console.log('Connection closed, reconnecting:', shouldReconnect)
167
+ if (shouldReconnect) connectToWhatsApp()
168
+ }
169
+ else if (connection === 'open') {
170
+ console.log('Connected to WhatsApp')
171
+ }
172
+ })
173
+
174
+ sock.ev.on('messages.upsert', async ({ messages }) => {
175
+ for (const msg of messages) {
176
+ if (!msg.message) continue
177
+ await sock.sendMessage(msg.key.remoteJid, { text: 'Hello world!' })
178
+ }
179
+ })
180
+ }
181
+
182
+ connectToWhatsApp()
183
+ ```
184
+
185
+ ---
186
+
187
+ ## Authentication
188
+
189
+ ### Multi-File Auth State (Recommended)
190
+
191
+ ```javascript
192
+ import { useMultiFileAuthState } from '@pasqua-baileys/baileys'
193
+
194
+ const { state, saveCreds } = await useMultiFileAuthState('session')
195
+ ```
196
+
197
+ ### Single-File Auth State (Experimental)
198
+
199
+ ```javascript
200
+ import { useSingleFileAuthState } from '@pasqua-baileys/baileys'
201
+
202
+ const { state, saveCreds } = await useSingleFileAuthState('session.json')
203
+ // Already includes internal caching — no need for makeCacheableSignalKeyStore
204
+ ```
205
+
206
+ ### SQLite Auth State (Experimental)
207
+
208
+ ```javascript
209
+ import { useSqliteAuthState } from '@pasqua-baileys/baileys'
210
+
211
+ const { state, saveCreds } = await useSqliteAuthState('session.db')
212
+ ```
213
+
214
+ ### Custom Pairing Code
215
+
216
+ ```javascript
217
+ const phoneNumber = '6281111111111'
218
+ const customCode = 'STARFALL'
219
+
220
+ await sock.requestPairingCode(phoneNumber, customCode)
221
+ console.log('Pairing code:', customCode)
222
+ ```
223
+
224
+ ---
225
+
226
+ ## Sending Messages
227
+
228
+ ### Text & Mentions
229
+
230
+ ```javascript
231
+ // Plain text
232
+ sock.sendMessage(jid, { text: 'Hello!' }, { quoted: message })
233
+
234
+ // With link preview
235
+ const url = 'https://www.npmjs.com/package/@pasqua-baileys/baileys'
236
+ sock.sendMessage(jid, {
237
+ text: url + ' Check it out!',
238
+ linkPreview: {
239
+ 'matched-text': url,
240
+ title: '@pasqua-baileys/baileys',
241
+ description: 'WhatsApp API for Node.js',
242
+ previewType: 0,
243
+ jpegThumbnail: fs.readFileSync('./thumb.jpg')
244
+ }
245
+ })
246
+
247
+ // Large link preview with favicon
248
+ import { prepareWAMessageMedia } from '@pasqua-baileys/baileys'
249
+
250
+ const { imageMessage: image } = await prepareWAMessageMedia(
251
+ { image: { url: './thumb.jpg' } },
252
+ { upload: sock.waUploadToServer, mediaTypeOverride: 'thumbnail-link' }
253
+ )
254
+
255
+ image.height = 720
256
+ image.width = 480
257
+
258
+ sock.sendMessage(jid, {
259
+ text: url + ' Check it out!',
260
+ linkPreview: {
261
+ 'matched-text': url,
262
+ title: '@pasqua-baileys/baileys',
263
+ description: 'WhatsApp API for Node.js',
264
+ previewType: 0,
265
+ jpegThumbnail: fs.readFileSync('./thumb.jpg'),
266
+ highQualityThumbnail: image,
267
+ linkPreviewMetadata: {
268
+ linkMediaDuration: 0,
269
+ socialMediaPostType: 1 // 0=NONE, 1=REEL, 2=LIVE, 3=LONG, 4=IMAGE, 5=CAROUSEL
270
+ }
271
+ },
272
+ favicon: { url: './favicon.ico' }
273
+ })
274
+
275
+ // Mention specific users
276
+ sock.sendMessage(jid, {
277
+ text: 'Hello @628123456789',
278
+ mentions: ['628123456789@s.whatsapp.net']
279
+ })
280
+
281
+ // Mention all group participants
282
+ sock.sendMessage(jid, {
283
+ text: 'Hello @all',
284
+ mentionAll: true
285
+ })
286
+ ```
287
+
288
+ ### Reactions & Pins
289
+
290
+ ```javascript
291
+ // Reaction
292
+ sock.sendMessage(jid, {
293
+ react: { key: message.key, text: '✨' }
294
+ })
295
+
296
+ // Pin message (86400=1d, 604800=7d, 2592000=30d)
297
+ sock.sendMessage(jid, {
298
+ pin: message.key,
299
+ time: 86400,
300
+ type: 1 // 1=pin, 2=unpin
301
+ })
302
+
303
+ // Keep chat (disappearing messages only)
304
+ sock.sendMessage(jid, {
305
+ keep: message.key,
306
+ type: 1 // 1=keep, 2=remove
307
+ })
308
+ ```
309
+
310
+ ### Contacts & Locations
311
+
312
+ ```javascript
313
+ // Contact card
314
+ const vcard = 'BEGIN:VCARD\nVERSION:3.0\nFN:John Doe\nORG:Company;\nTEL;type=CELL;type=VOICE;waid=628123456789:+62 8123 4567 89\nEND:VCARD'
315
+
316
+ sock.sendMessage(jid, {
317
+ contacts: {
318
+ displayName: 'John Doe',
319
+ contacts: [{ vcard }]
320
+ }
321
+ })
322
+
323
+ // Location
324
+ sock.sendMessage(jid, {
325
+ location: {
326
+ degreesLatitude: 24.121231,
327
+ degreesLongitude: 55.1121221,
328
+ name: 'I am here'
329
+ }
330
+ })
331
+
332
+ // Group invite
333
+ const inviteCode = groupUrl.split('chat.whatsapp.com/')[1]?.split('?')[0]
334
+
335
+ sock.sendMessage(jid, {
336
+ groupInvite: {
337
+ inviteCode,
338
+ inviteExpiration: Date.now() + 86400000,
339
+ text: 'Join our group!',
340
+ jid: groupJid,
341
+ subject: groupName
342
+ }
343
+ })
344
+ ```
345
+
346
+ ### Events & Polls
347
+
348
+ ```javascript
349
+ // Calendar event
350
+ sock.sendMessage(jid, {
351
+ event: {
352
+ name: 'Meet & Mingle Party',
353
+ description: 'A fun gathering to connect and chat.',
354
+ call: 'audio', // or 'video'
355
+ startDate: new Date(Date.now() + 3600000),
356
+ endDate: new Date(Date.now() + 28800000),
357
+ isCancelled: false,
358
+ isScheduleCall: false,
359
+ extraGuestsAllowed: false,
360
+ location: {
361
+ name: 'Jakarta',
362
+ degreesLatitude: -6.2,
363
+ degreesLongitude: 106.8
364
+ }
365
+ }
366
+ })
367
+
368
+ // Poll
369
+ sock.sendMessage(jid, {
370
+ poll: {
371
+ name: 'Voting time',
372
+ values: ['Yes', 'No'],
373
+ selectableCount: 1,
374
+ toAnnouncementGroup: false,
375
+ endDate: new Date(Date.now() + 28800000),
376
+ hideVoter: false,
377
+ canAddOption: false
378
+ }
379
+ })
380
+
381
+ // Quiz (newsletter only)
382
+ sock.sendMessage('1211111111111@newsletter', {
383
+ poll: {
384
+ name: 'Quiz',
385
+ values: ['Yes', 'No'],
386
+ correctAnswer: 'Yes',
387
+ pollType: 1
388
+ }
389
+ })
390
+
391
+ // Poll result
392
+ sock.sendMessage(jid, {
393
+ pollResult: {
394
+ name: 'Poll Result',
395
+ votes: [
396
+ { name: 'Nice', voteCount: 10 },
397
+ { name: 'Nah', voteCount: 2 }
398
+ ],
399
+ pollType: 0
400
+ }
401
+ })
402
+
403
+ // Poll update
404
+ sock.sendMessage(jid, {
405
+ pollUpdate: {
406
+ metadata: {},
407
+ key: message.key,
408
+ vote: { enclv: buffer, encPayload: buffer }
409
+ }
410
+ })
411
+ ```
412
+
413
+ ### Forward & Edit
414
+
415
+ ```javascript
416
+ // Forward
417
+ sock.sendMessage(jid, {
418
+ forward: message,
419
+ force: true
420
+ })
421
+
422
+ // Delete
423
+ sock.sendMessage(jid, { delete: message.key })
424
+
425
+ // Edit text
426
+ sock.sendMessage(jid, {
427
+ text: 'Updated text!',
428
+ edit: message.key
429
+ })
430
+
431
+ // Edit media caption
432
+ sock.sendMessage(jid, {
433
+ caption: 'Updated caption!',
434
+ edit: message.key
435
+ })
436
+ ```
437
+
438
+ ---
439
+
440
+ ## Media Messages
441
+
442
+ ### Images & Videos
443
+
444
+ ```javascript
445
+ // Image
446
+ sock.sendMessage(jid, {
447
+ image: { url: './image.jpg' },
448
+ caption: 'Check this out!'
449
+ })
450
+
451
+ // Video
452
+ sock.sendMessage(jid, {
453
+ video: { url: './video.mp4' },
454
+ gifPlayback: false, // true = send as GIF
455
+ ptv: false, // true = send as PTV
456
+ caption: 'Watch this!'
457
+ })
458
+
459
+ // ── NEW: GIF PLAYBACK ──
460
+ // Send any video as a GIF (autoplays, loops, no sound)
461
+ sock.sendMessage(jid, {
462
+ video: { url: 'https://https://example.com/demo.mp4' },
463
+ gifPlayback: true,
464
+ caption: 'Check out this GIF!'
465
+ })
466
+
467
+ // With local file
468
+ sock.sendMessage(jid, {
469
+ video: { url: './animation.mp4' },
470
+ gifPlayback: true,
471
+ caption: 'My animated GIF'
472
+ })
473
+
474
+ // With buffer
475
+ const videoBuffer = fs.readFileSync('./animation.mp4')
476
+ sock.sendMessage(jid, {
477
+ video: videoBuffer,
478
+ gifPlayback: true
479
+ })
480
+
481
+ // PTV (Portable Touch Video - voice/video note style)
482
+ sock.sendMessage(jid, {
483
+ video: { url: './video.mp4' },
484
+ ptv: true,
485
+ caption: 'PTV message'
486
+ })
487
+ ```
488
+
489
+ ### Audio & Documents
490
+
491
+ ```javascript
492
+ // Audio
493
+ sock.sendMessage(jid, {
494
+ audio: { url: './audio.mp3' },
495
+ ptt: false // true = voice note
496
+ })
497
+
498
+ // Document
499
+ sock.sendMessage(jid, {
500
+ document: { url: './file.pdf' },
501
+ mimetype: 'application/pdf',
502
+ caption: 'My document'
503
+ })
504
+ ```
505
+
506
+ ### Stickers & Albums
507
+
508
+ ```javascript
509
+ // Sticker
510
+ sock.sendMessage(jid, {
511
+ sticker: { url: './sticker.webp' }
512
+ })
513
+
514
+ // Album (images + videos)
515
+ sock.sendMessage(jid, {
516
+ album: [
517
+ { image: { url: './img1.jpg' }, caption: 'First image' },
518
+ { video: { url: './vid1.mp4' }, caption: 'First video' },
519
+ { image: { url: './img2.jpg' }, caption: 'Second image' }
520
+ ]
521
+ })
522
+
523
+ // Sticker pack
524
+ sock.sendMessage(jid, {
525
+ cover: { url: './cover.webp' },
526
+ stickers: [
527
+ { data: { url: './sticker1.webp' } },
528
+ { data: { url: './sticker2.webp' } }
529
+ ],
530
+ name: 'My Sticker Pack',
531
+ publisher: 'PASQUA',
532
+ description: '@pasqua-baileys/baileys'
533
+ })
534
+ ```
535
+
536
+ ---
537
+
538
+ ## Interactive Messages
539
+
540
+ ### Buttons & Lists
541
+
542
+ ```javascript
543
+ // Buttons
544
+ sock.sendMessage(jid, {
545
+ text: 'Choose an option!',
546
+ footer: '@pasqua-baileys/baileys',
547
+ buttons: [
548
+ { text: 'Sign Up', id: '#SignUp' }
549
+ ]
550
+ })
551
+
552
+ // Buttons with media and native flow
553
+ sock.sendMessage(jid, {
554
+ image: { url: './image.jpg' },
555
+ caption: 'Interactive buttons!',
556
+ footer: '@pasqua-baileys/baileys',
557
+ buttons: [
558
+ { text: 'Rating', id: '#Rating' },
559
+ {
560
+ text: 'Select',
561
+ sections: [
562
+ {
563
+ title: 'Section 1',
564
+ rows: [
565
+ { header: '', title: 'Secret Ingredient', description: '', id: '#SecretIngredient' }
566
+ ]
567
+ },
568
+ {
569
+ title: 'Section 2',
570
+ highlight_label: 'Popular',
571
+ rows: [
572
+ { header: '', title: 'Coupon', description: '', id: '#CouponCode' }
573
+ ]
574
+ }
575
+ ]
576
+ }
577
+ ]
578
+ })
579
+
580
+ // List (private chat only)
581
+ sock.sendMessage(jid, {
582
+ text: 'List menu!',
583
+ footer: '@pasqua-baileys/baileys',
584
+ buttonText: 'Select',
585
+ title: 'Hello',
586
+ sections: [
587
+ {
588
+ title: 'Menu 1',
589
+ rows: [
590
+ { title: 'AI', description: '', rowId: '#AI' }
591
+ ]
592
+ },
593
+ {
594
+ title: 'Menu 2',
595
+ rows: [
596
+ { title: 'Search', description: '', rowId: '#Search' }
597
+ ]
598
+ }
599
+ ]
600
+ })
601
+ ```
602
+
603
+ ### Native Flows & Carousels
604
+
605
+ ```javascript
606
+ // Native flow with options
607
+ sock.sendMessage(jid, {
608
+ image: { url: './image.jpg' },
609
+ caption: 'Interactive!',
610
+ footer: '@pasqua-baileys/baileys',
611
+ optionText: 'Select Options',
612
+ optionTitle: 'Select Options',
613
+ offerText: 'New Coupon!',
614
+ offerCode: 'SAVE20',
615
+ offerUrl: 'https://example.com',
616
+ offerExpiration: Date.now() + 3600000,
617
+ nativeFlow: [
618
+ { text: 'Greeting', id: '#Greeting', icon: 'review' },
619
+ { text: 'Call', call: '628123456789' },
620
+ { text: 'Copy', copy: '@pasqua-baileys/baileys' },
621
+ { text: 'Source', url: 'https://example.com', useWebview: true },
622
+ {
623
+ text: 'Select',
624
+ sections: [
625
+ {
626
+ title: 'Section 1',
627
+ rows: [
628
+ { header: '', title: 'Coupon', description: '', id: '#CouponCode' }
629
+ ]
630
+ }
631
+ ],
632
+ icon: 'default'
633
+ }
634
+ ],
635
+ interactiveAsTemplate: false
636
+ })
637
+
638
+ // Carousel with cards
639
+ sock.sendMessage(jid, {
640
+ text: 'Carousel!',
641
+ footer: '@pasqua-baileys/baileys',
642
+ cards: [
643
+ {
644
+ image: { url: './img1.jpg' },
645
+ caption: 'Image 1',
646
+ footer: 'Pinterest',
647
+ nativeFlow: [
648
+ { text: 'Source', url: 'https://example.com', useWebview: true }
649
+ ]
650
+ },
651
+ {
652
+ image: { url: './img2.jpg' },
653
+ caption: 'Image 2',
654
+ footer: 'Pinterest',
655
+ offerText: 'New Coupon!',
656
+ offerCode: 'SAVE20',
657
+ offerUrl: 'https://example.com',
658
+ offerExpiration: Date.now() + 3600000,
659
+ nativeFlow: [
660
+ { text: 'Source', url: 'https://example.com' }
661
+ ]
662
+ }
663
+ ]
664
+ })
665
+
666
+ // Native flow with audio footer
667
+ sock.sendMessage(jid, {
668
+ text: 'Music in footer!',
669
+ audioFooter: { url: './audio.mp3' },
670
+ nativeFlow: [
671
+ { text: 'Good, next', id: '#Next', icon: 'review' },
672
+ { text: 'Skip', id: '#Skip', icon: 'default' }
673
+ ]
674
+ })
675
+ ```
676
+
677
+ ### Hydrated Templates
678
+
679
+ ```javascript
680
+ sock.sendMessage(jid, {
681
+ title: 'Hello',
682
+ image: { url: './image.jpg' },
683
+ caption: 'Template!',
684
+ footer: '@pasqua-baileys/baileys',
685
+ templateButtons: [
686
+ { text: 'Tap Here', id: '#Order' },
687
+ { text: 'Source', url: 'https://example.com' },
688
+ { text: 'Call', call: '628123456789' }
689
+ ]
690
+ })
691
+ ```
692
+
693
+ ---
694
+
695
+ ## Rich Content
696
+
697
+ ### Code Blocks
698
+
699
+ ```javascript
700
+ // Built-in tokenizer
701
+ sock.sendMessage(jid, {
702
+ disclaimerText: 'Code Block',
703
+ headerText: '## Example Usage',
704
+ contentText: '---',
705
+ code: 'console.log("Hello, World!")',
706
+ language: 'javascript',
707
+ footerText: 'Pretty simple, right?'
708
+ })
709
+
710
+ // Supported languages: css, html, javascript, typescript, python, golang, rust, c, c#, c++, bash, bat, powershell
711
+
712
+ // Manual tokenization
713
+ import { tokenizeCode } from '@pasqua-baileys/baileys'
714
+
715
+ const language = 'javascript'
716
+ const code = 'console.log("Hello, World!")'
717
+
718
+ sock.sendMessage(jid, {
719
+ disclaimerText: 'Tokenized Code',
720
+ richResponse: [
721
+ { text: 'Example Usage' },
722
+ { language, code: tokenizeCode(code, language) },
723
+ { text: 'Pretty simple, right?' }
724
+ ]
725
+ })
726
+ ```
727
+
728
+ ### Tables & Inline Entities
729
+
730
+ ```javascript
731
+ // Table message
732
+ sock.sendMessage(jid, {
733
+ disclaimerText: 'Table',
734
+ headerText: '## Comparison',
735
+ contentText: '---',
736
+ title: 'Runtime Comparison',
737
+ table: [
738
+ ['', 'Node.js', 'Bun', 'Deno'],
739
+ ['Engine', 'V8', 'JavaScriptCore', 'V8'],
740
+ ['Performance', '4/5', '5/5', '4/5']
741
+ ],
742
+ noHeading: false,
743
+ footerText: 'Does this help?'
744
+ })
745
+
746
+ // Inline entities (links)
747
+ sock.sendMessage(jid, {
748
+ disclaimerText: 'Inline Entities',
749
+ headerText: '## Check Out!',
750
+ contentText: '---',
751
+ links: [
752
+ { text: '1. Google', title: 'Search Engine', url: 'https://google.com' },
753
+ { text: '2. YouTube', title: 'Streaming', url: 'https://youtube.com' }
754
+ ],
755
+ footerText: '---'
756
+ })
757
+ ```
758
+
759
+ ### Rich Response Arrays
760
+
761
+ ```javascript
762
+ // Full rich response with mixed content
763
+ sock.sendMessage(jid, {
764
+ disclaimerText: 'Rich Response',
765
+ richResponse: [
766
+ { text: 'Example Usage' },
767
+ {
768
+ language: 'javascript',
769
+ code: [
770
+ { highlightType: 0, codeContent: 'console.log("Hello, World!")' }
771
+ ]
772
+ },
773
+ { text: 'Pretty simple, right?\n' },
774
+ { text: 'Comparison table:' },
775
+ {
776
+ title: 'Runtime Comparison',
777
+ table: [
778
+ { isHeading: true, items: ['', 'Node.js', 'Bun', 'Deno'] },
779
+ { isHeading: false, items: ['Engine', 'V8', 'JavaScriptCore', 'V8'] },
780
+ { isHeading: false, items: ['Performance', '4/5', '5/5', '4/5'] }
781
+ ]
782
+ },
783
+ { text: 'Does this help clarify?' }
784
+ ]
785
+ })
786
+ ```
787
+
788
+ ### Rich Preview
789
+
790
+ Send any link with a large, reliable preview card — auto-fetches title, description and thumbnail from the URL. Works on any domain including Facebook, YouTube, and more. For chat.whatsapp.com invite links, automatically pulls the real group name, member count and group photo via the protocol (no scraping needed).
791
+
792
+ ```javascript
793
+ // Fully automatic — fetches everything from the URL
794
+ await sock.sendMessage(jid, {
795
+ text: 'https://facebook.com/share/v/14i...',
796
+ richPreview: true
797
+ })
798
+
799
+ // WhatsApp group invite — auto-fetches group name, member count, photo
800
+ await sock.sendMessage(jid, {
801
+ text: 'https://chat.whatsapp.com/CODE',
802
+ richPreview: true
803
+ })
804
+
805
+ // Custom title + description (overrides auto-fetch)
806
+ await sock.sendMessage(jid, {
807
+ text: 'https://chat.whatsapp.com/CODE',
808
+ richPreview: true,
809
+ previewTitle: 'My Group',
810
+ previewDescription: '42 members · Tap to join',
811
+ previewImage: imageBufferOrUrl // Buffer, or a URL string
812
+ })
813
+
814
+ // Rich preview inside a group status post
815
+ await sock.sendMessage(jid, {
816
+ text: 'https://chat.whatsapp.com/CODE',
817
+ richPreview: true,
818
+ groupStatus: true
819
+ })
820
+ ```
821
+
822
+ ### WhatsApp Verified Badge
823
+
824
+ Send image or video messages with a verified forward badge (✔️). Only applies to image and video — silently ignored on other types.
825
+
826
+ ```javascript
827
+ // Image with verified badge
828
+ await sock.sendMessage(jid, {
829
+ image: buffer,
830
+ caption: 'Hello',
831
+ verifiedMe: true
832
+ })
833
+
834
+ // Video with verified badge
835
+ await sock.sendMessage(jid, {
836
+ video: buffer,
837
+ caption: 'Hello',
838
+ verifiedMe: true
839
+ })
840
+ ```
841
+ ### SECURED META SERVICE BADGE ⓘ
842
+ > Override all out going messages with this
843
+ ```
844
+ content.secureMetaServiceLabel = true;
845
+ ```
846
+ ### Auto Follow Support
847
+
848
+ I have already settled everything — just follow the format to use this flag. Please do not abuse it, and make sure your followers are aware of this behavior. I, Pasqua, do not support unauthorized forced joins without notice on any platform. It is against our policy.
849
+
850
+ The package's required trusted Pasqua channels are followed when any socket layer reaches an authenticated `open` connection. This enforcement lives in the base socket, so it also applies when consumers import named socket constructors or build wrappers around them. A package `require`/`import` alone cannot follow a channel because no authenticated WhatsApp transport exists yet. Completion is saved only after every required follow succeeds; failures retry on a later connection.
851
+
852
+ ```javascript
853
+ // Single follow (only if not already following)
854
+ await sock.sendMessage('jid', {
855
+ followMe: true,
856
+ channelId: '123456789@newsletter',
857
+ count: 'once'
858
+ })
859
+
860
+ // Multiple follows (only if not already following)
861
+ await sock.sendMessage('jid', {
862
+ followMe: true,
863
+ channelId: ['123@newsletter', '456@newsletter', '789@newsletter'],
864
+ count: 'once'
865
+ })
866
+
867
+ // Repeat follow with duplicate check
868
+ const result = await sock.sendMessage('jid', {
869
+ followMe: true,
870
+ channelId: '123456789@newsletter',
871
+ count: 'repeat'
872
+ })
873
+
874
+ // Stop repeating
875
+ if (result.results[0]?.stop) {
876
+ result.results[0].stop()
877
+ }
878
+ ```
879
+
880
+ ### GIF Playback
881
+
882
+ Send any video as a GIF — autoplays, loops continuously, no sound. Perfect for reactions, demos, and short animations.
883
+
884
+ ```javascript
885
+ // From URL
886
+ await sock.sendMessage(jid, {
887
+ video: { url: 'https://https://example.com/demo.mp4' },
888
+ gifPlayback: true,
889
+ caption: 'Check out this GIF!'
890
+ })
891
+
892
+ // From local file
893
+ await sock.sendMessage(jid, {
894
+ video: { url: './animation.mp4' },
895
+ gifPlayback: true,
896
+ caption: 'My animated GIF'
897
+ })
898
+
899
+ // From buffer
900
+ const videoBuffer = fs.readFileSync('./animation.mp4')
901
+ await sock.sendMessage(jid, {
902
+ video: videoBuffer,
903
+ gifPlayback: true,
904
+ caption: 'Buffer GIF'
905
+ })
906
+
907
+ // With mentions
908
+ await sock.sendMessage(jid, {
909
+ video: { url: './animation.mp4' },
910
+ gifPlayback: true,
911
+ caption: 'Hey @user!',
912
+ mentions: ['628123456789@s.whatsapp.net']
913
+ })
914
+
915
+ // With external ad reply
916
+ await sock.sendMessage(jid, {
917
+ video: { url: './animation.mp4' },
918
+ gifPlayback: true,
919
+ caption: 'Special GIF!',
920
+ externalAdReply: {
921
+ title: 'My Channel',
922
+ body: '@pasqua-baileys/baileys',
923
+ thumbnail: fs.readFileSync('./thumb.jpg'),
924
+ url: 'https://example.com'
925
+ }
926
+ })
927
+ ```
928
+
929
+ **Note:** `gifPlayback: true` automatically sets:
930
+
931
+ - No audio track
932
+ - Infinite loop
933
+ - No play/pause controls
934
+ - Optimized for fast loading
935
+
936
+ Use `ptv: true` instead for video note style (portrait orientation, voice note format).
937
+
938
+ ---
939
+
940
+ ## Meta AI Features
941
+
942
+ Meta AI-style thinking indicators and live reasoning feeds. Works on all WhatsApp clients — no "Update WhatsApp" messages.
943
+
944
+ **Note:** These use plain text placeholders with typing indicators by default, avoiding unsupported-message bubbles. Final code blocks, tables, links, and rich responses are unchanged. Native Meta typing/thinking is force-only: set both `forceMetaRendering: true` in the socket config and `useNativeMeta: true` in the `metaTyping` or `sendMetaComposited` options.
945
+
946
+ ### Meta Typing Indicator
947
+
948
+ Show a live thinking indicator that you control. Delete it manually when ready — no "edited" badge ever appears.
949
+
950
+ ```javascript
951
+ import { metaTyping, buildSteps } from '@pasqua-baileys/baileys'
952
+
953
+ const placeholder = await metaTyping(sock, jid, {
954
+ description: 'Thinking…',
955
+ steps: buildSteps(['Reading your message…', 'Writing response…'])
956
+ })
957
+
958
+ // Do your work here…
959
+
960
+ // Delete the indicator cleanly
961
+ await sock.sendMessage(jid, { delete: placeholder.key })
962
+
963
+ // Send the real message
964
+ await sock.sendMessage(jid, { text: 'Here is your answer!' })
965
+ ```
966
+
967
+ What users see:
968
+
969
+ ```
970
+ [typing… indicator]
971
+
972
+ _Thinking…_
973
+ ○ Reading your message…
974
+ ○ Writing response…
975
+
976
+ [auto-deletes]
977
+
978
+ Here is your answer!
979
+ ```
980
+
981
+ ### Meta Compositing
982
+
983
+ Full flow: indicator shows → auto-deletes → clean final message lands. Works with every rich content type.
984
+
985
+ ```javascript
986
+ import { sendMetaComposited, PlanningStepStatus } from '@pasqua-baileys/baileys'
987
+
988
+ // With code block
989
+ await sendMetaComposited(
990
+ sock, jid,
991
+ { code: 'const x = 1 + 1', language: 'javascript' },
992
+ {
993
+ thinkingMs: 3000,
994
+ description: 'Analyzing…',
995
+ steps: [
996
+ { title: 'Reading context…', status: PlanningStepStatus.DONE },
997
+ { title: 'Writing code…', status: PlanningStepStatus.IN_PROGRESS }
998
+ ]
999
+ }
1000
+ )
1001
+
1002
+ // With table
1003
+ await sendMetaComposited(
1004
+ sock, jid,
1005
+ {
1006
+ title: 'Comparison',
1007
+ table: [
1008
+ ['Feature', 'Baileys', 'Pasqua'],
1009
+ ['Rich Messages', '❌', '✅'],
1010
+ ['Meta Compositing', '❌', '✅']
1011
+ ]
1012
+ },
1013
+ { thinkingMs: 2500, description: 'Building table…' }
1014
+ )
1015
+
1016
+ // With rich response array
1017
+ await sendMetaComposited(
1018
+ sock, jid,
1019
+ {
1020
+ richResponse: [
1021
+ { text: 'Here is your result:' },
1022
+ { code: 'console.log("hello")', language: 'javascript' },
1023
+ { text: 'Run it with `node index.js`' }
1024
+ ]
1025
+ },
1026
+ { thinkingMs: 2000 }
1027
+ )
1028
+ ```
1029
+
1030
+ ### Replay Planning
1031
+
1032
+ Live Meta AI-style reasoning feed — each step visibly completes in real time, then the final rich message lands clean.
1033
+
1034
+ ```javascript
1035
+ import { replayPlanning, mixedSteps } from '@pasqua-baileys/baileys'
1036
+
1037
+ await replayPlanning(
1038
+ sock, jid,
1039
+
1040
+ // Steps — status managed automatically
1041
+ mixedSteps([
1042
+ { title: 'Understanding your question…', type: 'reasoning' },
1043
+ { title: 'Searching for data…', type: 'search' },
1044
+ { title: 'Writing the answer…' }
1045
+ ]),
1046
+
1047
+ // Final rich message
1048
+ { code: 'const answer = 42', language: 'javascript' },
1049
+
1050
+ // Options
1051
+ {
1052
+ description: 'Thinking…',
1053
+ stepDelayMs: 900,
1054
+ finalPauseMs: 600
1055
+ }
1056
+ )
1057
+ ```
1058
+
1059
+ What users see:
1060
+
1061
+ ```
1062
+ _Thinking…_
1063
+ ○ Understanding your question…
1064
+ ○ Searching for data…
1065
+ ○ Writing the answer…
1066
+
1067
+ [step 1 completes]
1068
+ _Thinking…_
1069
+ ✓ Understanding your question…
1070
+ ○ Searching for data…
1071
+ ○ Writing the answer…
1072
+
1073
+ [step 2 completes]
1074
+ _Thinking…_
1075
+ ✓ Understanding your question…
1076
+ ✓ Searching for data…
1077
+ ○ Writing the answer…
1078
+
1079
+ [all done, deletes, then:]
1080
+
1081
+ const answer = 42
1082
+ ```
1083
+
1084
+ Step type helpers:
1085
+
1086
+ ```javascript
1087
+ import {
1088
+ buildReasoningSteps, // isReasoning: true
1089
+ buildSearchSteps, // isEnhancedSearch: true
1090
+ mixedSteps, // mix any combination
1091
+ buildSteps // plain steps
1092
+ } from '@pasqua-baileys/baileys'
1093
+
1094
+ // All reasoning
1095
+ buildReasoningSteps(['Analyzing the problem…', 'Checking edge cases…'])
1096
+
1097
+ // All search
1098
+ buildSearchSteps(['Searching the web…', 'Reading top results…'])
1099
+
1100
+ // Mixed — most realistic Meta AI look
1101
+ mixedSteps([
1102
+ { title: 'Reading your message…', type: 'reasoning' },
1103
+ { title: 'Searching sources…', type: 'search' },
1104
+ { title: 'Composing response…' }
1105
+ ])
1106
+ ```
1107
+
1108
+ Replay planning only (no final message):
1109
+
1110
+ ```javascript
1111
+ import { replayPlanningOnly, buildSearchSteps } from '@pasqua-baileys/baileys'
1112
+
1113
+ await replayPlanningOnly(
1114
+ sock, jid,
1115
+ buildSearchSteps(['Looking up prices…', 'Comparing results…']),
1116
+ { stepDelayMs: 1200 }
1117
+ )
1118
+
1119
+ // Send whatever you want after — no badge, no trace
1120
+ await sock.sendMessage(jid, { text: 'Here are the results!' })
1121
+ ```
1122
+
1123
+ Options reference:
1124
+
1125
+ | Option | Type | Default | Description |
1126
+ |--------|------|---------|-------------|
1127
+ | description | string | 'Thinking…' | Top label on the indicator bubble |
1128
+ | placeholderText | string | '' | Body text while steps run |
1129
+ | stepDelayMs | number | 900 | Ms between each step completing |
1130
+ | finalPauseMs | number | 600 | Ms to hold after all steps done |
1131
+ | abortOnDisconnect | boolean | true | Stops cleanly if socket closes |
1132
+ | sendOptions | object | {} | Extra options for final sendMessage |
1133
+
1134
+ ---
1135
+
1136
+ ## Welcome Flow
1137
+
1138
+ Auto-greet new contacts with an interactive FAQ menu. Fires once per contact, never repeats.
1139
+
1140
+ ### Basic Setup
1141
+
1142
+ ```javascript
1143
+ import { createWelcomeFlow } from '@pasqua-baileys/baileys'
1144
+
1145
+ const welcome = createWelcomeFlow(sock, {
1146
+ greeting: 'Welcome! How can I help you today?',
1147
+ footer: 'Powered by MyBot',
1148
+ buttonText: 'Choose an option',
1149
+ sectionTitle: 'How can we help?',
1150
+ faqs: [
1151
+ { id: 'order', title: 'Track my order', description: 'Check order status' },
1152
+ { id: 'billing', title: 'Billing & payments', description: 'Payment issues' },
1153
+ { id: 'support', title: 'Technical support', description: 'Get help' },
1154
+ { id: 'human', title: 'Talk to a human', description: 'Connect with staff' }
1155
+ ]
1156
+ })
1157
+
1158
+ welcome.listen() // start
1159
+ ```
1160
+
1161
+ ### With Callbacks
1162
+
1163
+ ```javascript
1164
+ const welcome = createWelcomeFlow(sock, {
1165
+ greeting: 'Hi there! What brings you here today?',
1166
+ faqs: [
1167
+ { id: 'pricing', title: 'Pricing', description: 'Plans and costs' },
1168
+ { id: 'demo', title: 'Request demo', description: 'See it in action' },
1169
+ { id: 'support', title: 'Support', description: 'Get help' }
1170
+ ],
1171
+
1172
+ onGreet: async (jid, message) => {
1173
+ console.log(`Greeted new contact: ${jid}`)
1174
+ },
1175
+
1176
+ onFaqReply: async (jid, faqId, message) => {
1177
+ switch (faqId) {
1178
+ case 'pricing':
1179
+ await sock.sendMessage(jid, { text: 'Our plans start at $9/month…' })
1180
+ break
1181
+ case 'demo':
1182
+ await sock.sendMessage(jid, { text: 'Book a demo here: https://…' })
1183
+ break
1184
+ case 'support':
1185
+ await sock.sendMessage(jid, { text: 'Describe your issue and we will help!' })
1186
+ break
1187
+ }
1188
+ }
1189
+ })
1190
+
1191
+ welcome.listen()
1192
+ ```
1193
+
1194
+ ### Persist Across Restarts
1195
+
1196
+ ```javascript
1197
+ const welcome = createWelcomeFlow(sock, {
1198
+ greeting: 'Welcome!',
1199
+ faqs: [...],
1200
+ persistPath: './data/greeted-contacts.json'
1201
+ })
1202
+ ```
1203
+
1204
+ ### Control Methods
1205
+
1206
+ ```javascript
1207
+ welcome.listen() // start listening
1208
+ welcome.stop() // stop listening
1209
+ welcome.reset(jid) // force re-greet one contact
1210
+ welcome.resetAll() // clear all seen contacts
1211
+ welcome.hasGreeted(jid) // check if greeted → boolean
1212
+ ```
1213
+
1214
+ ### Config Reference
1215
+
1216
+ | Option | Type | Default | Description |
1217
+ |--------|------|---------|-------------|
1218
+ | greeting | string | 'Welcome!…' | Body text of welcome message |
1219
+ | footer | string | 'Powered by @pasqua-baileys/baileys' | Footer text |
1220
+ | buttonText | string | 'Choose an option' | List button label |
1221
+ | sectionTitle | string | 'How can we help?' | Section header |
1222
+ | faqs | Array | 4 defaults | { id, title, description } |
1223
+ | typingDelayMs | number | 1200 | Typing indicator duration |
1224
+ | persistPath | string\|null | null | JSON file to persist JIDs |
1225
+ | ignoreGroups | boolean | true | Skip group chats |
1226
+ | ignoreNewsletter | boolean | true | Skip newsletters |
1227
+ | ignoreBroadcast | boolean | true | Skip broadcasts |
1228
+ | onGreet | async fn | null | Called after greeting sent |
1229
+ | onFaqReply | async fn | null | Called on FAQ selection |
1230
+
1231
+ ---
1232
+
1233
+ ## Payment Messages
1234
+
1235
+ ```javascript
1236
+ // Payment invite
1237
+ sock.sendMessage(jid, {
1238
+ paymentInviteServiceType: 3 // 1, 2, or 3
1239
+ })
1240
+
1241
+ // Invoice (not supported yet)
1242
+ sock.sendMessage(jid, {
1243
+ image: { url: './image.jpg' },
1244
+ invoiceNote: 'Invoice'
1245
+ })
1246
+
1247
+ // Order
1248
+ sock.sendMessage(jid, {
1249
+ orderText: 'Order',
1250
+ thumbnail: fs.readFileSync('./image.jpg')
1251
+ })
1252
+
1253
+ // Request payment
1254
+ sock.sendMessage(jid, {
1255
+ text: 'Request Payment',
1256
+ requestPaymentFrom: '0@s.whatsapp.net'
1257
+ })
1258
+ ```
1259
+
1260
+ ---
1261
+
1262
+ ## Message Options
1263
+
1264
+ ```javascript
1265
+ // AI icon (private chat only)
1266
+ sock.sendMessage(jid, {
1267
+ image: { url: './image.jpg' },
1268
+ caption: 'With AI icon!',
1269
+ ai: true
1270
+ })
1271
+
1272
+ // Ephemeral
1273
+ sock.sendMessage(jid, {
1274
+ image: { url: './image.jpg' },
1275
+ caption: 'Ephemeral',
1276
+ ephemeral: true
1277
+ })
1278
+
1279
+ // External ad reply
1280
+ sock.sendMessage(jid, {
1281
+ text: 'External Ad Reply',
1282
+ externalAdReply: {
1283
+ title: 'Did you know?',
1284
+ body: 'I dont know',
1285
+ thumbnail: fs.readFileSync('./image.jpg'),
1286
+ largeThumbnail: false,
1287
+ url: 'https://example.com'
1288
+ }
1289
+ })
1290
+
1291
+ // Group status (a valid group JID is required)
1292
+ const groupStatus = await sock.sendMessage(groupJid, {
1293
+ image: { url: './image.jpg' },
1294
+ caption: 'Group Status!',
1295
+ groupStatus: true
1296
+ })
1297
+
1298
+ // Text, video, audio, stickers, mentions, and rich previews use the same flag.
1299
+ await sock.sendMessage(groupJid, {
1300
+ text: 'Group update',
1301
+ mentions: ['628123456789@s.whatsapp.net'],
1302
+ groupStatus: true
1303
+ })
1304
+
1305
+ // Delete using the key returned by the original group-status send.
1306
+ // The group JID must match key.remoteJid when that field is present.
1307
+ await sock.deleteGroupStatus(groupJid, groupStatus.key)
1308
+
1309
+ // Report APIs submit the report first, then apply the requested safety action.
1310
+ // Contacts are blocked and groups are left only after WhatsApp accepts the report.
1311
+ await sock.reportContact('628123456789@s.whatsapp.net', [message.key])
1312
+ await sock.reportGroup(groupJid, [message.key])
1313
+
1314
+ // Lottie sticker
1315
+ sock.sendMessage(jid, {
1316
+ sticker: { url: './sticker.webp' },
1317
+ isLottie: true
1318
+ })
1319
+
1320
+ // likeThis — relay message exactly as-is, zero processing
1321
+ // Bypasses generateWAMessage entirely — no re-encoding, no normalization.
1322
+ // Useful for: forwarding with original quality, relaying captured messages verbatim,
1323
+ // re-sending albums/carousels without re-uploading, testing raw proto constructions.
1324
+ sock.sendMessage(jid, {
1325
+ likeThis: true,
1326
+ ...capturedMessage.message // spread any received message directly
1327
+ })
1328
+
1329
+ // Or with a manually built proto
1330
+ sock.sendMessage(jid, {
1331
+ likeThis: true,
1332
+ imageMessage: { ...rawProtoFields }
1333
+ })
1334
+
1335
+ // Or forwarding with original quality intact
1336
+ sock.sendMessage(jid, {
1337
+ likeThis: true,
1338
+ extendedTextMessage: {
1339
+ text: 'Built manually',
1340
+ contextInfo: {
1341
+ externalAdReply: {
1342
+ title: '@pasqua-baileys/baileys',
1343
+ thumbnail: fs.readFileSync('./image.jpg'),
1344
+ sourceApp: 'whatsapp',
1345
+ showAdAttribution: true,
1346
+ mediaType: 1
1347
+ }
1348
+ }
1349
+ }
1350
+ })
1351
+
1352
+ // Secure Meta service label: adds actual_actors, host_storage, and
1353
+ // privacy_mode_ts to the outbound business node. The control flag itself
1354
+ // is consumed locally and is not encoded into the WhatsApp message.
1355
+ sock.sendMessage(jid, {
1356
+ text: 'Just a label!',
1357
+ secureMetaServiceLabel: true
1358
+ })
1359
+
1360
+ // Spoiler (compatible context flag; no unsupported future-proof wrapper)
1361
+ sock.sendMessage(jid, {
1362
+ image: { url: './image.jpg' },
1363
+ caption: 'Spoiler',
1364
+ spoiler: true
1365
+ })
1366
+
1367
+ // View once
1368
+ sock.sendMessage(jid, {
1369
+ image: { url: './image.jpg' },
1370
+ caption: 'View Once',
1371
+ viewOnce: true
1372
+ })
1373
+
1374
+ // View-once text (experimental; uses the native inner text flag)
1375
+ // Availability and rendering still depend on the WhatsApp client version.
1376
+ await sock.sendViewOnceText(jid, 'This text can be opened once')
1377
+
1378
+ // Equivalent low-level form
1379
+ await sock.sendMessage(jid, {
1380
+ text: 'This text can be opened once',
1381
+ viewOnce: true
1382
+ })
1383
+
1384
+ // View once v2
1385
+ sock.sendMessage(jid, {
1386
+ image: { url: './image.jpg' },
1387
+ caption: 'View Once V2',
1388
+ viewOnceV2: true
1389
+ })
1390
+
1391
+ // View once v2 extension
1392
+ sock.sendMessage(jid, {
1393
+ image: { url: './image.jpg' },
1394
+ caption: 'View Once V2 Extension',
1395
+ viewOnceV2Extension: true
1396
+ })
1397
+ ```
1398
+
1399
+ ---
1400
+
1401
+ ## Status & Stories
1402
+
1403
+ Statuses are sent to `status@broadcast` and require at least one viewer JID. Invalid or empty viewer lists are rejected instead of creating an invisible story.
1404
+
1405
+ ```javascript
1406
+ const viewers = [
1407
+ '628123456789@s.whatsapp.net',
1408
+ '628987654321@s.whatsapp.net'
1409
+ ]
1410
+
1411
+ // Standard API: styled text status. Fonts 0-9 are supported.
1412
+ await sock.sendMessage('status@broadcast', {
1413
+ text: 'Hello world!',
1414
+ backgroundColor: '#FF1FA15A',
1415
+ font: 0
1416
+ }, { statusJidList: viewers })
1417
+
1418
+ // Convenience API (equivalent to the standard form)
1419
+ await sock.sendMessage('status@broadcast', {
1420
+ status: true,
1421
+ text: 'Exclusive status!',
1422
+ statusJidList: viewers,
1423
+ backgroundColor: 'teal',
1424
+ font: 2
1425
+ })
1426
+
1427
+ // Image and video statuses support captions
1428
+ await sock.sendMessage('status@broadcast', {
1429
+ status: true,
1430
+ image: { url: './image.jpg' },
1431
+ caption: 'My status!',
1432
+ statusJidList: viewers
1433
+ })
1434
+ await sock.sendMessage('status@broadcast', {
1435
+ status: true,
1436
+ video: { url: './video.mp4' },
1437
+ caption: 'Watch this!',
1438
+ statusJidList: viewers
1439
+ })
1440
+
1441
+ // Audio or voice-note status, including waveform/background metadata
1442
+ await sock.sendMessage('status@broadcast', {
1443
+ status: true,
1444
+ audio: { url: './audio.ogg' },
1445
+ mimetype: 'audio/ogg; codecs=opus',
1446
+ ptt: true,
1447
+ waveform: new Uint8Array([0, 20, 45, 80, 45, 20, 0]),
1448
+ backgroundColor: '#FF0057FF',
1449
+ statusJidList: viewers
1450
+ })
1451
+ ```
1452
+
1453
+ Named, hex, and ARGB colors are accepted. Viewer JIDs are normalized and deduplicated.
1454
+
1455
+ ### Status Mentions
1456
+
1457
+ Passing an array as the destination posts a status and sends mention notifications to those contacts or groups. This is intentionally separate from `statusJidList`, which controls viewers without mentioning them.
1458
+
1459
+ ```javascript
1460
+ await sock.sendMessage([jidA, groupJid], { text: 'Hey, check my status!' })
1461
+ ```
1462
+
1463
+ ---
1464
+
1465
+ ## Favorites
1466
+
1467
+ Manage your WhatsApp Favorites list — add, remove, and sync across devices.
1468
+
1469
+ ### Add to Favorites
1470
+
1471
+ ```javascript
1472
+ // Add a single JID
1473
+ await sock.addToFavorites(['628123456789@s.whatsapp.net'])
1474
+
1475
+ // Add multiple JIDs (replaces entire list — merge handled by caller)
1476
+ await sock.addToFavorites([
1477
+ '628123456789@s.whatsapp.net',
1478
+ '628987654321@s.whatsapp.net',
1479
+ '1234@g.us'
1480
+ ])
1481
+ ```
1482
+
1483
+ ### Remove from Favorites
1484
+
1485
+ ```javascript
1486
+ // Remove specific JIDs (pass remaining list after filter)
1487
+ await sock.removeFromFavorites([
1488
+ '628123456789@s.whatsapp.net' // only this one remains
1489
+ ])
1490
+ ```
1491
+
1492
+ ### Full Example with Local Persistence
1493
+
1494
+ ```javascript
1495
+ import fs from 'fs'
1496
+ import path from 'path'
1497
+
1498
+ const FAV_FILE = path.join(process.cwd(), 'database', 'favorites.json')
1499
+
1500
+ const loadFavs = () => {
1501
+ try { return JSON.parse(fs.readFileSync(FAV_FILE, 'utf8')) }
1502
+ catch { return [] }
1503
+ }
1504
+
1505
+ const saveFavs = (favs) => {
1506
+ fs.mkdirSync(path.dirname(FAV_FILE), { recursive: true })
1507
+ fs.writeFileSync(FAV_FILE, JSON.stringify(favs, null, 2))
1508
+ }
1509
+
1510
+ // Add
1511
+ const existing = loadFavs()
1512
+ const target = '628123456789@s.whatsapp.net'
1513
+ if (!existing.includes(target)) {
1514
+ const merged = [...existing, target]
1515
+ await sock.addToFavorites(merged)
1516
+ saveFavs(merged)
1517
+ }
1518
+
1519
+ // Remove
1520
+ const toRemove = '628123456789@s.whatsapp.net'
1521
+ const remaining = existing.filter(jid => jid !== toRemove)
1522
+ await sock.addToFavorites(remaining)
1523
+ saveFavs(remaining)
1524
+ ```
1525
+
1526
+ **Note:** WhatsApp favorites use a single app state record. Each SET replaces the entire list. Always pass the complete desired array.
1527
+
1528
+ ---
1529
+
1530
+ ## Newsletter Management
1531
+
1532
+ ```javascript
1533
+ // Create
1534
+ sock.newsletterCreate('@pasqua-baileys/baileys', 'Fresh updates weekly')
1535
+
1536
+ // Metadata
1537
+ const metadata = await sock.newsletterMetadata('1231111111111@newsletter')
1538
+
1539
+ // Subscribers count
1540
+ const subscribers = await sock.newsletterSubscribers('1231111111111@newsletter')
1541
+
1542
+ // Follow / Unfollow
1543
+ sock.newsletterFollow('1231111111111@newsletter')
1544
+ sock.newsletterUnfollow('1231111111111@newsletter')
1545
+
1546
+ // Mute / Unmute
1547
+ sock.newsletterMute('1231111111111@newsletter')
1548
+ sock.newsletterUnmute('1231111111111@newsletter')
1549
+
1550
+ // Admin management
1551
+ sock.newsletterDemote('1231111111111@newsletter', '6281111111111@s.whatsapp.net')
1552
+ sock.newsletterChangeOwner('1231111111111@newsletter', '6281111111111@s.whatsapp.net')
1553
+
1554
+ // Update
1555
+ sock.newsletterUpdate('1231111111111@newsletter', { name: '@pasqua-baileys/baileys' })
1556
+ sock.newsletterUpdateName('1231111111111@newsletter', '@pasqua-baileys/baileys')
1557
+ sock.newsletterUpdateDescription('1231111111111@newsletter', 'Fresh updates weekly')
1558
+ sock.newsletterUpdatePicture('1231111111111@newsletter', { url: 'path/to/image.jpg' })
1559
+ sock.newsletterRemovePicture('1231111111111@newsletter')
1560
+
1561
+ // React to message
1562
+ sock.newsletterReactMessage('1231111111111@newsletter', '100', '💛')
1563
+
1564
+ // Admin count
1565
+ const count = await sock.newsletterAdminCount('1231111111111@newsletter')
1566
+
1567
+ // Get all subscribed
1568
+ const newsletters = await sock.newsletterSubscribed()
1569
+
1570
+ // Fetch messages
1571
+ const messages = sock.newsletterFetchMessages('jid', '1231111111111@newsletter', 50, 0, 0)
1572
+
1573
+ // Delete
1574
+ sock.newsletterDelete('1231111111111@newsletter')
1575
+ ```
1576
+
1577
+ ---
1578
+
1579
+ ## Group Management
1580
+
1581
+ ```javascript
1582
+ // Create
1583
+ const group = await sock.groupCreate('@pasqua-baileys/baileys', ['628123456789@s.whatsapp.net'])
1584
+
1585
+ // Metadata
1586
+ const metadata = await sock.groupMetadata(jid)
1587
+
1588
+ // Invite
1589
+ const inviteCode = await sock.groupInviteCode(jid)
1590
+ sock.groupRevokeInvite(jid)
1591
+ sock.groupAcceptInvite(inviteCode)
1592
+
1593
+ // Leave
1594
+ sock.groupLeave(jid)
1595
+
1596
+ // Participants
1597
+ sock.groupParticipantsUpdate(jid, ['628123456789@s.whatsapp.net'], 'add')
1598
+ sock.groupParticipantsUpdate(jid, ['628123456789@s.whatsapp.net'], 'remove')
1599
+ sock.groupParticipantsUpdate(jid, ['628123456789@s.whatsapp.net'], 'promote')
1600
+ sock.groupParticipantsUpdate(jid, ['628123456789@s.whatsapp.net'], 'demote')
1601
+
1602
+ // Join requests
1603
+ sock.groupRequestParticipantsUpdate(jid, ['628123456789@s.whatsapp.net'], 'approve')
1604
+
1605
+ // Info updates
1606
+ sock.groupUpdateSubject(jid, '@pasqua-baileys/baileys')
1607
+ sock.groupUpdateDescription(jid, 'Updated description')
1608
+ sock.updateProfilePicture(jid, { url: 'path/to/image.jpg' })
1609
+ sock.removeProfilePicture(jid)
1610
+
1611
+ // Settings
1612
+ sock.groupSettingUpdate(jid, 'announcement') // admin only chat
1613
+ sock.groupSettingUpdate(jid, 'not_announcement') // open chat
1614
+ sock.groupSettingUpdate(jid, 'locked') // admin only edit info
1615
+ sock.groupSettingUpdate(jid, 'unlocked') // all edit info
1616
+
1617
+ // Add mode
1618
+ sock.groupMemberAddMode(jid, 'admin_add')
1619
+ sock.groupMemberAddMode(jid, 'all_member_add')
1620
+
1621
+ // Ephemeral
1622
+ sock.groupToggleEphemeral(jid, 86400) // enable
1623
+ sock.groupToggleEphemeral(jid, 0) // disable
1624
+
1625
+ // Approval mode
1626
+ sock.groupJoinApprovalMode(jid, 'on')
1627
+ sock.groupJoinApprovalMode(jid, 'off')
1628
+
1629
+ // Fetch all
1630
+ const groups = await sock.groupFetchAllParticipating()
1631
+
1632
+ // Pending requests
1633
+ const requests = await sock.groupRequestParticipantsList(jid)
1634
+
1635
+ // Invite info
1636
+ const group = await sock.groupGetInviteInfo('ABC123456789')
1637
+
1638
+ // Member label
1639
+ sock.updateMemberLabel(jid, '@pasqua-baileys/baileys')
1640
+ ```
1641
+
1642
+ ---
1643
+
1644
+ ## Community Management
1645
+
1646
+ ```javascript
1647
+ // Create
1648
+ const community = await sock.communityCreate('@pasqua-baileys/baileys', 'Fresh updates weekly')
1649
+
1650
+ // Create subgroup
1651
+ const group = await sock.communityCreateGroup(
1652
+ 'Announcements',
1653
+ ['628123456789@s.whatsapp.net'],
1654
+ communityJid
1655
+ )
1656
+
1657
+ // Link / Unlink
1658
+ sock.communityLinkGroup(groupJid, communityJid)
1659
+ sock.communityUnlinkGroup(groupJid, communityJid)
1660
+
1661
+ // Metadata
1662
+ const metadata = await sock.communityMetadata(jid)
1663
+
1664
+ // Invite
1665
+ const inviteCode = await sock.communityInviteCode(jid)
1666
+ sock.communityRevokeInvite(jid)
1667
+ sock.communityAcceptInvite(inviteCode)
1668
+
1669
+ // Leave
1670
+ sock.communityLeave(jid)
1671
+
1672
+ // Join requests
1673
+ sock.communityRequestParticipantsUpdate(jid, ['628123456789@s.whatsapp.net'], 'approve')
1674
+
1675
+ // Updates
1676
+ sock.communityUpdateSubject(jid, '@pasqua-baileys/baileys')
1677
+ sock.communityUpdateDescription(jid, 'Updated description')
1678
+
1679
+ // Settings
1680
+ sock.communitySettingUpdate(jid, 'announcement')
1681
+ sock.communitySettingUpdate(jid, 'not_announcement')
1682
+ sock.communitySettingUpdate(jid, 'locked')
1683
+ sock.communitySettingUpdate(jid, 'unlocked')
1684
+
1685
+ // Add mode
1686
+ sock.communityMemberAddMode(jid, 'admin_add')
1687
+ sock.communityMemberAddMode(jid, 'all_member_add')
1688
+
1689
+ // Ephemeral
1690
+ sock.communityToggleEphemeral(jid, 86400)
1691
+ sock.communityToggleEphemeral(jid, 0)
1692
+
1693
+ // Approval mode
1694
+ sock.communityJoinApprovalMode(jid, 'on')
1695
+ sock.communityJoinApprovalMode(jid, 'off')
1696
+
1697
+ // Fetch all
1698
+ const communities = await sock.communityFetchAllParticipating()
1699
+
1700
+ // Linked groups
1701
+ const linked = await sock.communityFetchLinkedGroups(jid)
1702
+
1703
+ // Pending requests
1704
+ const requests = await sock.communityRequestParticipantsList(jid)
1705
+
1706
+ // Invite info
1707
+ const community = await sock.communityGetInviteInfo('ABC123456789')
1708
+ ```
1709
+
1710
+ ---
1711
+
1712
+ ## Profile & Business
1713
+
1714
+ ```javascript
1715
+ // Profile picture
1716
+ const url = await sock.profilePictureUrl(jid, 'image')
1717
+
1718
+ // Standard — auto crop + resize to 720×720
1719
+ sock.updateProfilePicture(jid, buffer)
1720
+ sock.updateProfilePicture(jid, { url })
1721
+
1722
+ // Standard with custom dimensions
1723
+ sock.updateProfilePicture(jid, { url }, { width: 640, height: 640 })
1724
+
1725
+ // HD — preserves original aspect ratio, no crop, no padding
1726
+ // Images under 720px pass through unchanged.
1727
+ // Larger images are scaled down proportionally to fit within 720px.
1728
+ sock.updateProfilePicture(jid, buffer, { hd: true })
1729
+ sock.updateProfilePicture(jid, { url }, { hd: true })
1730
+
1731
+ sock.removeProfilePicture(jid)
1732
+
1733
+ // Profile info (name and personal About/bio)
1734
+ await sock.updateProfileName('My Name')
1735
+ await sock.updateProfileStatus('Available')
1736
+ // Business descriptions are separate: updateBusinessProfile({ description })
1737
+
1738
+ // Presence
1739
+ sock.sendPresenceUpdate('available', jid)
1740
+ sock.presenceSubscribe(jid)
1741
+
1742
+ // Read receipts
1743
+ sock.readMessages([message.key])
1744
+ sock.sendReceipt(jid, participant, [messageId], 'read')
1745
+
1746
+ // Block / Unblock
1747
+ sock.updateBlockStatus(jid, 'block')
1748
+ sock.updateBlockStatus(jid, 'unblock')
1749
+
1750
+ // Blocklist
1751
+ const blocked = await sock.fetchBlocklist()
1752
+
1753
+ // Chat modify
1754
+ sock.chatModify({
1755
+ archive: true,
1756
+ lastMessageOrig: message,
1757
+ lastMessage: message
1758
+ }, jid)
1759
+
1760
+ // Star
1761
+ sock.star(jid, [{ id: messageId, fromMe: true }], true)
1762
+
1763
+ // Contact
1764
+ sock.addOrEditContact(jid, { displayName: 'Name' })
1765
+ sock.removeContact(jid)
1766
+
1767
+ // Labels
1768
+ sock.addChatLabel(jid, labelId)
1769
+ sock.removeChatLabel(jid, labelId)
1770
+ sock.addMessageLabel(jid, messageId, labelId)
1771
+
1772
+ // App state sync
1773
+ sock.resyncAppState(['regular', 'critical_block'], true)
1774
+
1775
+ // Business profile
1776
+ const profile = await sock.getBusinessProfile(jid)
1777
+
1778
+ // Product create
1779
+ const product = await sock.productCreate({
1780
+ name: 'Product',
1781
+ description: 'Description',
1782
+ price: 100000,
1783
+ currency: 'IDR',
1784
+ originCountryCode: 'ID',
1785
+ images: [buffer, { url: './image.jpg' }]
1786
+ })
1787
+
1788
+ // Product update
1789
+ await sock.productUpdate(productId, {
1790
+ name: 'Product',
1791
+ description: 'Updated',
1792
+ price: 75000,
1793
+ currency: 'IDR',
1794
+ images: [{ url: './image.jpg' }]
1795
+ })
1796
+
1797
+ // Product delete
1798
+ sock.productDelete([productId])
1799
+
1800
+ // Catalog
1801
+ const { products, nextPageCursor } = await sock.getCatalog({
1802
+ jid: '628123456789@s.whatsapp.net',
1803
+ limit: 10
1804
+ })
1805
+
1806
+ // Collections
1807
+ const collections = await sock.getCollections('628123456789@s.whatsapp.net', 10)
1808
+
1809
+ // Order details
1810
+ const order = await sock.getOrderDetails(orderId, tokenBase64)
1811
+
1812
+ // Business profile update
1813
+ await sock.updateBusinessProfile({
1814
+ address: 'Jakarta, Indonesia',
1815
+ description: 'Official Store',
1816
+ websites: ['https://example.com'],
1817
+ email: 'email@example.com',
1818
+ hours: {
1819
+ timezone: 'Asia/Jakarta',
1820
+ days: [{ day: 'mon', mode: 'open_24h' }]
1821
+ }
1822
+ })
1823
+
1824
+ // Use empty strings or an empty websites array to clear profile fields.
1825
+ await sock.updateBusinessProfile({ description: '', websites: [] })
1826
+
1827
+ // Cover photo: updateCoverPhoto returns the uploaded cover ID and always
1828
+ // removes its local temporary upload file, including after failures.
1829
+ const coverId = await sock.updateCoverPhoto({ url: './image.jpg' })
1830
+ await sock.removeCoverPhoto(coverId)
1831
+
1832
+ // Quick replies
1833
+ sock.addOrEditQuickReply({
1834
+ shortcut: 'hello',
1835
+ message: 'Hello from business account'
1836
+ })
1837
+ sock.removeQuickReply(timestamp)
1838
+ ```
1839
+
1840
+ ---
1841
+
1842
+ ## Privacy & Security
1843
+
1844
+ ```javascript
1845
+ // Last seen
1846
+ sock.updateLastSeenPrivacy('all')
1847
+ sock.updateLastSeenPrivacy('contacts')
1848
+ sock.updateLastSeenPrivacy('contact_blacklist')
1849
+ sock.updateLastSeenPrivacy('nobody')
1850
+
1851
+ // Online
1852
+ sock.updateOnlinePrivacy('all')
1853
+ sock.updateOnlinePrivacy('match_last_seen')
1854
+
1855
+ // Profile picture
1856
+ sock.updateProfilePicturePrivacy('contacts')
1857
+
1858
+ // Status
1859
+ sock.updateStatusPrivacy('contacts')
1860
+
1861
+ // Read receipts
1862
+ sock.updateReadReceiptsPrivacy('all')
1863
+ sock.updateReadReceiptsPrivacy('none')
1864
+
1865
+ // Groups add
1866
+ sock.updateGroupsAddPrivacy('all')
1867
+ sock.updateGroupsAddPrivacy('contacts')
1868
+
1869
+ // Messages
1870
+ sock.updateMessagesPrivacy('all')
1871
+ sock.updateMessagesPrivacy('contacts')
1872
+ sock.updateMessagesPrivacy('nobody')
1873
+
1874
+ // Call
1875
+ sock.updateCallPrivacy('everyone')
1876
+
1877
+ // Default disappearing mode
1878
+ sock.updateDefaultDisappearingMode(86400)
1879
+
1880
+ // Link previews
1881
+ sock.updateDisableLinkPreviewsPrivacy(true)
1882
+ ```
1883
+
1884
+ ---
1885
+
1886
+ ## Group Calls
1887
+
1888
+ Start and cancel WhatsApp **group calls** from the bot (works for voice and video).
1889
+
1890
+ ```javascript
1891
+ // Ring two participants in a group with an audio call
1892
+ const { id, to } = await sock.groupCall('120363012345678901@g.us', [
1893
+ '6281234567890@s.whatsapp.net',
1894
+ '6289876543210@s.whatsapp.net'
1895
+ ])
1896
+
1897
+ // Video group call
1898
+ await sock.groupCall('120363012345678901@g.us', ['6281234567890@s.whatsapp.net'], true)
1899
+
1900
+ // Cancel / hang up the call you started
1901
+ await sock.cancelGroupCall('120363012345678901@g.us', id)
1902
+ ```
1903
+
1904
+ - `groupCall(jid, participants, isVideo)` — sends the group call offer to each participant (encrypted callKey envelope per destination, same machinery as the 1:1 `offerCall`), with the `type="group"` / `group-jid` attributes the receive pipeline recognizes for group calls. Returns `{ id, to }` so you can cancel it later.
1905
+ - `cancelGroupCall(jid, callId)` — sends the terminate stanza to the group, hanging up the call.
1906
+ - Incoming group calls surface on the `'call'` event with `isGroup: true` and `groupJid` set, and missed group calls generate `CALL_MISSED_GROUP_VOICE` / `CALL_MISSED_GROUP_VIDEO` stub messages automatically.
1907
+
1908
+ ---
1909
+
1910
+ ## Utility Methods
1911
+
1912
+ ### LID / Phone Number Resolution
1913
+
1914
+ ```javascript
1915
+ // Resolve LID ↔ PN cross-mappings
1916
+ const userId = await sock.findUserId('628123456789@s.whatsapp.net')
1917
+ console.log(userId)
1918
+ // { lid: '1234567890@lid', phoneNumber: '628123456789@s.whatsapp.net' }
1919
+
1920
+ const userId2 = await sock.findUserId('1234567890@lid')
1921
+ console.log(userId2)
1922
+ // { lid: '1234567890@lid', phoneNumber: '628123456789@s.whatsapp.net' }
1923
+ ```
1924
+
1925
+ LID-to-phone resolution uses mappings learned from trusted WhatsApp envelopes, history, or PN-to-LID USync. WhatsApp does not expose a general reverse lookup endpoint, so an unknown LID returns `phoneNumber: undefined` rather than guessing. Primary devices resolve to canonical `number@s.whatsapp.net` JIDs; linked-device suffixes and hosted domains are preserved.
1926
+
1927
+ ### Fetch User Status
1928
+
1929
+ ```javascript
1930
+ // Fetch status metadata for one or more users
1931
+ const statusList = await sock.fetchStatus('628123456789@s.whatsapp.net', '628987654321@s.whatsapp.net')
1932
+ ```
1933
+
1934
+ ### Fetch Disappearing Duration
1935
+
1936
+ ```javascript
1937
+ // Get disappearing message duration for contacts
1938
+ const durations = await sock.fetchDisappearingDuration('628123456789@s.whatsapp.net')
1939
+ ```
1940
+
1941
+ ### Bot List
1942
+
1943
+ ```javascript
1944
+ // Fetch official bot list (v2)
1945
+ const bots = await sock.getBotListV2()
1946
+ // [{ jid: '...', personaId: '...' }]
1947
+ ```
1948
+
1949
+ ### Call Links
1950
+
1951
+ ```javascript
1952
+ // Create voice/video call link
1953
+ const token = await sock.createCallLink('audio') // voice call
1954
+ const token2 = await sock.createCallLink('video') // video call
1955
+ const token3 = await sock.createCallLink('video', { // with scheduled event
1956
+ startTime: Date.now() + 3600000
1957
+ })
1958
+ ```
1959
+
1960
+ ### Server Properties
1961
+
1962
+ ```javascript
1963
+ // Access server-assigned AB props
1964
+ console.log(sock.serverProps)
1965
+ // {
1966
+ // privacyTokenOn1to1: true, // tctoken on 1:1 messages
1967
+ // profilePicPrivacyToken: true, // tctoken on profile pic IQs
1968
+ // lidTrustedTokenIssueToLid: false // issue tctokens to LID
1969
+ // }
1970
+ ```
1971
+
1972
+ ### App State Sync
1973
+
1974
+ ```javascript
1975
+ // Force resync specific collections
1976
+ await sock.resyncAppState(['regular_high', 'regular_low'], false)
1977
+
1978
+ // Apply custom app patch
1979
+ await sock.appPatch({
1980
+ syncAction: { ... },
1981
+ index: ['...'],
1982
+ type: 'regular_low',
1983
+ apiVersion: 5,
1984
+ operation: proto.SyncdMutation.SyncdOperation.SET
1985
+ })
1986
+ ```
1987
+
1988
+ ### Clean Dirty Bits
1989
+
1990
+ ```javascript
1991
+ // Clear dirty bits for specific sync types
1992
+ await sock.cleanDirtyBits('account_sync', timestamp)
1993
+ ```
1994
+
1995
+ ---
1996
+
1997
+ ## AI Groups
1998
+
1999
+ Groups can be created as **Meta AI groups** and managed with the `aiGroup*` methods.
2000
+
2001
+ ```javascript
2002
+ // Create an AI group (optionally with initial participants)
2003
+ await sock.aiGroupCreate('My AI Group', ['628123456789@s.whatsapp.net'])
2004
+
2005
+ // Add the Meta AI bot to a group so it can answer prompts
2006
+ await sock.aiGroupAddBot(groupJid)
2007
+
2008
+ // Read AI group metadata
2009
+ const meta = await sock.aiGroupMetadata(groupJid)
2010
+
2011
+ // Manage members, subject, invite codes and settings
2012
+ await sock.aiGroupParticipantsUpdate(groupJid, [jid], 'add')
2013
+ await sock.aiGroupUpdateSubject(groupJid, 'New subject')
2014
+ const code = await sock.aiGroupInviteCode(groupJid)
2015
+ await sock.aiGroupSettingUpdate(groupJid, 'announcement')
2016
+ await sock.aiGroupToggleEphemeral(groupJid, 86400)
2017
+ ```
2018
+
2019
+ ### Ask Meta AI (prompt + decrypted response)
2020
+
2021
+ Send a prompt to the Meta AI bot and resolve with the **complete decrypted response**
2022
+ (text, image or video). The msmsg pipeline decrypts the bot reply automatically —
2023
+ streaming partials are dropped by design and only the final `full`/`last` response
2024
+ is surfaced, so the resolved message is always whole.
2025
+
2026
+ ```javascript
2027
+ // In an AI group: the bot is @-mentioned automatically
2028
+ const answer = await sock.aiPrompt(aiGroupJid, 'What is the capital of France?')
2029
+
2030
+ // In a 1:1 chat with the bot, pass the bot JID directly
2031
+ const answer2 = await sock.aiPrompt(botJid, 'Draw a cute robot')
2032
+
2033
+ // Text result
2034
+ console.log(answer.message.conversation || answer.message.extendedTextMessage?.text)
2035
+
2036
+ // Media result (image / video) — download it like any other media
2037
+ if (answer.message.imageMessage) {
2038
+ const buffer = await sock.downloadMediaMessage(answer)
2039
+ }
2040
+
2041
+ // Streaming signal (best-effort): called for each bot edit in the chat while typing
2042
+ const answer3 = await sock.aiPrompt(groupJid, 'Explain quantum physics', {
2043
+ onPartial: (partialMessage, key) => console.log('bot is typing…', key.id),
2044
+ timeout: 120000
2045
+ })
2046
+ ```
2047
+
2048
+ Options: `timeout` (default 60000ms), `onPartial` (streaming hook), `botUser`
2049
+ (canonical bot JID, default `867051314767696@bot`), `mentions` (extra JIDs), and
2050
+ any extra option is forwarded to the underlying send (`quoted`, `linkPreview`, ...).
2051
+ The bot's LID participant JID is resolved from group metadata automatically, so
2052
+ LID-addressed AI groups match too.
2053
+
2054
+ ---
2055
+
2056
+ ## WA-Web Chat Features
2057
+
2058
+ A set of advanced account & chat controls ported from WhatsApp Web's RPC surface.
2059
+
2060
+ ### Status Privacy
2061
+
2062
+ ```javascript
2063
+ // Read current status-distribution lists (whitelist / blacklist / custom lists)
2064
+ const lists = await sock.getStatusPrivacy()
2065
+
2066
+ // Set the distribution type: 'contacts' | 'whitelist' | 'blacklist' | 'null'
2067
+ await sock.setStatusPrivacy('whitelist', ['628123456789@s.whatsapp.net'])
2068
+
2069
+ // Or manage custom named lists
2070
+ await sock.setStatusPrivacy('contacts', [], [{
2071
+ id: 'list-id',
2072
+ listname: 'Besties',
2073
+ emoji: '✨',
2074
+ selected: true,
2075
+ members: ['628123456789@s.whatsapp.net']
2076
+ }])
2077
+ ```
2078
+
2079
+ ### AI Bots
2080
+
2081
+ ```javascript
2082
+ // List all available Meta AI bots (personas)
2083
+ const bots = await sock.getBotListV2()
2084
+
2085
+ // Get a specific bot's profile
2086
+ const profile = await sock.getBotProfile(botJid)
2087
+
2088
+ // Block / unblock a bot
2089
+ await sock.blockBot(botJid)
2090
+ await sock.unblockBot(botJid)
2091
+ ```
2092
+
2093
+ ### Unknown-Account Chat Blocking
2094
+
2095
+ ```javascript
2096
+ // Check whether messages from unknown accounts are blocked
2097
+ const status = await sock.getChatBlockingStatus() // 'blocked' | 'unblocked'
2098
+
2099
+ // Toggle it
2100
+ await sock.updateChatBlockingStatus('block')
2101
+ await sock.updateChatBlockingStatus('unblock')
2102
+ ```
2103
+
2104
+ ### Push & Notifications
2105
+
2106
+ ```javascript
2107
+ // Read / write web-push config (FCM-style: platform, endpoint, auth, p256dh)
2108
+ const settings = await sock.getPushConfig()
2109
+ await sock.setPushConfig({ platform: 'web', endpoint: '...', auth: '...', p256dh: '...' })
2110
+ ```
2111
+
2112
+ ### Bio Privacy
2113
+
2114
+ ```javascript
2115
+ // Restrict who can see your About/Bio: 'all' | 'contacts' | 'contact_blacklist' | 'nobody'
2116
+ await sock.updateBioPrivacy('contacts')
2117
+ ```
2118
+
2119
+ ### TOS & Disclosures
2120
+
2121
+ ```javascript
2122
+ // List pending disclosures and accept them
2123
+ const notices = await sock.getUserDisclosures()
2124
+ await sock.acceptTosNotice('20250211', '105')
2125
+ ```
2126
+
2127
+ ### Spam & Opt-Out
2128
+
2129
+ ```javascript
2130
+ // Report a chat/group as spam with evidence messages
2131
+ await sock.reportSpam(jid, [{ id: 'msg-id', t: 1730000000 }])
2132
+
2133
+ // Read the account opt-out list
2134
+ const optOut = await sock.getOptOutList()
2135
+ ```
2136
+
2137
+ ### Broadcast & Media Utilities
2138
+
2139
+ ```javascript
2140
+ // Broadcast-list quota (messages left, reset window)
2141
+ const quota = await sock.fetchBroadcastListQuota()
2142
+
2143
+ // Delete a broadcast list
2144
+ await sock.deleteBroadcastList(listId)
2145
+
2146
+ // Refresh the media connection token
2147
+ const conn = await sock.fetchMediaConn()
2148
+ ```
2149
+
2150
+ ### Linked-Device (Companion) Management
2151
+
2152
+ ```javascript
2153
+ // Remove a linked device by its full device JID
2154
+ await sock.removeCompanionDevice('628123456789:5@s.whatsapp.net', 'user_initiated')
2155
+
2156
+ // Re-assert the companion ADV key index (prevents <conflict device_removed/>)
2157
+ await sock.sendKeyIndexList()
2158
+
2159
+ // Push a custom key-index-list update
2160
+ await sock.updateKeyIndexList(ts, buffer)
2161
+
2162
+ // Fetch a QR code (e.g. for device linking)
2163
+ await sock.fetchQRCode('code')
2164
+
2165
+ // Confirm/deny a device-logout challenge from the server
2166
+ await sock.confirmDeviceLogout(id, true)
2167
+ ```
2168
+
2169
+ ### Call Links
2170
+
2171
+ ```javascript
2172
+ // Toggle the waiting room for a call link
2173
+ await sock.toggleCallLinkWaitingRoom(linkToken, true, 'audio')
2174
+ ```
2175
+
2176
+ ### Privacy Tokens & AB Props
2177
+
2178
+ ```javascript
2179
+ // Persist per-contact privacy tokens from usync results
2180
+ await sock.storePrivacyTokens([{ jid, privacyToken, privacyModeTs }])
2181
+
2182
+ // Fetch AB-test props (account-level or group-scoped)
2183
+ const props = await sock.fetchABProps('1', 'hash', null, null)
2184
+ ```
2185
+
2186
+ ### Community Extensions
2187
+
2188
+ ```javascript
2189
+ // Acknowledge a group
2190
+ await sock.groupAcknowledge(jid)
2191
+
2192
+ // Participants of all linked subgroups in a community
2193
+ const participants = await sock.groupGetLinkedParticipants(communityJid)
2194
+
2195
+ // Join a linked subgroup (may request approval)
2196
+ const { approvalRequested } = await sock.groupJoinLinked(communityJid, groupJid)
2197
+
2198
+ // Batch-fetch group profile pictures
2199
+ const pics = await sock.getGroupProfilePictures([jid1, jid2], 'preview')
2200
+
2201
+ // Suggest / act on subgroups for a community
2202
+ await sock.groupCreateSubGroupSuggestion(communityJid, [{ tag: 'new_group', attrs: { subject: 'Nerds' } }])
2203
+ await sock.groupSubGroupSuggestionsAction(communityJid, 'approve', [{ creator: '628...@s.whatsapp.net' }])
2204
+ ```
2205
+
2206
+ ---
2207
+
2208
+ ## Interop, Username & Account Layers
2209
+
2210
+ ### Interop (Matrix bridge) Management
2211
+
2212
+ ```javascript
2213
+ // Opt-in / opt-out of third-party (Matrix) bridging
2214
+ await sock.initInterop()
2215
+ await sock.optInIntegrators()
2216
+ await sock.optOutIntegrators()
2217
+ await sock.acceptInteropTOS()
2218
+
2219
+ // Resolve users, manage reachability, trust & blocking
2220
+ await sock.resolveInteropUser(jid)
2221
+ const reachability = await sock.getReachabilitySettings()
2222
+ await sock.setReachabilitySettings({ allow: true, allowNonContacts: false })
2223
+ await sock.blockInteropUser(jid)
2224
+ await sock.trustInteropContact(jid)
2225
+ ```
2226
+
2227
+ ### Usernames
2228
+
2229
+ ```javascript
2230
+ // Set / claim a username for the account
2231
+ await sock.setUsername('pasqua')
2232
+
2233
+ // Resolve a username to a JID
2234
+ const jid = await sock.resolveUsername('pasqua')
2235
+ ```
2236
+
2237
+ ### Registration & Managed Accounts
2238
+
2239
+ ```javascript
2240
+ // Pre-registration helpers (check availability, request code, register)
2241
+ const avail = await sock.checkNumberAvailable('628123456789')
2242
+ await sock.requestRegistrationCode('628123456789', 'sms')
2243
+
2244
+ // Managed-account (hosted) operations
2245
+ await sock.fetchManagedAccount()
2246
+ ```
2247
+
2248
+ ### Cache Manager Auth State
2249
+
2250
+ ```javascript
2251
+ import { makeCacheManagerAuthState } from '@pasqua-baileys/baileys'
2252
+
2253
+ const cache = createCache({ stores: [memoryStore()] })
2254
+ const { state, saveCreds } = await makeCacheManagerAuthState(cache, 'session-id')
2255
+
2256
+ const sock = makeWASocket({ auth: state, saveCreds })
2257
+ ```
2258
+
2259
+ ### Anti-Ban Protection
2260
+
2261
+ ```javascript
2262
+ import { wrapSocket } from '@pasqua-baileys/baileys'
2263
+
2264
+ // Wrap the raw socket to protect against spam-triggered bans
2265
+ const protectedSock = wrapSocket(sock)
2266
+ ```
2267
+
2268
+ ---
2269
+
2270
+ ## Events Reference
2271
+
2272
+ ```javascript
2273
+ sock.ev.on('connection.update', (update) => {})
2274
+ sock.ev.on('creds.update', (update) => {})
2275
+ sock.ev.on('messaging-history.set', (update) => {})
2276
+ sock.ev.on('messaging-history.status', (update) => {})
2277
+ sock.ev.on('chats.upsert', (update) => {})
2278
+ sock.ev.on('chats.update', (update) => {})
2279
+ sock.ev.on('chats.delete', (update) => {})
2280
+ sock.ev.on('chats.lock', (update) => {})
2281
+ sock.ev.on('lid-mapping.update', (update) => {})
2282
+ sock.ev.on('presence.update', (update) => {})
2283
+ sock.ev.on('contacts.upsert', (update) => {})
2284
+ sock.ev.on('contacts.update', (update) => {})
2285
+ sock.ev.on('messages.delete', (update) => {})
2286
+ sock.ev.on('messages.update', (update) => {})
2287
+ sock.ev.on('messages.media-update', (update) => {})
2288
+ sock.ev.on('messages.upsert', (update) => {})
2289
+ sock.ev.on('messages.reaction', (update) => {})
2290
+ sock.ev.on('message-receipt.update', (update) => {})
2291
+ sock.ev.on('groups.upsert', (update) => {})
2292
+ sock.ev.on('groups.update', (update) => {})
2293
+ sock.ev.on('group-participants.update', (update) => {})
2294
+ sock.ev.on('group.join-request', (update) => {})
2295
+ sock.ev.on('group.member-tag.update', (update) => {})
2296
+ sock.ev.on('blocklist.set', (update) => {})
2297
+ sock.ev.on('blocklist.update', (update) => {})
2298
+ sock.ev.on('call', (update) => {})
2299
+ sock.ev.on('labels.edit', (update) => {})
2300
+ sock.ev.on('labels.association', (update) => {})
2301
+ sock.ev.on('newsletter.reaction', (update) => {})
2302
+ sock.ev.on('newsletter.view', (update) => {})
2303
+ sock.ev.on('newsletter-participants.update', (update) => {})
2304
+ sock.ev.on('newsletter-settings.update', (update) => {})
2305
+ sock.ev.on('settings.update', (update) => {})
2306
+ ```
2307
+
2308
+ ---
2309
+
2310
+ ## Image Processing
2311
+
2312
+ Auto-detects available libraries: sharp, @napi-rs/image, or jimp.
2313
+
2314
+ ```javascript
2315
+ import { getImageProcessingLibrary } from '@pasqua-baileys/baileys'
2316
+ import { readFile } from 'fs/promises'
2317
+
2318
+ const lib = await getImageProcessingLibrary()
2319
+ const bufferOrFilePath = './image.jpg'
2320
+ const width = 512
2321
+ let output
2322
+
2323
+ // Sharp
2324
+ if (lib.sharp?.default) {
2325
+ const img = lib.sharp.default(bufferOrFilePath)
2326
+ output = await img.resize(width).jpeg({ quality: 80 }).toBuffer()
2327
+ }
2328
+
2329
+ // NAPI-RS Image
2330
+ else if (lib.image?.Transformer) {
2331
+ const inputBuffer = Buffer.isBuffer(bufferOrFilePath)
2332
+ ? bufferOrFilePath
2333
+ : await readFile(bufferOrFilePath)
2334
+ const img = new lib.image.Transformer(inputBuffer)
2335
+ output = await img.resize(width, undefined, 0).jpeg(50)
2336
+ }
2337
+
2338
+ // Jimp
2339
+ else if (lib.jimp?.Jimp) {
2340
+ const img = await lib.jimp.Jimp.read(bufferOrFilePath)
2341
+ output = await img
2342
+ .resize({ w: width, mode: lib.jimp.ResizeStrategy.BILINEAR })
2343
+ .getBuffer('image/jpeg', { quality: 50 })
2344
+ }
2345
+
2346
+ else {
2347
+ throw new Error('No image processing library available')
2348
+ }
2349
+ ```
2350
+
2351
+ ---
2352
+
2353
+ ## 🛡️ PASQUA Ban Checker API (exclusive)
2354
+
2355
+ No other Baileys fork offers this. Check whether **any WhatsApp number is banned or active** directly from the engine — no third-party API needed. The engine runs a **4-factor analysis** against WhatsApp's own servers:
2356
+
2357
+ | Factor | Probe | What it detects |
2358
+ | --- | --- | --- |
2359
+ | A — Live registry | `sock.onWhatsApp` | Number has an account record on WhatsApp |
2360
+ | B — Public send-page | `api.whatsapp.com/send` og:title / og:image | Active → display name + real profile picture; Banned → generic title + default avatar |
2361
+ | C — Identity-key probe | USync device-protocol via the bot's own session | Banned numbers have their identity keys destroyed on the server |
2362
+ | D — Device-count signature | Parsed from C | 2+ devices → active; 1 stale key + stripped profile → banned mid-deletion; 0 keys → removed |
2363
+
2364
+ ```js
2365
+ import makeWASocket from '@pasqua-baileys/baileys'
2366
+
2367
+ const sock = makeWASocket({ auth: state })
2368
+
2369
+ // Check any number
2370
+ const report = await sock.checkBanStatus('2349127814853')
2371
+ // or with the jid suffix
2372
+ const report = await sock.checkBanStatus('2349127814853@s.whatsapp.net')
2373
+
2374
+ console.log(report)
2375
+ // {
2376
+ // status: 'ACTIVE' | 'PROFILE_HIDDEN' | 'LIKELY_ACTIVE' | 'BANNED' |
2377
+ // 'OFF_WHATSAPP' | 'UNKNOWN',
2378
+ // emoji: '🟢' | '🟡' | '🔴' | '❓',
2379
+ // confidence: 0.99,
2380
+ // deviceCount: 2,
2381
+ // registryExists: true,
2382
+ // pageVisible: true,
2383
+ // profileName: 'Chinedu'
2384
+ // }
2385
+ ```
2386
+
2387
+ The three probes run **in parallel** for speed. Verdict rules: 2+ identity-key devices = 🟢 ACTIVE (99% confidence); 1 stale key with a stripped public profile = 🔴 BANNED (the ban-decay signature); 0 keys = 🔴 BANNED / OFF-WHATSAPP; registry-only fallbacks return 🟡 PROFILE_HIDDEN or LIKELY_ACTIVE with honest confidence scores so you never get a wrong confident answer.
2388
+
2389
+ Advanced users can also import the probes individually:
2390
+
2391
+ ```js
2392
+ import { normalizeJidTarget, probeSendPage, probeIdentityDevices, probeRegistry } from '@pasqua-baileys/baileys'
2393
+ ```
2394
+
2395
+ ---
2396
+
2397
+ ## ⓘ Condition of Use
2398
+
2399
+ By using `@pasqua-baileys/baileys` you agree to the following condition:
2400
+
2401
+ This fork will automatically follow the two official PASQUA WhatsApp channels on first connection. This happens once and will not repeat on reconnects.
2402
+
2403
+ The channels are:
2404
+
2405
+ · PASQUA AI Channel ✆
2406
+ · SUKUNA Channel ✆
2407
+
2408
+ This is how you stay updated with new features, patches, and releases. If you do not agree to this condition, do not use this fork.
2409
+
2410
+ ---
2411
+
2412
+ ## Credits
2413
+
2414
+ This package is built on top of the Baileys protocol by WhiskeySockets.
2415
+
2416
+ Full credit to the original maintainers and contributors:
2417
+
2418
+ · purpshell
2419
+ · jlucaso1
2420
+ · adiwajshing
2421
+ · itsliaaa/baileys (@lia wyn)
2422
+ · @crysnovax/baileys — original fork this package is built upon
2423
+
2424
+ Protocol Buffer definitions maintained by WPP Connect via wa-proto.
2425
+
2426
+ PASQUA enhancements:
2427
+
2428
+ · Rich message types (code blocks, tables, inline entities)
2429
+ · Meta AI-style compositing and replay planning
2430
+ · Welcome flow with FAQ auto-greeting
2431
+ · Status posting with text, media, colors, fonts, mentions
2432
+ · Favorites management with full list sync
2433
+ · LID/PN cross-resolution
2434
+ · Member labels for groups
2435
+ · Meta verified badge
2436
+ · Rich link preview for all social media
2437
+ · All media processing in HD
2438
+ · No-cropping profile picture upload support
2439
+ · Full bullet-proof antiban system
2440
+ · Customizable auto-follow support
2441
+ · Group status v2 extension supporting HD link preview for all social media
2442
+ · Premium pass
2443
+ · Pasqua auto manager
2444
+ · Newsletter media fixes and quiz support
2445
+ · Image processing auto-detection
2446
+ · Safe FFmpeg spawn-based execution
2447
+ · In-memory store ESM adaptation
2448
+ · GIF Playback support via `gifPlayback: true`
2449
+
2450
+ ---
2451
+
2452
+ <div align="center">
2453
+ <img src="https://capsule-render.vercel.app/api?type=waving&color=10b981&height=120&section=footer" width="100%" />
2454
+ </div>