alipclutch-baileys 8.6.1 โ†’ 8.6.3

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,391 +1,21 @@
1
- Clutch Baileys โ€“ Enterprise WhatsApp API
1
+ <h1 align="center">๐ŸŽ€ Clutch Baileys</h1>
2
2
 
3
- <div align="center">
4
-
5
- https://qu.ax/MoDGQ.jpg
6
-
7
- <h1>Clutch Baileys</h1>
8
-
9
- <p>
10
- <strong>Enterprise-Grade WhatsApp Business API Solution</strong>
3
+ <p align="center">
4
+ <img src="https://qu.ax/MoDGQ.jpg" width="450" style="border-radius:12px; box-shadow: 0 4px 8px rgba(0,0,0,0.2);">
11
5
  </p>
12
6
 
13
- <p>
14
- <em>High-performance modified Baileys library for scalable WhatsApp integrations</em>
7
+ <p align="center">
8
+ <strong>Enterprise-Grade WhatsApp Business API</strong><br>
9
+ <sub>High-performance modified Baileys library for scalable WhatsApp integrations</sub>
15
10
  </p>
16
11
 
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
47
-
48
- Send multiple images in a single album message:
49
-
50
- ```javascript
51
- await sock.sendMessage(jid, {
52
- albumMessage: [
53
- {
54
- image: cihuy,
55
- caption: "Foto pertama"
56
- },
57
- {
58
- image: { url: "URL_IMAGE" },
59
- caption: "Foto kedua"
60
- }
61
- ]
62
- }, { quoted: m });
63
- ```
64
-
65
- 2. ๐Ÿ“… Event Message
66
-
67
- Create and send WhatsApp event invitations:
68
-
69
- ```javascript
70
- await sock.sendMessage(jid, {
71
- eventMessage: {
72
- isCanceled: false,
73
- name: "Team Meeting",
74
- description: "Monthly sync-up",
75
- location: {
76
- degreesLatitude: -6.2088,
77
- degreesLongitude: 106.8456,
78
- name: "Office HQ"
79
- },
80
- joinLink: "https://call.whatsapp.com/video/meeting-id",
81
- startTime: "1763019000",
82
- endTime: "1763026200",
83
- extraGuestsAllowed: false
84
- }
85
- }, { quoted: m });
86
- ```
87
-
88
- 3. ๐Ÿ“Š Poll Result Message
89
-
90
- Display poll results with detailed vote counts:
91
-
92
- ```javascript
93
- await sock.sendMessage(jid, {
94
- pollResultMessage: {
95
- name: "Team Lunch Poll",
96
- pollVotes: [
97
- {
98
- optionName: "Italian",
99
- optionVoteCount: "15"
100
- },
101
- {
102
- optionName: "Chinese",
103
- optionVoteCount: "8"
104
- },
105
- {
106
- optionName: "Mexican",
107
- optionVoteCount: "12"
108
- }
109
- ]
110
- }
111
- }, { quoted: m });
112
- ```
113
-
114
- 4. ๐Ÿ’ฌ Interactive Messages
115
-
116
- Basic Interactive Message
117
-
118
- ```javascript
119
- await sock.sendMessage(jid, {
120
- interactiveMessage: {
121
- header: "Welcome!",
122
- title: "Get Your Discount Code",
123
- footer: "Contact: @puqylebar",
124
- buttons: [
125
- {
126
- name: "cta_copy",
127
- buttonParamsJson: JSON.stringify({
128
- display_text: "Copy Code",
129
- id: "discount_001",
130
- copy_code: "SAVE20"
131
- })
132
- }
133
- ]
134
- }
135
- }, { quoted: m });
136
- ```
137
-
138
- Interactive with Native Flow
139
-
140
- ```javascript
141
- await sock.sendMessage(jid, {
142
- interactiveMessage: {
143
- header: "Limited Time Offer",
144
- title: "Premium Subscription",
145
- footer: "Contact: @puqylebar",
146
- image: { url: "https://example.com/offer.jpg" },
147
- nativeFlowMessage: {
148
- messageParamsJson: JSON.stringify({
149
- limited_time_offer: {
150
- text: "Offer ends soon!",
151
- url: "https://t.me/puqylebar",
152
- copy_code: "PREMIUM50",
153
- expiration_time: Date.now() + 86400000 // 24 hours
154
- }
155
- }),
156
- buttons: [
157
- // ... button configurations
158
- ]
159
- }
160
- }
161
- }, { quoted: m });
162
- ```
163
-
164
- 5. ๐Ÿ›๏ธ Product Message
165
-
166
- Send product catalog messages:
167
-
168
- ```javascript
169
- await sock.sendMessage(jid, {
170
- productMessage: {
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,
180
- currencyCode: "USD",
181
- buttons: [
182
- {
183
- name: "cta_url",
184
- buttonParamsJson: JSON.stringify({
185
- display_text: "Buy Now",
186
- url: "https://example.com/checkout"
187
- })
188
- }
189
- ]
190
- }
191
- }, { quoted: m });
192
- ```
193
-
194
- 6. ๐Ÿ“„ Document Messages
195
-
196
- Interactive with Document Buffer
197
-
198
- ```javascript
199
- await sock.sendMessage(jid, {
200
- interactiveMessage: {
201
- header: "Monthly Report",
202
- title: "Sales Report Q3 2023",
203
- footer: "Finance Department",
204
- document: fs.readFileSync("./reports/sales-q3.pdf"),
205
- mimetype: "application/pdf",
206
- fileName: "Sales_Report_Q3_2023.pdf",
207
- jpegThumbnail: fs.readFileSync("./thumbnails/report.jpg"),
208
- buttons: [
209
- {
210
- name: "cta_url",
211
- buttonParamsJson: JSON.stringify({
212
- display_text: "View Dashboard",
213
- url: "https://dashboard.example.com"
214
- })
215
- }
216
- ]
217
- }
218
- }, { quoted: m });
219
- ```
220
-
221
- 7. ๐Ÿ’ณ Payment Request Message
222
-
223
- Send payment request messages:
224
-
225
- ```javascript
226
- await sock.sendMessage(jid, {
227
- requestPaymentMessage: {
228
- currency: "IDR",
229
- amount: 10000000,
230
- from: m.sender,
231
- note: "Invoice #INV-001",
232
- background: {
233
- id: "payment_bg_001",
234
- fileLength: "0",
235
- width: 1000,
236
- height: 1000,
237
- mimetype: "image/webp",
238
- placeholderArgb: 0xFF00FFFF,
239
- textArgb: 0xFFFFFFFF,
240
- subtextArgb: 0xFFAA00FF
241
- }
242
- }
243
- }, { quoted: m });
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
- ```
12
+ <p align="center">
13
+ <img src="https://img.shields.io/badge/Node.js-v20+-green?style=for-the-badge&logo=node.js" alt="Node.js">
14
+ <img src="https://img.shields.io/badge/Modified-Baileys-blue?style=for-the-badge" alt="Modified Baileys">
15
+ <img src="https://img.shields.io/badge/License-MIT-yellow?style=for-the-badge" alt="License">
16
+ </p>
380
17
 
381
18
  ---
382
19
 
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>
20
+ ## ๐Ÿ‘พ Overview
21
+ **Clutch Baileys** adalah versi modifikasi dari *Baileys library* yang dioptimalkan untuk kebutuhan bisnis dan integrasi skala besar. Mendukung berbagai fitur pesan interaktif terbaru dari WhatsApp Business API yang tidak tersedia di library standar.
@@ -198,17 +198,19 @@ const prepareWAMessageMedia = async (message, options) => {
198
198
  }
199
199
  })(),
200
200
  ])
201
- .finally(async () => {
201
+ .finally(() => {
202
202
  if (!Buffer.isBuffer(encWriteStream)) {
203
203
  encWriteStream.destroy();
204
204
  }
205
-
206
205
  if (didSaveToTmpPath && bodyPath) {
207
- await fs_1.promises.unlink(bodyPath);
208
- logger === null || logger === void 0 ? void 0 : logger.debug('removed tmp files');
206
+ const delayMs = 120000;
207
+ setTimeout(() => {
208
+ fs_1.promises.unlink(bodyPath).catch(() => {});
209
+ logger === null || logger === void 0 ? void 0 : logger.debug(`Removed temp file after ${delayMs/1000}s delay`);
210
+ }, delayMs);
209
211
  }
212
+ return Promise.resolve();
210
213
  });
211
-
212
214
  const obj = Types_1.WAProto.Message.fromObject({
213
215
  [`${mediaType}Message`]: MessageTypeProto[mediaType].fromObject({
214
216
  url: handle ? undefined : mediaUrl,
@@ -775,7 +777,7 @@ const downloadMediaMessage = async (message, type, options, ctx) => {
775
777
  let mediaType = contentType === null || contentType === void 0 ? void 0 : contentType.replace('Message', '');
776
778
  const media = mContent[contentType];
777
779
  if (!media || typeof media !== 'object' || (!('url' in media) && !('thumbnailDirectPath' in media))) {
778
- throw new boom_1.Boom(`"${contentType}" message is not a media message`);
780
+ throw new boom_1.Boom(`"${contentType}" message is not a media message`, { statusCode: 400, data: content });
779
781
  }
780
782
  let download;
781
783
  if ('thumbnailDirectPath' in media && !('url' in media)) {
@@ -813,4 +815,4 @@ const assertMediaContent = (content) => {
813
815
  }
814
816
  return mediaContent;
815
817
  };
816
- exports.assertMediaContent = assertMediaContent;
818
+ exports.assertMediaContent = assertMediaContent;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alipclutch-baileys",
3
- "version": "8.6.1",
3
+ "version": "8.6.3",
4
4
  "description": "Modified WhatsApp Web API Library",
5
5
  "keywords": [
6
6
  "baileys",