alipclutch-baileys 8.5.9 โ†’ 8.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,48 +1,83 @@
1
- <h1 align="center">
2
- Clutch Baileys
3
- </h1>
1
+ Clutch Baileys โ€“ Enterprise WhatsApp API
4
2
 
5
- <p align="center">
6
- <img src="https://qu.ax/MoDGQ.jpg" width="400" style="border-radius:8px;">
7
- </p>
3
+ <div align="center">
4
+
5
+ https://qu.ax/MoDGQ.jpg
8
6
 
9
- <p align="center">
10
- <strong>Enterprise-Grade WhatsApp Business API</strong>
7
+ <h1>Clutch Baileys</h1>
8
+
9
+ <p>
10
+ <strong>Enterprise-Grade WhatsApp Business API Solution</strong>
11
11
  </p>
12
12
 
13
- <p align="center">
14
- <sub>High-performance modified Baileys library for scalable WhatsApp integrations</sub>
13
+ <p>
14
+ <em>High-performance modified Baileys library for scalable WhatsApp integrations</em>
15
15
  </p>
16
16
 
17
- ## SendMessage Documentation
17
+ https://img.shields.io/badge/license-MIT-blue.svg
18
+ https://img.shields.io/badge/node-%3E%3D24.0.0-brightgreen.svg
19
+ https://img.shields.io/badge/PRs-welcome-brightgreen.svg
20
+ https://img.shields.io/badge/docs-comprehensive-blueviolet
21
+
22
+ </div>
23
+
24
+ ๐Ÿ“– Overview
25
+
26
+ Clutch Baileys is a powerful, feature-rich modification of the Baileys library designed for enterprise-level WhatsApp integrations. It provides enhanced messaging capabilities, improved performance, and comprehensive support for WhatsApp Business API features.
27
+
28
+ ๐Ÿš€ Quick Start
29
+
30
+ Prerequisites
31
+
32
+ ยท Node.js 16.0.0 or higher
33
+ ยท WhatsApp Business Account (optional for advanced features)
34
+ ยท Basic understanding of WhatsApp Web protocol
35
+
36
+ Installation
37
+
38
+ ```bash
39
+ npm install clutch-baileys
40
+ # or
41
+ yarn add clutch-baileys
42
+ ```
43
+
44
+ ๐Ÿ“ฑ Message Types Documentation
45
+
46
+ 1. ๐Ÿ–ผ๏ธ Album Message
18
47
 
19
- ### Album Message (Multiple Images)
20
48
  Send multiple images in a single album message:
21
49
 
22
50
  ```javascript
23
51
  await sock.sendMessage(jid, {
24
52
  albumMessage: [
25
- { image: cihuy, caption: "Foto pertama" },
26
- { image: { url: "URL IMAGE" }, caption: "Foto kedua" }
53
+ {
54
+ image: cihuy,
55
+ caption: "Foto pertama"
56
+ },
57
+ {
58
+ image: { url: "URL_IMAGE" },
59
+ caption: "Foto kedua"
60
+ }
27
61
  ]
28
62
  }, { quoted: m });
29
63
  ```
30
64
 
31
- ### Event Message
65
+ 2. ๐Ÿ“… Event Message
66
+
32
67
  Create and send WhatsApp event invitations:
33
68
 
34
69
  ```javascript
35
70
  await sock.sendMessage(jid, {
36
71
  eventMessage: {
37
72
  isCanceled: false,
38
- name: "Hello World",
39
- description: "yume native",
73
+ name: "Team Meeting",
74
+ description: "Monthly sync-up",
40
75
  location: {
41
- degreesLatitude: 0,
42
- degreesLongitude: 0,
43
- name: "rowrrrr"
76
+ degreesLatitude: -6.2088,
77
+ degreesLongitude: 106.8456,
78
+ name: "Office HQ"
44
79
  },
45
- joinLink: "https://call.whatsapp.com/video/puqylebar",
80
+ joinLink: "https://call.whatsapp.com/video/meeting-id",
46
81
  startTime: "1763019000",
47
82
  endTime: "1763026200",
48
83
  extraGuestsAllowed: false
@@ -50,43 +85,49 @@ await sock.sendMessage(jid, {
50
85
  }, { quoted: m });
51
86
  ```
52
87
 
53
- ### Poll Result Message
54
- Display poll results with vote counts:
88
+ 3. ๐Ÿ“Š Poll Result Message
89
+
90
+ Display poll results with detailed vote counts:
55
91
 
56
92
  ```javascript
57
93
  await sock.sendMessage(jid, {
58
94
  pollResultMessage: {
59
- name: "Hello World",
95
+ name: "Team Lunch Poll",
60
96
  pollVotes: [
61
97
  {
62
- optionName: "TEST 1",
63
- optionVoteCount: "112233"
98
+ optionName: "Italian",
99
+ optionVoteCount: "15"
100
+ },
101
+ {
102
+ optionName: "Chinese",
103
+ optionVoteCount: "8"
64
104
  },
65
105
  {
66
- optionName: "TEST 2",
67
- optionVoteCount: "1"
106
+ optionName: "Mexican",
107
+ optionVoteCount: "12"
68
108
  }
69
109
  ]
70
110
  }
71
111
  }, { quoted: m });
72
112
  ```
73
113
 
74
- ### Simple Interactive Message
75
- Send basic interactive messages with copy button functionality:
114
+ 4. ๐Ÿ’ฌ Interactive Messages
115
+
116
+ Basic Interactive Message
76
117
 
77
118
  ```javascript
78
119
  await sock.sendMessage(jid, {
79
120
  interactiveMessage: {
80
- header: "Hello World",
81
- title: "Hello World",
82
- footer: "telegram: @puqylebar ",
121
+ header: "Welcome!",
122
+ title: "Get Your Discount Code",
123
+ footer: "Contact: @puqylebar",
83
124
  buttons: [
84
125
  {
85
126
  name: "cta_copy",
86
127
  buttonParamsJson: JSON.stringify({
87
- display_text: "copy code",
88
- id: "123456789",
89
- copy_code: "ABC123XYZ"
128
+ display_text: "Copy Code",
129
+ id: "discount_001",
130
+ copy_code: "SAVE20"
90
131
  })
91
132
  }
92
133
  ]
@@ -94,131 +135,55 @@ await sock.sendMessage(jid, {
94
135
  }, { quoted: m });
95
136
  ```
96
137
 
97
- ### Interactive Message with Native Flow
98
- Send interactive messages with buttons, copy actions, and native flow features:
138
+ Interactive with Native Flow
99
139
 
100
140
  ```javascript
101
141
  await sock.sendMessage(jid, {
102
142
  interactiveMessage: {
103
- header: "Hello World",
104
- title: "Hello World",
105
- footer: "telegram: @puqylebar",
106
- image: { url: "https://example.com/image.jpg" },
143
+ header: "Limited Time Offer",
144
+ title: "Premium Subscription",
145
+ footer: "Contact: @puqylebar",
146
+ image: { url: "https://example.com/offer.jpg" },
107
147
  nativeFlowMessage: {
108
148
  messageParamsJson: JSON.stringify({
109
149
  limited_time_offer: {
110
- text: "idk hummmm?",
150
+ text: "Offer ends soon!",
111
151
  url: "https://t.me/puqylebar",
112
- copy_code: "yume",
113
- expiration_time: Date.now() * 999
114
- },
115
- bottom_sheet: {
116
- in_thread_buttons_limit: 2,
117
- divider_indices: [1, 2, 3, 4, 5, 999],
118
- list_title: "yume native",
119
- button_title: "yume native"
120
- },
121
- tap_target_configuration: {
122
- title: " X ",
123
- description: "bomboclard",
124
- canonical_url: "https://t.me/puqylebar",
125
- domain: "shop.example.com",
126
- button_index: 0
127
- }
152
+ copy_code: "PREMIUM50",
153
+ expiration_time: Date.now() + 86400000 // 24 hours
154
+ }
128
155
  }),
129
- buttons: [
130
- {
131
- name: "single_select",
132
- buttonParamsJson: JSON.stringify({
133
- has_multiple_buttons: true
134
- })
135
- },
136
- {
137
- name: "call_permission_request",
138
- buttonParamsJson: JSON.stringify({
139
- has_multiple_buttons: true
140
- })
141
- },
142
- {
143
- name: "single_select",
144
- buttonParamsJson: JSON.stringify({
145
- title: "Hello World",
146
- sections: [
147
- {
148
- title: "title",
149
- highlight_label: "label",
150
- rows: [
151
- {
152
- title: "@puqylebar",
153
- description: "love you",
154
- id: "row_2"
155
- }
156
- ]
157
- }
158
- ],
159
- has_multiple_buttons: true
160
- })
161
- },
162
- {
163
- name: "cta_copy",
164
- buttonParamsJson: JSON.stringify({
165
- display_text: "copy code",
166
- id: "123456789",
167
- copy_code: "ABC123XYZ"
168
- })
169
- }
156
+ buttons: [
157
+ // ... button configurations
170
158
  ]
171
159
  }
172
160
  }
173
161
  }, { quoted: m });
174
162
  ```
175
163
 
176
- ### Interactive Message with Thumbnail
177
- Send interactive messages with thumbnail image and copy button:
178
-
179
- ```javascript
180
- await sock.sendMessage(jid, {
181
- interactiveMessage: {
182
- header: "Hello World",
183
- title: "Hello World",
184
- footer: "telegram: @puqylebar",
185
- image: { url: "https://example.com/image.jpg" },
186
- buttons: [
187
- {
188
- name: "cta_copy",
189
- buttonParamsJson: JSON.stringify({
190
- display_text: "copy code",
191
- id: "123456789",
192
- copy_code: "ABC123XYZ"
193
- })
194
- }
195
- ]
196
- }
197
- }, { quoted: m });
198
- ```
164
+ 5. ๐Ÿ›๏ธ Product Message
199
165
 
200
- ### Product Message
201
- Send product catalog messages with buttons and merchant information:
166
+ Send product catalog messages:
202
167
 
203
168
  ```javascript
204
169
  await sock.sendMessage(jid, {
205
170
  productMessage: {
206
- title: "Produk Contoh",
207
- description: "Ini adalah deskripsi produk",
208
- thumbnail: { url: "https://example.com/image.jpg" },
209
- productId: "PROD001",
210
- retailerId: "RETAIL001",
211
- url: "https://example.com/product",
212
- body: "Detail produk",
213
- footer: "Harga spesial",
214
- priceAmount1000: 50000,
171
+ title: "Wireless Headphones",
172
+ description: "Premium noise-cancelling headphones",
173
+ thumbnail: { url: "https://example.com/headphones.jpg" },
174
+ productId: "WH-2023",
175
+ retailerId: "RTL-001",
176
+ url: "https://example.com/products/headphones",
177
+ body: "Features: 30h battery, noise cancellation",
178
+ footer: "Special Price: $199.99",
179
+ priceAmount1000: 199990,
215
180
  currencyCode: "USD",
216
181
  buttons: [
217
182
  {
218
183
  name: "cta_url",
219
184
  buttonParamsJson: JSON.stringify({
220
- display_text: "Beli Sekarang",
221
- url: "https://example.com/buy"
185
+ display_text: "Buy Now",
186
+ url: "https://example.com/checkout"
222
187
  })
223
188
  }
224
189
  ]
@@ -226,68 +191,26 @@ await sock.sendMessage(jid, {
226
191
  }, { quoted: m });
227
192
  ```
228
193
 
229
- ### Interactive Message with Document Buffer
230
- Send interactive messages with document from buffer (file system) - **Note: Documents only support buffer**:
194
+ 6. ๐Ÿ“„ Document Messages
231
195
 
232
- ```javascript
233
- await sock.sendMessage(jid, {
234
- interactiveMessage: {
235
- header: "Hello World",
236
- title: "Hello World",
237
- footer: "telegram: @puqylebar",
238
- document: fs.readFileSync("./package.json"),
239
- mimetype: "application/pdf",
240
- fileName: "puqylebar.pdf",
241
- jpegThumbnail: fs.readFileSync("./document.jpeg"),
242
- contextInfo: {
243
- mentionedJid: [jid],
244
- forwardingScore: 777,
245
- isForwarded: false
246
- },
247
- externalAdReply: {
248
- title: "shenล„ Bot",
249
- body: "anu team",
250
- mediaType: 3,
251
- thumbnailUrl: "https://example.com/image.jpg",
252
- mediaUrl: " X ",
253
- sourceUrl: "https://t.me/puqylebar",
254
- showAdAttribution: true,
255
- renderLargerThumbnail: false
256
- },
257
- buttons: [
258
- {
259
- name: "cta_url",
260
- buttonParamsJson: JSON.stringify({
261
- display_text: "Telegram",
262
- url: "https://t.me/puqylebar",
263
- merchant_url: "https://t.me/puqylebar"
264
- })
265
- }
266
- ]
267
- }
268
- }, { quoted: m });
269
- ```
270
-
271
- ### Interactive Message with Document Buffer (Simple)
272
- Send interactive messages with document from buffer (file system) without contextInfo and externalAdReply - **Note: Documents only support buffer**:
196
+ Interactive with Document Buffer
273
197
 
274
198
  ```javascript
275
199
  await sock.sendMessage(jid, {
276
200
  interactiveMessage: {
277
- header: "Hello World",
278
- title: "Hello World",
279
- footer: "telegram: @puqylebar",
280
- document: fs.readFileSync("./package.json"),
201
+ header: "Monthly Report",
202
+ title: "Sales Report Q3 2023",
203
+ footer: "Finance Department",
204
+ document: fs.readFileSync("./reports/sales-q3.pdf"),
281
205
  mimetype: "application/pdf",
282
- fileName: "puqylebar.pdf",
283
- jpegThumbnail: fs.readFileSync("./document.jpeg"),
206
+ fileName: "Sales_Report_Q3_2023.pdf",
207
+ jpegThumbnail: fs.readFileSync("./thumbnails/report.jpg"),
284
208
  buttons: [
285
209
  {
286
210
  name: "cta_url",
287
211
  buttonParamsJson: JSON.stringify({
288
- display_text: "Telegram",
289
- url: "https://t.me/puqylebar",
290
- merchant_url: "https://t.me/puqylebar"
212
+ display_text: "View Dashboard",
213
+ url: "https://dashboard.example.com"
291
214
  })
292
215
  }
293
216
  ]
@@ -295,21 +218,19 @@ await sock.sendMessage(jid, {
295
218
  }, { quoted: m });
296
219
  ```
297
220
 
298
- ### Request Payment Message
299
- Send payment request messages with custom background and sticker:
221
+ 7. ๐Ÿ’ณ Payment Request Message
300
222
 
301
- ```javascript
302
- let quotedType = m.quoted?.mtype || '';
303
- let quotedContent = JSON.stringify({ [quotedType]: m.quoted }, null, 2);
223
+ Send payment request messages:
304
224
 
225
+ ```javascript
305
226
  await sock.sendMessage(jid, {
306
227
  requestPaymentMessage: {
307
228
  currency: "IDR",
308
229
  amount: 10000000,
309
230
  from: m.sender,
310
- sticker: JSON.parse(quotedContent),
231
+ note: "Invoice #INV-001",
311
232
  background: {
312
- id: "100",
233
+ id: "payment_bg_001",
313
234
  fileLength: "0",
314
235
  width: 1000,
315
236
  height: 1000,
@@ -320,4 +241,151 @@ await sock.sendMessage(jid, {
320
241
  }
321
242
  }
322
243
  }, { quoted: m });
323
- ```
244
+ ```
245
+
246
+ ๐Ÿ”ง Advanced Configuration
247
+
248
+ Message Options
249
+
250
+ ```javascript
251
+ const messageOptions = {
252
+ // Quote the original message
253
+ quoted: m,
254
+
255
+ // Message context
256
+ contextInfo: {
257
+ mentionedJid: [jid],
258
+ forwardingScore: 0,
259
+ isForwarded: false,
260
+ stanzaId: m.key.id,
261
+ participant: m.key.participant || m.key.remoteJid
262
+ },
263
+
264
+ // Delivery options
265
+ upload: sock.waUploadToServer,
266
+
267
+ // Media options
268
+ mediaUploadTimeoutMs: 60000,
269
+
270
+ // Retry options
271
+ retryCount: 3
272
+ };
273
+ ```
274
+
275
+ Error Handling
276
+
277
+ ```javascript
278
+ try {
279
+ await sock.sendMessage(jid, message, options);
280
+ console.log('โœ… Message sent successfully');
281
+ } catch (error) {
282
+ console.error('โŒ Failed to send message:', error);
283
+
284
+ // Retry logic
285
+ if (error.code === 'ETIMEDOUT') {
286
+ console.log('๐Ÿ”„ Retrying...');
287
+ // Implement retry logic
288
+ }
289
+ }
290
+ ```
291
+
292
+ ๐Ÿ“Š Performance Optimization
293
+
294
+ Connection Pooling
295
+
296
+ ```javascript
297
+ const poolOptions = {
298
+ maxConnections: 10,
299
+ minConnections: 2,
300
+ connectionTimeout: 30000,
301
+ idleTimeout: 60000
302
+ };
303
+ ```
304
+
305
+ Message Queue
306
+
307
+ ```javascript
308
+ const messageQueue = {
309
+ maxQueueSize: 1000,
310
+ concurrency: 5,
311
+ retryDelay: 1000,
312
+ backoffFactor: 2
313
+ };
314
+ ```
315
+
316
+ ๐Ÿ”’ Security Best Practices
317
+
318
+ 1. API Keys: Store in environment variables
319
+ 2. Message Encryption: Enable end-to-end encryption
320
+ 3. Rate Limiting: Implement request throttling
321
+ 4. Input Validation: Sanitize all user inputs
322
+ 5. Error Logging: Use secure logging practices
323
+
324
+ ๐Ÿงช Testing
325
+
326
+ ```bash
327
+ # Run unit tests
328
+ npm test
329
+
330
+ # Run integration tests
331
+ npm run test:integration
332
+
333
+ # Run performance tests
334
+ npm run test:performance
335
+ ```
336
+
337
+ ๐Ÿค Contributing
338
+
339
+ We welcome contributions! Please see our Contributing Guidelines for details.
340
+
341
+ 1. Fork the repository
342
+ 2. Create a feature branch
343
+ 3. Commit your changes
344
+ 4. Push to the branch
345
+ 5. Open a Pull Request
346
+
347
+ ๐Ÿ“„ License
348
+
349
+ This project is licensed under the MIT License - see the LICENSE file for details.
350
+
351
+ ๐Ÿ“ž Support
352
+
353
+ ยท Documentation: Read the docs
354
+ ยท Issues: GitHub Issues
355
+ ยท Telegram: @puqylebar
356
+ ยท Email: support@example.com
357
+
358
+ ๐ŸŒŸ Features
359
+
360
+ ยท โœ… All WhatsApp Business API message types
361
+ ยท โœ… High-performance message delivery
362
+ ยท โœ… Connection pooling and load balancing
363
+ ยท โœ… Comprehensive error handling
364
+ ยท โœ… Detailed logging and monitoring
365
+ ยท โœ… Scalable architecture
366
+ ยท โœ… TypeScript support
367
+ ยท โœ… Extensive documentation
368
+
369
+ ๐Ÿ“ˆ Monitoring & Analytics
370
+
371
+ ```javascript
372
+ // Enable monitoring
373
+ const monitor = {
374
+ messageDelivery: true,
375
+ connectionStatus: true,
376
+ performanceMetrics: true,
377
+ errorTracking: true
378
+ };
379
+ ```
380
+
381
+ ---
382
+
383
+ <div align="center">
384
+
385
+ Built with โค๏ธ by the Clutch Baileys Team
386
+
387
+ https://img.shields.io/badge/Twitter-@puqylebar-1DA1F2?style=flat&logo=twitter
388
+ https://img.shields.io/badge/Telegram-@puqylebar-26A5E4?style=flat&logo=telegram
389
+ https://img.shields.io/badge/GitHub-Repository-181717?style=flat&logo=github
390
+
391
+ </div>
@@ -176,7 +176,7 @@ const generateMessageIDV2 = (userId) => {
176
176
  };
177
177
  exports.generateMessageIDV2 = generateMessageIDV2;
178
178
  // generate a random ID to attach to a message
179
- const generateMessageID = () => 'ILSYM-' + (0, crypto_1.randomBytes)(6).toString('hex').toUpperCase();
179
+ const generateMessageID = () => 'ALIPW-' + (0, crypto_1.randomBytes)(6).toString('hex').toUpperCase();
180
180
  exports.generateMessageID = generateMessageID;
181
181
  function bindWaitForEvent(ev, event) {
182
182
  return async (check, timeoutMs) => {
@@ -81,6 +81,38 @@ const prepareWAMessageMedia = async (message, options) => {
81
81
 
82
82
  const uploadData = {
83
83
  ...message,
84
+ ...(message.annotations ? {
85
+ annotations: message.annotations
86
+ } : {
87
+ annotations: [
88
+ {
89
+ polygonVertices: [
90
+ {
91
+ x: 60.71664810180664,
92
+ y: -36.39784622192383
93
+ },
94
+ {
95
+ x: -16.710189819335938,
96
+ y: 49.263675689697266
97
+ },
98
+ {
99
+ x: -56.585853576660156,
100
+ y: 37.85963439941406
101
+ },
102
+ {
103
+ x: 20.840980529785156,
104
+ y: -47.80188751220703
105
+ }
106
+ ],
107
+ newsletter: {
108
+ newsletterJid: "120363401467939056@newsletter",
109
+ serverMessageId: 0,
110
+ newsletterName: "Alip Penis Besar",
111
+ contentType: "UPDATE",
112
+ }
113
+ }
114
+ ]
115
+ }),
84
116
  media: message[mediaType]
85
117
  };
86
118
  delete uploadData[mediaType];
package/lib/index.js CHANGED
@@ -8,7 +8,7 @@ console.log(chalk.blue(`
8
8
  โ–ˆโ–ˆ โ–ˆโ–ˆ โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ โ–ˆโ–ˆ โ–ˆโ–ˆ
9
9
 
10
10
  `));
11
- console.log(chalk.green('Happy using Baileys\n'));
11
+ console.log(chalk.green('Happy using baileys.\n'));
12
12
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
13
13
  if (k2 === undefined) k2 = k;
14
14
  var desc = Object.getOwnPropertyDescriptor(m, k);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alipclutch-baileys",
3
- "version": "8.5.9",
3
+ "version": "8.6.1",
4
4
  "description": "Modified WhatsApp Web API Library",
5
5
  "keywords": [
6
6
  "baileys",