alwaysaqioo 0.0.0-stage → 6.8.5

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.

Potentially problematic release.


This version of alwaysaqioo might be problematic. Click here for more details.

Files changed (193) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +481 -2
  3. package/WAProto/GenerateStatics.sh +4 -0
  4. package/WAProto/WAProto.proto +4450 -0
  5. package/WAProto/index.d.ts +48955 -0
  6. package/WAProto/index.js +151420 -0
  7. package/WASignalGroup/GroupProtocol.js +1771 -0
  8. package/WASignalGroup/ciphertext_message.js +10 -0
  9. package/WASignalGroup/group_cipher.js +103 -0
  10. package/WASignalGroup/group_session_builder.js +39 -0
  11. package/WASignalGroup/index.js +5 -0
  12. package/WASignalGroup/keyhelper.js +17 -0
  13. package/WASignalGroup/protobufs.js +2 -0
  14. package/WASignalGroup/queue_job.js +64 -0
  15. package/WASignalGroup/sender_chain_key.js +38 -0
  16. package/WASignalGroup/sender_key_distribution_message.js +68 -0
  17. package/WASignalGroup/sender_key_message.js +79 -0
  18. package/WASignalGroup/sender_key_name.js +59 -0
  19. package/WASignalGroup/sender_key_record.js +47 -0
  20. package/WASignalGroup/sender_key_state.js +110 -0
  21. package/WASignalGroup/sender_message_key.js +30 -0
  22. package/engine-requirements.js +12 -0
  23. package/lib/Defaults/baileys-version.json +3 -0
  24. package/lib/Defaults/index.d.ts +51 -0
  25. package/lib/Defaults/index.js +108 -0
  26. package/lib/Defaults/phonenumber-mcc.json +223 -0
  27. package/lib/Signal/libsignal.d.ts +3 -0
  28. package/lib/Signal/libsignal.js +153 -0
  29. package/lib/Socket/Client/abstract-socket-client.d.ts +15 -0
  30. package/lib/Socket/Client/abstract-socket-client.js +13 -0
  31. package/lib/Socket/Client/index.d.ts +2 -0
  32. package/lib/Socket/Client/index.js +18 -0
  33. package/lib/Socket/Client/mobile-socket-client.d.ts +12 -0
  34. package/lib/Socket/Client/mobile-socket-client.js +65 -0
  35. package/lib/Socket/Client/types.d.ts +15 -0
  36. package/lib/Socket/Client/types.js +14 -0
  37. package/lib/Socket/Client/web-socket-client.d.ts +12 -0
  38. package/lib/Socket/Client/web-socket-client.js +62 -0
  39. package/lib/Socket/Client/websocket.d.ts +12 -0
  40. package/lib/Socket/Client/websocket.js +57 -0
  41. package/lib/Socket/business.d.ts +181 -0
  42. package/lib/Socket/business.js +259 -0
  43. package/lib/Socket/chats.d.ts +95 -0
  44. package/lib/Socket/chats.js +906 -0
  45. package/lib/Socket/groups.d.ts +128 -0
  46. package/lib/Socket/groups.js +307 -0
  47. package/lib/Socket/index.d.ts +183 -0
  48. package/lib/Socket/index.js +10 -0
  49. package/lib/Socket/messages-recv.d.ts +195 -0
  50. package/lib/Socket/messages-recv.js +1290 -0
  51. package/lib/Socket/messages-send.d.ts +188 -0
  52. package/lib/Socket/messages-send.js +1081 -0
  53. package/lib/Socket/newsletter.d.ts +151 -0
  54. package/lib/Socket/newsletter.js +297 -0
  55. package/lib/Socket/registration.d.ts +264 -0
  56. package/lib/Socket/registration.js +166 -0
  57. package/lib/Socket/socket.d.ts +47 -0
  58. package/lib/Socket/socket.js +611 -0
  59. package/lib/Socket/usync.d.ts +45 -0
  60. package/lib/Socket/usync.js +74 -0
  61. package/lib/Store/index.d.ts +3 -0
  62. package/lib/Store/index.js +10 -0
  63. package/lib/Store/make-cache-manager-store.d.ts +14 -0
  64. package/lib/Store/make-cache-manager-store.js +83 -0
  65. package/lib/Store/make-in-memory-store.d.ts +118 -0
  66. package/lib/Store/make-in-memory-store.js +431 -0
  67. package/lib/Store/make-ordered-dictionary.d.ts +13 -0
  68. package/lib/Store/make-ordered-dictionary.js +81 -0
  69. package/lib/Store/object-repository.d.ts +10 -0
  70. package/lib/Store/object-repository.js +27 -0
  71. package/lib/Types/Auth.d.ts +109 -0
  72. package/lib/Types/Auth.js +2 -0
  73. package/lib/Types/Call.d.ts +13 -0
  74. package/lib/Types/Call.js +2 -0
  75. package/lib/Types/Chat.d.ts +107 -0
  76. package/lib/Types/Chat.js +4 -0
  77. package/lib/Types/Contact.d.ts +19 -0
  78. package/lib/Types/Contact.js +2 -0
  79. package/lib/Types/Events.d.ts +172 -0
  80. package/lib/Types/Events.js +2 -0
  81. package/lib/Types/GroupMetadata.d.ts +56 -0
  82. package/lib/Types/GroupMetadata.js +2 -0
  83. package/lib/Types/Label.d.ts +46 -0
  84. package/lib/Types/Label.js +27 -0
  85. package/lib/Types/LabelAssociation.d.ts +29 -0
  86. package/lib/Types/LabelAssociation.js +9 -0
  87. package/lib/Types/Message.d.ts +433 -0
  88. package/lib/Types/Message.js +9 -0
  89. package/lib/Types/Newsletter.d.ts +92 -0
  90. package/lib/Types/Newsletter.js +32 -0
  91. package/lib/Types/Product.d.ts +78 -0
  92. package/lib/Types/Product.js +2 -0
  93. package/lib/Types/Signal.d.ts +57 -0
  94. package/lib/Types/Signal.js +2 -0
  95. package/lib/Types/Socket.d.ts +116 -0
  96. package/lib/Types/Socket.js +2 -0
  97. package/lib/Types/State.d.ts +27 -0
  98. package/lib/Types/State.js +2 -0
  99. package/lib/Types/USync.d.ts +25 -0
  100. package/lib/Types/USync.js +2 -0
  101. package/lib/Types/index.d.ts +66 -0
  102. package/lib/Types/index.js +42 -0
  103. package/lib/Utils/auth-utils.d.ts +18 -0
  104. package/lib/Utils/auth-utils.js +198 -0
  105. package/lib/Utils/baileys-event-stream.d.ts +16 -0
  106. package/lib/Utils/baileys-event-stream.js +69 -0
  107. package/lib/Utils/business.d.ts +28 -0
  108. package/lib/Utils/business.js +242 -0
  109. package/lib/Utils/chat-utils.d.ts +93 -0
  110. package/lib/Utils/chat-utils.js +858 -0
  111. package/lib/Utils/crypto.d.ts +40 -0
  112. package/lib/Utils/crypto.js +184 -0
  113. package/lib/Utils/decode-wa-message.d.ts +36 -0
  114. package/lib/Utils/decode-wa-message.js +236 -0
  115. package/lib/Utils/event-buffer.d.ts +35 -0
  116. package/lib/Utils/event-buffer.js +587 -0
  117. package/lib/Utils/generics.d.ts +99 -0
  118. package/lib/Utils/generics.js +574 -0
  119. package/lib/Utils/history.d.ts +19 -0
  120. package/lib/Utils/history.js +107 -0
  121. package/lib/Utils/index.d.ts +19 -0
  122. package/lib/Utils/index.js +35 -0
  123. package/lib/Utils/link-preview.d.ts +21 -0
  124. package/lib/Utils/link-preview.js +134 -0
  125. package/lib/Utils/logger.d.ts +11 -0
  126. package/lib/Utils/logger.js +7 -0
  127. package/lib/Utils/lt-hash.d.ts +12 -0
  128. package/lib/Utils/lt-hash.js +58 -0
  129. package/lib/Utils/make-mutex.d.ts +7 -0
  130. package/lib/Utils/make-mutex.js +45 -0
  131. package/lib/Utils/messages-media.d.ts +144 -0
  132. package/lib/Utils/messages-media.js +872 -0
  133. package/lib/Utils/messages.d.ts +74 -0
  134. package/lib/Utils/messages.js +1455 -0
  135. package/lib/Utils/noise-handler.d.ts +19 -0
  136. package/lib/Utils/noise-handler.js +173 -0
  137. package/lib/Utils/process-message.d.ts +41 -0
  138. package/lib/Utils/process-message.js +450 -0
  139. package/lib/Utils/signal.d.ts +49 -0
  140. package/lib/Utils/signal.js +225 -0
  141. package/lib/Utils/use-mongo-file-auth-state.d.ts +5 -0
  142. package/lib/Utils/use-mongo-file-auth-state.js +83 -0
  143. package/lib/Utils/use-multi-file-auth-state.d.ts +12 -0
  144. package/lib/Utils/use-multi-file-auth-state.js +124 -0
  145. package/lib/Utils/use-single-file-auth-state.d.ts +12 -0
  146. package/lib/Utils/use-single-file-auth-state.js +80 -0
  147. package/lib/Utils/validate-connection.d.ts +10 -0
  148. package/lib/Utils/validate-connection.js +201 -0
  149. package/lib/WABinary/constants.d.ts +27 -0
  150. package/lib/WABinary/constants.js +45 -0
  151. package/lib/WABinary/decode.d.ts +6 -0
  152. package/lib/WABinary/decode.js +255 -0
  153. package/lib/WABinary/encode.d.ts +2 -0
  154. package/lib/WABinary/encode.js +243 -0
  155. package/lib/WABinary/generic-utils.d.ts +16 -0
  156. package/lib/WABinary/generic-utils.js +125 -0
  157. package/lib/WABinary/index.d.ts +5 -0
  158. package/lib/WABinary/index.js +21 -0
  159. package/lib/WABinary/jid-utils.d.ts +34 -0
  160. package/lib/WABinary/jid-utils.js +73 -0
  161. package/lib/WABinary/types.d.ts +18 -0
  162. package/lib/WABinary/types.js +2 -0
  163. package/lib/WAM/BinaryInfo.d.ts +16 -0
  164. package/lib/WAM/BinaryInfo.js +14 -0
  165. package/lib/WAM/constants.d.ts +39 -0
  166. package/lib/WAM/constants.js +15362 -0
  167. package/lib/WAM/encode.d.ts +2 -0
  168. package/lib/WAM/encode.js +156 -0
  169. package/lib/WAM/index.d.ts +3 -0
  170. package/lib/WAM/index.js +19 -0
  171. package/lib/WAUSync/Protocols/USyncBotProfileProtocol.d.ts +25 -0
  172. package/lib/WAUSync/Protocols/USyncBotProfileProtocol.js +60 -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 +58 -0
  177. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +12 -0
  178. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +31 -0
  179. package/lib/WAUSync/Protocols/USyncLIDProtocol.d.ts +8 -0
  180. package/lib/WAUSync/Protocols/USyncLIDProtocol.js +26 -0
  181. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +12 -0
  182. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +42 -0
  183. package/lib/WAUSync/Protocols/index.d.ts +6 -0
  184. package/lib/WAUSync/Protocols/index.js +22 -0
  185. package/lib/WAUSync/USyncQuery.d.ts +28 -0
  186. package/lib/WAUSync/USyncQuery.js +88 -0
  187. package/lib/WAUSync/USyncUser.d.ts +12 -0
  188. package/lib/WAUSync/USyncUser.js +27 -0
  189. package/lib/WAUSync/index.d.ts +3 -0
  190. package/lib/WAUSync/index.js +19 -0
  191. package/lib/index.d.ts +12 -0
  192. package/lib/index.js +33 -0
  193. package/package.json +59 -4
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 OwensDev owensdev1/baileys
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 CHANGED
@@ -1,3 +1,482 @@
1
- # Temporary Holding Version
1
+ # 🚀 WhatsApp Web API
2
2
 
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.
3
+ <div align="center">
4
+
5
+ ![WhatsApp API Banner](https://camo.githubusercontent.com/8c1cc888a216088f8515ca5eb0dc7131bb190d6059af8d02c4616e39b6639114/68747470733a2f2f69696c692e696f2f325a706a746c702e6a7067)
6
+
7
+ [![npm version](https://img.shields.io/npm/v/@owensdev1/baileys?style=for-the-badge&color=00d26a)](https://www.npmjs.com/package/@owensdev1/baileys)
8
+ [![Downloads](https://img.shields.io/npm/dm/@owensdev1/baileys?style=for-the-badge&color=blue)](https://www.npmjs.com/package/@owensdev1/baileys)
9
+ [![GitHub stars](https://img.shields.io/github/stars/owensdev1/baileys?style=for-the-badge&color=yellow)](https://github.com/owensdev1/baileys/stargazers)
10
+ [![License](https://img.shields.io/badge/License-GPL%20v3-red?style=for-the-badge)](https://www.gnu.org/licenses/gpl-3.0)
11
+
12
+ **A powerful WebSockets-based TypeScript library for interacting with the WhatsApp Web API**
13
+
14
+ [📖 Documentation](#-table-of-contents) • [🚀 Quick Start](#-quick-start) • [💬 Support](#-support) • [🤝 Contributing](#-contributing)
15
+
16
+ </div>
17
+
18
+ ---
19
+
20
+ ## ⚠️ Important Disclaimer
21
+
22
+ > [!WARNING]
23
+ > This project is **not affiliated** with WhatsApp Inc. Use responsibly and comply with WhatsApp's Terms of Service.
24
+ >
25
+ > **We strongly discourage:**
26
+ > - Spam messaging
27
+ > - Bulk messaging
28
+ > - Stalkerware usage
29
+ > - Any automated abuse
30
+
31
+ ---
32
+
33
+ ## ✨ Features
34
+
35
+ <div align="center">
36
+
37
+ | 🔐 **Multi-Device Support** | 📱 **QR & Pairing Code** | 🎨 **Rich Messages** | 🔄 **Real-time Events** |
38
+ |:---:|:---:|:---:|:---:|
39
+ | Connect as secondary device | Multiple connection methods | Buttons, polls, media, etc. | Live message updates |
40
+
41
+ | 👥 **Group Management** | 🔒 **Privacy Controls** | 📊 **Message History** | 🎯 **Custom Functions** |
42
+ |:---:|:---:|:---:|:---:|
43
+ | Full admin capabilities | Block, privacy settings | Fetch chat history | Extensible architecture |
44
+
45
+ </div>
46
+
47
+ ---
48
+
49
+ ## 🚀 Quick Start
50
+
51
+ ### 📦 Installation
52
+
53
+ Choose your preferred package manager:
54
+
55
+ ```bash
56
+ # Using npm (stable version) **not available**
57
+ npm install @owensdev1/baileys
58
+
59
+ # Using yarn (edge version)
60
+ yarn add @owensdev1/baileys
61
+ ```
62
+
63
+ ### 🔌 Basic Usage
64
+
65
+ ```javascript
66
+ const { default: makeWASocket, DisconnectReason, useMultiFileAuthState } = require("@owensdev1/baileys");
67
+ const { Boom } = require('@hapi/boom');
68
+
69
+ async function connectToWhatsApp() {
70
+ const { state, saveCreds } = await useMultiFileAuthState('auth_info_baileys');
71
+
72
+ const sock = makeWASocket({
73
+ auth: state,
74
+ printQRInTerminal: true
75
+ });
76
+
77
+ sock.ev.on('connection.update', (update) => {
78
+ const { connection, lastDisconnect } = update;
79
+
80
+ if(connection === 'close') {
81
+ const shouldReconnect = (lastDisconnect.error as Boom)?.output?.statusCode !== DisconnectReason.loggedOut;
82
+ console.log('Connection closed, reconnecting...', shouldReconnect);
83
+
84
+ if(shouldReconnect) {
85
+ connectToWhatsApp();
86
+ }
87
+ } else if(connection === 'open') {
88
+ console.log('✅ Connected to WhatsApp!');
89
+ }
90
+ });
91
+
92
+ sock.ev.on('messages.upsert', async (m) => {
93
+ console.log('📩 New message:', JSON.stringify(m, undefined, 2));
94
+
95
+ // Echo received messages
96
+ const msg = m.messages[0];
97
+ if (!msg.key.fromMe && msg.message) {
98
+ await sock.sendMessage(msg.key.remoteJid, { text: 'Hello! 👋' });
99
+ }
100
+ });
101
+
102
+ sock.ev.on('creds.update', saveCreds);
103
+ }
104
+
105
+ connectToWhatsApp();
106
+ ```
107
+
108
+ ---
109
+
110
+ ## 📚 Table of Contents
111
+
112
+ <details>
113
+ <summary>🔗 <strong>Click to expand full contents</strong></summary>
114
+
115
+ ### 🏗️ **Setup & Connection**
116
+ - [🔌 Connecting Account](#connecting-account)
117
+ - [📱 QR Code Connection](#starting-socket-with-qr-code)
118
+ - [🔢 Pairing Code Connection](#starting-socket-with-pairing-code)
119
+ - [📜 Receive Full History](#receive-full-history)
120
+ - [⚙️ Socket Configuration](#important-notes-about-socket-config)
121
+ - [💾 Save Auth Info](#saving--restoring-sessions)
122
+
123
+ ### 📨 **Messaging**
124
+ - [📤 Sending Messages](#sending-messages)
125
+ - [📝 Text Messages](#text-message)
126
+ - [🔘 Button Messages](#buttons-message)
127
+ - [🎯 Interactive Messages](#interactive-message)
128
+ - [📋 Poll Messages](#poll-message)
129
+ - [📍 Location Messages](#location-message)
130
+ - [👤 Contact Messages](#contact-message)
131
+ - [🎬 Media Messages](#media-messages)
132
+ - [✏️ Modify Messages](#modify-messages)
133
+
134
+ ### 👥 **Groups & Privacy**
135
+ - [👥 Groups Management](#groups)
136
+ - [🔒 Privacy Settings](#privacy)
137
+ - [📢 Broadcast & Stories](#broadcast-lists--stories)
138
+
139
+ ### 🔧 **Advanced**
140
+ - [📊 Data Store Implementation](#implementing-a-data-store)
141
+ - [🎯 Custom Functionality](#writing-custom-functionality)
142
+ - [🐛 Debug Mode](#enabling-debug-level-in-baileys-logs)
143
+
144
+ </details>
145
+
146
+ ---
147
+
148
+ ## 🔌 Connecting Account
149
+
150
+ ### 📱 Starting socket with **QR-CODE**
151
+
152
+ > [!TIP]
153
+ > Customize browser name using the `Browser` constant. See [available browsers](https://baileys.whiskeysockets.io/types/BrowsersMap.html).
154
+
155
+ ```javascript
156
+ const { default: makeWASocket, Browsers } = require("@owensdev1/baileys");
157
+
158
+ const sock = makeWASocket({
159
+ browser: Browsers.ubuntu('My App'),
160
+ printQRInTerminal: true
161
+ });
162
+ ```
163
+
164
+ ### 🔢 Starting socket with **Pairing Code**
165
+
166
+ > [!IMPORTANT]
167
+ > Pairing Code connects WhatsApp Web without QR-CODE. Phone number format: country code + number (no +, (), or -)
168
+
169
+ ```javascript
170
+ const sock = makeWASocket({
171
+ printQRInTerminal: false // Must be false for pairing code
172
+ });
173
+
174
+ // Standard pairing
175
+ if (!sock.authState.creds.registered) {
176
+ const number = '1234567890'; // Your phone number
177
+ const code = await sock.requestPairingCode(number);
178
+ console.log('🔑 Pairing Code:', code);
179
+ }
180
+
181
+ // Custom pairing (8 digits/letters)
182
+ if (!sock.authState.creds.registered) {
183
+ const customPair = "12345678";
184
+ const number = '1234567890';
185
+ const code = await sock.requestPairingCode(number, customPair);
186
+ console.log('🔑 Custom Pairing Code:', code);
187
+ }
188
+ ```
189
+
190
+ ---
191
+
192
+ ## 💾 Saving & Restoring Sessions
193
+
194
+ Never scan QR codes again! Save your session:
195
+
196
+ ```javascript
197
+ const { useMultiFileAuthState } = require("@owensdev1/baileys");
198
+
199
+ const { state, saveCreds } = await useMultiFileAuthState('auth_info_baileys');
200
+
201
+ const sock = makeWASocket({ auth: state });
202
+
203
+ // Auto-save credentials when they update
204
+ sock.ev.on('creds.update', saveCreds);
205
+ ```
206
+
207
+ > [!WARNING]
208
+ > Always save auth keys when they update (`authState.keys.set()` is called) to ensure message delivery!
209
+
210
+ ---
211
+
212
+ ## 📤 Sending Messages
213
+
214
+ ### 📝 Text Message
215
+ ```javascript
216
+ await sock.sendMessage(jid, { text: 'Hello World! 🌍' });
217
+ ```
218
+
219
+ ### 🔘 Button Message
220
+ ```javascript
221
+ await sock.sendMessage(jid, {
222
+ text: "Choose an option:",
223
+ footer: "© 2025 Your Bot",
224
+ buttons: [
225
+ {
226
+ buttonId: 'btn1',
227
+ buttonText: { displayText: '✅ Option 1' },
228
+ type: 1
229
+ },
230
+ {
231
+ buttonId: 'btn2',
232
+ buttonText: { displayText: '❌ Option 2' },
233
+ type: 1
234
+ }
235
+ ],
236
+ headerType: 1
237
+ });
238
+ ```
239
+
240
+ ### 🎯 Interactive Message with Flow
241
+ ```javascript
242
+ await sock.sendMessage(jid, {
243
+ text: "Interactive Menu",
244
+ footer: "© 2025 Bot",
245
+ buttons: [
246
+ {
247
+ buttonId: 'menu',
248
+ buttonText: { displayText: '📋 Show Menu' },
249
+ type: 4,
250
+ nativeFlowInfo: {
251
+ name: 'single_select',
252
+ paramsJson: JSON.stringify({
253
+ title: 'Select Option',
254
+ sections: [{
255
+ title: 'Available Options',
256
+ highlight_label: '⭐',
257
+ rows: [
258
+ {
259
+ header: 'OPTION 1',
260
+ title: 'First Choice',
261
+ description: 'Description for option 1',
262
+ id: 'opt1'
263
+ },
264
+ {
265
+ header: 'OPTION 2',
266
+ title: 'Second Choice',
267
+ description: 'Description for option 2',
268
+ id: 'opt2'
269
+ }
270
+ ]
271
+ }]
272
+ })
273
+ }
274
+ }
275
+ ]
276
+ });
277
+ ```
278
+
279
+ ### 📋 Poll Message
280
+ ```javascript
281
+ await sock.sendMessage(jid, {
282
+ poll: {
283
+ name: 'What\'s your favorite color? 🎨',
284
+ values: ['🔴 Red', '🔵 Blue', '🟢 Green', '🟡 Yellow'],
285
+ selectableCount: 1
286
+ }
287
+ });
288
+ ```
289
+
290
+ ### 🖼️ Image Message
291
+ ```javascript
292
+ await sock.sendMessage(jid, {
293
+ image: { url: './path/to/image.jpg' },
294
+ caption: 'Beautiful image! 📸'
295
+ });
296
+ ```
297
+
298
+ ### 🎥 Video Message
299
+ ```javascript
300
+ await sock.sendMessage(jid, {
301
+ video: { url: './path/to/video.mp4' },
302
+ caption: 'Check this out! 🎬',
303
+ ptv: false // Set to true for video note
304
+ });
305
+ ```
306
+
307
+ ### 🎵 Audio Message
308
+ ```javascript
309
+ await sock.sendMessage(jid, {
310
+ audio: { url: './path/to/audio.mp3' },
311
+ mimetype: 'audio/mp4'
312
+ });
313
+ ```
314
+
315
+ ---
316
+
317
+ ## 📊 Implementing a Data Store
318
+
319
+ > [!IMPORTANT]
320
+ > Build your own data store for production. The in-memory store is just for testing!
321
+
322
+ ```javascript
323
+ const { makeInMemoryStore } = require("@owensdev1/baileys");
324
+
325
+ const store = makeInMemoryStore({});
326
+
327
+ // Load from file
328
+ store.readFromFile('./baileys_store.json');
329
+
330
+ // Auto-save every 10 seconds
331
+ setInterval(() => {
332
+ store.writeToFile('./baileys_store.json');
333
+ }, 10_000);
334
+
335
+ // Bind to socket
336
+ const sock = makeWASocket({});
337
+ store.bind(sock.ev);
338
+
339
+ // Access stored data
340
+ sock.ev.on('chats.upsert', () => {
341
+ console.log('💬 Chats:', store.chats.all());
342
+ });
343
+ ```
344
+
345
+ ---
346
+
347
+ ## 👥 Groups
348
+
349
+ ### 🆕 Create a Group
350
+ ```javascript
351
+ const group = await sock.groupCreate('🎉 My Awesome Group', [
352
+ '1234567890@s.whatsapp.net',
353
+ '0987654321@s.whatsapp.net'
354
+ ]);
355
+
356
+ console.log('✅ Group created:', group.id);
357
+ await sock.sendMessage(group.id, { text: 'Welcome everyone! 👋' });
358
+ ```
359
+
360
+ ### 👤 Add/Remove Participants
361
+ ```javascript
362
+ await sock.groupParticipantsUpdate(
363
+ groupJid,
364
+ ['1234567890@s.whatsapp.net'],
365
+ 'add' // 'remove', 'promote', 'demote'
366
+ );
367
+ ```
368
+
369
+ ### ⚙️ Change Group Settings
370
+ ```javascript
371
+ // Update group name
372
+ await sock.groupUpdateSubject(groupJid, '🚀 New Group Name');
373
+
374
+ // Update description
375
+ await sock.groupUpdateDescription(groupJid, '📝 New group description');
376
+
377
+ // Admin-only messages
378
+ await sock.groupSettingUpdate(groupJid, 'announcement');
379
+
380
+ // Everyone can send messages
381
+ await sock.groupSettingUpdate(groupJid, 'not_announcement');
382
+ ```
383
+
384
+ ---
385
+
386
+ ## 🔒 Privacy
387
+
388
+ ### 🚫 Block/Unblock Users
389
+ ```javascript
390
+ // Block user
391
+ await sock.updateBlockStatus(jid, 'block');
392
+
393
+ // Unblock user
394
+ await sock.updateBlockStatus(jid, 'unblock');
395
+ ```
396
+
397
+ ### ⚙️ Privacy Settings
398
+ ```javascript
399
+ // Update various privacy settings
400
+ await sock.updateLastSeenPrivacy('contacts'); // 'all', 'contacts', 'none'
401
+ await sock.updateOnlinePrivacy('all'); // 'all', 'match_last_seen'
402
+ await sock.updateProfilePicturePrivacy('contacts');
403
+ await sock.updateStatusPrivacy('contacts');
404
+ await sock.updateReadReceiptsPrivacy('all'); // 'all', 'none'
405
+ ```
406
+
407
+ ---
408
+
409
+ ## 🐛 Debugging
410
+
411
+ Enable debug mode to see all WhatsApp communications:
412
+
413
+ ```javascript
414
+ const sock = makeWASocket({
415
+ logger: P({ level: 'debug' }),
416
+ });
417
+ ```
418
+
419
+ ### 🎯 Custom Event Handlers
420
+ ```javascript
421
+ // Listen for specific WebSocket events
422
+ sock.ws.on('CB:edge_routing', (node) => {
423
+ console.log('📡 Edge routing message:', node);
424
+ });
425
+
426
+ // Listen with specific attributes
427
+ sock.ws.on('CB:edge_routing,id:abcd', (node) => {
428
+ console.log('🎯 Specific edge routing message:', node);
429
+ });
430
+ ```
431
+
432
+ ---
433
+
434
+ ## 💬 Support
435
+
436
+ <div align="center">
437
+
438
+ ### 🆘 Need Help?
439
+
440
+ | 📞 **Contact** | 💬 **WhatsApp** | 📧 **Issues** |
441
+ |:---:|:---:|:---:|
442
+ | **6285358977442** | For Baileys support | [GitHub Issues](https://github.com/owensdev1/baileys/issues) |
443
+
444
+ </div>
445
+
446
+ ---
447
+
448
+ ## 🤝 Contributing
449
+
450
+ We welcome contributions! Here's how you can help:
451
+
452
+ 1. 🍴 Fork the repository
453
+ 2. 🌟 Create your feature branch (`git checkout -b feature/AmazingFeature`)
454
+ 3. 💻 Commit your changes (`git commit -m 'Add some AmazingFeature'`)
455
+ 4. 📤 Push to the branch (`git push origin feature/AmazingFeature`)
456
+ 5. 🔄 Open a Pull Request
457
+
458
+ ---
459
+
460
+ ## 📄 License
461
+
462
+ This project is licensed under the **GPL v3 License** - see the [LICENSE](LICENSE) file for details.
463
+
464
+ ---
465
+
466
+ ## 🙏 Acknowledgments
467
+
468
+ - Built with ❤️ using [libsignal-node](https://git.questbook.io/backend/service-coderunner/-/merge_requests/1)
469
+ - Special thanks to the WhatsApp Web reverse engineering community
470
+
471
+ ---
472
+
473
+ <div align="center">
474
+
475
+ ### ⭐ Star this repo if it helped you!
476
+
477
+ [![GitHub stars](https://img.shields.io/github/stars/owensdev1/baileys?style=social)](https://github.com/owensdev1/baileys/stargazers)
478
+ [![GitHub forks](https://img.shields.io/github/forks/owensdev1/baileys?style=social)](https://github.com/owensdev1/baileys/network)
479
+
480
+ **Made with 💻 and ☕ by the community**
481
+
482
+ </div>
@@ -0,0 +1,4 @@
1
+ yarn pbjs -t static-module -w commonjs -o ./WAProto/index.js ./WAProto/WAProto.proto;
2
+ yarn pbts -o ./WAProto/index.d.ts ./WAProto/index.js;
3
+
4
+ #protoc --plugin=./node_modules/.bin/protoc-gen-ts_proto --ts_proto_opt=env=node,useOptionals=true,forceLong=long --ts_proto_out=. ./src/Binary/WAMessage.proto;