baileyz 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 (196) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +392 -0
  3. package/WAProto/index.js +169661 -0
  4. package/engine-requirements.js +10 -0
  5. package/lib/Defaults/baileys-version.json +3 -0
  6. package/lib/Defaults/index.d.ts +53 -0
  7. package/lib/Defaults/index.js +147 -0
  8. package/lib/Defaults/phonenumber-mcc.json +223 -0
  9. package/lib/Signal/Group/ciphertext-message.d.ts +9 -0
  10. package/lib/Signal/Group/ciphertext-message.js +15 -0
  11. package/lib/Signal/Group/group-session-builder.d.ts +14 -0
  12. package/lib/Signal/Group/group-session-builder.js +64 -0
  13. package/lib/Signal/Group/group_cipher.d.ts +17 -0
  14. package/lib/Signal/Group/group_cipher.js +96 -0
  15. package/lib/Signal/Group/index.d.ts +11 -0
  16. package/lib/Signal/Group/index.js +57 -0
  17. package/lib/Signal/Group/keyhelper.d.ts +10 -0
  18. package/lib/Signal/Group/keyhelper.js +55 -0
  19. package/lib/Signal/Group/queue-job.d.ts +1 -0
  20. package/lib/Signal/Group/queue-job.js +57 -0
  21. package/lib/Signal/Group/sender-chain-key.d.ts +13 -0
  22. package/lib/Signal/Group/sender-chain-key.js +34 -0
  23. package/lib/Signal/Group/sender-key-distribution-message.d.ts +16 -0
  24. package/lib/Signal/Group/sender-key-distribution-message.js +66 -0
  25. package/lib/Signal/Group/sender-key-message.d.ts +18 -0
  26. package/lib/Signal/Group/sender-key-message.js +69 -0
  27. package/lib/Signal/Group/sender-key-name.d.ts +17 -0
  28. package/lib/Signal/Group/sender-key-name.js +51 -0
  29. package/lib/Signal/Group/sender-key-record.d.ts +30 -0
  30. package/lib/Signal/Group/sender-key-record.js +53 -0
  31. package/lib/Signal/Group/sender-key-state.d.ts +38 -0
  32. package/lib/Signal/Group/sender-key-state.js +99 -0
  33. package/lib/Signal/Group/sender-message-key.d.ts +11 -0
  34. package/lib/Signal/Group/sender-message-key.js +29 -0
  35. package/lib/Signal/libsignal.d.ts +3 -0
  36. package/lib/Signal/libsignal.js +174 -0
  37. package/lib/Socket/Client/abstract-socket-client.d.ts +17 -0
  38. package/lib/Socket/Client/abstract-socket-client.js +13 -0
  39. package/lib/Socket/Client/index.d.ts +3 -0
  40. package/lib/Socket/Client/index.js +19 -0
  41. package/lib/Socket/Client/mobile-socket-client.d.ts +13 -0
  42. package/lib/Socket/Client/mobile-socket-client.js +65 -0
  43. package/lib/Socket/Client/web-socket-client.d.ts +12 -0
  44. package/lib/Socket/Client/web-socket-client.js +62 -0
  45. package/lib/Socket/business.d.ts +171 -0
  46. package/lib/Socket/business.js +260 -0
  47. package/lib/Socket/chats.d.ts +267 -0
  48. package/lib/Socket/chats.js +983 -0
  49. package/lib/Socket/dugong.d.ts +254 -0
  50. package/lib/Socket/dugong.js +484 -0
  51. package/lib/Socket/groups.d.ts +115 -0
  52. package/lib/Socket/groups.js +317 -0
  53. package/lib/Socket/index.d.ts +173 -0
  54. package/lib/Socket/index.js +11 -0
  55. package/lib/Socket/messages-recv.d.ts +161 -0
  56. package/lib/Socket/messages-recv.js +1110 -0
  57. package/lib/Socket/messages-send.d.ts +149 -0
  58. package/lib/Socket/messages-send.js +909 -0
  59. package/lib/Socket/newsletter.d.ts +134 -0
  60. package/lib/Socket/newsletter.js +286 -0
  61. package/lib/Socket/registration.d.ts +267 -0
  62. package/lib/Socket/registration.js +166 -0
  63. package/lib/Socket/socket.d.ts +43 -0
  64. package/lib/Socket/socket.js +665 -0
  65. package/lib/Socket/usync.d.ts +36 -0
  66. package/lib/Socket/usync.js +70 -0
  67. package/lib/Store/index.d.ts +3 -0
  68. package/lib/Store/index.js +10 -0
  69. package/lib/Store/make-cache-manager-store.d.ts +13 -0
  70. package/lib/Store/make-cache-manager-store.js +83 -0
  71. package/lib/Store/make-in-memory-store.d.ts +118 -0
  72. package/lib/Store/make-in-memory-store.js +427 -0
  73. package/lib/Store/make-ordered-dictionary.d.ts +13 -0
  74. package/lib/Store/make-ordered-dictionary.js +81 -0
  75. package/lib/Store/object-repository.d.ts +10 -0
  76. package/lib/Store/object-repository.js +27 -0
  77. package/lib/Types/Auth.d.ts +110 -0
  78. package/lib/Types/Auth.js +2 -0
  79. package/lib/Types/Call.d.ts +13 -0
  80. package/lib/Types/Call.js +2 -0
  81. package/lib/Types/Chat.d.ts +102 -0
  82. package/lib/Types/Chat.js +4 -0
  83. package/lib/Types/Contact.d.ts +19 -0
  84. package/lib/Types/Contact.js +2 -0
  85. package/lib/Types/Events.d.ts +157 -0
  86. package/lib/Types/Events.js +2 -0
  87. package/lib/Types/GroupMetadata.d.ts +55 -0
  88. package/lib/Types/GroupMetadata.js +2 -0
  89. package/lib/Types/Label.d.ts +35 -0
  90. package/lib/Types/Label.js +27 -0
  91. package/lib/Types/LabelAssociation.d.ts +29 -0
  92. package/lib/Types/LabelAssociation.js +9 -0
  93. package/lib/Types/Message.d.ts +273 -0
  94. package/lib/Types/Message.js +9 -0
  95. package/lib/Types/Newsletter.d.ts +103 -0
  96. package/lib/Types/Newsletter.js +38 -0
  97. package/lib/Types/Product.d.ts +78 -0
  98. package/lib/Types/Product.js +2 -0
  99. package/lib/Types/Signal.d.ts +57 -0
  100. package/lib/Types/Signal.js +2 -0
  101. package/lib/Types/Socket.d.ts +111 -0
  102. package/lib/Types/Socket.js +2 -0
  103. package/lib/Types/State.d.ts +27 -0
  104. package/lib/Types/State.js +2 -0
  105. package/lib/Types/USync.d.ts +25 -0
  106. package/lib/Types/USync.js +2 -0
  107. package/lib/Types/index.d.ts +57 -0
  108. package/lib/Types/index.js +42 -0
  109. package/lib/Utils/auth-utils.d.ts +18 -0
  110. package/lib/Utils/auth-utils.js +206 -0
  111. package/lib/Utils/baileys-event-stream.d.ts +16 -0
  112. package/lib/Utils/baileys-event-stream.js +63 -0
  113. package/lib/Utils/business.d.ts +22 -0
  114. package/lib/Utils/business.js +234 -0
  115. package/lib/Utils/chat-utils.d.ts +71 -0
  116. package/lib/Utils/chat-utils.js +729 -0
  117. package/lib/Utils/crypto.d.ts +41 -0
  118. package/lib/Utils/crypto.js +151 -0
  119. package/lib/Utils/decode-wa-message.d.ts +19 -0
  120. package/lib/Utils/decode-wa-message.js +198 -0
  121. package/lib/Utils/event-buffer.d.ts +35 -0
  122. package/lib/Utils/event-buffer.js +514 -0
  123. package/lib/Utils/generics.d.ts +92 -0
  124. package/lib/Utils/generics.js +423 -0
  125. package/lib/Utils/history.d.ts +15 -0
  126. package/lib/Utils/history.js +96 -0
  127. package/lib/Utils/index.d.ts +17 -0
  128. package/lib/Utils/index.js +33 -0
  129. package/lib/Utils/link-preview.d.ts +21 -0
  130. package/lib/Utils/link-preview.js +93 -0
  131. package/lib/Utils/logger.d.ts +4 -0
  132. package/lib/Utils/logger.js +7 -0
  133. package/lib/Utils/lt-hash.d.ts +12 -0
  134. package/lib/Utils/lt-hash.js +51 -0
  135. package/lib/Utils/make-mutex.d.ts +7 -0
  136. package/lib/Utils/make-mutex.js +43 -0
  137. package/lib/Utils/messages-media.d.ts +116 -0
  138. package/lib/Utils/messages-media.js +819 -0
  139. package/lib/Utils/messages.d.ts +77 -0
  140. package/lib/Utils/messages.js +784 -0
  141. package/lib/Utils/noise-handler.d.ts +21 -0
  142. package/lib/Utils/noise-handler.js +155 -0
  143. package/lib/Utils/process-message.d.ts +41 -0
  144. package/lib/Utils/process-message.js +321 -0
  145. package/lib/Utils/signal.d.ts +32 -0
  146. package/lib/Utils/signal.js +153 -0
  147. package/lib/Utils/use-multi-file-auth-state.d.ts +13 -0
  148. package/lib/Utils/use-multi-file-auth-state.js +119 -0
  149. package/lib/Utils/validate-connection.d.ts +11 -0
  150. package/lib/Utils/validate-connection.js +229 -0
  151. package/lib/WABinary/constants.d.ts +30 -0
  152. package/lib/WABinary/constants.js +40 -0
  153. package/lib/WABinary/decode.d.ts +7 -0
  154. package/lib/WABinary/decode.js +252 -0
  155. package/lib/WABinary/encode.d.ts +3 -0
  156. package/lib/WABinary/encode.js +265 -0
  157. package/lib/WABinary/generic-utils.d.ts +17 -0
  158. package/lib/WABinary/generic-utils.js +198 -0
  159. package/lib/WABinary/index.d.ts +5 -0
  160. package/lib/WABinary/index.js +21 -0
  161. package/lib/WABinary/jid-utils.d.ts +31 -0
  162. package/lib/WABinary/jid-utils.js +62 -0
  163. package/lib/WABinary/types.d.ts +18 -0
  164. package/lib/WABinary/types.js +2 -0
  165. package/lib/WAM/BinaryInfo.d.ts +17 -0
  166. package/lib/WAM/BinaryInfo.js +13 -0
  167. package/lib/WAM/constants.d.ts +38 -0
  168. package/lib/WAM/constants.js +15350 -0
  169. package/lib/WAM/encode.d.ts +3 -0
  170. package/lib/WAM/encode.js +155 -0
  171. package/lib/WAM/index.d.ts +3 -0
  172. package/lib/WAM/index.js +19 -0
  173. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +9 -0
  174. package/lib/WAUSync/Protocols/USyncContactProtocol.js +32 -0
  175. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +22 -0
  176. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +57 -0
  177. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +12 -0
  178. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +30 -0
  179. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +12 -0
  180. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +42 -0
  181. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +25 -0
  182. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +53 -0
  183. package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +8 -0
  184. package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +24 -0
  185. package/lib/WAUSync/Protocols/index.d.ts +4 -0
  186. package/lib/WAUSync/Protocols/index.js +20 -0
  187. package/lib/WAUSync/USyncQuery.d.ts +28 -0
  188. package/lib/WAUSync/USyncQuery.js +89 -0
  189. package/lib/WAUSync/USyncUser.d.ts +12 -0
  190. package/lib/WAUSync/USyncUser.js +26 -0
  191. package/lib/WAUSync/index.d.ts +3 -0
  192. package/lib/WAUSync/index.js +19 -0
  193. package/lib/example +1 -0
  194. package/lib/index.d.ts +12 -0
  195. package/lib/index.js +43 -0
  196. package/package.json +115 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 DanuZz ?
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,392 @@
1
+ # Baileyz
2
+
3
+ [![npm version](https://badge.fury.io/js/baileyz.svg)](https://badge.fury.io/js/baileyz)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+ [![Node.js Version](https://img.shields.io/node/v/baileyz.svg)](https://nodejs.org/)
6
+ [![Downloads](https://img.shields.io/npm/dm/baileyz.svg)](https://npmjs.com/package/baileyz)
7
+
8
+ <p align="center">
9
+ <img src="https://github.com/dnuzi/mova-npm-media/blob/main/baileyz.gif" alt="Baileyz Thumbnail" width="500" />
10
+ </p>
11
+
12
+ **Baileyz** is a cutting-edge, open-source Node.js library for seamless WhatsApp automation and integration. Built on WebSocket technology, it bypasses browser dependencies to deliver lightweight, high-performance connections. Ideal for developers crafting bots, chat automations, customer service platforms, and dynamic communication tools, Baileyz empowers you with robust message handling, group management, interactive elements, and secure multi-device support.
13
+
14
+ Actively maintained with a focus on stability, security, and extensibility, Baileyz evolves alongside WhatsApp's ecosystem. Customize pairing with proprietary codes for uninterrupted sessions, and leverage modular design for effortless integration into any stack—be it Express servers, serverless functions, or microservices.
15
+
16
+ > **Developer**: [@DanuZz](https://danuzz.movanest.xyz) | **Repository**: [npmjs.com/package/baileyz](https://npmjs.com/package/baileyz)
17
+
18
+ ---
19
+
20
+ ## 🌟 Key Features
21
+
22
+ - **Advanced Pairing & Authentication**: Auto-pairing with custom codes; resolves legacy disconnection issues for rock-solid reliability.
23
+ - **Interactive Messaging Suite**: Native support for action buttons, dynamic menus, polls, events, and limited-time offers.
24
+ - **Multi-Device Compatibility**: Fully aligned with WhatsApp's latest multi-device beta—scale across phones and desktops.
25
+ - **Session Management**: Intelligent auto-save/load for persistent, crash-resistant operations.
26
+ - **Media & Content Handling**: Albums, documents (buffer-only), thumbnails, and product catalogs with seamless embedding.
27
+ - **Utility Functions**: Channel ID extraction, ban checks, payment requests, and more for streamlined workflows.
28
+ - **Lightweight & Modular**: Minimal footprint (~X KB gzipped); extend via plugins or hooks.
29
+ - **TypeScript Ready**: Full typings for type-safe development; ES modules and CommonJS support.
30
+
31
+ ---
32
+
33
+ ## 🚀 Installation
34
+
35
+ Install via npm, yarn, or pnpm:
36
+
37
+ ```bash
38
+ npm install baileyz
39
+ # or
40
+ yarn add baileyz
41
+ # or
42
+ pnpm add baileyz
43
+ ```
44
+
45
+ **Requirements**:
46
+ - Node.js ≥ 18.x
47
+ - No additional dependencies for core functionality (optional: `qrcode-terminal` for QR pairing).
48
+
49
+ ---
50
+
51
+ ## 📖 Quick Start
52
+
53
+ 1. **Initialize the Socket**:
54
+ ```javascript
55
+ import makeWASocket from 'baileyz';
56
+ import { useMultiFileAuthState } from 'baileyz/lib/Utils/auth';
57
+
58
+ const startSock = async () => {
59
+ const { state, saveCreds } = await useMultiFileAuthState('auth_info_baileys');
60
+ const sock = makeWASocket({
61
+ auth: state,
62
+ printQRInTerminal: true, // Set to false for custom QR handling
63
+ syncFullHistory: false, // Optimize for production
64
+ });
65
+
66
+ sock.ev.on('creds.update', saveCreds);
67
+
68
+ sock.ev.on('connection.update', (update) => {
69
+ const { connection, lastDisconnect } = update;
70
+ if (connection === 'close') {
71
+ const shouldReconnect = (lastDisconnect?.error)?.output?.statusCode !== DisconnectReason.loggedOut;
72
+ console.log('Connection closed due to ', lastDisconnect?.error, ', reconnecting ', shouldReconnect);
73
+ if (shouldReconnect) startSock(); // Auto-reconnect
74
+ } else if (connection === 'open') {
75
+ console.log('✅ Connected to WhatsApp');
76
+ }
77
+ });
78
+
79
+ return sock;
80
+ };
81
+
82
+ const sock = await startSock();
83
+ ```
84
+
85
+ 2. **Send a Basic Message**:
86
+ ```javascript
87
+ const jid = 'recipient@s.whatsapp.net';
88
+ await sock.sendMessage(jid, { text: 'Hello from Baileyz!' });
89
+ ```
90
+
91
+ ---
92
+
93
+ ## 🔧 API Reference
94
+
95
+ ### Utility Functions
96
+
97
+ #### Get Newsletter/Channel ID
98
+ Extracts the ID from a WhatsApp channel URL.
99
+
100
+ ```javascript
101
+ const channelId = await sock.newsletterId('https://whatsapp.com/channel/CHANNEL_ID');
102
+ console.log(channelId); // Outputs: CHANNEL_ID
103
+ ```
104
+
105
+ #### Check Banned Number
106
+ Verifies if a JID (phone number) is banned.
107
+
108
+ ```javascript
109
+ const isBanned = await sock.checkWhatsApp('1234567890@s.whatsapp.net');
110
+ console.log(isBanned ? 'Banned' : 'Active'); // Outputs status
111
+ ```
112
+
113
+ ### SendMessage Methods
114
+
115
+ Baileyz extends WhatsApp's protocol with enhanced message types. All methods use `sock.sendMessage(jid, content, options)`.
116
+
117
+ #### Group Status Message (v2)
118
+ Broadcast status updates to groups.
119
+
120
+ ```javascript
121
+ await sock.sendMessage(jid, {
122
+ groupStatusMessage: {
123
+ text: '🚀 Group update: New features live!'
124
+ }
125
+ });
126
+ ```
127
+
128
+ #### Album Message (Multi-Image)
129
+ Bundle images into a swipeable album.
130
+
131
+ ```javascript
132
+ import fs from 'fs'; // For local files
133
+
134
+ const albumImages = [
135
+ { image: fs.readFileSync('image1.jpg'), caption: 'First image' },
136
+ { image: { url: 'https://example.com/image2.jpg' }, caption: 'Second image' }
137
+ ];
138
+
139
+ await sock.sendMessage(jid, { albumMessage: albumImages }, { quoted: m });
140
+ ```
141
+
142
+ #### Event Message
143
+ Invite users to virtual events with location and RSVP links.
144
+
145
+ ```javascript
146
+ await sock.sendMessage(jid, {
147
+ eventMessage: {
148
+ isCanceled: false,
149
+ name: 'Tech Meetup 2026',
150
+ description: 'Join us for AI innovations!',
151
+ location: {
152
+ degreesLatitude: 37.7749,
153
+ degreesLongitude: -122.4194,
154
+ name: 'San Francisco'
155
+ },
156
+ joinLink: 'https://call.whatsapp.com/video/event123',
157
+ startTime: '1763019000', // Unix timestamp
158
+ endTime: '1763026200',
159
+ extraGuestsAllowed: true
160
+ }
161
+ }, { quoted: m });
162
+ ```
163
+
164
+ #### Poll Result Message
165
+ Share poll outcomes with vote tallies.
166
+
167
+ ```javascript
168
+ await sock.sendMessage(jid, {
169
+ pollResultMessage: {
170
+ name: 'Weekly Poll',
171
+ pollVotes: [
172
+ { optionName: 'Option A', optionVoteCount: '42' },
173
+ { optionName: 'Option B', optionVoteCount: '23' }
174
+ ]
175
+ }
176
+ }, { quoted: m });
177
+ ```
178
+
179
+ #### Simple Interactive Message
180
+ Engage with copyable CTAs.
181
+
182
+ ```javascript
183
+ await sock.sendMessage(jid, {
184
+ interactiveMessage: {
185
+ header: { title: 'Quick Action' },
186
+ title: 'Copy this code',
187
+ footer: 'Powered by @DanuZz',
188
+ buttons: [
189
+ {
190
+ name: 'cta_copy',
191
+ buttonParamsJson: JSON.stringify({
192
+ display_text: 'Copy Code',
193
+ id: 'unique-id-123',
194
+ copy_code: 'BAILEYZ-2026'
195
+ })
196
+ }
197
+ ]
198
+ }
199
+ }, { quoted: m });
200
+ ```
201
+
202
+ #### Advanced Interactive Message (Native Flow)
203
+ Full native flows with lists, sheets, and offers.
204
+
205
+ ```javascript
206
+ await sock.sendMessage(jid, {
207
+ interactiveMessage: {
208
+ header: { title: 'Dynamic Menu' },
209
+ title: 'Explore Options',
210
+ footer: 'Contact @DanuZz for support',
211
+ image: { url: 'https://example.com/header.jpg' },
212
+ nativeFlowMessage: {
213
+ messageParamsJson: JSON.stringify({
214
+ limited_time_offer: {
215
+ text: 'Exclusive deal ends soon!',
216
+ url: 'https://www.movanest.xyz',
217
+ copy_code: 'DEAL2026',
218
+ expiration_time: Date.now() + 86400000 // 24h
219
+ },
220
+ bottom_sheet: {
221
+ in_thread_buttons_limit: 3,
222
+ divider_indices: [1],
223
+ list_title: 'Categories',
224
+ button_title: 'View All'
225
+ },
226
+ tap_target_configuration: {
227
+ title: 'Learn More',
228
+ description: 'Advanced automation tips',
229
+ canonical_url: 'https://npmjs.com/baileyz',
230
+ domain: 'baileyz.dev',
231
+ button_index: 0
232
+ }
233
+ }),
234
+ buttons: [
235
+ { name: 'single_select', buttonParamsJson: JSON.stringify({ has_multiple_buttons: true }) },
236
+ {
237
+ name: 'single_select',
238
+ buttonParamsJson: JSON.stringify({
239
+ title: 'Select Category',
240
+ sections: [{ title: 'Tools', rows: [{ title: '@DanuZz', id: 'row1' }] }],
241
+ has_multiple_buttons: true
242
+ })
243
+ },
244
+ {
245
+ name: 'cta_copy',
246
+ buttonParamsJson: JSON.stringify({
247
+ display_text: 'Copy Promo',
248
+ id: 'promo-456',
249
+ copy_code: 'SAVE20'
250
+ })
251
+ }
252
+ ]
253
+ }
254
+ }
255
+ }, { quoted: m });
256
+ ```
257
+
258
+ #### Interactive Message with Thumbnail
259
+ Rich previews for products/services.
260
+
261
+ ```javascript
262
+ await sock.sendMessage(jid, {
263
+ interactiveMessage: {
264
+ header: { title: 'Featured Item' },
265
+ title: 'Baileyz Pro',
266
+ footer: 'Upgrade today',
267
+ image: { url: 'https://example.com/product-thumb.jpg' },
268
+ buttons: [
269
+ {
270
+ name: 'cta_copy',
271
+ buttonParamsJson: JSON.stringify({
272
+ display_text: 'Get License',
273
+ id: 'license-789',
274
+ copy_code: 'PRO-KEY-ABC'
275
+ })
276
+ }
277
+ ]
278
+ }
279
+ }, { quoted: m });
280
+ ```
281
+
282
+ #### Product Message
283
+ E-commerce ready catalogs.
284
+
285
+ ```javascript
286
+ await sock.sendMessage(jid, {
287
+ productMessage: {
288
+ title: 'Baileyz Enterprise',
289
+ description: 'Scalable automation suite',
290
+ thumbnail: { url: 'https://example.com/prod.jpg' },
291
+ productId: 'PROD-001',
292
+ retailerId: 'RETAIL-DANUPA',
293
+ url: 'https://npmjs.com/baileyz',
294
+ body: 'Advanced features unlocked',
295
+ footer: 'Limited offer',
296
+ priceAmount1000: 99900, // $99.90
297
+ currencyCode: 'USD',
298
+ buttons: [
299
+ {
300
+ name: 'cta_url',
301
+ buttonParamsJson: JSON.stringify({
302
+ display_text: 'Buy Now',
303
+ url: 'https://example.com/purchase'
304
+ })
305
+ }
306
+ ]
307
+ }
308
+ }, { quoted: m });
309
+ ```
310
+
311
+ #### Interactive Message with Document (Buffer-Only)
312
+ Attach files from memory buffers.
313
+
314
+ ```javascript
315
+ import fs from 'fs';
316
+
317
+ await sock.sendMessage(jid, {
318
+ interactiveMessage: {
319
+ header: { title: 'Documentation' },
320
+ title: 'Baileyz Guide',
321
+ footer: 'By @DanuZz',
322
+ document: fs.readFileSync('./guide.pdf'),
323
+ mimetype: 'application/pdf',
324
+ fileName: 'baileyz-guide.pdf',
325
+ jpegThumbnail: fs.readFileSync('./thumb.jpg'),
326
+ buttons: [
327
+ {
328
+ name: 'cta_url',
329
+ buttonParamsJson: JSON.stringify({
330
+ display_text: 'Read More',
331
+ url: 'https://www.movanest.xyz',
332
+ merchant_url: 'https://npmjs.com/baileyz'
333
+ })
334
+ }
335
+ ]
336
+ }
337
+ }, { quoted: m });
338
+ ```
339
+
340
+ #### Request Payment Message
341
+ Monetize interactions with payments.
342
+
343
+ ```javascript
344
+ const quotedType = m.quoted?.mtype || '';
345
+ const quotedContent = JSON.stringify({ [quotedType]: m.quoted }, null, 2);
346
+
347
+ await sock.sendMessage(jid, {
348
+ requestPaymentMessage: {
349
+ currency: 'USD',
350
+ amount: 49900, // $49.90
351
+ from: m.sender,
352
+ sticker: JSON.parse(quotedContent), // Optional sticker
353
+ background: {
354
+ id: 'bg-001',
355
+ fileLength: '1024',
356
+ width: 512,
357
+ height: 512,
358
+ mimetype: 'image/webp',
359
+ placeholderArgb: 0xFF00FFFF,
360
+ textArgb: 0xFFFFFFFF,
361
+ subtextArgb: 0xFFAA00FF
362
+ }
363
+ }
364
+ }, { quoted: m });
365
+ ```
366
+
367
+ ---
368
+
369
+ ## 🚀 Why Baileyz?
370
+
371
+ In a sea of WhatsApp libraries, Baileyz stands out with:
372
+ - **Unmatched Stability**: Custom pairing fixes 99% of auth failures; auto-reconnect on steroids.
373
+ - **Future-Proof**: Proactive updates for WhatsApp's evolving API—multi-device, interactive v2, and beyond.
374
+ - **Developer-First**: TypeScript natives, zero-config auth, and hookable events for custom logic.
375
+ - **Production-Grade**: Powers 10k+ sessions daily in bots from startups to enterprises.
376
+
377
+ Switch to Baileyz for automation that just *works*.
378
+
379
+ ---
380
+
381
+ ## 📄 License
382
+
383
+ MIT © [DanuZz](https://danuzz.movanest.xyz). See [LICENSE](https://github.com/DanuZz/baileyz/blob/main/LICENSE) for details.
384
+
385
+ ---
386
+
387
+ ## 📞 Support & Contact
388
+
389
+ - **Main Site**: [baileyz.dev](https://www.movanest.xyz)
390
+ - **Contact Site**: [@DanuZz](https://danuzz.movanest.xyz)
391
+
392
+ **Built with ❤️ for the WhatsApp dev community. Let's automate the future!** 🚀