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