@pontalabs/baileys 1.0.6 → 1.0.7
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/LICENSE +1 -1
- package/README.md +839 -267
- package/WAProto/GenerateStatics.sh +4 -3
- package/WAProto/WAProto.proto +511 -1215
- package/WAProto/index.d.ts +55 -14017
- package/WAProto/index.js +29 -97689
- package/lib/Defaults/index.d.ts +74 -72
- package/lib/Defaults/index.js +108 -94
- package/lib/Signal/Group/ciphertext-message.d.ts +7 -8
- package/lib/Signal/Group/ciphertext-message.js +16 -9
- package/lib/Signal/Group/group-session-builder.d.ts +13 -11
- package/lib/Signal/Group/group-session-builder.js +61 -19
- package/lib/Signal/Group/group_cipher.d.ts +16 -14
- package/lib/Signal/Group/group_cipher.js +70 -41
- package/lib/Signal/Group/index.d.ts +11 -12
- package/lib/Signal/Group/index.js +61 -12
- package/lib/Signal/Group/keyhelper.d.ts +14 -9
- package/lib/Signal/Group/keyhelper.js +58 -10
- package/lib/Signal/Group/sender-chain-key.d.ts +13 -13
- package/lib/Signal/Group/sender-chain-key.js +34 -13
- package/lib/Signal/Group/sender-key-distribution-message.d.ts +16 -16
- package/lib/Signal/Group/sender-key-distribution-message.js +36 -28
- package/lib/Signal/Group/sender-key-message.d.ts +18 -18
- package/lib/Signal/Group/sender-key-message.js +45 -38
- package/lib/Signal/Group/sender-key-name.d.ts +15 -14
- package/lib/Signal/Group/sender-key-name.js +31 -20
- package/lib/Signal/Group/sender-key-record.d.ts +25 -24
- package/lib/Signal/Group/sender-key-record.js +35 -18
- package/lib/Signal/Group/sender-key-state.d.ts +34 -29
- package/lib/Signal/Group/sender-key-state.js +100 -37
- package/lib/Signal/Group/sender-message-key.d.ts +10 -11
- package/lib/Signal/Group/sender-message-key.js +22 -15
- package/lib/Signal/libsignal.d.ts +8 -5
- package/lib/Signal/libsignal.js +142 -288
- package/lib/Signal/lid-mapping.d.ts +28 -23
- package/lib/Signal/lid-mapping.js +184 -277
- package/lib/Socket/Client/index.d.ts +2 -3
- package/lib/Socket/Client/index.js +22 -3
- package/lib/Socket/Client/types.d.ts +15 -15
- package/lib/Socket/Client/types.js +15 -8
- package/lib/Socket/Client/websocket.d.ts +12 -12
- package/lib/Socket/Client/websocket.js +37 -29
- package/lib/Socket/business.d.ts +178 -208
- package/lib/Socket/business.js +127 -91
- package/lib/Socket/chats.d.ts +93 -120
- package/lib/Socket/chats.js +652 -727
- package/lib/Socket/community.js +10 -2
- package/lib/Socket/groups.d.ts +111 -143
- package/lib/Socket/groups.js +186 -165
- package/lib/Socket/index.d.ts +183 -252
- package/lib/Socket/index.js +18 -38
- package/lib/Socket/messages-recv.d.ts +167 -196
- package/lib/Socket/messages-recv.js +1567 -1443
- package/lib/Socket/messages-send.d.ts +158 -192
- package/lib/Socket/messages-send.js +1208 -1102
- package/lib/Socket/newsletter.d.ts +138 -163
- package/lib/Socket/newsletter.js +249 -153
- package/lib/Socket/socket.d.ts +36 -50
- package/lib/Socket/socket.js +820 -749
- package/lib/Store/index.d.ts +4 -4
- package/lib/Store/index.js +24 -4
- package/lib/Store/make-in-memory-store.d.ts +104 -44
- package/lib/Store/make-in-memory-store.js +213 -199
- package/lib/Store/make-ordered-dictionary.d.ts +12 -13
- package/lib/Store/make-ordered-dictionary.js +45 -38
- package/lib/Store/object-repository.d.ts +10 -11
- package/lib/Store/object-repository.js +16 -9
- package/lib/Types/Auth.d.ts +97 -93
- package/lib/Types/Auth.js +3 -2
- package/lib/Types/Bussines.js +3 -2
- package/lib/Types/Call.d.ts +13 -14
- package/lib/Types/Call.js +3 -2
- package/lib/Types/Chat.d.ts +97 -78
- package/lib/Types/Chat.js +9 -8
- package/lib/Types/Contact.d.ts +9 -12
- package/lib/Types/Contact.js +3 -2
- package/lib/Types/Events.d.ts +176 -206
- package/lib/Types/Events.js +3 -2
- package/lib/Types/GroupMetadata.d.ts +48 -53
- package/lib/Types/GroupMetadata.js +3 -2
- package/lib/Types/Label.d.ts +14 -13
- package/lib/Types/Label.js +30 -24
- package/lib/Types/LabelAssociation.d.ts +20 -15
- package/lib/Types/LabelAssociation.js +12 -6
- package/lib/Types/Message.d.ts +412 -248
- package/lib/Types/Message.js +19 -17
- package/lib/Types/Product.d.ts +71 -58
- package/lib/Types/Product.js +3 -2
- package/lib/Types/Signal.d.ts +82 -71
- package/lib/Types/Signal.js +3 -2
- package/lib/Types/Socket.d.ts +81 -76
- package/lib/Types/Socket.js +3 -3
- package/lib/Types/State.d.ts +19 -75
- package/lib/Types/State.js +14 -56
- package/lib/Types/USync.d.ts +8 -8
- package/lib/Types/USync.js +3 -2
- package/lib/Types/index.d.ts +62 -47
- package/lib/Types/index.js +50 -26
- package/lib/Utils/auth-utils.d.ts +10 -13
- package/lib/Utils/auth-utils.js +472 -213
- package/lib/Utils/business.d.ts +20 -14
- package/lib/Utils/business.js +134 -110
- package/lib/Utils/chat-utils.d.ts +70 -88
- package/lib/Utils/chat-utils.js +403 -466
- package/lib/Utils/crypto.d.ts +46 -27
- package/lib/Utils/crypto.js +188 -117
- package/lib/Utils/decode-wa-message.d.ts +45 -58
- package/lib/Utils/decode-wa-message.js +311 -212
- package/lib/Utils/event-buffer.d.ts +17 -14
- package/lib/Utils/event-buffer.js +296 -321
- package/lib/Utils/generics.d.ts +92 -66
- package/lib/Utils/generics.js +436 -270
- package/lib/Utils/history.d.ts +23 -24
- package/lib/Utils/history.js +76 -106
- package/lib/Utils/index.d.ts +21 -24
- package/lib/Utils/index.js +41 -24
- package/lib/Utils/link-preview.d.ts +14 -12
- package/lib/Utils/link-preview.js +75 -40
- package/lib/Utils/logger.d.ts +11 -10
- package/lib/Utils/logger.js +7 -3
- package/lib/Utils/lt-hash.d.ts +14 -8
- package/lib/Utils/lt-hash.js +53 -3
- package/lib/Utils/make-mutex.d.ts +7 -7
- package/lib/Utils/make-mutex.js +44 -28
- package/lib/Utils/message-retry-manager.d.ts +88 -115
- package/lib/Utils/message-retry-manager.js +160 -265
- package/lib/Utils/messages-media.d.ts +107 -105
- package/lib/Utils/messages-media.js +619 -548
- package/lib/Utils/messages.d.ts +66 -52
- package/lib/Utils/messages.js +1558 -1730
- package/lib/Utils/noise-handler.d.ts +18 -18
- package/lib/Utils/noise-handler.js +130 -176
- package/lib/Utils/process-message.d.ts +32 -43
- package/lib/Utils/process-message.js +282 -484
- package/lib/Utils/rich-message-utils.js +724 -1220
- package/lib/Utils/signal.d.ts +32 -37
- package/lib/Utils/signal.js +105 -140
- package/lib/Utils/use-multi-file-auth-state.d.ts +5 -5
- package/lib/Utils/use-multi-file-auth-state.js +120 -70
- package/lib/Utils/use-single-file-auth-state.d.ts +13 -11
- package/lib/Utils/use-single-file-auth-state.js +66 -92
- package/lib/Utils/validate-connection.d.ts +13 -11
- package/lib/Utils/validate-connection.js +113 -128
- package/lib/WABinary/constants.d.ts +27 -25
- package/lib/WABinary/constants.js +1292 -1451
- package/lib/WABinary/decode.d.ts +9 -7
- package/lib/WABinary/decode.js +189 -163
- package/lib/WABinary/encode.d.ts +3 -3
- package/lib/WABinary/encode.js +155 -110
- package/lib/WABinary/generic-utils.d.ts +27 -14
- package/lib/WABinary/generic-utils.js +105 -177
- package/lib/WABinary/index.d.ts +5 -6
- package/lib/WABinary/index.js +25 -6
- package/lib/WABinary/jid-utils.d.ts +54 -41
- package/lib/WABinary/jid-utils.js +152 -83
- package/lib/WABinary/types.d.ts +13 -10
- package/lib/WABinary/types.js +3 -2
- package/lib/WAM/BinaryInfo.d.ts +15 -8
- package/lib/WAM/BinaryInfo.js +14 -7
- package/lib/WAM/constants.d.ts +37 -30
- package/lib/WAM/constants.js +11983 -19465
- package/lib/WAM/encode.d.ts +3 -3
- package/lib/WAM/encode.js +109 -95
- package/lib/WAM/index.d.ts +3 -4
- package/lib/WAM/index.js +23 -4
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +9 -9
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +21 -37
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +22 -19
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +26 -18
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +12 -11
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +20 -12
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +12 -11
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +24 -16
- package/lib/WAUSync/Protocols/index.d.ts +6 -6
- package/lib/WAUSync/Protocols/index.js +26 -6
- package/lib/WAUSync/USyncQuery.d.ts +28 -27
- package/lib/WAUSync/USyncQuery.js +62 -68
- package/lib/WAUSync/USyncUser.d.ts +10 -15
- package/lib/WAUSync/USyncUser.js +19 -20
- package/lib/WAUSync/index.d.ts +3 -4
- package/lib/WAUSync/index.js +23 -4
- package/lib/index.d.ts +12 -11
- package/lib/index.js +39 -12
- package/package.json +42 -86
- package/engine-requirements.js +0 -10
package/README.md
CHANGED
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
|
|
30
30
|
<br><br>
|
|
31
31
|
|
|
32
|
-
<p><em>Extended from <code>@whiskeysockets/baileys</code> —
|
|
32
|
+
<p><em>Extended from <code>@whiskeysockets/baileys</code> — packed with exclusive patches, AI-rich messages, and advanced WhatsApp features.</em></p>
|
|
33
33
|
|
|
34
34
|
</div>
|
|
35
35
|
|
|
@@ -45,9 +45,7 @@
|
|
|
45
45
|
- [Connecting](#-connecting)
|
|
46
46
|
- [Events](#-events)
|
|
47
47
|
- [Sending Messages](#-sending-messages)
|
|
48
|
-
- [
|
|
49
|
-
- [Order Status](#-order-status)
|
|
50
|
-
- [AI Rich Messages](#-ai-rich-messages)
|
|
48
|
+
- [Rich Messages](#-rich-messages)
|
|
51
49
|
- [Newsletter](#-newsletter)
|
|
52
50
|
- [Groups](#-groups)
|
|
53
51
|
- [Privacy](#-privacy)
|
|
@@ -61,32 +59,34 @@
|
|
|
61
59
|
|
|
62
60
|
## ✨ Why This Fork?
|
|
63
61
|
|
|
64
|
-
|
|
62
|
+
This fork builds on top of the original Baileys library with **targeted, production-ready patches** designed for modern bot development and AI integrations.
|
|
65
63
|
|
|
66
64
|
| # | Patch | Description |
|
|
67
65
|
|:---:|:---|:---|
|
|
68
|
-
| 01 | 🤖 **
|
|
69
|
-
| 02 | 💻 **Code Block** | Syntax-highlighted code
|
|
70
|
-
| 03 | 📊 **Table** |
|
|
71
|
-
| 04 | 🖼️ **Rich
|
|
72
|
-
| 05 | 🎥 **Rich Video** | Video
|
|
73
|
-
| 06 | 💡 **
|
|
74
|
-
| 07 | 🔣 **LaTeX** |
|
|
75
|
-
| 08 | 🛍️ **Rich Product** |
|
|
76
|
-
| 09 | 📰 **Rich Post** |
|
|
77
|
-
| 10 | 🎬 **Reels** |
|
|
78
|
-
| 11 | 🔍 **
|
|
79
|
-
| 12 | 📌 **
|
|
80
|
-
| 13 | 🔀 **Mixed
|
|
81
|
-
| 14 | 🔗 **
|
|
82
|
-
| 15 |
|
|
83
|
-
| 16 |
|
|
84
|
-
| 17 |
|
|
85
|
-
| 18 |
|
|
86
|
-
| 19 |
|
|
87
|
-
| 20 |
|
|
88
|
-
| 21 |
|
|
89
|
-
| 22 |
|
|
66
|
+
| 01 | 🤖 **Rich Text** | AI-styled markdown text via `richText` |
|
|
67
|
+
| 02 | 💻 **Rich Code Block** | Syntax-highlighted code blocks with language support |
|
|
68
|
+
| 03 | 📊 **Rich Table** | Structured data tables with headers and rows |
|
|
69
|
+
| 04 | 🖼️ **Rich Images** | Image grid / carousel for AI-generated visuals |
|
|
70
|
+
| 05 | 🎥 **Rich Video** | Video embeds rendered as AI animated media |
|
|
71
|
+
| 06 | 💡 **Rich Suggestions** | Follow-up prompt pills (like native AI chat) |
|
|
72
|
+
| 07 | 🔣 **Rich LaTeX** | Math formula rendering via `GenAILatexItem` |
|
|
73
|
+
| 08 | 🛍️ **Rich Product** | Product cards with horizontal scroll carousel |
|
|
74
|
+
| 09 | 📰 **Rich Post** | Post cards with author metadata and carousel |
|
|
75
|
+
| 10 | 🎬 **Rich Reels** | Reels carousel with engagement stats |
|
|
76
|
+
| 11 | 🔍 **Rich Sources** | Search result source list with favicons |
|
|
77
|
+
| 12 | 📌 **Rich Tip & Footer** | Metadata blocks for branding and disclaimers |
|
|
78
|
+
| 13 | 🔀 **Rich Mixed** | Combine all rich types freely in `items` arrays |
|
|
79
|
+
| 14 | 🔗 **Rich Response** | Full array mode with inline citations |
|
|
80
|
+
| 15 | 🪪 **Custom Message ID** | All outgoing IDs prefixed with `PONTASOCKETS` |
|
|
81
|
+
| 16 | 🐛 **LID Bug Fixes** | Full resolution for participant, sender, and admin LID issues |
|
|
82
|
+
| 17 | 📦 **makeInMemoryStore Fix** | Stable session handling and store behavior |
|
|
83
|
+
| 18 | 📣 **Newsletter Support** | Full channel/newsletter create, follow, react, and admin tools |
|
|
84
|
+
| 19 | 🤖 **AI Logo Message** | Bot avatar support in message context |
|
|
85
|
+
| 20 | 📊 **Logger Buffer Clear** | Prevents memory buildup from log buffers |
|
|
86
|
+
| 21 | 🔁 **LID → JID Conversion** | Auto-converts LID mentions, sender, and member LIDs to JID |
|
|
87
|
+
| 22 | 📍 **Location + Buttons** | Location messages with native list menu and extra buttons |
|
|
88
|
+
| 23 | 📢 **Group Status** | Styled group status (text/media) with audience control |
|
|
89
|
+
| 24 | 📦 **Order Status** | Interactive order tracking cards with native `order_status` flow |
|
|
90
90
|
|
|
91
91
|
---
|
|
92
92
|
|
|
@@ -95,7 +95,7 @@ Fork ini dibangun di atas Baileys asli, dengan penekanan khusus pada satu hal: *
|
|
|
95
95
|
```
|
|
96
96
|
✔ Multi-Device Support ✔ End-to-End Encryption
|
|
97
97
|
✔ Real-Time Messaging ✔ Session Persistence
|
|
98
|
-
✔ AI
|
|
98
|
+
✔ Rich AI Bot Messages ✔ Newsletter Management
|
|
99
99
|
✔ Group & Channel Management ✔ Inline Citations & LaTeX
|
|
100
100
|
✔ Poll, Album, Carousel ✔ LID → JID Auto-Conversion
|
|
101
101
|
✔ Product / Post / Reels Cards ✔ Math Formula Rendering
|
|
@@ -168,6 +168,8 @@ const sock = makeWASocket({
|
|
|
168
168
|
if (!sock.authState.creds.registered) {
|
|
169
169
|
const number = '62xxxx'
|
|
170
170
|
const code = await sock.requestPairingCode(number)
|
|
171
|
+
// Or custom 8-digit code:
|
|
172
|
+
const customCode = await sock.requestPairingCode(number, 'PONTASOCKETS')
|
|
171
173
|
console.log(code)
|
|
172
174
|
}
|
|
173
175
|
```
|
|
@@ -227,11 +229,13 @@ await sock.sendMessage(jid, { text: 'Reply!' }, { quoted: message })
|
|
|
227
229
|
<summary><b>🖼️ Image</b></summary>
|
|
228
230
|
|
|
229
231
|
```js
|
|
232
|
+
// From file
|
|
230
233
|
await sock.sendMessage(jid, {
|
|
231
234
|
image: fs.readFileSync('image.jpg'),
|
|
232
235
|
caption: 'Caption here'
|
|
233
236
|
})
|
|
234
237
|
|
|
238
|
+
// From URL
|
|
235
239
|
await sock.sendMessage(jid, {
|
|
236
240
|
image: { url: 'https://example.com/image.jpg' },
|
|
237
241
|
caption: 'Downloaded image'
|
|
@@ -248,6 +252,7 @@ await sock.sendMessage(jid, {
|
|
|
248
252
|
caption: 'Funny clip!'
|
|
249
253
|
})
|
|
250
254
|
|
|
255
|
+
// View Once
|
|
251
256
|
await sock.sendMessage(jid, {
|
|
252
257
|
video: fs.readFileSync('secret.mp4'),
|
|
253
258
|
viewOnce: true
|
|
@@ -259,8 +264,10 @@ await sock.sendMessage(jid, {
|
|
|
259
264
|
<summary><b>🎵 Audio / PTT</b></summary>
|
|
260
265
|
|
|
261
266
|
```js
|
|
267
|
+
// Regular audio
|
|
262
268
|
await sock.sendMessage(jid, { audio: fs.readFileSync('audio.mp3'), ptt: false })
|
|
263
269
|
|
|
270
|
+
// Push-to-talk
|
|
264
271
|
await sock.sendMessage(jid, {
|
|
265
272
|
audio: fs.readFileSync('voice.ogg'),
|
|
266
273
|
ptt: true,
|
|
@@ -304,7 +311,8 @@ await sock.sendMessage(jid, {
|
|
|
304
311
|
|
|
305
312
|
```js
|
|
306
313
|
await sock.sendMessage(jid, { react: { text: '👍', key: message.key } })
|
|
307
|
-
|
|
314
|
+
// Remove reaction
|
|
315
|
+
await sock.sendMessage(jid, { react: { text: '', key: message.key } })
|
|
308
316
|
```
|
|
309
317
|
</details>
|
|
310
318
|
|
|
@@ -325,15 +333,11 @@ await sock.sendMessage(jid, {
|
|
|
325
333
|
<details>
|
|
326
334
|
<summary><b>📸 Album</b></summary>
|
|
327
335
|
|
|
328
|
-
> Minimal 2 media (gabungan gambar/video). Gunakan key `album`, bukan method terpisah.
|
|
329
|
-
|
|
330
336
|
```js
|
|
331
|
-
await sock.
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
]
|
|
336
|
-
}, { quoted: message })
|
|
337
|
+
await sock.sendAlbumMessage(jid, [
|
|
338
|
+
{ image: { url: 'https://example.com/1.jpg' }, caption: 'First' },
|
|
339
|
+
{ video: { url: 'https://example.com/clip.mp4' }, caption: 'Second' }
|
|
340
|
+
], { quoted: message, delay: 3000 })
|
|
337
341
|
```
|
|
338
342
|
</details>
|
|
339
343
|
|
|
@@ -341,11 +345,12 @@ await sock.sendMessage(jid, {
|
|
|
341
345
|
<summary><b>👨💻 Interactive (Native Flow & Carousel)</b></summary>
|
|
342
346
|
|
|
343
347
|
```js
|
|
344
|
-
// Native Flow
|
|
348
|
+
// Native Flow
|
|
345
349
|
await sock.sendMessage(jid, {
|
|
346
350
|
text: 'Choose an option:',
|
|
347
|
-
|
|
348
|
-
|
|
351
|
+
title: 'Title',
|
|
352
|
+
footer: '© PONTASOCKETS Baileys',
|
|
353
|
+
interactive: [{
|
|
349
354
|
name: 'quick_reply',
|
|
350
355
|
buttonParamsJson: JSON.stringify({ display_text: 'Quick Reply', id: '123' })
|
|
351
356
|
}]
|
|
@@ -354,13 +359,14 @@ await sock.sendMessage(jid, {
|
|
|
354
359
|
// Carousel
|
|
355
360
|
await sock.sendMessage(jid, {
|
|
356
361
|
text: 'Check out our collection!',
|
|
357
|
-
|
|
362
|
+
title: 'Catalog',
|
|
363
|
+
footer: '© PONTASOCKETS Baileys',
|
|
358
364
|
cards: [{
|
|
359
365
|
image: { url: 'https://example.com/image.jpg' },
|
|
360
366
|
title: 'Product Name',
|
|
361
|
-
|
|
362
|
-
footer: '©
|
|
363
|
-
|
|
367
|
+
body: 'Product description',
|
|
368
|
+
footer: '© PONTASOCKETS',
|
|
369
|
+
buttons: [{
|
|
364
370
|
name: 'quick_reply',
|
|
365
371
|
buttonParamsJson: JSON.stringify({ display_text: 'Select', id: '1' })
|
|
366
372
|
}]
|
|
@@ -385,7 +391,7 @@ await sock.sendMessage(jid, { keep: { key: message.key, type: 1 } })
|
|
|
385
391
|
|
|
386
392
|
### 📍 Location + Buttons
|
|
387
393
|
|
|
388
|
-
>
|
|
394
|
+
> Location message with native list menu (`single_select`) and extra buttons — all in one `buttonsMessage`.
|
|
389
395
|
|
|
390
396
|
<details>
|
|
391
397
|
<summary><b>Location + List Menu</b></summary>
|
|
@@ -401,15 +407,11 @@ await sock.sendMessage(jid, {
|
|
|
401
407
|
footer: '© PontaCT',
|
|
402
408
|
thumbnail: 'https://example.com/map-preview.jpg',
|
|
403
409
|
listButtonText: 'Pilih Layanan',
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
{ id: 'kasir', title: 'Kasir & Pembayaran', description: 'Lantai 2, buka setiap hari' },
|
|
410
|
-
{ id: 'gudang', title: 'Gudang & Pengiriman', description: 'Gedung B, pintu belakang' }
|
|
411
|
-
]
|
|
412
|
-
}
|
|
410
|
+
listSectionTitle: 'Layanan Tersedia',
|
|
411
|
+
listMenu: [
|
|
412
|
+
{ title: 'Customer Service', description: 'Lantai 1, Senin–Jumat 08.00–17.00', id: 'cs' },
|
|
413
|
+
{ title: 'Kasir & Pembayaran', description: 'Lantai 2, buka setiap hari', id: 'kasir' },
|
|
414
|
+
{ title: 'Gudang & Pengiriman', description: 'Gedung B, pintu belakang', id: 'gudang' }
|
|
413
415
|
]
|
|
414
416
|
}
|
|
415
417
|
})
|
|
@@ -439,23 +441,51 @@ await sock.sendMessage(jid, {
|
|
|
439
441
|
```
|
|
440
442
|
</details>
|
|
441
443
|
|
|
444
|
+
<details>
|
|
445
|
+
<summary><b>Location + List Menu + Extra Buttons</b></summary>
|
|
446
|
+
|
|
447
|
+
```js
|
|
448
|
+
await sock.sendMessage(jid, {
|
|
449
|
+
buttonLocation: {
|
|
450
|
+
latitude: -6.2088,
|
|
451
|
+
longitude: 106.8456,
|
|
452
|
+
name: 'Plaza PontaCT',
|
|
453
|
+
address: 'Jl. MH Thamrin No. 5, Jakarta',
|
|
454
|
+
text: 'Selamat datang di pusat layanan kami.',
|
|
455
|
+
footer: 'Buka setiap hari 09.00–21.00',
|
|
456
|
+
thumbnail: 'https://example.com/plaza.jpg',
|
|
457
|
+
listButtonText: 'Pilih Tujuan',
|
|
458
|
+
listSectionTitle: 'Area Tersedia',
|
|
459
|
+
listMenu: [
|
|
460
|
+
{ title: 'Food Court', description: 'Lt. 1 — lebih dari 30 tenant', id: 'food' },
|
|
461
|
+
{ title: 'Cinema', description: 'Lt. 4 — 8 studio', id: 'cinema' },
|
|
462
|
+
{ title: 'Customer Care', description: 'Lt. 2 — sebelah eskalator', id: 'care' }
|
|
463
|
+
],
|
|
464
|
+
extraButtons: [
|
|
465
|
+
{ id: 'navigate', displayText: '🧭 Navigasi' },
|
|
466
|
+
{ id: 'promo', displayText: '🎁 Promo Hari Ini' }
|
|
467
|
+
]
|
|
468
|
+
}
|
|
469
|
+
})
|
|
470
|
+
```
|
|
471
|
+
</details>
|
|
472
|
+
|
|
442
473
|
<details>
|
|
443
474
|
<summary><b>📋 Fields Reference</b></summary>
|
|
444
475
|
|
|
445
476
|
| Field | Type | Required | Default | Description |
|
|
446
477
|
|:---|:---|:---:|:---|:---|
|
|
447
|
-
| `latitude` | `number` |
|
|
448
|
-
| `longitude` | `number` |
|
|
449
|
-
| `name` | `string` | — | `'Location'` |
|
|
450
|
-
| `address` | `string` | — | `''` |
|
|
451
|
-
| `text` | `string` | — | `''` |
|
|
452
|
-
| `footer` | `string` | — | `''` |
|
|
453
|
-
| `thumbnail` | `Buffer / URL / path` |
|
|
454
|
-
| `listButtonText` | `string` | — | `'
|
|
455
|
-
| `
|
|
456
|
-
| `
|
|
457
|
-
|
|
458
|
-
> Wajib ada minimal 1 `sections` **atau** 1 `extraButtons`.
|
|
478
|
+
| `latitude` | `number` | — | `0` | Latitude coordinate |
|
|
479
|
+
| `longitude` | `number` | — | `0` | Longitude coordinate |
|
|
480
|
+
| `name` | `string` | — | `'Location'` | Place name |
|
|
481
|
+
| `address` | `string` | — | `''` | Text address |
|
|
482
|
+
| `text` | `string` | — | `''` | Message body text |
|
|
483
|
+
| `footer` | `string` | — | `''` | Footer text |
|
|
484
|
+
| `thumbnail` | `Buffer / URL / path` | ✅ | — | Map preview image |
|
|
485
|
+
| `listButtonText` | `string` | — | `'Pilih Menu'` | List button label |
|
|
486
|
+
| `listSectionTitle` | `string` | — | `'Pilihan'` | List section title |
|
|
487
|
+
| `listMenu` | `array` | — | — | Menu rows |
|
|
488
|
+
| `extraButtons` | `array` | — | — | Extra buttons |
|
|
459
489
|
|
|
460
490
|
</details>
|
|
461
491
|
|
|
@@ -463,7 +493,7 @@ await sock.sendMessage(jid, {
|
|
|
463
493
|
|
|
464
494
|
### 📦 Order Status
|
|
465
495
|
|
|
466
|
-
>
|
|
496
|
+
> Interactive order tracking card using native `order_status` flow button.
|
|
467
497
|
|
|
468
498
|
<details>
|
|
469
499
|
<summary><b>Basic Order Status</b></summary>
|
|
@@ -474,7 +504,7 @@ await sock.sendMessage(jid, {
|
|
|
474
504
|
image: 'https://example.com/order-banner.jpg',
|
|
475
505
|
title: 'Status Pesanan',
|
|
476
506
|
text: 'Pesanan kamu sedang diproses oleh penjual.',
|
|
477
|
-
referenceId: 'ORD-
|
|
507
|
+
referenceId: 'ORD-20250629-001',
|
|
478
508
|
status: 'PROCESSING',
|
|
479
509
|
currency: 'IDR'
|
|
480
510
|
}
|
|
@@ -489,10 +519,10 @@ await sock.sendMessage(jid, {
|
|
|
489
519
|
await sock.sendMessage(jid, {
|
|
490
520
|
orderStatus: {
|
|
491
521
|
image: 'https://example.com/order.jpg',
|
|
492
|
-
title: 'Update Pesanan #ORD-
|
|
522
|
+
title: 'Update Pesanan #ORD-2025-001',
|
|
493
523
|
text: 'Pesananmu sedang dalam perjalanan! 🚚',
|
|
494
524
|
footer: 'Estimasi tiba: 2–3 hari kerja',
|
|
495
|
-
referenceId: 'ORD-
|
|
525
|
+
referenceId: 'ORD-2025-001',
|
|
496
526
|
status: 'SHIPPED',
|
|
497
527
|
subtotalValue: 15000000,
|
|
498
528
|
subtotalOffset: 100,
|
|
@@ -504,22 +534,40 @@ await sock.sendMessage(jid, {
|
|
|
504
534
|
```
|
|
505
535
|
</details>
|
|
506
536
|
|
|
537
|
+
<details>
|
|
538
|
+
<summary><b>Local Image File</b></summary>
|
|
539
|
+
|
|
540
|
+
```js
|
|
541
|
+
const fs = require('fs')
|
|
542
|
+
await sock.sendMessage(jid, {
|
|
543
|
+
orderStatus: {
|
|
544
|
+
image: fs.readFileSync('./assets/order-confirm.jpg'),
|
|
545
|
+
title: 'Pesanan Dikonfirmasi ✅',
|
|
546
|
+
text: 'Terima kasih telah berbelanja!',
|
|
547
|
+
referenceId: 'ORD-LOCAL-001',
|
|
548
|
+
status: 'PROCESSING',
|
|
549
|
+
currency: 'IDR'
|
|
550
|
+
}
|
|
551
|
+
})
|
|
552
|
+
```
|
|
553
|
+
</details>
|
|
554
|
+
|
|
507
555
|
<details>
|
|
508
556
|
<summary><b>📋 Fields Reference</b></summary>
|
|
509
557
|
|
|
510
558
|
| Field | Type | Required | Default | Description |
|
|
511
559
|
|:---|:---|:---:|:---|:---|
|
|
512
|
-
| `image` | `Buffer / URL / path` | ✅ | — |
|
|
513
|
-
| `title` | `string` | — | `'Order Status'` |
|
|
514
|
-
| `text` | `string` | — | `'Silakan cek status pesanan Anda.'` |
|
|
515
|
-
| `footer` | `string` | — | `'Powered by
|
|
516
|
-
| `referenceId` | `string` |
|
|
517
|
-
| `status` | `string` | — | `'PROCESSING'` |
|
|
518
|
-
| `subtotalValue` | `number` | — | `0` |
|
|
519
|
-
| `subtotalOffset` | `number` | — | `100` |
|
|
520
|
-
| `taxValue` | `number` | — | `0` |
|
|
521
|
-
| `taxOffset` | `number` | — | `100` |
|
|
522
|
-
| `currency` | `string` | — | `'IDR'` |
|
|
560
|
+
| `image` | `Buffer / URL / path` | ✅ | — | Header card image |
|
|
561
|
+
| `title` | `string` | — | `'Order Status'` | Header title |
|
|
562
|
+
| `text` | `string` | — | `'Silakan cek status pesanan Anda.'` | Body text |
|
|
563
|
+
| `footer` | `string` | — | `'Powered by PontaCT'` | Footer text |
|
|
564
|
+
| `referenceId` | `string` | — | `'PT-001'` | Order reference ID |
|
|
565
|
+
| `status` | `string` | — | `'PROCESSING'` | Order status |
|
|
566
|
+
| `subtotalValue` | `number` | — | `0` | Subtotal value (in offset units) |
|
|
567
|
+
| `subtotalOffset` | `number` | — | `100` | Value divider |
|
|
568
|
+
| `taxValue` | `number` | — | `0` | Tax value |
|
|
569
|
+
| `taxOffset` | `number` | — | `100` | Tax divider |
|
|
570
|
+
| `currency` | `string` | — | `'IDR'` | Currency code |
|
|
523
571
|
|
|
524
572
|
> **Status values:** `PROCESSING` · `SHIPPED` · `DELIVERED` · `CANCELLED` · `REFUNDED`
|
|
525
573
|
|
|
@@ -527,60 +575,75 @@ await sock.sendMessage(jid, {
|
|
|
527
575
|
|
|
528
576
|
---
|
|
529
577
|
|
|
530
|
-
### 🤖
|
|
578
|
+
### 🤖 Rich Messages
|
|
531
579
|
|
|
532
|
-
>
|
|
580
|
+
> 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.
|
|
533
581
|
|
|
534
|
-
**Quick jump:** [
|
|
582
|
+
**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)
|
|
535
583
|
|
|
536
584
|
---
|
|
537
585
|
|
|
538
|
-
####
|
|
586
|
+
#### 📝 Rich Text
|
|
587
|
+
|
|
588
|
+
> AI bot-styled markdown text rendered in `richResponseMessage`.
|
|
539
589
|
|
|
540
|
-
>
|
|
590
|
+
<details>
|
|
591
|
+
<summary><b>Simple Text</b></summary>
|
|
592
|
+
|
|
593
|
+
```js
|
|
594
|
+
await sock.sendMessage(jid, { richText: 'Halo! Ini pesan dari bot.' }, { quoted: message })
|
|
595
|
+
```
|
|
596
|
+
</details>
|
|
597
|
+
|
|
598
|
+
<details>
|
|
599
|
+
<summary><b>Markdown (bold, italic, inline code)</b></summary>
|
|
541
600
|
|
|
542
601
|
```js
|
|
543
602
|
await sock.sendMessage(jid, {
|
|
544
|
-
|
|
545
|
-
{ text: 'Ini teks dari AI dengan *markdown* dan _italic_.' },
|
|
546
|
-
{ code: 'console.log("Hello World")', language: 'javascript' },
|
|
547
|
-
{ table: [['id', 'name', 'score'], ['1', 'Ponta', '98'], ['2', 'Yue', '87']], title: 'Leaderboard' },
|
|
548
|
-
{ suggest: ['Lihat selengkapnya', 'Bagikan', 'Simpan'] }
|
|
549
|
-
],
|
|
550
|
-
topText: 'Judul',
|
|
551
|
-
bottomText: 'Footer',
|
|
552
|
-
aiNotice: 'Generated by AI'
|
|
603
|
+
richText: '*Hasil eksekusi:*\nStatus: `success`\nWaktu: _120ms_'
|
|
553
604
|
}, { quoted: message })
|
|
554
605
|
```
|
|
606
|
+
</details>
|
|
555
607
|
|
|
556
|
-
|
|
608
|
+
<details>
|
|
609
|
+
<summary><b>Multiple Paragraphs (Array)</b></summary>
|
|
557
610
|
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
| `{ richVideo }` | Video embed |
|
|
565
|
-
| `{ latex }` | Formula matematika |
|
|
566
|
-
| `{ richProduct }` | Kartu produk |
|
|
567
|
-
| `{ richPost }` | Kartu post |
|
|
568
|
-
| `{ reels }` | Carousel reels |
|
|
569
|
-
| `{ source }` | Daftar sumber pencarian |
|
|
570
|
-
| `{ tip }` | Teks metadata kecil |
|
|
571
|
-
| `{ suggest }` | Suggestion pills |
|
|
572
|
-
| `{ gridImage, inlineImage, dynamic, map, contentItems }` | Tipe legacy (masih didukung) |
|
|
611
|
+
```js
|
|
612
|
+
await sock.sendMessage(jid, {
|
|
613
|
+
richText: ['Baris pertama.', 'Baris kedua.', 'Baris ketiga.']
|
|
614
|
+
}, { quoted: message })
|
|
615
|
+
```
|
|
616
|
+
</details>
|
|
573
617
|
|
|
574
618
|
---
|
|
575
619
|
|
|
576
|
-
#### 💻 Code Block
|
|
620
|
+
#### 💻 Rich Code Block
|
|
621
|
+
|
|
622
|
+
> Syntax-highlighted code. Use `code` for single block, `codes` for multiple.
|
|
623
|
+
|
|
624
|
+
<details>
|
|
625
|
+
<summary><b>Single Block</b></summary>
|
|
626
|
+
|
|
627
|
+
```js
|
|
628
|
+
await sock.sendMessage(jid, {
|
|
629
|
+
code: 'console.log("Hello World")',
|
|
630
|
+
language: 'javascript'
|
|
631
|
+
}, { quoted: message })
|
|
632
|
+
```
|
|
633
|
+
</details>
|
|
634
|
+
|
|
635
|
+
<details>
|
|
636
|
+
<summary><b>Multiple Blocks</b></summary>
|
|
577
637
|
|
|
578
638
|
```js
|
|
579
639
|
await sock.sendMessage(jid, {
|
|
580
|
-
|
|
581
|
-
|
|
640
|
+
codes: [
|
|
641
|
+
{ code: 'SELECT * FROM users WHERE id = 1;', language: 'sql' },
|
|
642
|
+
{ code: '{ "id": 1, "name": "Ponta", "role": "admin" }', language: 'json' }
|
|
643
|
+
]
|
|
582
644
|
}, { quoted: message })
|
|
583
645
|
```
|
|
646
|
+
</details>
|
|
584
647
|
|
|
585
648
|
<details>
|
|
586
649
|
<summary><b>Supported Languages</b></summary>
|
|
@@ -603,141 +666,373 @@ await sock.sendMessage(jid, {
|
|
|
603
666
|
|
|
604
667
|
---
|
|
605
668
|
|
|
606
|
-
#### 📊 Table
|
|
669
|
+
#### 📊 Rich Table
|
|
670
|
+
|
|
671
|
+
> Structured table with `title`, `headers`, and `rows`.
|
|
607
672
|
|
|
608
|
-
>
|
|
673
|
+
<details>
|
|
674
|
+
<summary><b>Simple Table</b></summary>
|
|
609
675
|
|
|
610
676
|
```js
|
|
611
677
|
await sock.sendMessage(jid, {
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
['Name', 'Role', 'Status'],
|
|
615
|
-
[
|
|
616
|
-
|
|
617
|
-
|
|
678
|
+
table: {
|
|
679
|
+
title: 'Daftar User',
|
|
680
|
+
headers: ['Name', 'Role', 'Status'],
|
|
681
|
+
rows: [
|
|
682
|
+
['Ponta', 'Admin', 'Active'],
|
|
683
|
+
['Yue', 'Member', 'Idle'],
|
|
684
|
+
['Frieren', 'Guest', 'Offline']
|
|
685
|
+
]
|
|
686
|
+
}
|
|
687
|
+
}, { quoted: message })
|
|
688
|
+
```
|
|
689
|
+
</details>
|
|
690
|
+
|
|
691
|
+
<details>
|
|
692
|
+
<summary><b>Table without Title</b></summary>
|
|
693
|
+
|
|
694
|
+
```js
|
|
695
|
+
await sock.sendMessage(jid, {
|
|
696
|
+
table: {
|
|
697
|
+
headers: ['Command', 'Description'],
|
|
698
|
+
rows: [
|
|
699
|
+
['.ping', 'Cek latency bot'],
|
|
700
|
+
['.info', 'Info bot'],
|
|
701
|
+
['.help', 'List semua command']
|
|
702
|
+
]
|
|
703
|
+
}
|
|
704
|
+
}, { quoted: message })
|
|
705
|
+
```
|
|
706
|
+
</details>
|
|
707
|
+
|
|
708
|
+
<details>
|
|
709
|
+
<summary><b>Data Only (no header)</b></summary>
|
|
710
|
+
|
|
711
|
+
```js
|
|
712
|
+
await sock.sendMessage(jid, {
|
|
713
|
+
table: {
|
|
714
|
+
rows: [
|
|
715
|
+
['RAM', '512 MB'],
|
|
716
|
+
['CPU', '4 Core'],
|
|
717
|
+
['Uptime', '99.9%']
|
|
718
|
+
]
|
|
719
|
+
}
|
|
618
720
|
}, { quoted: message })
|
|
619
721
|
```
|
|
722
|
+
</details>
|
|
620
723
|
|
|
621
724
|
---
|
|
622
725
|
|
|
623
|
-
#### 🖼️ Rich
|
|
726
|
+
#### 🖼️ Rich Images
|
|
727
|
+
|
|
728
|
+
> AI image grid. Single URL = single image, multiple URLs = carousel.
|
|
729
|
+
|
|
730
|
+
<details>
|
|
731
|
+
<summary><b>Single Image</b></summary>
|
|
624
732
|
|
|
625
733
|
```js
|
|
626
|
-
|
|
627
|
-
|
|
734
|
+
await sock.sendMessage(jid, { richImages: 'https://example.com/photo.jpg' }, { quoted: message })
|
|
735
|
+
```
|
|
736
|
+
</details>
|
|
628
737
|
|
|
629
|
-
|
|
738
|
+
<details>
|
|
739
|
+
<summary><b>Multiple Images (Grid)</b></summary>
|
|
740
|
+
|
|
741
|
+
```js
|
|
630
742
|
await sock.sendMessage(jid, {
|
|
631
|
-
|
|
743
|
+
richImages: [
|
|
632
744
|
'https://example.com/photo1.jpg',
|
|
633
745
|
'https://example.com/photo2.jpg',
|
|
634
746
|
'https://example.com/photo3.jpg'
|
|
635
747
|
]
|
|
636
748
|
}, { quoted: message })
|
|
637
749
|
```
|
|
750
|
+
</details>
|
|
751
|
+
|
|
752
|
+
<details>
|
|
753
|
+
<summary><b>Inside items / richResponse</b></summary>
|
|
754
|
+
|
|
755
|
+
```js
|
|
756
|
+
// items
|
|
757
|
+
await sock.sendMessage(jid, {
|
|
758
|
+
items: [
|
|
759
|
+
{ text: 'Hasil foto hari ini:' },
|
|
760
|
+
{ images: ['https://example.com/1.jpg', 'https://example.com/2.jpg'] }
|
|
761
|
+
]
|
|
762
|
+
}, { quoted: message })
|
|
763
|
+
|
|
764
|
+
// richResponse
|
|
765
|
+
await sock.sendMessage(jid, {
|
|
766
|
+
richResponse: [
|
|
767
|
+
{ text: 'Lihat gambarnya:' },
|
|
768
|
+
{ images: 'https://example.com/banner.jpg' }
|
|
769
|
+
]
|
|
770
|
+
}, { quoted: message })
|
|
771
|
+
```
|
|
772
|
+
</details>
|
|
638
773
|
|
|
639
774
|
---
|
|
640
775
|
|
|
641
776
|
#### 🎥 Rich Video
|
|
642
777
|
|
|
643
|
-
>
|
|
778
|
+
> Video embed as AI animated media (`GenAIImaginePrimitive` with `imagine_type: ANIMATE`).
|
|
779
|
+
|
|
780
|
+
<details>
|
|
781
|
+
<summary><b>Shorthand URL</b></summary>
|
|
782
|
+
|
|
783
|
+
```js
|
|
784
|
+
await sock.sendMessage(jid, { richVideo: 'https://example.com/clip.mp4' }, { quoted: message })
|
|
785
|
+
```
|
|
786
|
+
</details>
|
|
787
|
+
|
|
788
|
+
<details>
|
|
789
|
+
<summary><b>Full Options</b></summary>
|
|
790
|
+
|
|
791
|
+
```js
|
|
792
|
+
await sock.sendMessage(jid, {
|
|
793
|
+
richVideo: {
|
|
794
|
+
url: 'https://example.com/clip.mp4',
|
|
795
|
+
mimeType: 'video/mp4', // default: 'video/mp4'
|
|
796
|
+
duration: 15, // seconds, default: 10
|
|
797
|
+
fallbackText: 'Preview video' // default: '[ VIDEO - PontaCT ]'
|
|
798
|
+
}
|
|
799
|
+
}, { quoted: message })
|
|
800
|
+
```
|
|
801
|
+
</details>
|
|
802
|
+
|
|
803
|
+
<details>
|
|
804
|
+
<summary><b>Inside items / richResponse</b></summary>
|
|
644
805
|
|
|
645
806
|
```js
|
|
807
|
+
// items
|
|
808
|
+
await sock.sendMessage(jid, {
|
|
809
|
+
items: [
|
|
810
|
+
{ text: 'Cek videonya:' },
|
|
811
|
+
{ videoUrl: 'https://example.com/clip.mp4', duration: 20 }
|
|
812
|
+
]
|
|
813
|
+
}, { quoted: message })
|
|
814
|
+
|
|
815
|
+
// richResponse
|
|
646
816
|
await sock.sendMessage(jid, {
|
|
647
|
-
|
|
817
|
+
richResponse: [
|
|
818
|
+
{ text: 'Tutorial:' },
|
|
819
|
+
{ video: { url: 'https://example.com/tutorial.mp4', duration: 30 } }
|
|
820
|
+
]
|
|
648
821
|
}, { quoted: message })
|
|
649
822
|
```
|
|
823
|
+
</details>
|
|
650
824
|
|
|
651
825
|
---
|
|
652
826
|
|
|
653
|
-
#### 💡
|
|
827
|
+
#### 💡 Rich Suggestions
|
|
828
|
+
|
|
829
|
+
> Follow-up prompt pills — like native AI chat buttons.
|
|
830
|
+
|
|
831
|
+
<details>
|
|
832
|
+
<summary><b>Shorthand</b></summary>
|
|
833
|
+
|
|
834
|
+
```js
|
|
835
|
+
await sock.sendMessage(jid, {
|
|
836
|
+
richSuggestions: ['Coba lagi', 'Lihat detail', 'Batalkan']
|
|
837
|
+
}, { quoted: message })
|
|
838
|
+
```
|
|
839
|
+
</details>
|
|
840
|
+
|
|
841
|
+
<details>
|
|
842
|
+
<summary><b>Inside items / richResponse</b></summary>
|
|
654
843
|
|
|
655
844
|
```js
|
|
845
|
+
// items
|
|
656
846
|
await sock.sendMessage(jid, {
|
|
657
|
-
|
|
847
|
+
items: [
|
|
848
|
+
{ text: 'Mau lanjut ke mana?' },
|
|
849
|
+
{ suggestions: ['Halaman utama', 'Bantuan', 'Hubungi admin'] }
|
|
850
|
+
]
|
|
851
|
+
}, { quoted: message })
|
|
852
|
+
|
|
853
|
+
// richResponse
|
|
854
|
+
await sock.sendMessage(jid, {
|
|
855
|
+
richResponse: [
|
|
856
|
+
{ text: 'Hasil pencarian ditemukan.' },
|
|
857
|
+
{ suggestions: ['Tampilkan semua', 'Filter ulang', 'Export'] }
|
|
858
|
+
]
|
|
658
859
|
}, { quoted: message })
|
|
659
860
|
```
|
|
861
|
+
</details>
|
|
660
862
|
|
|
661
863
|
---
|
|
662
864
|
|
|
663
|
-
#### 🔣 LaTeX
|
|
865
|
+
#### 🔣 Rich LaTeX
|
|
866
|
+
|
|
867
|
+
> Math formula rendering as `GenAILatexItem` inline entity. `url` points to a rendered formula image (PNG/JPG from external LaTeX renderer).
|
|
664
868
|
|
|
665
|
-
>
|
|
869
|
+
<details>
|
|
870
|
+
<summary><b>Shorthand URL</b></summary>
|
|
666
871
|
|
|
667
872
|
```js
|
|
668
873
|
await sock.sendMessage(jid, {
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
874
|
+
richLatex: 'https://latex.codecogs.com/png.latex?E%3Dmc%5E2'
|
|
875
|
+
}, { quoted: message })
|
|
876
|
+
```
|
|
877
|
+
</details>
|
|
878
|
+
|
|
879
|
+
<details>
|
|
880
|
+
<summary><b>Full Options</b></summary>
|
|
881
|
+
|
|
882
|
+
```js
|
|
883
|
+
await sock.sendMessage(jid, {
|
|
884
|
+
richLatex: {
|
|
885
|
+
url: 'https://latex.codecogs.com/png.latex?E%3Dmc%5E2',
|
|
886
|
+
text: 'E = mc²', // label & fallback
|
|
887
|
+
width: 120, // default: 100
|
|
888
|
+
height: 60, // default: 100
|
|
889
|
+
font_height: 83.33, // default: 83.33
|
|
890
|
+
padding: 15 // default: 15
|
|
674
891
|
}
|
|
675
892
|
}, { quoted: message })
|
|
676
893
|
```
|
|
894
|
+
</details>
|
|
895
|
+
|
|
896
|
+
<details>
|
|
897
|
+
<summary><b>Inside items / richResponse</b></summary>
|
|
898
|
+
|
|
899
|
+
```js
|
|
900
|
+
// items
|
|
901
|
+
await sock.sendMessage(jid, {
|
|
902
|
+
items: [
|
|
903
|
+
{ text: 'Rumus energi kinetik:' },
|
|
904
|
+
{
|
|
905
|
+
latexUrl: 'https://latex.codecogs.com/png.latex?E_k%3D%5Cfrac%7B1%7D%7B2%7Dmv%5E2',
|
|
906
|
+
latexText: 'Ek = ½mv²',
|
|
907
|
+
latexWidth: 150,
|
|
908
|
+
latexHeight: 60
|
|
909
|
+
}
|
|
910
|
+
]
|
|
911
|
+
}, { quoted: message })
|
|
912
|
+
|
|
913
|
+
// richResponse
|
|
914
|
+
await sock.sendMessage(jid, {
|
|
915
|
+
richResponse: [
|
|
916
|
+
{ text: 'Solusi integral:' },
|
|
917
|
+
{ latex: { url: 'https://latex.codecogs.com/png.latex?%5Cint%20x%5E2%20dx', text: '∫x² dx = x³/3 + C' } }
|
|
918
|
+
]
|
|
919
|
+
}, { quoted: message })
|
|
920
|
+
```
|
|
921
|
+
</details>
|
|
677
922
|
|
|
678
923
|
---
|
|
679
924
|
|
|
680
925
|
#### 🛍️ Rich Product
|
|
681
926
|
|
|
927
|
+
> Product card(s) as `GenAIProductItemCardPrimitive`. Object = single card, Array = horizontal scroll carousel.
|
|
928
|
+
|
|
929
|
+
<details>
|
|
930
|
+
<summary><b>Single Product</b></summary>
|
|
931
|
+
|
|
682
932
|
```js
|
|
683
|
-
// Single
|
|
684
933
|
await sock.sendMessage(jid, {
|
|
685
934
|
richProduct: {
|
|
686
935
|
title: 'Sepatu Adidas Samba',
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
936
|
+
price_display_string: 'Rp 1.200.000',
|
|
937
|
+
description: 'Sepatu casual ikonik, tersedia berbagai ukuran.',
|
|
938
|
+
retailer_id: 'adidas_store',
|
|
939
|
+
thumbnail: { url: 'https://example.com/adidas.jpg', mime_type: 'image/jpeg', width: 300, height: 300 }
|
|
691
940
|
}
|
|
692
941
|
}, { quoted: message })
|
|
942
|
+
```
|
|
943
|
+
</details>
|
|
944
|
+
|
|
945
|
+
<details>
|
|
946
|
+
<summary><b>Product Carousel</b></summary>
|
|
693
947
|
|
|
694
|
-
|
|
948
|
+
```js
|
|
695
949
|
await sock.sendMessage(jid, {
|
|
696
950
|
richProduct: [
|
|
697
|
-
{
|
|
698
|
-
|
|
951
|
+
{
|
|
952
|
+
title: 'Sepatu A',
|
|
953
|
+
price_display_string: 'Rp 500.000',
|
|
954
|
+
thumbnail: { url: 'https://example.com/a.jpg', mime_type: 'image/jpeg', width: 300, height: 300 }
|
|
955
|
+
},
|
|
956
|
+
{
|
|
957
|
+
title: 'Sepatu B',
|
|
958
|
+
price_display_string: 'Rp 750.000',
|
|
959
|
+
thumbnail: { url: 'https://example.com/b.jpg', mime_type: 'image/jpeg', width: 300, height: 300 }
|
|
960
|
+
}
|
|
699
961
|
]
|
|
700
962
|
}, { quoted: message })
|
|
701
963
|
```
|
|
964
|
+
</details>
|
|
702
965
|
|
|
703
966
|
<details>
|
|
704
|
-
<summary><b
|
|
967
|
+
<summary><b>Inside items / richResponse</b></summary>
|
|
705
968
|
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
969
|
+
```js
|
|
970
|
+
// items
|
|
971
|
+
await sock.sendMessage(jid, {
|
|
972
|
+
items: [
|
|
973
|
+
{ text: 'Rekomendasi produk hari ini:' },
|
|
974
|
+
{ product: { title: 'Produk X', price_display_string: 'Rp 99.000' } }
|
|
975
|
+
]
|
|
976
|
+
}, { quoted: message })
|
|
712
977
|
|
|
978
|
+
// richResponse
|
|
979
|
+
await sock.sendMessage(jid, {
|
|
980
|
+
richResponse: [
|
|
981
|
+
{ text: 'Pilih produkmu:' },
|
|
982
|
+
{ product: [{ title: 'A' }, { title: 'B' }] }
|
|
983
|
+
]
|
|
984
|
+
}, { quoted: message })
|
|
985
|
+
```
|
|
713
986
|
</details>
|
|
714
987
|
|
|
715
988
|
---
|
|
716
989
|
|
|
717
990
|
#### 📰 Rich Post
|
|
718
991
|
|
|
992
|
+
> Post card(s) as `GenAIPostPrimitive`. Object = single post, Array = carousel.
|
|
993
|
+
|
|
994
|
+
<details>
|
|
995
|
+
<summary><b>Single Post</b></summary>
|
|
996
|
+
|
|
719
997
|
```js
|
|
720
998
|
await sock.sendMessage(jid, {
|
|
721
999
|
richPost: {
|
|
722
1000
|
title: 'Caption post ini',
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
comments_count: 8,
|
|
728
|
-
source_app: 'INSTAGRAM'
|
|
1001
|
+
author_display_name: '@pontalabs',
|
|
1002
|
+
author_profile_image: 'https://example.com/avatar.jpg',
|
|
1003
|
+
media_url: 'https://example.com/post.jpg',
|
|
1004
|
+
timestamp: Math.floor(Date.now() / 1000)
|
|
729
1005
|
}
|
|
730
1006
|
}, { quoted: message })
|
|
731
1007
|
```
|
|
1008
|
+
</details>
|
|
1009
|
+
|
|
1010
|
+
<details>
|
|
1011
|
+
<summary><b>Post Carousel</b></summary>
|
|
1012
|
+
|
|
1013
|
+
```js
|
|
1014
|
+
await sock.sendMessage(jid, {
|
|
1015
|
+
richPost: [
|
|
1016
|
+
{ title: 'Post 1', author_display_name: '@user1', media_url: 'https://example.com/1.jpg' },
|
|
1017
|
+
{ title: 'Post 2', author_display_name: '@user2', media_url: 'https://example.com/2.jpg' }
|
|
1018
|
+
]
|
|
1019
|
+
}, { quoted: message })
|
|
1020
|
+
```
|
|
1021
|
+
</details>
|
|
732
1022
|
|
|
733
1023
|
---
|
|
734
1024
|
|
|
735
|
-
#### 🎬 Reels
|
|
1025
|
+
#### 🎬 Rich Reels
|
|
1026
|
+
|
|
1027
|
+
> Reels carousel as `GenAIReelPrimitive` with `contentItemsMetadata`. Auto-injects `richResponseSourcesMetadata` with `provider: 'PontaCT'`.
|
|
1028
|
+
|
|
1029
|
+
<details>
|
|
1030
|
+
<summary><b>Single Reel</b></summary>
|
|
736
1031
|
|
|
737
1032
|
```js
|
|
738
1033
|
await sock.sendMessage(jid, {
|
|
739
|
-
|
|
740
|
-
|
|
1034
|
+
richReels: {
|
|
1035
|
+
title: '@creator_name',
|
|
741
1036
|
profileIconUrl: 'https://example.com/avatar.jpg',
|
|
742
1037
|
thumbnailUrl: 'https://example.com/thumb.jpg',
|
|
743
1038
|
videoUrl: 'https://example.com/reel.mp4',
|
|
@@ -750,72 +1045,330 @@ await sock.sendMessage(jid, {
|
|
|
750
1045
|
}
|
|
751
1046
|
}, { quoted: message })
|
|
752
1047
|
```
|
|
1048
|
+
</details>
|
|
1049
|
+
|
|
1050
|
+
<details>
|
|
1051
|
+
<summary><b>Reels Carousel</b></summary>
|
|
1052
|
+
|
|
1053
|
+
```js
|
|
1054
|
+
await sock.sendMessage(jid, {
|
|
1055
|
+
richReels: [
|
|
1056
|
+
{
|
|
1057
|
+
title: '@creator1',
|
|
1058
|
+
profileIconUrl: 'https://example.com/av1.jpg',
|
|
1059
|
+
thumbnailUrl: 'https://example.com/th1.jpg',
|
|
1060
|
+
videoUrl: 'https://example.com/r1.mp4',
|
|
1061
|
+
likes_count: 5000,
|
|
1062
|
+
reel_source: 'IG'
|
|
1063
|
+
},
|
|
1064
|
+
{
|
|
1065
|
+
title: '@creator2',
|
|
1066
|
+
profileIconUrl: 'https://example.com/av2.jpg',
|
|
1067
|
+
thumbnailUrl: 'https://example.com/th2.jpg',
|
|
1068
|
+
videoUrl: 'https://example.com/r2.mp4',
|
|
1069
|
+
likes_count: 8200,
|
|
1070
|
+
reel_source: 'TT'
|
|
1071
|
+
}
|
|
1072
|
+
]
|
|
1073
|
+
}, { quoted: message })
|
|
1074
|
+
```
|
|
1075
|
+
</details>
|
|
753
1076
|
|
|
754
1077
|
<details>
|
|
755
1078
|
<summary><b>📋 Fields Reference</b></summary>
|
|
756
1079
|
|
|
757
|
-
| Field | Default | Description |
|
|
758
|
-
|
|
759
|
-
| `
|
|
760
|
-
| `profileIconUrl` | — | Avatar URL |
|
|
761
|
-
| `thumbnailUrl` | — | Thumbnail cover |
|
|
762
|
-
| `videoUrl` | — |
|
|
763
|
-
| `reels_title` | `''` |
|
|
764
|
-
| `likes_count
|
|
765
|
-
| `
|
|
766
|
-
| `
|
|
1080
|
+
| Field | Type | Default | Description |
|
|
1081
|
+
|:---|:---|:---:|:---|
|
|
1082
|
+
| `title` | `string` | — | Username / creator name |
|
|
1083
|
+
| `profileIconUrl` | `string` | — | Avatar URL |
|
|
1084
|
+
| `thumbnailUrl` | `string` | — | Thumbnail cover URL |
|
|
1085
|
+
| `videoUrl` | `string` | — | Video source URL |
|
|
1086
|
+
| `reels_title` | `string` | `''` | Reel title |
|
|
1087
|
+
| `likes_count` | `number` | `0` | Like count |
|
|
1088
|
+
| `shares_count` | `number` | `0` | Share count |
|
|
1089
|
+
| `view_count` | `number` | `0` | View count |
|
|
1090
|
+
| `reel_source` | `string` | `'IG'` | Source platform |
|
|
1091
|
+
| `is_verified` | `boolean` | `false` | Verified badge |
|
|
767
1092
|
|
|
768
1093
|
</details>
|
|
769
1094
|
|
|
770
1095
|
---
|
|
771
1096
|
|
|
772
|
-
#### 🔍
|
|
1097
|
+
#### 🔍 Rich Sources
|
|
1098
|
+
|
|
1099
|
+
> Search result source list as `GenAISearchResultPrimitive`. Accepts full objects **or** shorthand `[faviconUrl, sourceUrl, displayName]`.
|
|
1100
|
+
|
|
1101
|
+
<details>
|
|
1102
|
+
<summary><b>Shorthand Array</b></summary>
|
|
1103
|
+
|
|
1104
|
+
```js
|
|
1105
|
+
await sock.sendMessage(jid, {
|
|
1106
|
+
richSources: [
|
|
1107
|
+
['https://wikipedia.org/favicon.ico', 'https://wikipedia.org/wiki/Node.js', 'Wikipedia'],
|
|
1108
|
+
['https://nodejs.org/favicon.ico', 'https://nodejs.org/en/docs', 'Node.js Docs'],
|
|
1109
|
+
['https://github.com/favicon.ico', 'https://github.com/nodejs/node', 'GitHub']
|
|
1110
|
+
]
|
|
1111
|
+
}, { quoted: message })
|
|
1112
|
+
```
|
|
1113
|
+
</details>
|
|
1114
|
+
|
|
1115
|
+
<details>
|
|
1116
|
+
<summary><b>Full Object</b></summary>
|
|
1117
|
+
|
|
1118
|
+
```js
|
|
1119
|
+
await sock.sendMessage(jid, {
|
|
1120
|
+
richSources: [
|
|
1121
|
+
{
|
|
1122
|
+
source_type: 'THIRD_PARTY',
|
|
1123
|
+
source_display_name: 'Wikipedia',
|
|
1124
|
+
source_subtitle: 'wikipedia.org',
|
|
1125
|
+
source_url: 'https://wikipedia.org/wiki/Node.js',
|
|
1126
|
+
favicon: { url: 'https://wikipedia.org/favicon.ico', mime_type: 'image/jpeg', width: 16, height: 16 }
|
|
1127
|
+
}
|
|
1128
|
+
]
|
|
1129
|
+
}, { quoted: message })
|
|
1130
|
+
```
|
|
1131
|
+
</details>
|
|
1132
|
+
|
|
1133
|
+
<details>
|
|
1134
|
+
<summary><b>Mixed Format</b></summary>
|
|
773
1135
|
|
|
774
1136
|
```js
|
|
775
1137
|
await sock.sendMessage(jid, {
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
{
|
|
1138
|
+
richSources: [
|
|
1139
|
+
['https://wikipedia.org/fav.ico', 'https://wikipedia.org', 'Wikipedia'],
|
|
1140
|
+
{ source_type: 'THIRD_PARTY', source_display_name: 'Docs', source_url: 'https://docs.example.com' }
|
|
779
1141
|
]
|
|
780
1142
|
}, { quoted: message })
|
|
781
1143
|
```
|
|
1144
|
+
</details>
|
|
782
1145
|
|
|
783
1146
|
---
|
|
784
1147
|
|
|
785
|
-
#### 📌
|
|
1148
|
+
#### 📌 Rich Tip & Footer
|
|
1149
|
+
|
|
1150
|
+
> `richTip` — small metadata text above/center of message.
|
|
1151
|
+
> `richFooter` — metadata text below message (disclaimer / branding).
|
|
786
1152
|
|
|
787
|
-
>
|
|
1153
|
+
<details>
|
|
1154
|
+
<summary><b>Rich Tip</b></summary>
|
|
788
1155
|
|
|
789
1156
|
```js
|
|
790
1157
|
await sock.sendMessage(jid, {
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
1158
|
+
richTip: 'Dihasilkan oleh AI · pontalabs v0.3.4'
|
|
1159
|
+
}, { quoted: message })
|
|
1160
|
+
```
|
|
1161
|
+
</details>
|
|
1162
|
+
|
|
1163
|
+
<details>
|
|
1164
|
+
<summary><b>Rich Footer</b></summary>
|
|
1165
|
+
|
|
1166
|
+
```js
|
|
1167
|
+
await sock.sendMessage(jid, {
|
|
1168
|
+
richFooter: '© 2025 PontaCT · Data bersumber dari layanan publik'
|
|
1169
|
+
}, { quoted: message })
|
|
1170
|
+
```
|
|
1171
|
+
</details>
|
|
1172
|
+
|
|
1173
|
+
<details>
|
|
1174
|
+
<summary><b>Inside items / richResponse</b></summary>
|
|
1175
|
+
|
|
1176
|
+
```js
|
|
1177
|
+
// items
|
|
1178
|
+
await sock.sendMessage(jid, {
|
|
1179
|
+
items: [
|
|
1180
|
+
{ text: 'Hasil pencarian:' },
|
|
1181
|
+
{ sources: [['https://fav.ico', 'https://example.com', 'Example']] },
|
|
1182
|
+
{ tip: 'AI-generated content' },
|
|
1183
|
+
{ footer: '© PontaCT Baileys' }
|
|
1184
|
+
]
|
|
1185
|
+
}, { quoted: message })
|
|
1186
|
+
|
|
1187
|
+
// richResponse
|
|
1188
|
+
await sock.sendMessage(jid, {
|
|
1189
|
+
richResponse: [
|
|
1190
|
+
{ text: 'Summary di sini.' },
|
|
1191
|
+
{ footer: '© PontaCT · pontalabs' }
|
|
1192
|
+
]
|
|
1193
|
+
}, { quoted: message })
|
|
1194
|
+
```
|
|
1195
|
+
</details>
|
|
1196
|
+
|
|
1197
|
+
---
|
|
1198
|
+
|
|
1199
|
+
#### 🔀 Rich Mixed — `items`
|
|
1200
|
+
|
|
1201
|
+
> Combine all rich types in any order. Array order = display order.
|
|
1202
|
+
|
|
1203
|
+
**Valid keys in `items`:**
|
|
1204
|
+
|
|
1205
|
+
| Key | Type |
|
|
1206
|
+
|:---|:---|
|
|
1207
|
+
| `{ text }` | Rich text |
|
|
1208
|
+
| `{ code, language }` | Code block |
|
|
1209
|
+
| `{ table }` | Table |
|
|
1210
|
+
| `{ images }` | Image grid |
|
|
1211
|
+
| `{ videoUrl, mimeType?, duration? }` | Video embed |
|
|
1212
|
+
| `{ suggestions }` | Suggestion pills |
|
|
1213
|
+
| `{ latexUrl, latexText?, latexWidth?, latexHeight? }` | LaTeX formula |
|
|
1214
|
+
| `{ product }` | Product card(s) |
|
|
1215
|
+
| `{ post }` | Post card(s) |
|
|
1216
|
+
| `{ reels }` | Reels carousel |
|
|
1217
|
+
| `{ sources }` | Search sources |
|
|
1218
|
+
| `{ tip }` | Tip metadata |
|
|
1219
|
+
| `{ footer }` | Footer metadata |
|
|
1220
|
+
|
|
1221
|
+
<details>
|
|
1222
|
+
<summary><b>Text + Code + Table</b></summary>
|
|
1223
|
+
|
|
1224
|
+
```js
|
|
1225
|
+
await sock.sendMessage(jid, {
|
|
1226
|
+
items: [
|
|
1227
|
+
{ text: 'Query yang dijalankan:' },
|
|
1228
|
+
{ code: 'SELECT id, name, score FROM users ORDER BY score DESC LIMIT 3', language: 'sql' },
|
|
1229
|
+
{ text: 'Hasil:' },
|
|
1230
|
+
{
|
|
1231
|
+
table: {
|
|
1232
|
+
headers: ['id', 'name', 'score'],
|
|
1233
|
+
rows: [
|
|
1234
|
+
['1', 'Ponta', '98'],
|
|
1235
|
+
['2', 'Yue', '87'],
|
|
1236
|
+
['3', 'Frieren', '75']
|
|
1237
|
+
]
|
|
1238
|
+
}
|
|
1239
|
+
}
|
|
1240
|
+
]
|
|
1241
|
+
}, { quoted: message })
|
|
1242
|
+
```
|
|
1243
|
+
</details>
|
|
1244
|
+
|
|
1245
|
+
<details>
|
|
1246
|
+
<summary><b>Text + Images + Video + Suggestions</b></summary>
|
|
1247
|
+
|
|
1248
|
+
```js
|
|
1249
|
+
await sock.sendMessage(jid, {
|
|
1250
|
+
items: [
|
|
1251
|
+
{ text: '*Konten hari ini*' },
|
|
1252
|
+
{ images: ['https://example.com/1.jpg', 'https://example.com/2.jpg'] },
|
|
1253
|
+
{ videoUrl: 'https://example.com/preview.mp4', duration: 15 },
|
|
1254
|
+
{ suggestions: ['Lihat selengkapnya', 'Bagikan', 'Simpan'] }
|
|
1255
|
+
]
|
|
1256
|
+
}, { quoted: message })
|
|
1257
|
+
```
|
|
1258
|
+
</details>
|
|
1259
|
+
|
|
1260
|
+
<details>
|
|
1261
|
+
<summary><b>Full Mixed (all types)</b></summary>
|
|
1262
|
+
|
|
1263
|
+
```js
|
|
1264
|
+
await sock.sendMessage(jid, {
|
|
1265
|
+
items: [
|
|
1266
|
+
{ text: '*Laporan Harian Bot*' },
|
|
1267
|
+
{ table: { headers: ['Metric', 'Value'], rows: [['Uptime', '99.9%'], ['Messages', '1.2K']] } },
|
|
1268
|
+
{ code: 'SELECT COUNT(*) FROM messages WHERE date = CURDATE()', language: 'sql' },
|
|
1269
|
+
{ text: 'Formula uptime:' },
|
|
1270
|
+
{
|
|
1271
|
+
latexUrl: 'https://latex.codecogs.com/png.latex?U%3D%5Cfrac%7Bt_u%7D%7Bt_t%7D%5Ctimes100',
|
|
1272
|
+
latexText: 'U = (tu/tt) × 100'
|
|
1273
|
+
},
|
|
1274
|
+
{ sources: [['https://example.com/fav.ico', 'https://example.com', 'Dashboard']] },
|
|
1275
|
+
{ suggestions: ['Refresh', 'Export PDF'] },
|
|
1276
|
+
{ footer: 'Auto-generated · PontaCT' }
|
|
1277
|
+
]
|
|
1278
|
+
}, { quoted: message })
|
|
798
1279
|
```
|
|
1280
|
+
</details>
|
|
799
1281
|
|
|
800
1282
|
---
|
|
801
1283
|
|
|
802
|
-
#### 🔗
|
|
1284
|
+
#### 🔗 Rich Response — `richResponse`
|
|
803
1285
|
|
|
804
|
-
>
|
|
1286
|
+
> Full array mode supporting all types including inline citations via `inlineEntities`.
|
|
1287
|
+
|
|
1288
|
+
**Valid keys in `richResponse`:**
|
|
1289
|
+
|
|
1290
|
+
| Key | Type |
|
|
1291
|
+
|:---|:---|
|
|
1292
|
+
| `{ text, inlineEntities? }` | Text + optional citation/hyperlink |
|
|
1293
|
+
| `{ code, language }` | Code block |
|
|
1294
|
+
| `{ table, title? }` | Table |
|
|
1295
|
+
| `{ images }` | Image grid |
|
|
1296
|
+
| `{ video }` | Video embed |
|
|
1297
|
+
| `{ suggestions }` | Suggestion pills |
|
|
1298
|
+
| `{ latex }` | LaTeX formula |
|
|
1299
|
+
| `{ product }` | Product card(s) |
|
|
1300
|
+
| `{ post }` | Post card(s) |
|
|
1301
|
+
| `{ reels }` | Reels carousel |
|
|
1302
|
+
| `{ sources }` | Search sources |
|
|
1303
|
+
| `{ tip }` | Tip metadata |
|
|
1304
|
+
| `{ footer }` | Footer metadata |
|
|
1305
|
+
|
|
1306
|
+
<details>
|
|
1307
|
+
<summary><b>Inline Citation</b></summary>
|
|
805
1308
|
|
|
806
1309
|
```js
|
|
807
1310
|
await sock.sendMessage(jid, {
|
|
808
|
-
|
|
1311
|
+
richResponse: [
|
|
809
1312
|
{
|
|
810
|
-
text: 'Node.js adalah runtime JavaScript',
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
1313
|
+
text: 'Node.js {{SS_0}}¹{{/SS_0}} adalah runtime JavaScript. Dibuat oleh Ryan Dahl {{SS_1}}²{{/SS_1}} pada 2009.',
|
|
1314
|
+
inlineEntities: [
|
|
1315
|
+
{
|
|
1316
|
+
key: 'SS_0',
|
|
1317
|
+
metadata: {
|
|
1318
|
+
reference_id: 1,
|
|
1319
|
+
reference_url: 'https://nodejs.org',
|
|
1320
|
+
reference_title: 'Node.js Official',
|
|
1321
|
+
reference_display_name: 'nodejs.org',
|
|
1322
|
+
sources: [{
|
|
1323
|
+
source_type: 'THIRD_PARTY',
|
|
1324
|
+
source_display_name: 'nodejs.org',
|
|
1325
|
+
source_subtitle: 'nodejs.org',
|
|
1326
|
+
source_url: 'https://nodejs.org'
|
|
1327
|
+
}],
|
|
1328
|
+
__typename: 'GenAISearchCitationItem'
|
|
1329
|
+
}
|
|
1330
|
+
},
|
|
1331
|
+
{
|
|
1332
|
+
key: 'SS_1',
|
|
1333
|
+
metadata: {
|
|
1334
|
+
reference_id: 2,
|
|
1335
|
+
reference_url: 'https://wikipedia.org/wiki/Ryan_Dahl',
|
|
1336
|
+
reference_title: 'Ryan Dahl - Wikipedia',
|
|
1337
|
+
reference_display_name: 'Wikipedia',
|
|
1338
|
+
sources: [{
|
|
1339
|
+
source_type: 'THIRD_PARTY',
|
|
1340
|
+
source_display_name: 'Wikipedia',
|
|
1341
|
+
source_subtitle: 'wikipedia.org',
|
|
1342
|
+
source_url: 'https://wikipedia.org/wiki/Ryan_Dahl'
|
|
1343
|
+
}],
|
|
1344
|
+
__typename: 'GenAISearchCitationItem'
|
|
1345
|
+
}
|
|
1346
|
+
}
|
|
1347
|
+
]
|
|
814
1348
|
}
|
|
815
|
-
]
|
|
816
|
-
|
|
1349
|
+
]
|
|
1350
|
+
}, { quoted: message })
|
|
1351
|
+
```
|
|
1352
|
+
</details>
|
|
1353
|
+
|
|
1354
|
+
<details>
|
|
1355
|
+
<summary><b>Full Response — all types at once</b></summary>
|
|
1356
|
+
|
|
1357
|
+
```js
|
|
1358
|
+
await sock.sendMessage(jid, {
|
|
1359
|
+
richResponse: [
|
|
1360
|
+
{ text: '*Hasil Pencarian:* Node.js {{SS_0}}¹{{/SS_0}}', inlineEntities: [/* ... */] },
|
|
1361
|
+
{ images: ['https://example.com/nodejs.png'] },
|
|
1362
|
+
{ text: 'Cara install:' },
|
|
1363
|
+
{ code: 'npm install node', language: 'bash' },
|
|
1364
|
+
{ table: { headers: ['Version', 'LTS', 'Release'], rows: [['22.x', 'Yes', '2024'], ['21.x', 'No', '2023']] } },
|
|
1365
|
+
{ sources: [['https://nodejs.org/fav.ico', 'https://nodejs.org', 'Node.js']] },
|
|
1366
|
+
{ suggestions: ['Lihat changelog', 'Download', 'Docs'] },
|
|
1367
|
+
{ footer: 'PontaCT · pontalabs' }
|
|
1368
|
+
]
|
|
817
1369
|
}, { quoted: message })
|
|
818
1370
|
```
|
|
1371
|
+
</details>
|
|
819
1372
|
|
|
820
1373
|
---
|
|
821
1374
|
|
|
@@ -825,8 +1378,11 @@ await sock.sendMessage(jid, {
|
|
|
825
1378
|
<summary><b>📋 Get Newsletter Metadata</b></summary>
|
|
826
1379
|
|
|
827
1380
|
```js
|
|
1381
|
+
// By invite code
|
|
828
1382
|
const newsletter = await sock.newsletterMetadata('invite', '0029Vaf0HPMLdQeZsp3XRp2T')
|
|
829
|
-
|
|
1383
|
+
|
|
1384
|
+
// By JID
|
|
1385
|
+
const newsletter = await sock.newsletterMetadata('jid', '120363282083849178@newsletter')
|
|
830
1386
|
```
|
|
831
1387
|
</details>
|
|
832
1388
|
|
|
@@ -859,7 +1415,11 @@ const newsletter = await sock.newsletterCreate(
|
|
|
859
1415
|
<summary><b>🌟 React to Newsletter Post</b></summary>
|
|
860
1416
|
|
|
861
1417
|
```js
|
|
862
|
-
await sock.newsletterReactMessage(
|
|
1418
|
+
await sock.newsletterReactMessage(
|
|
1419
|
+
'120363282083849178@newsletter',
|
|
1420
|
+
'12', // server message ID
|
|
1421
|
+
'🦖' // emoji
|
|
1422
|
+
)
|
|
863
1423
|
```
|
|
864
1424
|
</details>
|
|
865
1425
|
|
|
@@ -886,10 +1446,10 @@ console.log('Group JID:', group.id)
|
|
|
886
1446
|
```js
|
|
887
1447
|
const jid = '123456789@g.us'
|
|
888
1448
|
|
|
889
|
-
await sock.groupSettingUpdate(jid, 'announcement')
|
|
890
|
-
await sock.groupSettingUpdate(jid, 'not_announcement')
|
|
891
|
-
await sock.groupSettingUpdate(jid, 'locked')
|
|
892
|
-
await sock.groupSettingUpdate(jid, 'unlocked')
|
|
1449
|
+
await sock.groupSettingUpdate(jid, 'announcement') // admin-only messages
|
|
1450
|
+
await sock.groupSettingUpdate(jid, 'not_announcement') // all members can send
|
|
1451
|
+
await sock.groupSettingUpdate(jid, 'locked') // admin-only edit info
|
|
1452
|
+
await sock.groupSettingUpdate(jid, 'unlocked') // all members can edit info
|
|
893
1453
|
```
|
|
894
1454
|
</details>
|
|
895
1455
|
|
|
@@ -913,41 +1473,54 @@ await sock.groupParticipantsUpdate(jid, participants, 'demote')
|
|
|
913
1473
|
const code = await sock.groupInviteCode(jid)
|
|
914
1474
|
console.log('Link: https://chat.whatsapp.com/' + code)
|
|
915
1475
|
|
|
1476
|
+
// Revoke & generate new link
|
|
916
1477
|
const newCode = await sock.groupRevokeInvite(jid)
|
|
917
1478
|
```
|
|
918
1479
|
</details>
|
|
919
1480
|
|
|
1481
|
+
<details>
|
|
1482
|
+
<summary><b>📋 Group Metadata</b></summary>
|
|
1483
|
+
|
|
1484
|
+
```js
|
|
1485
|
+
const metadata = await sock.groupMetadata(jid)
|
|
1486
|
+
console.log('Name:', metadata.subject)
|
|
1487
|
+
console.log('Participants:', metadata.participants.length)
|
|
1488
|
+
```
|
|
1489
|
+
</details>
|
|
1490
|
+
|
|
920
1491
|
<details>
|
|
921
1492
|
<summary><b>📢 Group Status</b></summary>
|
|
922
1493
|
|
|
923
|
-
>
|
|
1494
|
+
> Send group status (`groupStatusMessageV2`) with audience control and styling. `message` can be a `string` or a prepared WAMessage object.
|
|
924
1495
|
|
|
925
1496
|
```js
|
|
926
1497
|
// Text Status
|
|
927
1498
|
await sock.sendMessage(jid, {
|
|
928
|
-
|
|
929
|
-
message:
|
|
930
|
-
audienceType: 0
|
|
1499
|
+
groupStatus: {
|
|
1500
|
+
message: 'Selamat datang di grup PontaCT! 🎉',
|
|
1501
|
+
audienceType: 0 // 0 = all members
|
|
931
1502
|
}
|
|
932
1503
|
})
|
|
933
1504
|
|
|
934
1505
|
// Styled Text Status
|
|
935
1506
|
await sock.sendMessage(jid, {
|
|
936
|
-
|
|
937
|
-
message:
|
|
1507
|
+
groupStatus: {
|
|
1508
|
+
message: 'Bot aktif kembali! ✅',
|
|
938
1509
|
audienceType: 0,
|
|
939
|
-
|
|
940
|
-
|
|
1510
|
+
backgroundArgb: 0xFF1A1A2E,
|
|
1511
|
+
textArgb: 0xFFFFFFFF,
|
|
941
1512
|
font: 4
|
|
942
1513
|
}
|
|
943
1514
|
})
|
|
944
1515
|
|
|
945
1516
|
// Media Status
|
|
1517
|
+
const { imageMessage } = await prepareWAMessageMedia(
|
|
1518
|
+
{ image: { url: 'https://example.com/banner.jpg' } },
|
|
1519
|
+
{ upload: sock.waUploadToServer }
|
|
1520
|
+
)
|
|
1521
|
+
|
|
946
1522
|
await sock.sendMessage(jid, {
|
|
947
|
-
|
|
948
|
-
message: { image: { url: 'https://example.com/banner.jpg' } },
|
|
949
|
-
audienceType: 0
|
|
950
|
-
}
|
|
1523
|
+
groupStatus: { message: { imageMessage }, audienceType: 0 }
|
|
951
1524
|
})
|
|
952
1525
|
```
|
|
953
1526
|
|
|
@@ -956,11 +1529,11 @@ await sock.sendMessage(jid, {
|
|
|
956
1529
|
|
|
957
1530
|
| Field | Type | Required | Default | Description |
|
|
958
1531
|
|:---|:---|:---:|:---|:---|
|
|
959
|
-
| `message` | `object` | ✅ | — |
|
|
1532
|
+
| `message` | `string / object` | ✅ | — | Status content (string or WAMessage) |
|
|
960
1533
|
| `audienceType` | `number` | — | `0` | Target audience (0 = all) |
|
|
961
|
-
| `
|
|
962
|
-
| `
|
|
963
|
-
| `font` | `number` | — | — |
|
|
1534
|
+
| `backgroundArgb` | `number` | — | — | Background ARGB color (text only) |
|
|
1535
|
+
| `textArgb` | `number` | — | — | Text ARGB color (text only) |
|
|
1536
|
+
| `font` | `number` | — | — | Font style 0–9 (text only) |
|
|
964
1537
|
|
|
965
1538
|
</details>
|
|
966
1539
|
|
|
@@ -992,12 +1565,12 @@ await sock.updateBlockStatus(jid, 'unblock')
|
|
|
992
1565
|
<summary><b>👁️ Privacy Settings</b></summary>
|
|
993
1566
|
|
|
994
1567
|
```js
|
|
995
|
-
await sock.updateLastSeenPrivacy('all')
|
|
996
|
-
await sock.updateOnlinePrivacy('all')
|
|
997
|
-
await sock.updateProfilePicturePrivacy('all')
|
|
998
|
-
await sock.updateReadReceiptsPrivacy('all')
|
|
999
|
-
await sock.updateGroupsAddPrivacy('all')
|
|
1000
|
-
await sock.updateDefaultDisappearingMode(86400)
|
|
1568
|
+
await sock.updateLastSeenPrivacy('all') // 'all' | 'contacts' | 'none'
|
|
1569
|
+
await sock.updateOnlinePrivacy('all') // 'all' | 'match_last_seen'
|
|
1570
|
+
await sock.updateProfilePicturePrivacy('all') // 'all' | 'contacts' | 'none'
|
|
1571
|
+
await sock.updateReadReceiptsPrivacy('all') // 'all' | 'none'
|
|
1572
|
+
await sock.updateGroupsAddPrivacy('all') // 'all' | 'contacts'
|
|
1573
|
+
await sock.updateDefaultDisappearingMode(86400) // 0 = disable
|
|
1001
1574
|
```
|
|
1002
1575
|
</details>
|
|
1003
1576
|
|
|
@@ -1010,7 +1583,7 @@ await sock.updateDefaultDisappearingMode(86400)
|
|
|
1010
1583
|
|
|
1011
1584
|
```js
|
|
1012
1585
|
const sock = makeWASocket({
|
|
1013
|
-
logger: { level: 'debug' },
|
|
1586
|
+
logger: { level: 'debug' }, // 'fatal' | 'error' | 'warn' | 'info' | 'debug' | 'trace'
|
|
1014
1587
|
auth: state
|
|
1015
1588
|
})
|
|
1016
1589
|
```
|
|
@@ -1023,6 +1596,10 @@ const sock = makeWASocket({
|
|
|
1023
1596
|
sock.ws.on('CB:presence', (json) => {
|
|
1024
1597
|
console.log('Presence update:', json)
|
|
1025
1598
|
})
|
|
1599
|
+
|
|
1600
|
+
sock.ws.on('CB:edge_routing', (node) => {
|
|
1601
|
+
console.log('Edge routing:', node)
|
|
1602
|
+
})
|
|
1026
1603
|
```
|
|
1027
1604
|
</details>
|
|
1028
1605
|
|
|
@@ -1030,39 +1607,34 @@ sock.ws.on('CB:presence', (json) => {
|
|
|
1030
1607
|
|
|
1031
1608
|
## 📚 API Reference
|
|
1032
1609
|
|
|
1033
|
-
| Method
|
|
1610
|
+
| Method | Description |
|
|
1034
1611
|
|:---|:---|
|
|
1035
|
-
| `makeWASocket(options)` |
|
|
1036
|
-
| `useMultiFileAuthState(path)` | Multi-file
|
|
1037
|
-
| `sock.sendMessage(jid, content, opts)` |
|
|
1038
|
-
| `
|
|
1039
|
-
| `
|
|
1040
|
-
| `
|
|
1041
|
-
| `
|
|
1042
|
-
| `
|
|
1043
|
-
| `
|
|
1044
|
-
| `sock.
|
|
1045
|
-
| `sock.
|
|
1046
|
-
| `sock.
|
|
1047
|
-
| `sock.
|
|
1048
|
-
| `sock.
|
|
1049
|
-
| `sock.
|
|
1050
|
-
| `sock.
|
|
1051
|
-
| `sock.
|
|
1052
|
-
| `sock.
|
|
1053
|
-
| `sock.
|
|
1054
|
-
| `sock.
|
|
1055
|
-
| `sock.
|
|
1056
|
-
| `sock.
|
|
1057
|
-
| `sock.
|
|
1058
|
-
| `sock.
|
|
1059
|
-
| `sock.
|
|
1060
|
-
| `sock.
|
|
1061
|
-
| `sock.updateOnlinePrivacy(value)` | Atur visibilitas status online |
|
|
1062
|
-
| `sock.updateProfilePicturePrivacy(value)` | Atur visibilitas foto profil |
|
|
1063
|
-
| `sock.updateReadReceiptsPrivacy(value)` | Atur read receipts |
|
|
1064
|
-
| `sock.updateGroupsAddPrivacy(value)` | Atur siapa yang bisa menambahkan ke grup |
|
|
1065
|
-
| `sock.updateDefaultDisappearingMode(seconds)` | Atur default disappearing messages |
|
|
1612
|
+
| `makeWASocket(options)` | Create a new WhatsApp socket connection |
|
|
1613
|
+
| `useMultiFileAuthState(path)` | Multi-file authentication state manager |
|
|
1614
|
+
| `sock.sendMessage(jid, content, opts)` | Send any message type |
|
|
1615
|
+
| `sock.sendAlbumMessage(jid, contents, opts)` | Send album/carousel of media |
|
|
1616
|
+
| `sock.groupCreate(title, participants)` | Create a new group |
|
|
1617
|
+
| `sock.groupMetadata(jid)` | Fetch group metadata |
|
|
1618
|
+
| `sock.groupSettingUpdate(jid, setting)` | Update group settings |
|
|
1619
|
+
| `sock.groupParticipantsUpdate(jid, participants, action)` | Modify group members |
|
|
1620
|
+
| `sock.groupInviteCode(jid)` | Get group invite code |
|
|
1621
|
+
| `sock.groupRevokeInvite(jid)` | Revoke and regenerate invite |
|
|
1622
|
+
| `sock.newsletterMetadata(type, value)` | Fetch newsletter info |
|
|
1623
|
+
| `sock.newsletterCreate(name, desc, picture)` | Create a newsletter |
|
|
1624
|
+
| `sock.newsletterFollow(jid)` | Follow a newsletter |
|
|
1625
|
+
| `sock.newsletterUnfollow(jid)` | Unfollow a newsletter |
|
|
1626
|
+
| `sock.newsletterMute(jid)` | Mute a newsletter |
|
|
1627
|
+
| `sock.newsletterUnmute(jid)` | Unmute a newsletter |
|
|
1628
|
+
| `sock.newsletterReactMessage(jid, id, emoji)` | React to a newsletter post |
|
|
1629
|
+
| `sock.updateProfilePicture(jid, content)` | Update profile picture |
|
|
1630
|
+
| `sock.removeProfilePicture(jid)` | Remove profile picture |
|
|
1631
|
+
| `sock.updateBlockStatus(jid, status)` | Block or unblock a user |
|
|
1632
|
+
| `sock.updateLastSeenPrivacy(value)` | Control last seen visibility |
|
|
1633
|
+
| `sock.updateOnlinePrivacy(value)` | Control online status visibility |
|
|
1634
|
+
| `sock.updateProfilePicturePrivacy(value)` | Control profile picture visibility |
|
|
1635
|
+
| `sock.updateReadReceiptsPrivacy(value)` | Control read receipts |
|
|
1636
|
+
| `sock.updateGroupsAddPrivacy(value)` | Control who can add you to groups |
|
|
1637
|
+
| `sock.updateDefaultDisappearingMode(seconds)` | Set default disappearing messages |
|
|
1066
1638
|
|
|
1067
1639
|
---
|
|
1068
1640
|
|
|
@@ -1078,31 +1650,31 @@ sock.ws.on('CB:presence', (json) => {
|
|
|
1078
1650
|
|
|
1079
1651
|
## 🤝 Contributing
|
|
1080
1652
|
|
|
1081
|
-
1. **Fork** repository
|
|
1082
|
-
2.
|
|
1083
|
-
3. Commit
|
|
1084
|
-
4. Push
|
|
1085
|
-
5.
|
|
1653
|
+
1. **Fork** the repository
|
|
1654
|
+
2. Create a feature branch: `git checkout -b feat/your-feature`
|
|
1655
|
+
3. Commit your changes: `git commit -m "feat: add something awesome"`
|
|
1656
|
+
4. Push to your branch: `git push origin feat/your-feature`
|
|
1657
|
+
5. Open a **Pull Request**
|
|
1086
1658
|
|
|
1087
1659
|
---
|
|
1088
1660
|
|
|
1089
1661
|
## 📜 License
|
|
1090
1662
|
|
|
1091
|
-
|
|
1663
|
+
This project is licensed for **personal and non-commercial use only**.
|
|
1092
1664
|
|
|
1093
1665
|
| | |
|
|
1094
1666
|
|:---:|:---|
|
|
1095
|
-
| ✅ |
|
|
1096
|
-
| ✅ |
|
|
1097
|
-
| ❌ |
|
|
1098
|
-
| ❌ |
|
|
1667
|
+
| ✅ | Personal use and modification allowed |
|
|
1668
|
+
| ✅ | Redistribution with attribution allowed |
|
|
1669
|
+
| ❌ | Commercial use strictly prohibited |
|
|
1670
|
+
| ❌ | Resale or rebranding prohibited |
|
|
1099
1671
|
|
|
1100
1672
|
---
|
|
1101
1673
|
|
|
1102
1674
|
## ⚠️ Disclaimer
|
|
1103
1675
|
|
|
1104
|
-
>
|
|
1105
|
-
>
|
|
1676
|
+
> This project is **not affiliated with WhatsApp or Meta** in any way.
|
|
1677
|
+
> Use at your own risk and refer to WhatsApp's [Terms of Service](https://www.whatsapp.com/legal/terms-of-service) for compliance.
|
|
1106
1678
|
|
|
1107
1679
|
---
|
|
1108
1680
|
|