@pontalabs/baileys 1.2.4 → 1.2.6
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 +574 -1067
- package/lib/Socket/messages-send.js +129 -41
- package/lib/Utils/rich-message-utils.js +31 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,41 +1,60 @@
|
|
|
1
|
+
<img src="https://capsule-render.vercel.app/api?type=waving&color=0:0f0c29,50:302b63,100:24243e&height=220§ion=header&text=Baileys%20PontaLabs&fontSize=52&fontColor=ffffff&animation=fadeIn&fontAlignY=38&desc=⚡%20AI%20Rich%20Messages%20•%20High%20Performance%20•%20Advanced%20Features&descAlignY=58&descSize=16" width="100%"/>
|
|
2
|
+
|
|
1
3
|
<div align="center">
|
|
2
4
|
|
|
3
|
-
<!--
|
|
4
|
-
<
|
|
5
|
+
<!-- Animated Banner with Glow -->
|
|
6
|
+
<a href="https://github.com/PontaSja">
|
|
7
|
+
<img src="https://raw.githubusercontent.com/PontaSja/image/408b34d9d8521dd22688a24d6b28db3f8ab1825a/IMG-20260710-WA0070.jpg" alt="PontaSockets Banner" width="720" style="border-radius: 18px; box-shadow: 0 0 40px rgba(0,217,255,0.4), 0 0 80px rgba(124,58,237,0.3);" />
|
|
8
|
+
</a>
|
|
5
9
|
|
|
6
10
|
<br><br>
|
|
7
11
|
|
|
8
|
-
<!--
|
|
9
|
-
<
|
|
10
|
-
<img src="https://
|
|
11
|
-
|
|
12
|
-
</h2>
|
|
12
|
+
<!-- Typing Animation -->
|
|
13
|
+
<a href="https://git.io/typing-svg">
|
|
14
|
+
<img src="https://readme-typing-svg.demolab.com?font=JetBrains+Mono&weight=700&size=24&duration=3000&pause=1000&color=00D9FF¢er=true&vCenter=true&width=800&height=50&lines=Extended+from+%40whiskeysockets%2Fbaileys;🚀+Packed+with+Exclusive+Patches+%26+AI+Features;💬+Rich+Messages+%7C+Newsletter+%7C+Groups;⚡+Built+for+Speed%2C+Stability+%26+Scale" alt="Typing Animation" />
|
|
15
|
+
</a>
|
|
13
16
|
|
|
14
17
|
<br>
|
|
15
18
|
|
|
16
|
-
<!-- Badges -->
|
|
17
|
-
<
|
|
18
|
-
<
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
<
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
<
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
<
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
19
|
+
<!-- Animated Badges -->
|
|
20
|
+
<p>
|
|
21
|
+
<a href="https://www.npmjs.com/package/@pontalabs/baileys">
|
|
22
|
+
<img src="https://img.shields.io/npm/v/@pontalabs/baileys?style=for-the-badge&color=cb3837&label=npm&logo=npm&logoColor=white" alt="NPM Version" />
|
|
23
|
+
</a>
|
|
24
|
+
<a href="https://nodejs.org">
|
|
25
|
+
<img src="https://img.shields.io/badge/node-%3E%3D18.x-339933?style=for-the-badge&logo=node.js&logoColor=white" alt="Node.js" />
|
|
26
|
+
</a>
|
|
27
|
+
<a href="./LICENSE">
|
|
28
|
+
<img src="https://img.shields.io/badge/license-Non--Commercial-orange?style=for-the-badge" alt="License" />
|
|
29
|
+
</a>
|
|
30
|
+
<a href="https://github.com/WhiskeySockets/Baileys">
|
|
31
|
+
<img src="https://img.shields.io/badge/fork-whiskeysockets%2Fbaileys-6e5494?style=for-the-badge&logo=github" alt="Fork" />
|
|
32
|
+
</a>
|
|
33
|
+
</p>
|
|
34
|
+
|
|
35
|
+
<!-- Animated Stats / Divider -->
|
|
36
|
+
<img src="https://raw.githubusercontent.com/andreasbm/readme/master/assets/lines/rainbow.png" width="100%" />
|
|
31
37
|
|
|
32
38
|
<p><em>Extended from <code>@whiskeysockets/baileys</code> — packed with exclusive patches, AI-rich messages, and advanced WhatsApp features.</em></p>
|
|
33
39
|
|
|
40
|
+
<!-- Visitor + Animated Wave -->
|
|
41
|
+
<img src="https://komarev.com/ghpvc/?username=PontaSja&label=Views&color=00D9FF&style=for-the-badge" alt="Views" />
|
|
42
|
+
<img src="https://img.shields.io/github/stars/PontaSja/baileys?color=FFD700&style=for-the-badge&logo=github" alt="Stars" />
|
|
43
|
+
|
|
44
|
+
</div>
|
|
45
|
+
|
|
46
|
+
<br>
|
|
47
|
+
|
|
48
|
+
<div align="center">
|
|
49
|
+
|
|
50
|
+
### ⚡ Quick Navigation ⚡
|
|
51
|
+
`Installation` • `Quick Start` • `Rich Messages` • `Newsletter` • `Groups`
|
|
52
|
+
|
|
34
53
|
</div>
|
|
35
54
|
|
|
36
55
|
---
|
|
37
56
|
|
|
38
|
-
##
|
|
57
|
+
## <img src="https://raw.githubusercontent.com/Tarikul-Islam-Anik/Animated-Fluent-Emojis/master/Emojis/Objects/Bookmark.png" width="30" /> Table of Contents
|
|
39
58
|
|
|
40
59
|
- [Why This Fork?](#-why-this-fork)
|
|
41
60
|
- [Features](#-features)
|
|
@@ -56,8 +75,20 @@
|
|
|
56
75
|
|
|
57
76
|
---
|
|
58
77
|
|
|
78
|
+
<div align="center">
|
|
79
|
+
<img src="https://raw.githubusercontent.com/platane/snk/output/github-contribution-grid-snake-dark.svg" alt="Snake animation" width="100%"/>
|
|
80
|
+
</div>
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
59
84
|
<details>
|
|
60
|
-
<summary><h2>📥 Installation
|
|
85
|
+
<summary><h2>📥 Installation <img src="https://raw.githubusercontent.com/Tarikul-Islam-Anik/Animated-Fluent-Emojis/master/Emojis/Objects/Inbox%20Tray.png" width="28" /></h2></summary>
|
|
86
|
+
|
|
87
|
+
<br>
|
|
88
|
+
|
|
89
|
+
<div align="center">
|
|
90
|
+
<img src="https://readme-typing-svg.demolab.com?font=Fira+Code&size=18&pause=1000&color=00D9FF¢er=true&width=600&lines=npm+install+%40pontalabs%2Fbaileys" alt="install" />
|
|
91
|
+
</div>
|
|
61
92
|
|
|
62
93
|
```bash
|
|
63
94
|
# npm
|
|
@@ -65,6 +96,12 @@ npm install @pontalabs/baileys
|
|
|
65
96
|
|
|
66
97
|
# yarn
|
|
67
98
|
yarn add @pontalabs/baileys
|
|
99
|
+
|
|
100
|
+
# pnpm
|
|
101
|
+
pnpm add @pontalabs/baileys
|
|
102
|
+
|
|
103
|
+
# bun
|
|
104
|
+
bun add @pontalabs/baileys
|
|
68
105
|
```
|
|
69
106
|
|
|
70
107
|
</details>
|
|
@@ -72,7 +109,9 @@ yarn add @pontalabs/baileys
|
|
|
72
109
|
---
|
|
73
110
|
|
|
74
111
|
<details>
|
|
75
|
-
<summary><h2>🚀 Quick Start
|
|
112
|
+
<summary><h2>🚀 Quick Start <img src="https://raw.githubusercontent.com/Tarikul-Islam-Anik/Animated-Fluent-Emojis/master/Emojis/Travel%20and%20places/Rocket.png" width="28" /></h2></summary>
|
|
113
|
+
|
|
114
|
+
<br>
|
|
76
115
|
|
|
77
116
|
```js
|
|
78
117
|
import makeWASocket, { useMultiFileAuthState } from '@pontalabs/baileys'
|
|
@@ -95,13 +134,15 @@ async function start() {
|
|
|
95
134
|
start()
|
|
96
135
|
```
|
|
97
136
|
|
|
137
|
+
> <img src="https://raw.githubusercontent.com/Tarikul-Islam-Anik/Animated-Fluent-Emojis/master/Emojis/Symbols/Bubbles.png" width="20" /> **Tip:** Gunakan `printQRInTerminal: true` untuk scan QR langsung di terminal!
|
|
138
|
+
|
|
98
139
|
</details>
|
|
99
140
|
|
|
100
141
|
---
|
|
101
142
|
|
|
102
143
|
## 📖 Documentation
|
|
103
144
|
|
|
104
|
-
###
|
|
145
|
+
### <img src="https://raw.githubusercontent.com/Tarikul-Islam-Anik/Animated-Fluent-Emojis/master/Emojis/Objects/Electric%20Plug.png" width="25" /> Connecting
|
|
105
146
|
|
|
106
147
|
<details>
|
|
107
148
|
<summary><b>🔗 QR Code</b></summary>
|
|
@@ -257,695 +298,230 @@ await sock.sendMessage(jid, {
|
|
|
257
298
|
await sock.sendMessage(jid, {
|
|
258
299
|
location: {
|
|
259
300
|
degreesLatitude: 37.422,
|
|
260
|
-
degreesLongitude: -122.084
|
|
261
|
-
name: 'Google HQ'
|
|
301
|
+
degreesLongitude: -122.084
|
|
262
302
|
}
|
|
263
303
|
})
|
|
264
304
|
```
|
|
265
305
|
</details>
|
|
266
306
|
|
|
267
307
|
<details>
|
|
268
|
-
<summary><b
|
|
269
|
-
|
|
270
|
-
```js
|
|
271
|
-
await sock.sendMessage(jid, { react: { text: '👍', key: message.key } })
|
|
272
|
-
// Remove reaction
|
|
273
|
-
await sock.sendMessage(jid, { react: { text: '', key: message.key } })
|
|
274
|
-
```
|
|
275
|
-
</details>
|
|
276
|
-
|
|
277
|
-
<details>
|
|
278
|
-
<summary><b>📊 Poll</b></summary>
|
|
279
|
-
|
|
280
|
-
```js
|
|
281
|
-
await sock.sendMessage(jid, {
|
|
282
|
-
poll: {
|
|
283
|
-
name: 'Favorite color?',
|
|
284
|
-
values: ['Red', 'Blue', 'Green'],
|
|
285
|
-
selectableCount: 1
|
|
286
|
-
}
|
|
287
|
-
})
|
|
288
|
-
```
|
|
289
|
-
</details>
|
|
290
|
-
|
|
291
|
-
<details>
|
|
292
|
-
<summary><b>📸 Album</b></summary>
|
|
293
|
-
|
|
294
|
-
```js
|
|
295
|
-
await sock.sendAlbumMessage(jid, [
|
|
296
|
-
{ image: { url: 'https://example.com/1.jpg' }, caption: 'First' },
|
|
297
|
-
{ video: { url: 'https://example.com/clip.mp4' }, caption: 'Second' }
|
|
298
|
-
], { quoted: message, delay: 3000 })
|
|
299
|
-
```
|
|
300
|
-
</details>
|
|
301
|
-
|
|
302
|
-
<details>
|
|
303
|
-
<summary><b>👨💻 Interactive (Native Flow & Carousel)</b></summary>
|
|
304
|
-
|
|
305
|
-
```js
|
|
306
|
-
// Native Flow
|
|
307
|
-
await sock.sendMessage(jid, {
|
|
308
|
-
text: 'Choose an option:',
|
|
309
|
-
title: 'Title',
|
|
310
|
-
footer: '© PontaLabs Baileys',
|
|
311
|
-
interactive: [{
|
|
312
|
-
name: 'quick_reply',
|
|
313
|
-
buttonParamsJson: JSON.stringify({ display_text: 'Quick Reply', id: '123' })
|
|
314
|
-
}]
|
|
315
|
-
})
|
|
316
|
-
|
|
317
|
-
// Carousel
|
|
318
|
-
await sock.sendMessage(jid, {
|
|
319
|
-
text: 'Check out our collection!',
|
|
320
|
-
title: 'Catalog',
|
|
321
|
-
footer: '© PontaLabs Baileys',
|
|
322
|
-
cards: [{
|
|
323
|
-
image: { url: 'https://example.com/image.jpg' },
|
|
324
|
-
title: 'Product Name',
|
|
325
|
-
body: 'Product description',
|
|
326
|
-
footer: '© PontaLabs',
|
|
327
|
-
buttons: [{
|
|
328
|
-
name: 'quick_reply',
|
|
329
|
-
buttonParamsJson: JSON.stringify({ display_text: 'Select', id: '1' })
|
|
330
|
-
}]
|
|
331
|
-
}]
|
|
332
|
-
})
|
|
333
|
-
```
|
|
334
|
-
</details>
|
|
335
|
-
|
|
336
|
-
<details>
|
|
337
|
-
<summary><b>🔩 Raw / Legacy Buttons</b></summary>
|
|
338
|
-
|
|
339
|
-
> Varian tombol raw/proto WhatsApp mentah — lebih fleksibel, tapi kamu yang susun strukturnya sendiri.
|
|
340
|
-
|
|
341
|
-
#### `buttonsMessage`
|
|
342
|
-
|
|
343
|
-
Kirim objek `buttonsMessage` proto WhatsApp mentah — thumbnail lokasi di dalamnya otomatis diproses kalau berupa Buffer/URL/path.
|
|
344
|
-
|
|
345
|
-
```js
|
|
346
|
-
await sock.sendMessage(jid, {
|
|
347
|
-
buttonsMessage: {
|
|
348
|
-
contentText: 'Pilih salah satu:',
|
|
349
|
-
footerText: '© PontaCT',
|
|
350
|
-
buttons: [
|
|
351
|
-
{ buttonId: 'a', buttonText: { displayText: 'Opsi A' }, type: 1 },
|
|
352
|
-
{ buttonId: 'b', buttonText: { displayText: 'Opsi B' }, type: 1 }
|
|
353
|
-
]
|
|
354
|
-
}
|
|
355
|
-
}, { quoted: message })
|
|
356
|
-
```
|
|
357
|
-
|
|
358
|
-
#### `templateButtons`
|
|
308
|
+
<summary><b>📄 Document</b></summary>
|
|
359
309
|
|
|
360
310
|
```js
|
|
361
311
|
await sock.sendMessage(jid, {
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
{ index: 1, urlButton: { displayText: 'Kunjungi Website', url: 'https://example.com' } },
|
|
366
|
-
{ index: 2, callButton: { displayText: 'Telepon', phoneNumber: '+6281234567890' } }
|
|
367
|
-
]
|
|
368
|
-
}, { quoted: message })
|
|
369
|
-
```
|
|
370
|
-
|
|
371
|
-
#### `interactiveButtons`
|
|
372
|
-
|
|
373
|
-
```js
|
|
374
|
-
await sock.sendMessage(jid, {
|
|
375
|
-
title: 'Menu Utama',
|
|
376
|
-
subtitle: 'Silakan pilih',
|
|
377
|
-
text: 'Ada yang bisa dibantu?',
|
|
378
|
-
footer: '© PontaCT',
|
|
379
|
-
interactiveButtons: [
|
|
380
|
-
{ name: 'quick_reply', buttonParamsJson: JSON.stringify({ display_text: 'Mulai', id: 'start' }) }
|
|
381
|
-
]
|
|
382
|
-
}, { quoted: message })
|
|
383
|
-
```
|
|
384
|
-
|
|
385
|
-
</details>
|
|
386
|
-
|
|
387
|
-
<details>
|
|
388
|
-
<summary><b>📌 Pin & Keep</b></summary>
|
|
389
|
-
|
|
390
|
-
```js
|
|
391
|
-
// Pin — 24h = 86400 · 7d = 604800 · 30d = 2592000
|
|
392
|
-
await sock.sendMessage(jid, { pin: { type: 1, time: 86400, key: message.key } })
|
|
393
|
-
|
|
394
|
-
// Keep
|
|
395
|
-
await sock.sendMessage(jid, { keep: { key: message.key, type: 1 } })
|
|
396
|
-
```
|
|
397
|
-
</details>
|
|
398
|
-
|
|
399
|
-
---
|
|
400
|
-
|
|
401
|
-
### 📍 Location + Buttons
|
|
402
|
-
|
|
403
|
-
> Location message with native list menu (`single_select`) and extra buttons — all in one `buttonsMessage`.
|
|
404
|
-
|
|
405
|
-
<details>
|
|
406
|
-
<summary><b>Location + List Menu</b></summary>
|
|
407
|
-
|
|
408
|
-
```js
|
|
409
|
-
await sock.sendMessage(jid, {
|
|
410
|
-
buttonLocation: {
|
|
411
|
-
latitude: -6.2088,
|
|
412
|
-
longitude: 106.8456,
|
|
413
|
-
name: 'Kantor Pusat PontaCT',
|
|
414
|
-
address: 'Jl. Sudirman No. 1, Jakarta Pusat',
|
|
415
|
-
text: 'Temukan kami di sini:',
|
|
416
|
-
footer: '© PontaCT',
|
|
417
|
-
thumbnail: 'https://example.com/map-preview.jpg',
|
|
418
|
-
listButtonText: 'Pilih Layanan',
|
|
419
|
-
listSectionTitle: 'Layanan Tersedia',
|
|
420
|
-
listMenu: [
|
|
421
|
-
{ title: 'Customer Service', description: 'Lantai 1, Senin–Jumat 08.00–17.00', id: 'cs' },
|
|
422
|
-
{ title: 'Kasir & Pembayaran', description: 'Lantai 2, buka setiap hari', id: 'kasir' },
|
|
423
|
-
{ title: 'Gudang & Pengiriman', description: 'Gedung B, pintu belakang', id: 'gudang' }
|
|
424
|
-
]
|
|
425
|
-
}
|
|
312
|
+
document: fs.readFileSync('file.pdf'),
|
|
313
|
+
mimetype: 'application/pdf',
|
|
314
|
+
fileName: 'myfile.pdf'
|
|
426
315
|
})
|
|
427
316
|
```
|
|
428
317
|
</details>
|
|
429
318
|
|
|
430
319
|
<details>
|
|
431
|
-
<summary><b
|
|
320
|
+
<summary><b>😆 Reaction</b></summary>
|
|
432
321
|
|
|
433
322
|
```js
|
|
434
323
|
await sock.sendMessage(jid, {
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
name: 'Toko PontaCT',
|
|
439
|
-
address: 'Jl. Kebon Sirih No. 10, Jakarta',
|
|
440
|
-
text: 'Kunjungi toko kami!',
|
|
441
|
-
footer: '© PontaCT',
|
|
442
|
-
thumbnail: 'https://example.com/store.jpg',
|
|
443
|
-
extraButtons: [
|
|
444
|
-
{ id: 'call', displayText: '📞 Hubungi Kami' },
|
|
445
|
-
{ id: 'whatsapp', displayText: '💬 WhatsApp' },
|
|
446
|
-
{ id: 'maps', displayText: '🗺️ Buka di Maps' }
|
|
447
|
-
]
|
|
324
|
+
react: {
|
|
325
|
+
text: '🔥',
|
|
326
|
+
key: message.key
|
|
448
327
|
}
|
|
449
328
|
})
|
|
450
329
|
```
|
|
451
330
|
</details>
|
|
452
331
|
|
|
453
332
|
<details>
|
|
454
|
-
<summary><b
|
|
333
|
+
<summary><b>📊 Poll</b></summary>
|
|
455
334
|
|
|
456
335
|
```js
|
|
457
336
|
await sock.sendMessage(jid, {
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
address: 'Jl. MH Thamrin No. 5, Jakarta',
|
|
463
|
-
text: 'Selamat datang di pusat layanan kami.',
|
|
464
|
-
footer: 'Buka setiap hari 09.00–21.00',
|
|
465
|
-
thumbnail: 'https://example.com/plaza.jpg',
|
|
466
|
-
listButtonText: 'Pilih Tujuan',
|
|
467
|
-
listSectionTitle: 'Area Tersedia',
|
|
468
|
-
listMenu: [
|
|
469
|
-
{ title: 'Food Court', description: 'Lt. 1 — lebih dari 30 tenant', id: 'food' },
|
|
470
|
-
{ title: 'Cinema', description: 'Lt. 4 — 8 studio', id: 'cinema' },
|
|
471
|
-
{ title: 'Customer Care', description: 'Lt. 2 — sebelah eskalator', id: 'care' }
|
|
472
|
-
],
|
|
473
|
-
extraButtons: [
|
|
474
|
-
{ id: 'navigate', displayText: '🧭 Navigasi' },
|
|
475
|
-
{ id: 'promo', displayText: '🎁 Promo Hari Ini' }
|
|
476
|
-
]
|
|
337
|
+
poll: {
|
|
338
|
+
name: 'Favorite Programming Language?',
|
|
339
|
+
values: ['JavaScript', 'Python', 'Go'],
|
|
340
|
+
selectableCount: 1
|
|
477
341
|
}
|
|
478
342
|
})
|
|
479
343
|
```
|
|
480
344
|
</details>
|
|
481
345
|
|
|
482
|
-
<details>
|
|
483
|
-
<summary><b>📋 Fields Reference</b></summary>
|
|
484
|
-
|
|
485
|
-
| Field | Type | Required | Default | Description |
|
|
486
|
-
|:---|:---|:---:|:---|:---|
|
|
487
|
-
| `latitude` | `number` | — | `0` | Latitude coordinate |
|
|
488
|
-
| `longitude` | `number` | — | `0` | Longitude coordinate |
|
|
489
|
-
| `name` | `string` | — | `'Location'` | Place name |
|
|
490
|
-
| `address` | `string` | — | `''` | Text address |
|
|
491
|
-
| `text` | `string` | — | `''` | Message body text |
|
|
492
|
-
| `footer` | `string` | — | `''` | Footer text |
|
|
493
|
-
| `thumbnail` | `Buffer / URL / path` | ✅ | — | Map preview image |
|
|
494
|
-
| `listButtonText` | `string` | — | `'Pilih Menu'` | List button label |
|
|
495
|
-
| `listSectionTitle` | `string` | — | `'Pilihan'` | List section title |
|
|
496
|
-
| `listMenu` | `array` | — | — | Menu rows |
|
|
497
|
-
| `extraButtons` | `array` | — | — | Extra buttons |
|
|
498
|
-
|
|
499
|
-
</details>
|
|
500
|
-
|
|
501
346
|
---
|
|
502
347
|
|
|
503
|
-
###
|
|
348
|
+
### <img src="https://raw.githubusercontent.com/Tarikul-Islam-Anik/Animated-Fluent-Emojis/master/Emojis/Activities/Sparkles.png" width="25" /> Rich Messages
|
|
504
349
|
|
|
505
|
-
>
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
<summary><b>Basic Order Status</b></summary>
|
|
509
|
-
|
|
510
|
-
```js
|
|
511
|
-
await sock.sendMessage(jid, {
|
|
512
|
-
orderStatus: {
|
|
513
|
-
image: 'https://example.com/order-banner.jpg',
|
|
514
|
-
title: 'Status Pesanan',
|
|
515
|
-
text: 'Pesanan kamu sedang diproses oleh penjual.',
|
|
516
|
-
referenceId: 'ORD-20250629-001',
|
|
517
|
-
status: 'PROCESSING',
|
|
518
|
-
currency: 'IDR'
|
|
519
|
-
}
|
|
520
|
-
})
|
|
521
|
-
```
|
|
522
|
-
</details>
|
|
523
|
-
|
|
524
|
-
<details>
|
|
525
|
-
<summary><b>Full Order Status with Total & Tax</b></summary>
|
|
526
|
-
|
|
527
|
-
```js
|
|
528
|
-
await sock.sendMessage(jid, {
|
|
529
|
-
orderStatus: {
|
|
530
|
-
image: 'https://example.com/order.jpg',
|
|
531
|
-
title: 'Update Pesanan #ORD-2025-001',
|
|
532
|
-
text: 'Pesananmu sedang dalam perjalanan! 🚚',
|
|
533
|
-
footer: 'Estimasi tiba: 2–3 hari kerja',
|
|
534
|
-
referenceId: 'ORD-2025-001',
|
|
535
|
-
status: 'SHIPPED',
|
|
536
|
-
subtotalValue: 15000000,
|
|
537
|
-
subtotalOffset: 100,
|
|
538
|
-
taxValue: 1500000,
|
|
539
|
-
taxOffset: 100,
|
|
540
|
-
currency: 'IDR'
|
|
541
|
-
}
|
|
542
|
-
})
|
|
543
|
-
```
|
|
544
|
-
</details>
|
|
350
|
+
> <img src="https://raw.githubusercontent.com/Tarikul-Islam-Anik/Animated-Fluent-Emojis/master/Emojis/Objects/Light%20Bulb.png" width="20" /> Semua fitur **Rich Message** dikirim melalui `sock.sendMessage()` dan dirender sebagai AI bot message di WhatsApp.
|
|
351
|
+
>
|
|
352
|
+
> **Tidak ada daftar `build.*` terpisah.** Builder, shortcut lama, `items`, `richResponse`, HTML WebView, interactive builder, dan opsi terkait semuanya didokumentasikan di bagian ini supaya API Rich tetap berada di satu tempat.
|
|
545
353
|
|
|
546
354
|
<details>
|
|
547
|
-
<summary><b
|
|
355
|
+
<summary><b>📌 Quick Start — Rich Message <img src="https://raw.githubusercontent.com/Tarikul-Islam-Anik/Animated-Fluent-Emojis/master/Emojis/Symbols/Double%20Exclamation%20Mark.png" width="20" /></b></summary>
|
|
548
356
|
|
|
549
357
|
```js
|
|
550
|
-
const fs = require('fs')
|
|
551
358
|
await sock.sendMessage(jid, {
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
title: 'Pesanan Dikonfirmasi ✅',
|
|
555
|
-
text: 'Terima kasih telah berbelanja!',
|
|
556
|
-
referenceId: 'ORD-LOCAL-001',
|
|
557
|
-
status: 'PROCESSING',
|
|
558
|
-
currency: 'IDR'
|
|
559
|
-
}
|
|
560
|
-
})
|
|
359
|
+
richText: 'Halo! 👋'
|
|
360
|
+
}, { quoted: message })
|
|
561
361
|
```
|
|
562
|
-
</details>
|
|
563
362
|
|
|
564
|
-
|
|
565
|
-
<summary><b>📋 Fields Reference</b></summary>
|
|
566
|
-
|
|
567
|
-
| Field | Type | Required | Default | Description |
|
|
568
|
-
|:---|:---|:---:|:---|:---|
|
|
569
|
-
| `image` | `Buffer / URL / path` | ✅ | — | Header card image |
|
|
570
|
-
| `title` | `string` | — | `'Order Status'` | Header title |
|
|
571
|
-
| `text` | `string` | — | `'Silakan cek status pesanan Anda.'` | Body text |
|
|
572
|
-
| `footer` | `string` | — | `'Powered by PontaCT'` | Footer text |
|
|
573
|
-
| `referenceId` | `string` | — | `'PT-001'` | Order reference ID |
|
|
574
|
-
| `status` | `string` | — | `'PROCESSING'` | Order status |
|
|
575
|
-
| `subtotalValue` | `number` | — | `0` | Subtotal value (in offset units) |
|
|
576
|
-
| `subtotalOffset` | `number` | — | `100` | Value divider |
|
|
577
|
-
| `taxValue` | `number` | — | `0` | Tax value |
|
|
578
|
-
| `taxOffset` | `number` | — | `100` | Tax divider |
|
|
579
|
-
| `currency` | `string` | — | `'IDR'` | Currency code |
|
|
580
|
-
|
|
581
|
-
> **Status values:** `PROCESSING` · `SHIPPED` · `DELIVERED` · `CANCELLED` · `REFUNDED`
|
|
582
|
-
|
|
583
|
-
</details>
|
|
584
|
-
|
|
585
|
-
---
|
|
586
|
-
|
|
587
|
-
### 🧱 Rich Builder API — `build.*`
|
|
588
|
-
|
|
589
|
-
`build.*` adalah cara singkat untuk membuat **Rich AI item** yang langsung bisa dipakai di `sock.sendMessage()`.
|
|
590
|
-
|
|
591
|
-
> **Tidak perlu import `build`.** Package mengekspos `build` secara global saat dimuat.
|
|
592
|
-
|
|
593
|
-
#### 🚀 Cara paling sederhana
|
|
363
|
+
Builder `build.*` hanya membuat payload. Pengiriman tetap melalui `sock.sendMessage()`:
|
|
594
364
|
|
|
595
365
|
```js
|
|
596
366
|
await sock.sendMessage(jid, {
|
|
597
367
|
items: [
|
|
598
368
|
build.richText('Halo! 👋'),
|
|
599
|
-
build.
|
|
600
|
-
build.richTip('Selesai!')
|
|
369
|
+
build.richTip('Dikirim dari PontaLabs')
|
|
601
370
|
]
|
|
602
371
|
})
|
|
603
372
|
```
|
|
604
373
|
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
#### ⏱️ Delay antar build
|
|
608
|
-
|
|
609
|
-
Kalau setiap item builder ingin dikirim sebagai **pesan terpisah**, gunakan `buildDelay` dalam milidetik:
|
|
610
|
-
|
|
611
|
-
```js
|
|
612
|
-
await sock.sendMessage(jid, {
|
|
613
|
-
items: [
|
|
614
|
-
build.richText('Build 1'),
|
|
615
|
-
build.richText('Build 2'),
|
|
616
|
-
build.richTip('Build 3')
|
|
617
|
-
],
|
|
618
|
-
buildDelay: 1000
|
|
619
|
-
})
|
|
620
|
-
```
|
|
621
|
-
|
|
622
|
-
Urutannya menjadi `Build 1 → tunggu 1 detik → Build 2 → tunggu 1 detik → Build 3`.
|
|
623
|
-
|
|
624
|
-
Tanpa `buildDelay`, item Rich AI tetap digabung menjadi **satu Rich AI message**. Jika `items` berisi `build.button()`, `build.buttonV2()`, atau `build.carousel()`, item interactive dikirim sebagai message native-flow tersendiri karena bukan Rich AI primitive.
|
|
625
|
-
|
|
626
|
-
> `buildDelay` hanya berlaku untuk `items`. Nilai dalam milidetik harus lebih besar dari `0`.
|
|
627
|
-
|
|
628
|
-
#### ✨ Semua factory
|
|
629
|
-
|
|
630
|
-
| Factory | Contoh | Hasil |
|
|
631
|
-
| --- | --- | --- |
|
|
632
|
-
| `build.button()` | `build.button().addReply('OK', 'ok')` | Native Flow buttons |
|
|
633
|
-
| `build.buttonV2()` | `build.buttonV2().addButton('OK')` | Buttons V2 |
|
|
634
|
-
| `build.carousel()` | `build.carousel().addCard(card)` | Interactive carousel |
|
|
635
|
-
| `build.richText(text)` | `build.richText('Halo')` | Text |
|
|
636
|
-
| `build.richFOAText(text)` | `build.richFOAText('Halo')` | FOA text |
|
|
637
|
-
| `build.richHtml(html)` | `build.richHtml('<html>...</html>')` | HTML WebView |
|
|
638
|
-
| `build.richCode(code, language)` | `build.richCode('console.log(1)', 'javascript')` | Code |
|
|
639
|
-
| `build.richTable(table)` | `build.richTable([['A', 'B']])` | Table |
|
|
640
|
-
| `build.richSource(sources)` | `build.richSource([...])` | Sources |
|
|
641
|
-
| `build.richReels(items)` | `build.richReels([...])` | Reels |
|
|
642
|
-
| `build.richImage(url)` | `build.richImage('https://...')` | Image |
|
|
643
|
-
| `build.richVideo(url)` | `build.richVideo('https://...')` | Video |
|
|
644
|
-
| `build.richProduct(data)` | `build.richProduct({...})` | Product |
|
|
645
|
-
| `build.richPost(data)` | `build.richPost({...})` | Post |
|
|
646
|
-
| `build.richMetadata(text)` | `build.richMetadata('Info')` | Metadata |
|
|
647
|
-
| `build.richTip(text)` | `build.richTip('Tip')` | Tip |
|
|
648
|
-
| `build.richWidget(data)` | `build.richWidget({...})` | Widget |
|
|
649
|
-
| `build.richFooterAction(data)` | `build.richFooterAction({...})` | Footer action |
|
|
650
|
-
| `build.richSuggest(value)` | `build.richSuggest('Lanjutkan')` | Suggestion |
|
|
651
|
-
|
|
652
|
-
#### 🧩 Interactive Builder — Button, ButtonV2 & Carousel
|
|
653
|
-
|
|
654
|
-
Builder interactive dari `mbuilder.js` juga tersedia langsung di namespace `build` dan **tidak membutuhkan `sock` saat dibuat**. Pesannya tetap dikirim melalui `sock.sendMessage()`.
|
|
655
|
-
|
|
656
|
-
##### Native Flow — `build.button()`
|
|
374
|
+
> `build` tersedia dari package dan tidak membutuhkan `sock` saat membuat payload.
|
|
657
375
|
|
|
658
|
-
|
|
659
|
-
const button = build.button()
|
|
660
|
-
.setTitle('Menu')
|
|
661
|
-
.setBody('Pilih salah satu')
|
|
662
|
-
.setFooter('PontaLabs')
|
|
663
|
-
.addReply('Halo', 'hello')
|
|
664
|
-
.addUrl('Website', 'https://example.com')
|
|
665
|
-
.addCopy('Copy ID', 'ABC123')
|
|
666
|
-
|
|
667
|
-
await sock.sendMessage(jid, {
|
|
668
|
-
items: [button]
|
|
669
|
-
})
|
|
670
|
-
```
|
|
376
|
+
</details>
|
|
671
377
|
|
|
672
|
-
|
|
378
|
+
<details>
|
|
379
|
+
<summary><b>📝 Rich Text — <code>richText</code></b></summary>
|
|
673
380
|
|
|
674
|
-
|
|
675
|
-
- `setContextInfo()` / `addPayload()`
|
|
676
|
-
- `setImage()` / `setDocument()` / `setMedia()`
|
|
677
|
-
- `clearButtons()` / `setParams()` / `addButton()`
|
|
678
|
-
- `addSelection()` / `makeSection()` / `makeRow()`
|
|
679
|
-
- `addReply()` / `addCall()` / `addReminder()` / `addCancelReminder()`
|
|
680
|
-
- `addAddress()` / `addLocation()` / `addUrl()` / `addCopy()`
|
|
381
|
+
Rich markdown text yang dirender sebagai `GenAIMarkdownTextUXPrimitive`.
|
|
681
382
|
|
|
682
|
-
|
|
383
|
+
**Direct:**
|
|
683
384
|
|
|
684
385
|
```js
|
|
685
|
-
const buttons = build.buttonV2()
|
|
686
|
-
.setBody('Pilih aksi')
|
|
687
|
-
.setFooter('PontaLabs')
|
|
688
|
-
.addButton('Yes')
|
|
689
|
-
.addButton('No')
|
|
690
|
-
|
|
691
386
|
await sock.sendMessage(jid, {
|
|
692
|
-
|
|
693
|
-
})
|
|
387
|
+
richText: '*Halo!* Ini rich text dari bot.\nStatus: `success`\nWaktu: _120ms_'
|
|
388
|
+
}, { quoted: message })
|
|
694
389
|
```
|
|
695
390
|
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
##### Carousel — `build.carousel()`
|
|
391
|
+
**Array / beberapa paragraf:**
|
|
699
392
|
|
|
700
393
|
```js
|
|
701
|
-
const carousel = build.carousel()
|
|
702
|
-
.setBody('Pilih produk')
|
|
703
|
-
.setFooter('PontaLabs')
|
|
704
|
-
.addCard({
|
|
705
|
-
header: {
|
|
706
|
-
hasMediaAttachment: true,
|
|
707
|
-
imageMessage: imageMessage
|
|
708
|
-
},
|
|
709
|
-
body: { text: 'Produk A' },
|
|
710
|
-
footer: { text: 'Rp 10.000' },
|
|
711
|
-
nativeFlowMessage: {
|
|
712
|
-
messageParamsJson: '{}',
|
|
713
|
-
buttons: [{
|
|
714
|
-
name: 'quick_reply',
|
|
715
|
-
buttonParamsJson: JSON.stringify({
|
|
716
|
-
display_text: 'Pilih',
|
|
717
|
-
id: 'product_a'
|
|
718
|
-
})
|
|
719
|
-
}]
|
|
720
|
-
}
|
|
721
|
-
})
|
|
722
|
-
|
|
723
394
|
await sock.sendMessage(jid, {
|
|
724
|
-
|
|
725
|
-
|
|
395
|
+
richText: [
|
|
396
|
+
'Baris pertama.',
|
|
397
|
+
'Baris kedua.',
|
|
398
|
+
'Baris ketiga.'
|
|
399
|
+
]
|
|
400
|
+
}, { quoted: message })
|
|
726
401
|
```
|
|
727
402
|
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
##### ⏱️ Interactive + `buildDelay`
|
|
731
|
-
|
|
732
|
-
Semua builder dapat dicampur. Jika `buildDelay` dipasang, setiap item dikirim sebagai pesan terpisah dengan jeda yang sama, termasuk Button, ButtonV2, Carousel, dan Rich AI:
|
|
403
|
+
**Builder:**
|
|
733
404
|
|
|
734
405
|
```js
|
|
735
406
|
await sock.sendMessage(jid, {
|
|
736
407
|
items: [
|
|
737
|
-
build.richText('Halo 👋')
|
|
738
|
-
|
|
739
|
-
build.richHtml('<h1>WebView</h1>'),
|
|
740
|
-
build.buttonV2().addButton('OK'),
|
|
741
|
-
build.carousel().addCard(card)
|
|
742
|
-
],
|
|
743
|
-
buildDelay: 5000
|
|
408
|
+
build.richText('Halo! 👋')
|
|
409
|
+
]
|
|
744
410
|
})
|
|
745
411
|
```
|
|
746
412
|
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
> `build.button()`, `build.buttonV2()`, dan `build.carousel()` adalah payload builders. Tidak perlu `send()` dan tidak perlu memasukkan `sock` ke factory. `sock.sendMessage()` tetap menjadi jalur pengiriman utama.
|
|
750
|
-
|
|
751
|
-
#### 🧩 Campur dengan shortcut lama
|
|
752
|
-
|
|
753
|
-
API lama **tetap dipertahankan**. Builder bisa dicampur dengan object Rich AI biasa di `items`.
|
|
413
|
+
</details>
|
|
754
414
|
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
items: [
|
|
758
|
-
{ richText: 'Shortcut lama tetap jalan' },
|
|
759
|
-
build.richText('Item dari Builder'),
|
|
760
|
-
{ richTip: 'Shortcut lama' },
|
|
761
|
-
build.richTip('Tip dari Builder')
|
|
762
|
-
]
|
|
763
|
-
})
|
|
764
|
-
```
|
|
415
|
+
<details>
|
|
416
|
+
<summary><b>🌐 Rich HTML WebView — <code>richHtml</code></b></summary>
|
|
765
417
|
|
|
766
|
-
|
|
418
|
+
Mengirim HTML langsung ke primitive `GenAIaeacdsnwHtmlPrimitive`.
|
|
767
419
|
|
|
768
|
-
|
|
420
|
+
**Direct `sendMessage`:**
|
|
769
421
|
|
|
770
422
|
```js
|
|
771
423
|
const html = `<!DOCTYPE html>
|
|
772
424
|
<html>
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
425
|
+
<head>
|
|
426
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
427
|
+
</head>
|
|
428
|
+
<body>
|
|
429
|
+
<h2>🎮 Game Center</h2>
|
|
430
|
+
<button onclick="document.body.innerHTML += '<p>Clicked!</p>'">
|
|
431
|
+
Play
|
|
432
|
+
</button>
|
|
433
|
+
</body>
|
|
779
434
|
</html>`
|
|
780
435
|
|
|
781
436
|
await sock.sendMessage(jid, {
|
|
782
|
-
|
|
783
|
-
})
|
|
784
|
-
```
|
|
785
|
-
|
|
786
|
-
Karena HTML berjalan di sisi client/webview, gunakan HTML/JavaScript yang memang kamu kontrol dan sesuaikan dengan dukungan client WhatsApp yang dituju.
|
|
787
|
-
|
|
788
|
-
#### 🛠️ Builder untuk edit / delete
|
|
789
|
-
|
|
790
|
-
Untuk kebutuhan yang benar-benar membutuhkan state dan manipulasi node, gunakan `build.AIRich(sock)`.
|
|
791
|
-
|
|
792
|
-
```js
|
|
793
|
-
const ai = build.AIRich(sock)
|
|
794
|
-
|
|
795
|
-
ai.addText('⏳ Loading...', { id: 'status' })
|
|
796
|
-
ai.addTip('Mohon tunggu')
|
|
797
|
-
|
|
798
|
-
await ai.send(jid)
|
|
799
|
-
|
|
800
|
-
// Ganti node berdasarkan ID
|
|
801
|
-
ai.addText('✅ Selesai!', { replace: 'status' })
|
|
802
|
-
|
|
803
|
-
// Hapus node
|
|
804
|
-
ai.delete('status')
|
|
805
|
-
|
|
806
|
-
// Sisipkan setelah node tertentu
|
|
807
|
-
ai.addTip('Tambahan', { insertAt: 'status' })
|
|
808
|
-
```
|
|
809
|
-
|
|
810
|
-
> `replace` dan `insertAt` adalah **options pada `add*()`**, bukan method `ai.replace()` atau `ai.insertAt()`.
|
|
811
|
-
|
|
812
|
-
#### 📝 Contoh workflow edit
|
|
813
|
-
|
|
814
|
-
```js
|
|
815
|
-
const ai = build.AIRich(sock)
|
|
816
|
-
ai.addText('⏳ Memproses...', { id: 'answer' })
|
|
817
|
-
|
|
818
|
-
await ai.send(jid)
|
|
819
|
-
|
|
820
|
-
const result = await getAIResponse()
|
|
821
|
-
|
|
822
|
-
ai.addText(result, { replace: 'answer' })
|
|
823
|
-
ai.addTip('Generated by AI')
|
|
824
|
-
|
|
825
|
-
await ai.sendEdit(jid)
|
|
437
|
+
richHtml: html
|
|
438
|
+
}, { quoted: message })
|
|
826
439
|
```
|
|
827
440
|
|
|
828
|
-
|
|
441
|
+
**Builder:**
|
|
829
442
|
|
|
830
443
|
```js
|
|
831
|
-
await sock.sendMessage(jid, {
|
|
832
|
-
richText: 'Halo'
|
|
833
|
-
})
|
|
834
|
-
|
|
835
444
|
await sock.sendMessage(jid, {
|
|
836
445
|
items: [
|
|
837
|
-
|
|
838
|
-
{ richTip: 'Testing' }
|
|
446
|
+
build.richHtml(html)
|
|
839
447
|
]
|
|
840
448
|
})
|
|
841
449
|
```
|
|
842
450
|
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
- **`sock.sendMessage()` + shortcut** → paling sederhana.
|
|
846
|
-
- **`sock.sendMessage()` + `build.rich*()`** → payload Rich AI yang lebih rapi dan mudah dirangkai.
|
|
847
|
-
- **`build.AIRich(sock)`** → kebutuhan advanced seperti `id`, `replace`, `insertAt`, `delete`, dan edit message.
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
### 🤖 Rich Messages
|
|
851
|
-
|
|
852
|
-
> All rich messages are sent via standard `sendMessage` and rendered as AI bot messages in WhatsApp. Use the appropriate key instead of `text`, `image`, `video`, etc.
|
|
853
|
-
|
|
854
|
-
**Quick jump:** [Rich Text](#rich-text) · [Code](#rich-code-block) · [Table](#rich-table) · [Images](#rich-images) · [Video](#rich-video) · [Suggestions](#rich-suggestions) · [LaTeX](#rich-latex) · [Product](#rich-product) · [Post](#rich-post) · [Reels](#rich-reels) · [Sources](#rich-sources) · [Tip & Footer](#rich-tip--footer) · [Mixed](#rich-mixed) · [Response](#rich-response)
|
|
855
|
-
|
|
856
|
-
---
|
|
857
|
-
|
|
858
|
-
#### 📝 Rich Text
|
|
859
|
-
|
|
860
|
-
> AI bot-styled markdown text rendered in `richResponseMessage`.
|
|
861
|
-
|
|
862
|
-
<details>
|
|
863
|
-
<summary><b>Simple Text</b></summary>
|
|
864
|
-
|
|
865
|
-
```js
|
|
866
|
-
await sock.sendMessage(jid, { richText: 'Halo! Ini pesan dari bot.' }, { quoted: message })
|
|
867
|
-
```
|
|
868
|
-
</details>
|
|
869
|
-
|
|
870
|
-
<details>
|
|
871
|
-
<summary><b>Markdown (bold, italic, inline code)</b></summary>
|
|
451
|
+
**Raw item:**
|
|
872
452
|
|
|
873
453
|
```js
|
|
874
454
|
await sock.sendMessage(jid, {
|
|
875
|
-
|
|
876
|
-
|
|
455
|
+
items: [
|
|
456
|
+
{ html: html }
|
|
457
|
+
]
|
|
458
|
+
})
|
|
877
459
|
```
|
|
878
|
-
</details>
|
|
879
460
|
|
|
880
|
-
|
|
881
|
-
<summary><b>Multiple Paragraphs (Array)</b></summary>
|
|
461
|
+
> HTML berjalan di sisi client/webview. Gunakan HTML/JavaScript yang kamu kontrol dan sesuaikan dengan dukungan client WhatsApp yang dituju.
|
|
882
462
|
|
|
883
|
-
```js
|
|
884
|
-
await sock.sendMessage(jid, {
|
|
885
|
-
richText: ['Baris pertama.', 'Baris kedua.', 'Baris ketiga.']
|
|
886
|
-
}, { quoted: message })
|
|
887
|
-
```
|
|
888
463
|
</details>
|
|
889
464
|
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
#### 💻 Rich Code Block
|
|
465
|
+
<details>
|
|
466
|
+
<summary><b>👤 Rich Card — <code>richCard</code></b></summary>
|
|
893
467
|
|
|
894
|
-
|
|
468
|
+
Entity card / profile preview yang dirender sebagai AI message. Cocok untuk menampilkan kontak, channel, atau brand profile tanpa perlu builder terpisah.
|
|
895
469
|
|
|
896
|
-
|
|
897
|
-
<summary><b>Single Block</b></summary>
|
|
470
|
+
**Direct `sendMessage`:**
|
|
898
471
|
|
|
899
472
|
```js
|
|
900
473
|
await sock.sendMessage(jid, {
|
|
901
|
-
|
|
902
|
-
|
|
474
|
+
richCard: {
|
|
475
|
+
thumbnail_url: 'https://example.com/profile.jpg',
|
|
476
|
+
verification: true,
|
|
477
|
+
title: 'PontaLabs',
|
|
478
|
+
subtitle: 'Official Channel',
|
|
479
|
+
description: 'WhatsApp Bot Framework by PontaLabs',
|
|
480
|
+
entity_id: '62123456789',
|
|
481
|
+
entity_url: 'https://wa.me/62123456789',
|
|
482
|
+
profile_url: 'https://example.com/profile.jpg'
|
|
483
|
+
}
|
|
903
484
|
}, { quoted: message })
|
|
904
485
|
```
|
|
905
|
-
</details>
|
|
906
486
|
|
|
907
|
-
|
|
908
|
-
<summary><b>Multiple Blocks</b></summary>
|
|
487
|
+
**Builder:**
|
|
909
488
|
|
|
910
489
|
```js
|
|
911
490
|
await sock.sendMessage(jid, {
|
|
912
|
-
|
|
913
|
-
{
|
|
914
|
-
|
|
491
|
+
items: [
|
|
492
|
+
build.richCard({
|
|
493
|
+
thumbnail_url: 'https://example.com/profile.jpg',
|
|
494
|
+
verification: true,
|
|
495
|
+
title: 'PontaLabs',
|
|
496
|
+
subtitle: 'Official Channel',
|
|
497
|
+
description: 'WhatsApp Bot Framework by PontaLabs',
|
|
498
|
+
entity_id: '62123456789',
|
|
499
|
+
entity_url: 'https://wa.me/62123456789',
|
|
500
|
+
profile_url: 'https://example.com/profile.jpg'
|
|
501
|
+
})
|
|
915
502
|
]
|
|
916
|
-
}
|
|
503
|
+
})
|
|
917
504
|
```
|
|
918
|
-
</details>
|
|
919
505
|
|
|
920
|
-
|
|
921
|
-
|
|
506
|
+
| Property | Type | Required | Description |
|
|
507
|
+
|:---|:---|:---:|:---|
|
|
508
|
+
| `thumbnail_url` | `string` | — | URL thumbnail publik untuk card |
|
|
509
|
+
| `verification` | `boolean` | — | Menampilkan badge verified |
|
|
510
|
+
| `title` | `string` | ✅ | Judul utama entity |
|
|
511
|
+
| `subtitle` | `string` | — | Subjudul / role / tagline |
|
|
512
|
+
| `description` | `string` | — | Deskripsi singkat entity |
|
|
513
|
+
| `entity_id` | `string` | ✅ | ID / nomor WhatsApp entity |
|
|
514
|
+
| `entity_url` | `string` | — | URL tujuan saat card diklik |
|
|
515
|
+
| `profile_url` | `string` | — | Fallback URL untuk avatar / profile |
|
|
922
516
|
|
|
923
|
-
|
|
924
|
-
|:---|:---|
|
|
925
|
-
| JavaScript | `javascript` · `js` |
|
|
926
|
-
| TypeScript | `typescript` · `ts` |
|
|
927
|
-
| Python | `python` · `py` |
|
|
928
|
-
| Bash / Shell | `bash` · `sh` · `zsh` |
|
|
929
|
-
| Go | `go` · `golang` |
|
|
930
|
-
| Rust | `rust` · `rs` |
|
|
931
|
-
| C / C++ | `c` · `h` · `cpp` · `c++` |
|
|
932
|
-
| C# | `csharp` · `cs` |
|
|
933
|
-
| CSS / HTML | `css` · `html` |
|
|
934
|
-
| PowerShell / CMD | `powershell` · `ps1` · `cmd` · `bat` |
|
|
935
|
-
| SQL / JSON | `sql` · `json` |
|
|
517
|
+
> Gunakan URL thumbnail yang valid dan dapat diakses publik. `entity_id` harus dalam format nomor internasional tanpa `+`.
|
|
936
518
|
|
|
937
519
|
</details>
|
|
938
520
|
|
|
939
|
-
---
|
|
940
|
-
|
|
941
|
-
#### 📊 Rich Table
|
|
942
|
-
|
|
943
|
-
> Structured table with `title`, `headers`, and `rows`.
|
|
944
|
-
>
|
|
945
|
-
> ⚠️ Shorthand `{ title?, headers?, rows }` ini hanya berlaku untuk key `table` top-level dan di dalam `items`. Kalau dipakai di dalam `richResponse`, isi `table` harus sudah berupa array baris jadi — lihat [Rich Response](#-rich-response--richresponse).
|
|
946
|
-
|
|
947
521
|
<details>
|
|
948
|
-
<summary><b
|
|
522
|
+
<summary><b>📊 Rich Table — <code>table</code> / <code>richTable</code></b></summary>
|
|
523
|
+
|
|
524
|
+
**Top-level:**
|
|
949
525
|
|
|
950
526
|
```js
|
|
951
527
|
await sock.sendMessage(jid, {
|
|
@@ -960,57 +536,37 @@ await sock.sendMessage(jid, {
|
|
|
960
536
|
}
|
|
961
537
|
}, { quoted: message })
|
|
962
538
|
```
|
|
963
|
-
</details>
|
|
964
539
|
|
|
965
|
-
|
|
966
|
-
<summary><b>Table without Title</b></summary>
|
|
540
|
+
**Builder:**
|
|
967
541
|
|
|
968
542
|
```js
|
|
969
543
|
await sock.sendMessage(jid, {
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
['
|
|
974
|
-
['
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
}, { quoted: message })
|
|
544
|
+
items: [
|
|
545
|
+
build.richTable([
|
|
546
|
+
['Name', 'Role'],
|
|
547
|
+
['Ponta', 'Admin'],
|
|
548
|
+
['Yue', 'Member']
|
|
549
|
+
])
|
|
550
|
+
]
|
|
551
|
+
})
|
|
979
552
|
```
|
|
980
|
-
</details>
|
|
981
553
|
|
|
982
|
-
|
|
983
|
-
<summary><b>Data Only (no header)</b></summary>
|
|
554
|
+
> Untuk `richResponse`, format `table` berbeda: gunakan array baris siap-pakai seperti `{ items: [...], isHeading }`, bukan `{ headers, rows }`.
|
|
984
555
|
|
|
985
|
-
```js
|
|
986
|
-
await sock.sendMessage(jid, {
|
|
987
|
-
table: {
|
|
988
|
-
rows: [
|
|
989
|
-
['RAM', '512 MB'],
|
|
990
|
-
['CPU', '4 Core'],
|
|
991
|
-
['Uptime', '99.9%']
|
|
992
|
-
]
|
|
993
|
-
}
|
|
994
|
-
}, { quoted: message })
|
|
995
|
-
```
|
|
996
556
|
</details>
|
|
997
557
|
|
|
998
|
-
---
|
|
999
|
-
|
|
1000
|
-
#### 🖼️ Rich Images
|
|
1001
|
-
|
|
1002
|
-
> AI image grid. Single URL = single image, multiple URLs = carousel.
|
|
1003
|
-
|
|
1004
558
|
<details>
|
|
1005
|
-
<summary><b>
|
|
559
|
+
<summary><b>🖼️ Rich Images — <code>richImages</code> / <code>richImage</code></b></summary>
|
|
560
|
+
|
|
561
|
+
**Single image:**
|
|
1006
562
|
|
|
1007
563
|
```js
|
|
1008
|
-
await sock.sendMessage(jid, {
|
|
564
|
+
await sock.sendMessage(jid, {
|
|
565
|
+
richImages: 'https://example.com/photo.jpg'
|
|
566
|
+
}, { quoted: message })
|
|
1009
567
|
```
|
|
1010
|
-
</details>
|
|
1011
568
|
|
|
1012
|
-
|
|
1013
|
-
<summary><b>Multiple Images (Grid)</b></summary>
|
|
569
|
+
**Multiple images:**
|
|
1014
570
|
|
|
1015
571
|
```js
|
|
1016
572
|
await sock.sendMessage(jid, {
|
|
@@ -1021,252 +577,156 @@ await sock.sendMessage(jid, {
|
|
|
1021
577
|
]
|
|
1022
578
|
}, { quoted: message })
|
|
1023
579
|
```
|
|
1024
|
-
</details>
|
|
1025
580
|
|
|
1026
|
-
|
|
1027
|
-
<summary><b>Inside items / richResponse</b></summary>
|
|
581
|
+
**Builder:**
|
|
1028
582
|
|
|
1029
583
|
```js
|
|
1030
|
-
// items
|
|
1031
584
|
await sock.sendMessage(jid, {
|
|
1032
585
|
items: [
|
|
1033
|
-
|
|
1034
|
-
{ images: ['https://example.com/1.jpg', 'https://example.com/2.jpg'] }
|
|
1035
|
-
]
|
|
1036
|
-
}, { quoted: message })
|
|
1037
|
-
|
|
1038
|
-
// richResponse
|
|
1039
|
-
await sock.sendMessage(jid, {
|
|
1040
|
-
richResponse: [
|
|
1041
|
-
{ text: 'Lihat gambarnya:' },
|
|
1042
|
-
{ images: 'https://example.com/banner.jpg' }
|
|
586
|
+
build.richImage('https://example.com/photo.jpg')
|
|
1043
587
|
]
|
|
1044
|
-
}
|
|
588
|
+
})
|
|
1045
589
|
```
|
|
1046
|
-
</details>
|
|
1047
590
|
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
#### 🎥 Rich Video
|
|
1051
|
-
|
|
1052
|
-
> Video embed as AI animated media (`GenAIImaginePrimitive` with `imagine_type: ANIMATE`).
|
|
591
|
+
</details>
|
|
1053
592
|
|
|
1054
593
|
<details>
|
|
1055
|
-
<summary><b>
|
|
594
|
+
<summary><b>🎥 Rich Video — <code>richVideo</code> / <code>richVideo</code> builder</b></summary>
|
|
595
|
+
|
|
596
|
+
**Shorthand:**
|
|
1056
597
|
|
|
1057
598
|
```js
|
|
1058
|
-
await sock.sendMessage(jid, {
|
|
599
|
+
await sock.sendMessage(jid, {
|
|
600
|
+
richVideo: 'https://example.com/clip.mp4'
|
|
601
|
+
}, { quoted: message })
|
|
1059
602
|
```
|
|
1060
|
-
</details>
|
|
1061
603
|
|
|
1062
|
-
|
|
1063
|
-
<summary><b>Full Options</b></summary>
|
|
604
|
+
**Full options:**
|
|
1064
605
|
|
|
1065
606
|
```js
|
|
1066
607
|
await sock.sendMessage(jid, {
|
|
1067
608
|
richVideo: {
|
|
1068
609
|
url: 'https://example.com/clip.mp4',
|
|
1069
|
-
mimeType: 'video/mp4',
|
|
1070
|
-
duration: 15,
|
|
1071
|
-
fallbackText: 'Preview video'
|
|
610
|
+
mimeType: 'video/mp4',
|
|
611
|
+
duration: 15,
|
|
612
|
+
fallbackText: 'Preview video'
|
|
1072
613
|
}
|
|
1073
614
|
}, { quoted: message })
|
|
1074
615
|
```
|
|
1075
|
-
</details>
|
|
1076
616
|
|
|
1077
|
-
|
|
1078
|
-
<summary><b>Inside items / richResponse</b></summary>
|
|
617
|
+
**Builder:**
|
|
1079
618
|
|
|
1080
619
|
```js
|
|
1081
|
-
// items
|
|
1082
620
|
await sock.sendMessage(jid, {
|
|
1083
621
|
items: [
|
|
1084
|
-
|
|
1085
|
-
{ videoUrl: 'https://example.com/clip.mp4', duration: 20 }
|
|
622
|
+
build.richVideo('https://example.com/clip.mp4')
|
|
1086
623
|
]
|
|
1087
|
-
}
|
|
1088
|
-
|
|
1089
|
-
// richResponse
|
|
1090
|
-
await sock.sendMessage(jid, {
|
|
1091
|
-
richResponse: [
|
|
1092
|
-
{ text: 'Tutorial:' },
|
|
1093
|
-
{ video: { url: 'https://example.com/tutorial.mp4', duration: 30 } }
|
|
1094
|
-
]
|
|
1095
|
-
}, { quoted: message })
|
|
624
|
+
})
|
|
1096
625
|
```
|
|
1097
|
-
</details>
|
|
1098
|
-
|
|
1099
|
-
---
|
|
1100
|
-
|
|
1101
|
-
#### 💡 Rich Suggestions
|
|
1102
626
|
|
|
1103
|
-
>
|
|
627
|
+
</details>
|
|
1104
628
|
|
|
1105
629
|
<details>
|
|
1106
|
-
<summary><b>
|
|
630
|
+
<summary><b>💡 Rich Suggestions — <code>richSuggestions</code> / <code>richSuggest</code></b></summary>
|
|
631
|
+
|
|
632
|
+
**Direct:**
|
|
1107
633
|
|
|
1108
634
|
```js
|
|
1109
635
|
await sock.sendMessage(jid, {
|
|
1110
636
|
richSuggestions: ['Coba lagi', 'Lihat detail', 'Batalkan']
|
|
1111
637
|
}, { quoted: message })
|
|
1112
638
|
```
|
|
1113
|
-
</details>
|
|
1114
639
|
|
|
1115
|
-
|
|
1116
|
-
<summary><b>Inside items / richResponse</b></summary>
|
|
640
|
+
**Builder:**
|
|
1117
641
|
|
|
1118
642
|
```js
|
|
1119
|
-
// items
|
|
1120
643
|
await sock.sendMessage(jid, {
|
|
1121
644
|
items: [
|
|
1122
|
-
|
|
1123
|
-
{ suggestions: ['Halaman utama', 'Bantuan', 'Hubungi admin'] }
|
|
645
|
+
build.richSuggest('Lihat detail')
|
|
1124
646
|
]
|
|
1125
|
-
}
|
|
1126
|
-
|
|
1127
|
-
// richResponse
|
|
1128
|
-
await sock.sendMessage(jid, {
|
|
1129
|
-
richResponse: [
|
|
1130
|
-
{ text: 'Hasil pencarian ditemukan.' },
|
|
1131
|
-
{ suggestions: ['Tampilkan semua', 'Filter ulang', 'Export'] }
|
|
1132
|
-
]
|
|
1133
|
-
}, { quoted: message })
|
|
647
|
+
})
|
|
1134
648
|
```
|
|
1135
|
-
</details>
|
|
1136
|
-
|
|
1137
|
-
---
|
|
1138
|
-
|
|
1139
|
-
#### 🔣 Rich LaTeX
|
|
1140
649
|
|
|
1141
|
-
>
|
|
650
|
+
</details>
|
|
1142
651
|
|
|
1143
652
|
<details>
|
|
1144
|
-
<summary><b>
|
|
653
|
+
<summary><b>🔣 Rich LaTeX — <code>richLatex</code></b></summary>
|
|
654
|
+
|
|
655
|
+
**Shorthand URL:**
|
|
1145
656
|
|
|
1146
657
|
```js
|
|
1147
658
|
await sock.sendMessage(jid, {
|
|
1148
659
|
richLatex: 'https://latex.codecogs.com/png.latex?E%3Dmc%5E2'
|
|
1149
660
|
}, { quoted: message })
|
|
1150
661
|
```
|
|
1151
|
-
</details>
|
|
1152
662
|
|
|
1153
|
-
|
|
1154
|
-
<summary><b>Full Options</b></summary>
|
|
663
|
+
**Full options:**
|
|
1155
664
|
|
|
1156
665
|
```js
|
|
1157
666
|
await sock.sendMessage(jid, {
|
|
1158
667
|
richLatex: {
|
|
1159
668
|
url: 'https://latex.codecogs.com/png.latex?E%3Dmc%5E2',
|
|
1160
|
-
text: 'E = mc²',
|
|
1161
|
-
width: 120,
|
|
1162
|
-
height: 60,
|
|
1163
|
-
font_height: 83.33,
|
|
1164
|
-
padding: 15
|
|
669
|
+
text: 'E = mc²',
|
|
670
|
+
width: 120,
|
|
671
|
+
height: 60,
|
|
672
|
+
font_height: 83.33,
|
|
673
|
+
padding: 15
|
|
1165
674
|
}
|
|
1166
675
|
}, { quoted: message })
|
|
1167
676
|
```
|
|
1168
|
-
</details>
|
|
1169
677
|
|
|
1170
|
-
<details>
|
|
1171
|
-
<summary><b>Inside items / richResponse</b></summary>
|
|
1172
|
-
|
|
1173
|
-
```js
|
|
1174
|
-
// items
|
|
1175
|
-
await sock.sendMessage(jid, {
|
|
1176
|
-
items: [
|
|
1177
|
-
{ text: 'Rumus energi kinetik:' },
|
|
1178
|
-
{
|
|
1179
|
-
latexUrl: 'https://latex.codecogs.com/png.latex?E_k%3D%5Cfrac%7B1%7D%7B2%7Dmv%5E2',
|
|
1180
|
-
latexText: 'Ek = ½mv²',
|
|
1181
|
-
latexWidth: 150,
|
|
1182
|
-
latexHeight: 60
|
|
1183
|
-
}
|
|
1184
|
-
]
|
|
1185
|
-
}, { quoted: message })
|
|
1186
|
-
|
|
1187
|
-
// richResponse
|
|
1188
|
-
await sock.sendMessage(jid, {
|
|
1189
|
-
richResponse: [
|
|
1190
|
-
{ text: 'Solusi integral:' },
|
|
1191
|
-
{ latex: { url: 'https://latex.codecogs.com/png.latex?%5Cint%20x%5E2%20dx', text: '∫x² dx = x³/3 + C' } }
|
|
1192
|
-
]
|
|
1193
|
-
}, { quoted: message })
|
|
1194
|
-
```
|
|
1195
678
|
</details>
|
|
1196
679
|
|
|
1197
|
-
---
|
|
1198
|
-
|
|
1199
|
-
#### 🛍️ Rich Product
|
|
1200
|
-
|
|
1201
|
-
> Product card(s) as `GenAIProductItemCardPrimitive`. Object = single card, Array = horizontal scroll carousel.
|
|
1202
|
-
|
|
1203
680
|
<details>
|
|
1204
|
-
<summary><b
|
|
681
|
+
<summary><b>🛍️ Rich Product — <code>richProduct</code> / <code>richProduct</code> builder</b></summary>
|
|
682
|
+
|
|
683
|
+
**Single product:**
|
|
1205
684
|
|
|
1206
685
|
```js
|
|
1207
686
|
await sock.sendMessage(jid, {
|
|
1208
687
|
richProduct: {
|
|
1209
688
|
title: 'Sepatu Adidas Samba',
|
|
1210
689
|
price_display_string: 'Rp 1.200.000',
|
|
1211
|
-
description: 'Sepatu casual ikonik
|
|
690
|
+
description: 'Sepatu casual ikonik.',
|
|
1212
691
|
retailer_id: 'adidas_store',
|
|
1213
|
-
thumbnail: {
|
|
692
|
+
thumbnail: {
|
|
693
|
+
url: 'https://example.com/adidas.jpg',
|
|
694
|
+
mime_type: 'image/jpeg',
|
|
695
|
+
width: 300,
|
|
696
|
+
height: 300
|
|
697
|
+
}
|
|
1214
698
|
}
|
|
1215
699
|
}, { quoted: message })
|
|
1216
700
|
```
|
|
1217
|
-
</details>
|
|
1218
701
|
|
|
1219
|
-
|
|
1220
|
-
<summary><b>Product Carousel</b></summary>
|
|
702
|
+
**Carousel:**
|
|
1221
703
|
|
|
1222
704
|
```js
|
|
1223
705
|
await sock.sendMessage(jid, {
|
|
1224
706
|
richProduct: [
|
|
1225
|
-
{
|
|
1226
|
-
|
|
1227
|
-
price_display_string: 'Rp 500.000',
|
|
1228
|
-
thumbnail: { url: 'https://example.com/a.jpg', mime_type: 'image/jpeg', width: 300, height: 300 }
|
|
1229
|
-
},
|
|
1230
|
-
{
|
|
1231
|
-
title: 'Sepatu B',
|
|
1232
|
-
price_display_string: 'Rp 750.000',
|
|
1233
|
-
thumbnail: { url: 'https://example.com/b.jpg', mime_type: 'image/jpeg', width: 300, height: 300 }
|
|
1234
|
-
}
|
|
707
|
+
{ title: 'Sepatu A', price_display_string: 'Rp 500.000' },
|
|
708
|
+
{ title: 'Sepatu B', price_display_string: 'Rp 750.000' }
|
|
1235
709
|
]
|
|
1236
710
|
}, { quoted: message })
|
|
1237
711
|
```
|
|
1238
|
-
</details>
|
|
1239
|
-
|
|
1240
|
-
<details>
|
|
1241
|
-
<summary><b>Inside items / richResponse</b></summary>
|
|
1242
|
-
|
|
1243
|
-
```js
|
|
1244
|
-
// items
|
|
1245
|
-
await sock.sendMessage(jid, {
|
|
1246
|
-
items: [
|
|
1247
|
-
{ text: 'Rekomendasi produk hari ini:' },
|
|
1248
|
-
{ product: { title: 'Produk X', price_display_string: 'Rp 99.000' } }
|
|
1249
|
-
]
|
|
1250
|
-
}, { quoted: message })
|
|
1251
|
-
|
|
1252
|
-
// richResponse
|
|
1253
|
-
await sock.sendMessage(jid, {
|
|
1254
|
-
richResponse: [
|
|
1255
|
-
{ text: 'Pilih produkmu:' },
|
|
1256
|
-
{ product: [{ title: 'A' }, { title: 'B' }] }
|
|
1257
|
-
]
|
|
1258
|
-
}, { quoted: message })
|
|
1259
|
-
```
|
|
1260
|
-
</details>
|
|
1261
712
|
|
|
1262
|
-
|
|
713
|
+
**Builder:**
|
|
1263
714
|
|
|
1264
|
-
|
|
715
|
+
```js
|
|
716
|
+
await sock.sendMessage(jid, {
|
|
717
|
+
items: [
|
|
718
|
+
build.richProduct({
|
|
719
|
+
title: 'Sepatu A',
|
|
720
|
+
price_display_string: 'Rp 500.000'
|
|
721
|
+
})
|
|
722
|
+
]
|
|
723
|
+
})
|
|
724
|
+
```
|
|
1265
725
|
|
|
1266
|
-
>
|
|
726
|
+
</details>
|
|
1267
727
|
|
|
1268
728
|
<details>
|
|
1269
|
-
<summary><b
|
|
729
|
+
<summary><b>📰 Rich Post — <code>richPost</code> / <code>richPost</code> builder</b></summary>
|
|
1270
730
|
|
|
1271
731
|
```js
|
|
1272
732
|
await sock.sendMessage(jid, {
|
|
@@ -1279,29 +739,25 @@ await sock.sendMessage(jid, {
|
|
|
1279
739
|
}
|
|
1280
740
|
}, { quoted: message })
|
|
1281
741
|
```
|
|
1282
|
-
</details>
|
|
1283
742
|
|
|
1284
|
-
|
|
1285
|
-
<summary><b>Post Carousel</b></summary>
|
|
743
|
+
**Builder:**
|
|
1286
744
|
|
|
1287
745
|
```js
|
|
1288
746
|
await sock.sendMessage(jid, {
|
|
1289
|
-
|
|
1290
|
-
{
|
|
1291
|
-
|
|
747
|
+
items: [
|
|
748
|
+
build.richPost({
|
|
749
|
+
title: 'Post PontaLabs',
|
|
750
|
+
author_display_name: '@pontalabs',
|
|
751
|
+
media_url: 'https://example.com/post.jpg'
|
|
752
|
+
})
|
|
1292
753
|
]
|
|
1293
|
-
}
|
|
754
|
+
})
|
|
1294
755
|
```
|
|
1295
|
-
</details>
|
|
1296
|
-
|
|
1297
|
-
---
|
|
1298
|
-
|
|
1299
|
-
#### 🎬 Rich Reels
|
|
1300
756
|
|
|
1301
|
-
>
|
|
757
|
+
</details>
|
|
1302
758
|
|
|
1303
759
|
<details>
|
|
1304
|
-
<summary><b>
|
|
760
|
+
<summary><b>🎬 Rich Reels — <code>richReels</code> / <code>richReels</code> builder</b></summary>
|
|
1305
761
|
|
|
1306
762
|
```js
|
|
1307
763
|
await sock.sendMessage(jid, {
|
|
@@ -1319,345 +775,364 @@ await sock.sendMessage(jid, {
|
|
|
1319
775
|
}
|
|
1320
776
|
}, { quoted: message })
|
|
1321
777
|
```
|
|
1322
|
-
</details>
|
|
1323
778
|
|
|
1324
|
-
|
|
1325
|
-
<summary><b>Reels Carousel</b></summary>
|
|
779
|
+
**Builder:**
|
|
1326
780
|
|
|
1327
781
|
```js
|
|
1328
782
|
await sock.sendMessage(jid, {
|
|
1329
|
-
|
|
1330
|
-
{
|
|
1331
|
-
title: '@
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
likes_count: 5000,
|
|
1336
|
-
reel_source: 'IG'
|
|
1337
|
-
},
|
|
1338
|
-
{
|
|
1339
|
-
title: '@creator2',
|
|
1340
|
-
profileIconUrl: 'https://example.com/av2.jpg',
|
|
1341
|
-
thumbnailUrl: 'https://example.com/th2.jpg',
|
|
1342
|
-
videoUrl: 'https://example.com/r2.mp4',
|
|
1343
|
-
likes_count: 8200,
|
|
1344
|
-
reel_source: 'TT'
|
|
1345
|
-
}
|
|
783
|
+
items: [
|
|
784
|
+
build.richReels([{
|
|
785
|
+
title: '@creator',
|
|
786
|
+
thumbnailUrl: 'https://example.com/thumb.jpg',
|
|
787
|
+
videoUrl: 'https://example.com/reel.mp4'
|
|
788
|
+
}])
|
|
1346
789
|
]
|
|
1347
|
-
}
|
|
790
|
+
})
|
|
1348
791
|
```
|
|
1349
|
-
</details>
|
|
1350
|
-
|
|
1351
|
-
<details>
|
|
1352
|
-
<summary><b>📋 Fields Reference</b></summary>
|
|
1353
|
-
|
|
1354
|
-
| Field | Type | Default | Description |
|
|
1355
|
-
|:---|:---|:---:|:---|
|
|
1356
|
-
| `title` | `string` | — | Username / creator name |
|
|
1357
|
-
| `profileIconUrl` | `string` | — | Avatar URL |
|
|
1358
|
-
| `thumbnailUrl` | `string` | — | Thumbnail cover URL |
|
|
1359
|
-
| `videoUrl` | `string` | — | Video source URL |
|
|
1360
|
-
| `reels_title` | `string` | `''` | Reel title |
|
|
1361
|
-
| `likes_count` | `number` | `0` | Like count |
|
|
1362
|
-
| `shares_count` | `number` | `0` | Share count |
|
|
1363
|
-
| `view_count` | `number` | `0` | View count |
|
|
1364
|
-
| `reel_source` | `string` | `'IG'` | Source platform |
|
|
1365
|
-
| `is_verified` | `boolean` | `false` | Verified badge |
|
|
1366
792
|
|
|
1367
793
|
</details>
|
|
1368
794
|
|
|
1369
|
-
---
|
|
1370
|
-
|
|
1371
|
-
#### 🔍 Rich Sources
|
|
1372
|
-
|
|
1373
|
-
> Search result source list as `GenAISearchResultPrimitive`. Accepts full objects **or** shorthand `[faviconUrl, sourceUrl, displayName]`.
|
|
1374
|
-
|
|
1375
795
|
<details>
|
|
1376
|
-
<summary><b>
|
|
796
|
+
<summary><b>🔍 Rich Sources — <code>richSources</code> / <code>richSource</code></b></summary>
|
|
797
|
+
|
|
798
|
+
**Shorthand:**
|
|
1377
799
|
|
|
1378
800
|
```js
|
|
1379
801
|
await sock.sendMessage(jid, {
|
|
1380
802
|
richSources: [
|
|
1381
803
|
['https://wikipedia.org/favicon.ico', 'https://wikipedia.org/wiki/Node.js', 'Wikipedia'],
|
|
1382
|
-
['https://nodejs.org/favicon.ico', 'https://nodejs.org/en/docs', 'Node.js Docs']
|
|
1383
|
-
['https://github.com/favicon.ico', 'https://github.com/nodejs/node', 'GitHub']
|
|
804
|
+
['https://nodejs.org/favicon.ico', 'https://nodejs.org/en/docs', 'Node.js Docs']
|
|
1384
805
|
]
|
|
1385
806
|
}, { quoted: message })
|
|
1386
807
|
```
|
|
1387
|
-
</details>
|
|
1388
808
|
|
|
1389
|
-
|
|
1390
|
-
<summary><b>Full Object</b></summary>
|
|
809
|
+
**Full object:**
|
|
1391
810
|
|
|
1392
811
|
```js
|
|
1393
812
|
await sock.sendMessage(jid, {
|
|
1394
|
-
richSources: [
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
813
|
+
richSources: [{
|
|
814
|
+
source_type: 'THIRD_PARTY',
|
|
815
|
+
source_display_name: 'Wikipedia',
|
|
816
|
+
source_subtitle: 'wikipedia.org',
|
|
817
|
+
source_url: 'https://wikipedia.org/wiki/Node.js',
|
|
818
|
+
favicon: {
|
|
819
|
+
url: 'https://wikipedia.org/favicon.ico',
|
|
820
|
+
mime_type: 'image/jpeg',
|
|
821
|
+
width: 16,
|
|
822
|
+
height: 16
|
|
1401
823
|
}
|
|
1402
|
-
]
|
|
824
|
+
}]
|
|
1403
825
|
}, { quoted: message })
|
|
1404
826
|
```
|
|
1405
|
-
</details>
|
|
1406
827
|
|
|
1407
|
-
|
|
1408
|
-
<summary><b>Mixed Format</b></summary>
|
|
828
|
+
**Builder:**
|
|
1409
829
|
|
|
1410
830
|
```js
|
|
1411
831
|
await sock.sendMessage(jid, {
|
|
1412
|
-
|
|
1413
|
-
[
|
|
1414
|
-
|
|
832
|
+
items: [
|
|
833
|
+
build.richSource([
|
|
834
|
+
['https://wikipedia.org/favicon.ico', 'https://wikipedia.org/wiki/Node.js', 'Wikipedia']
|
|
835
|
+
])
|
|
1415
836
|
]
|
|
1416
|
-
}
|
|
837
|
+
})
|
|
1417
838
|
```
|
|
839
|
+
|
|
1418
840
|
</details>
|
|
1419
841
|
|
|
1420
|
-
|
|
842
|
+
<details>
|
|
843
|
+
<summary><b>📌 Rich Tip, Footer & Metadata — <code>richTip</code> / <code>richFooter</code> / <code>richMetadata</code></b></summary>
|
|
1421
844
|
|
|
1422
|
-
|
|
845
|
+
```js
|
|
846
|
+
await sock.sendMessage(jid, {
|
|
847
|
+
richTip: 'Dihasilkan oleh AI · PontaLabs'
|
|
848
|
+
}, { quoted: message })
|
|
1423
849
|
|
|
1424
|
-
|
|
1425
|
-
|
|
850
|
+
await sock.sendMessage(jid, {
|
|
851
|
+
richFooter: '© PontaLabs · Data bersumber dari layanan publik'
|
|
852
|
+
}, { quoted: message })
|
|
853
|
+
```
|
|
1426
854
|
|
|
1427
|
-
|
|
1428
|
-
<summary><b>Rich Tip</b></summary>
|
|
855
|
+
**Builder:**
|
|
1429
856
|
|
|
1430
857
|
```js
|
|
1431
858
|
await sock.sendMessage(jid, {
|
|
1432
|
-
|
|
1433
|
-
|
|
859
|
+
items: [
|
|
860
|
+
build.richTip('AI-generated content'),
|
|
861
|
+
build.richMetadata('PontaLabs Rich Message'),
|
|
862
|
+
build.richFooter('© PontaLabs')
|
|
863
|
+
]
|
|
864
|
+
})
|
|
1434
865
|
```
|
|
866
|
+
|
|
1435
867
|
</details>
|
|
1436
868
|
|
|
1437
869
|
<details>
|
|
1438
|
-
<summary><b
|
|
870
|
+
<summary><b>🧩 Rich FOA Text — <code>richFOAText</code></b></summary>
|
|
1439
871
|
|
|
1440
872
|
```js
|
|
1441
873
|
await sock.sendMessage(jid, {
|
|
1442
|
-
|
|
1443
|
-
|
|
874
|
+
items: [
|
|
875
|
+
build.richFOAText('Halo dari FOA Rich Text')
|
|
876
|
+
]
|
|
877
|
+
})
|
|
1444
878
|
```
|
|
879
|
+
|
|
1445
880
|
</details>
|
|
1446
881
|
|
|
1447
882
|
<details>
|
|
1448
|
-
<summary><b
|
|
883
|
+
<summary><b>🧱 Rich Widget — <code>richWidget</code></b></summary>
|
|
1449
884
|
|
|
1450
885
|
```js
|
|
1451
|
-
// items
|
|
1452
886
|
await sock.sendMessage(jid, {
|
|
1453
887
|
items: [
|
|
1454
|
-
{
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
{ footer: '© PontaCT Baileys' }
|
|
888
|
+
build.richWidget({
|
|
889
|
+
/* widget payload */
|
|
890
|
+
})
|
|
1458
891
|
]
|
|
1459
|
-
}
|
|
892
|
+
})
|
|
893
|
+
```
|
|
894
|
+
|
|
895
|
+
</details>
|
|
1460
896
|
|
|
1461
|
-
|
|
897
|
+
<details>
|
|
898
|
+
<summary><b>🔀 Mixed Rich — <code>items</code></b></summary>
|
|
899
|
+
|
|
900
|
+
Semua Rich item dapat dicampur dalam satu `items`. Urutan array menjadi urutan tampilan.
|
|
901
|
+
|
|
902
|
+
```js
|
|
1462
903
|
await sock.sendMessage(jid, {
|
|
1463
|
-
|
|
1464
|
-
{ text: '
|
|
1465
|
-
{
|
|
904
|
+
items: [
|
|
905
|
+
{ text: '*Laporan Harian Bot*' },
|
|
906
|
+
{ table: {
|
|
907
|
+
headers: ['Metric', 'Value'],
|
|
908
|
+
rows: [
|
|
909
|
+
['Uptime', '99.9%'],
|
|
910
|
+
['Messages', '1.2K']
|
|
911
|
+
]
|
|
912
|
+
}},
|
|
913
|
+
build.richText('SELECT COUNT(*) FROM messages;'),
|
|
914
|
+
build.richHtml('<h2>Dashboard</h2>'),
|
|
915
|
+
build.richSuggest('Refresh'),
|
|
916
|
+
build.richFooter('Auto-generated · PontaLabs')
|
|
1466
917
|
]
|
|
1467
918
|
}, { quoted: message })
|
|
1468
919
|
```
|
|
1469
|
-
</details>
|
|
1470
920
|
|
|
1471
|
-
|
|
921
|
+
**Item shorthand yang tersedia:**
|
|
1472
922
|
|
|
1473
|
-
|
|
923
|
+
<details>
|
|
924
|
+
<summary><b>📋 Lihat semua key <code>items</code></b></summary>
|
|
1474
925
|
|
|
1475
|
-
|
|
926
|
+
- `{ text, inlineEntities? }` — Rich text
|
|
927
|
+
- `{ table }` — Table
|
|
928
|
+
- `{ images }` — Image grid
|
|
929
|
+
- `{ videoUrl, mimeType?, duration? }` — Video
|
|
930
|
+
- `{ suggestions }` — Suggestion pills
|
|
931
|
+
- `{ latexUrl, latexText?, latexWidth?, latexHeight? }` — LaTeX
|
|
932
|
+
- `{ product }` — Product card
|
|
933
|
+
- `{ post }` — Post card
|
|
934
|
+
- `{ reels }` — Reels
|
|
935
|
+
- `{ sources }` — Sources
|
|
936
|
+
- `{ tip }` — Tip
|
|
937
|
+
- `{ footer }` — Footer
|
|
1476
938
|
|
|
1477
|
-
|
|
939
|
+
</details>
|
|
1478
940
|
|
|
1479
|
-
|
|
1480
|
-
|:---|:---|
|
|
1481
|
-
| `{ text }` | Rich text |
|
|
1482
|
-
| `{ code, language }` | Code block |
|
|
1483
|
-
| `{ table }` | Table |
|
|
1484
|
-
| `{ images }` | Image grid |
|
|
1485
|
-
| `{ videoUrl, mimeType?, duration? }` | Video embed |
|
|
1486
|
-
| `{ suggestions }` | Suggestion pills |
|
|
1487
|
-
| `{ latexUrl, latexText?, latexWidth?, latexHeight? }` | LaTeX formula |
|
|
1488
|
-
| `{ product }` | Product card(s) |
|
|
1489
|
-
| `{ post }` | Post card(s) |
|
|
1490
|
-
| `{ reels }` | Reels carousel |
|
|
1491
|
-
| `{ sources }` | Search sources |
|
|
1492
|
-
| `{ tip }` | Tip metadata |
|
|
1493
|
-
| `{ footer }` | Footer metadata |
|
|
941
|
+
</details>
|
|
1494
942
|
|
|
1495
943
|
<details>
|
|
1496
|
-
<summary><b
|
|
944
|
+
<summary><b>🔗 Rich Response — <code>richResponse</code></b></summary>
|
|
945
|
+
|
|
946
|
+
`richResponse` adalah full array mode untuk menyusun Rich primitive secara manual, termasuk inline citation melalui `inlineEntities`.
|
|
947
|
+
|
|
948
|
+
**Basic:**
|
|
1497
949
|
|
|
1498
950
|
```js
|
|
1499
951
|
await sock.sendMessage(jid, {
|
|
1500
|
-
|
|
1501
|
-
{ text: '
|
|
1502
|
-
{ code: '
|
|
1503
|
-
{
|
|
1504
|
-
{
|
|
1505
|
-
table: {
|
|
1506
|
-
headers: ['id', 'name', 'score'],
|
|
1507
|
-
rows: [
|
|
1508
|
-
['1', 'Ponta', '98'],
|
|
1509
|
-
['2', 'Yue', '87'],
|
|
1510
|
-
['3', 'Frieren', '75']
|
|
1511
|
-
]
|
|
1512
|
-
}
|
|
1513
|
-
}
|
|
952
|
+
richResponse: [
|
|
953
|
+
{ text: '*Hasil:* Node.js adalah runtime JavaScript.' },
|
|
954
|
+
{ code: 'node --version', language: 'bash' },
|
|
955
|
+
{ suggestions: ['Lihat docs', 'Install'] },
|
|
956
|
+
{ footer: 'PontaLabs' }
|
|
1514
957
|
]
|
|
1515
958
|
}, { quoted: message })
|
|
1516
959
|
```
|
|
1517
|
-
</details>
|
|
1518
960
|
|
|
1519
|
-
|
|
1520
|
-
<summary><b>Text + Images + Video + Suggestions</b></summary>
|
|
961
|
+
**Inline citation:**
|
|
1521
962
|
|
|
1522
963
|
```js
|
|
1523
964
|
await sock.sendMessage(jid, {
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
965
|
+
richResponse: [{
|
|
966
|
+
text: 'Node.js {{SS_0}}¹{{/SS_0}} adalah runtime JavaScript.',
|
|
967
|
+
inlineEntities: [{
|
|
968
|
+
key: 'SS_0',
|
|
969
|
+
metadata: {
|
|
970
|
+
reference_id: 1,
|
|
971
|
+
reference_url: 'https://nodejs.org',
|
|
972
|
+
reference_title: 'Node.js Official',
|
|
973
|
+
reference_display_name: 'nodejs.org',
|
|
974
|
+
sources: [{
|
|
975
|
+
source_type: 'THIRD_PARTY',
|
|
976
|
+
source_display_name: 'Node.js',
|
|
977
|
+
source_url: 'https://nodejs.org'
|
|
978
|
+
}]
|
|
979
|
+
}
|
|
980
|
+
}]
|
|
981
|
+
}]
|
|
1530
982
|
}, { quoted: message })
|
|
1531
983
|
```
|
|
1532
|
-
</details>
|
|
1533
984
|
|
|
1534
|
-
|
|
1535
|
-
<summary><b>Full Mixed (all types)</b></summary>
|
|
985
|
+
**Table di `richResponse`:**
|
|
1536
986
|
|
|
1537
987
|
```js
|
|
1538
988
|
await sock.sendMessage(jid, {
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
},
|
|
1548
|
-
{ sources: [['https://example.com/fav.ico', 'https://example.com', 'Dashboard']] },
|
|
1549
|
-
{ suggestions: ['Refresh', 'Export PDF'] },
|
|
1550
|
-
{ footer: 'Auto-generated · PontaCT' }
|
|
1551
|
-
]
|
|
989
|
+
richResponse: [{
|
|
990
|
+
table: {
|
|
991
|
+
items: [
|
|
992
|
+
{ items: ['Name', 'Role'], isHeading: true },
|
|
993
|
+
{ items: ['Ponta', 'Admin'] }
|
|
994
|
+
]
|
|
995
|
+
}
|
|
996
|
+
}]
|
|
1552
997
|
}, { quoted: message })
|
|
1553
998
|
```
|
|
999
|
+
|
|
1000
|
+
> Berbeda dari `table` top-level / `items`, format table di `richResponse` harus berupa array row siap-pakai.
|
|
1001
|
+
|
|
1554
1002
|
</details>
|
|
1555
1003
|
|
|
1556
|
-
|
|
1004
|
+
<details>
|
|
1005
|
+
<summary><b>🎛️ Interactive Rich Builder — Button, ButtonV2 & Carousel</b></summary>
|
|
1006
|
+
|
|
1007
|
+
Builder interactive juga berada di namespace `build` dan dikirim melalui `sock.sendMessage()`.
|
|
1557
1008
|
|
|
1558
|
-
|
|
1009
|
+
**Native Flow Button:**
|
|
1559
1010
|
|
|
1560
|
-
|
|
1011
|
+
```js
|
|
1012
|
+
const button = build.button()
|
|
1013
|
+
.setTitle('Menu')
|
|
1014
|
+
.setBody('Pilih salah satu')
|
|
1015
|
+
.setFooter('PontaLabs')
|
|
1016
|
+
.addReply('Halo', 'hello')
|
|
1017
|
+
.addUrl('Website', 'https://example.com')
|
|
1018
|
+
.addCopy('Copy ID', 'ABC123')
|
|
1561
1019
|
|
|
1562
|
-
|
|
1020
|
+
await sock.sendMessage(jid, {
|
|
1021
|
+
items: [button]
|
|
1022
|
+
})
|
|
1023
|
+
```
|
|
1563
1024
|
|
|
1564
|
-
|
|
1565
|
-
|:---|:---|
|
|
1566
|
-
| `{ text, inlineEntities? }` | Text + optional citation/hyperlink |
|
|
1567
|
-
| `{ code, language }` | Code block |
|
|
1568
|
-
| `{ table, title? }` | Table — ⚠️ format beda dari `items`/top-level: `table` di sini harus array baris siap-pakai `[{ items: [...], isHeading }]`, **bukan** `{ headers, rows }` |
|
|
1569
|
-
| `{ images }` | Image grid |
|
|
1570
|
-
| `{ video }` | Video embed |
|
|
1571
|
-
| `{ suggestions }` | Suggestion pills |
|
|
1572
|
-
| `{ latex }` | LaTeX formula |
|
|
1573
|
-
| `{ product }` | Product card(s) |
|
|
1574
|
-
| `{ post }` | Post card(s) |
|
|
1575
|
-
| `{ reels }` | Reels carousel |
|
|
1576
|
-
| `{ sources }` | Search sources |
|
|
1577
|
-
| `{ tip }` | Tip metadata |
|
|
1578
|
-
| `{ footer }` | Footer metadata |
|
|
1025
|
+
**ButtonV2:**
|
|
1579
1026
|
|
|
1580
|
-
|
|
1581
|
-
|
|
1027
|
+
```js
|
|
1028
|
+
const buttons = build.buttonV2()
|
|
1029
|
+
.setBody('Pilih aksi')
|
|
1030
|
+
.setFooter('PontaLabs')
|
|
1031
|
+
.addButton('Yes')
|
|
1032
|
+
.addButton('No')
|
|
1033
|
+
|
|
1034
|
+
await sock.sendMessage(jid, {
|
|
1035
|
+
items: [buttons]
|
|
1036
|
+
})
|
|
1037
|
+
```
|
|
1038
|
+
|
|
1039
|
+
**Carousel:**
|
|
1582
1040
|
|
|
1583
1041
|
```js
|
|
1042
|
+
const carousel = build.carousel()
|
|
1043
|
+
.addCard(c => c
|
|
1044
|
+
.setTitle('Card 1')
|
|
1045
|
+
.setBody('Deskripsi 1')
|
|
1046
|
+
.addReply('Pilih', 'card1')
|
|
1047
|
+
)
|
|
1048
|
+
.addCard(c => c
|
|
1049
|
+
.setTitle('Card 2')
|
|
1050
|
+
.setBody('Deskripsi 2')
|
|
1051
|
+
.addUrl('Buka', 'https://example.com')
|
|
1052
|
+
)
|
|
1053
|
+
|
|
1584
1054
|
await sock.sendMessage(jid, {
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
text: 'Node.js {{SS_0}}¹{{/SS_0}} adalah runtime JavaScript. Dibuat oleh Ryan Dahl {{SS_1}}²{{/SS_1}} pada 2009.',
|
|
1588
|
-
inlineEntities: [
|
|
1589
|
-
{
|
|
1590
|
-
key: 'SS_0',
|
|
1591
|
-
metadata: {
|
|
1592
|
-
reference_id: 1,
|
|
1593
|
-
reference_url: 'https://nodejs.org',
|
|
1594
|
-
reference_title: 'Node.js Official',
|
|
1595
|
-
reference_display_name: 'nodejs.org',
|
|
1596
|
-
sources: [{
|
|
1597
|
-
source_type: 'THIRD_PARTY',
|
|
1598
|
-
source_display_name: 'nodejs.org',
|
|
1599
|
-
source_subtitle: 'nodejs.org',
|
|
1600
|
-
source_url: 'https://nodejs.org'
|
|
1601
|
-
}],
|
|
1602
|
-
__typename: 'GenAISearchCitationItem'
|
|
1603
|
-
}
|
|
1604
|
-
},
|
|
1605
|
-
{
|
|
1606
|
-
key: 'SS_1',
|
|
1607
|
-
metadata: {
|
|
1608
|
-
reference_id: 2,
|
|
1609
|
-
reference_url: 'https://wikipedia.org/wiki/Ryan_Dahl',
|
|
1610
|
-
reference_title: 'Ryan Dahl - Wikipedia',
|
|
1611
|
-
reference_display_name: 'Wikipedia',
|
|
1612
|
-
sources: [{
|
|
1613
|
-
source_type: 'THIRD_PARTY',
|
|
1614
|
-
source_display_name: 'Wikipedia',
|
|
1615
|
-
source_subtitle: 'wikipedia.org',
|
|
1616
|
-
source_url: 'https://wikipedia.org/wiki/Ryan_Dahl'
|
|
1617
|
-
}],
|
|
1618
|
-
__typename: 'GenAISearchCitationItem'
|
|
1619
|
-
}
|
|
1620
|
-
}
|
|
1621
|
-
]
|
|
1622
|
-
}
|
|
1623
|
-
]
|
|
1624
|
-
}, { quoted: message })
|
|
1055
|
+
items: [carousel]
|
|
1056
|
+
})
|
|
1625
1057
|
```
|
|
1058
|
+
|
|
1626
1059
|
</details>
|
|
1627
1060
|
|
|
1628
1061
|
<details>
|
|
1629
|
-
<summary><b
|
|
1062
|
+
<summary><b>⏱️ Rich Build Delay — <code>buildDelay</code></b></summary>
|
|
1063
|
+
|
|
1064
|
+
`buildDelay` digunakan bersama `items` untuk melakukan progressive update pada target message yang sama.
|
|
1630
1065
|
|
|
1631
1066
|
```js
|
|
1632
1067
|
await sock.sendMessage(jid, {
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1068
|
+
items: [
|
|
1069
|
+
build.richText('⏳ Memproses...'),
|
|
1070
|
+
build.richText('🔍 Mencari data...'),
|
|
1071
|
+
build.richText('✅ Selesai!')
|
|
1072
|
+
],
|
|
1073
|
+
buildDelay: 1000
|
|
1074
|
+
})
|
|
1075
|
+
```
|
|
1076
|
+
|
|
1077
|
+
Dengan `buildDelay: 1000`, item berikutnya diproses setiap 1 detik dan update tetap menggunakan message ID target yang sama.
|
|
1078
|
+
|
|
1079
|
+
**Custom message ID:**
|
|
1080
|
+
|
|
1081
|
+
```js
|
|
1082
|
+
await sock.sendMessage(jid, {
|
|
1083
|
+
messageId: 'MY_MESSAGE_ID',
|
|
1084
|
+
items: [
|
|
1085
|
+
build.richText('Build 1'),
|
|
1086
|
+
build.richText('Build 2')
|
|
1087
|
+
],
|
|
1088
|
+
buildDelay: 1000
|
|
1089
|
+
})
|
|
1650
1090
|
```
|
|
1091
|
+
|
|
1651
1092
|
</details>
|
|
1652
1093
|
|
|
1653
|
-
|
|
1094
|
+
<details>
|
|
1095
|
+
<summary><b>🛠️ Advanced Rich Builder — <code>build.AIRich(sock)</code></b></summary>
|
|
1096
|
+
|
|
1097
|
+
Untuk state, node ID, replace, insert, delete, dan edit message gunakan `build.AIRich(sock)`.
|
|
1098
|
+
|
|
1099
|
+
```js
|
|
1100
|
+
const ai = build.AIRich(sock)
|
|
1101
|
+
|
|
1102
|
+
ai.addText('⏳ Loading...', { id: 'status' })
|
|
1103
|
+
ai.addTip('Mohon tunggu')
|
|
1104
|
+
|
|
1105
|
+
await ai.send(jid)
|
|
1106
|
+
|
|
1107
|
+
ai.addText('✅ Selesai!', { replace: 'status' })
|
|
1108
|
+
ai.delete('status')
|
|
1109
|
+
ai.addTip('Tambahan', { insertAt: 'status' })
|
|
1110
|
+
```
|
|
1111
|
+
|
|
1112
|
+
**Contoh edit:**
|
|
1113
|
+
|
|
1114
|
+
```js
|
|
1115
|
+
const ai = build.AIRich(sock)
|
|
1116
|
+
|
|
1117
|
+
ai.addText('⏳ Memproses...', { id: 'answer' })
|
|
1118
|
+
await ai.send(jid)
|
|
1654
1119
|
|
|
1655
|
-
|
|
1120
|
+
const result = await getAIResponse()
|
|
1121
|
+
|
|
1122
|
+
ai.addText(result, { replace: 'answer' })
|
|
1123
|
+
ai.addTip('Generated by AI')
|
|
1124
|
+
|
|
1125
|
+
await ai.sendEdit(jid)
|
|
1126
|
+
```
|
|
1127
|
+
|
|
1128
|
+
> `replace` dan `insertAt` adalah options pada `add*()`, bukan method `ai.replace()` atau `ai.insertAt()`.
|
|
1129
|
+
|
|
1130
|
+
</details>
|
|
1656
1131
|
|
|
1657
1132
|
<details>
|
|
1658
|
-
<summary><b
|
|
1133
|
+
<summary><b>⚙️ Rich Options — <code>aiForwarded</code></b></summary>
|
|
1659
1134
|
|
|
1660
|
-
|
|
1135
|
+
`aiForwarded` menambahkan label forwarded-from-AI-bot pada `contextInfo`.
|
|
1661
1136
|
|
|
1662
1137
|
```js
|
|
1663
1138
|
await sock.sendMessage(jid, {
|
|
@@ -1665,6 +1140,42 @@ await sock.sendMessage(jid, {
|
|
|
1665
1140
|
aiForwarded: true
|
|
1666
1141
|
}, { quoted: message })
|
|
1667
1142
|
```
|
|
1143
|
+
|
|
1144
|
+
Bisa digunakan bersama `richText`, `items`, `richResponse`, `richHtml`, dan key Rich lainnya.
|
|
1145
|
+
|
|
1146
|
+
</details>
|
|
1147
|
+
|
|
1148
|
+
<details>
|
|
1149
|
+
<summary><b>🔌 Legacy Compatibility</b></summary>
|
|
1150
|
+
|
|
1151
|
+
API Rich lama tetap kompatibel:
|
|
1152
|
+
|
|
1153
|
+
```js
|
|
1154
|
+
await sock.sendMessage(jid, {
|
|
1155
|
+
richText: 'Halo'
|
|
1156
|
+
})
|
|
1157
|
+
|
|
1158
|
+
await sock.sendMessage(jid, {
|
|
1159
|
+
items: [
|
|
1160
|
+
{ richText: 'Halo' },
|
|
1161
|
+
{ richTip: 'Testing' }
|
|
1162
|
+
]
|
|
1163
|
+
})
|
|
1164
|
+
```
|
|
1165
|
+
|
|
1166
|
+
Kamu juga dapat mencampur object Rich lama dengan `build.*`:
|
|
1167
|
+
|
|
1168
|
+
```js
|
|
1169
|
+
await sock.sendMessage(jid, {
|
|
1170
|
+
items: [
|
|
1171
|
+
{ richText: 'Shortcut lama' },
|
|
1172
|
+
build.richText('Builder baru'),
|
|
1173
|
+
{ richTip: 'Shortcut lama' },
|
|
1174
|
+
build.richTip('Builder baru')
|
|
1175
|
+
]
|
|
1176
|
+
})
|
|
1177
|
+
```
|
|
1178
|
+
|
|
1668
1179
|
</details>
|
|
1669
1180
|
|
|
1670
1181
|
---
|
|
@@ -1684,39 +1195,19 @@ const newsletter = await sock.newsletterMetadata('jid', '120363282083849178@news
|
|
|
1684
1195
|
</details>
|
|
1685
1196
|
|
|
1686
1197
|
<details>
|
|
1687
|
-
<summary><b
|
|
1688
|
-
|
|
1689
|
-
```js
|
|
1690
|
-
const nlJid = '120363282083849178@newsletter'
|
|
1691
|
-
|
|
1692
|
-
await sock.newsletterFollow(nlJid)
|
|
1693
|
-
await sock.newsletterUnfollow(nlJid)
|
|
1694
|
-
await sock.newsletterMute(nlJid)
|
|
1695
|
-
await sock.newsletterUnmute(nlJid)
|
|
1696
|
-
```
|
|
1697
|
-
</details>
|
|
1698
|
-
|
|
1699
|
-
<details>
|
|
1700
|
-
<summary><b>📣 Create Newsletter</b></summary>
|
|
1198
|
+
<summary><b>➕ Follow / Unfollow Newsletter</b></summary>
|
|
1701
1199
|
|
|
1702
1200
|
```js
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
'Description here',
|
|
1706
|
-
{ url: 'https://example.com/image.jpg' }
|
|
1707
|
-
)
|
|
1201
|
+
await sock.newsletterFollow('120363282083849178@newsletter')
|
|
1202
|
+
await sock.newsletterUnfollow('120363282083849178@newsletter')
|
|
1708
1203
|
```
|
|
1709
1204
|
</details>
|
|
1710
1205
|
|
|
1711
1206
|
<details>
|
|
1712
|
-
<summary><b
|
|
1207
|
+
<summary><b>📨 Newsletter Reaction</b></summary>
|
|
1713
1208
|
|
|
1714
1209
|
```js
|
|
1715
|
-
await sock.newsletterReactMessage(
|
|
1716
|
-
'120363282083849178@newsletter',
|
|
1717
|
-
'12', // server message ID
|
|
1718
|
-
'🦖' // emoji
|
|
1719
|
-
)
|
|
1210
|
+
await sock.newsletterReactMessage('120363282083849178@newsletter', '123', '🔥')
|
|
1720
1211
|
```
|
|
1721
1212
|
</details>
|
|
1722
1213
|
|
|
@@ -1725,15 +1216,11 @@ await sock.newsletterReactMessage(
|
|
|
1725
1216
|
## 👥 Groups
|
|
1726
1217
|
|
|
1727
1218
|
<details>
|
|
1728
|
-
<summary><b
|
|
1219
|
+
<summary><b>📝 Create Group</b></summary>
|
|
1729
1220
|
|
|
1730
1221
|
```js
|
|
1731
|
-
const group = await sock.groupCreate('Group
|
|
1732
|
-
|
|
1733
|
-
'0987654321@s.whatsapp.net'
|
|
1734
|
-
])
|
|
1735
|
-
|
|
1736
|
-
console.log('Group JID:', group.id)
|
|
1222
|
+
const group = await sock.groupCreate('My Group', ['1234567890@s.whatsapp.net'])
|
|
1223
|
+
console.log('Group ID:', group.id)
|
|
1737
1224
|
```
|
|
1738
1225
|
</details>
|
|
1739
1226
|
|
|
@@ -1933,6 +1420,14 @@ const summary = getAggregateResponsesInEventMessage(eventMsg, sock.user.lid)
|
|
|
1933
1420
|
|
|
1934
1421
|
## 🤝 Contributing
|
|
1935
1422
|
|
|
1423
|
+
<div align="center">
|
|
1424
|
+
|
|
1425
|
+
<img src="https://raw.githubusercontent.com/Tarikul-Islam-Anik/Animated-Fluent-Emojis/master/Emojis/Hand%20gestures/Handshake.png" width="60" />
|
|
1426
|
+
|
|
1427
|
+
**Contributions are welcome!**
|
|
1428
|
+
|
|
1429
|
+
</div>
|
|
1430
|
+
|
|
1936
1431
|
1. **Fork** repository
|
|
1937
1432
|
2. Create a feature branch: `git checkout -b feat/your-feature`
|
|
1938
1433
|
3. Commit your changes: `git commit -m "feat: add something awesome"`
|
|
@@ -1943,6 +1438,10 @@ const summary = getAggregateResponsesInEventMessage(eventMsg, sock.user.lid)
|
|
|
1943
1438
|
|
|
1944
1439
|
## 📜 License
|
|
1945
1440
|
|
|
1441
|
+
<div align="center">
|
|
1442
|
+
|
|
1443
|
+
<img src="https://raw.githubusercontent.com/Tarikul-Islam-Anik/Animated-Fluent-Emojis/master/Emojis/Objects/Scroll.png" width="40" />
|
|
1444
|
+
|
|
1946
1445
|
This project is licensed for **personal and non-commercial use only**.
|
|
1947
1446
|
|
|
1948
1447
|
| | |
|
|
@@ -1952,6 +1451,8 @@ This project is licensed for **personal and non-commercial use only**.
|
|
|
1952
1451
|
| ❌ | Commercial use strictly prohibited |
|
|
1953
1452
|
| ❌ | Resale or rebranding prohibited |
|
|
1954
1453
|
|
|
1454
|
+
</div>
|
|
1455
|
+
|
|
1955
1456
|
---
|
|
1956
1457
|
|
|
1957
1458
|
## ⚠️ Disclaimer
|
|
@@ -1963,10 +1464,16 @@ This project is licensed for **personal and non-commercial use only**.
|
|
|
1963
1464
|
|
|
1964
1465
|
<div align="center">
|
|
1965
1466
|
|
|
1467
|
+
<img src="https://capsule-render.vercel.app/api?type=waving&color=0:0f0c29,100:302b63&height=150§ion=footer&text=PontaLabs&fontSize=30&fontColor=fff&animation=fadeIn" width="100%"/>
|
|
1468
|
+
|
|
1966
1469
|
[📦 NPM](https://www.npmjs.com/package/@pontalabs/baileys) · [📖 Baileys Wiki](https://github.com/WhiskeySockets/Baileys/wiki) · [⭐ Star this repo](#)
|
|
1967
1470
|
|
|
1968
1471
|
<br>
|
|
1969
1472
|
|
|
1970
|
-
Made
|
|
1473
|
+
<img src="https://readme-typing-svg.demolab.com?font=Fira+Code&size=14&pause=1000&color=00D9FF¢er=true&width=400&lines=Made+with+%E2%99%A5+by+PontaCT;Thanks+for+visiting!" alt="footer typing" />
|
|
1474
|
+
|
|
1475
|
+
<br><br>
|
|
1476
|
+
|
|
1477
|
+
<img src="https://komarev.com/ghpvc/?username=PontaCT&label=Thanks+for+visiting&color=00D9FF&style=flat-square" />
|
|
1971
1478
|
|
|
1972
1479
|
</div>
|