@pontalabs/baileys 1.2.5 → 1.2.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/README.md +564 -497
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -280,9 +280,33 @@ await sock.sendMessage(jid, { react: { text: '', key: message.key } })
|
|
|
280
280
|
```js
|
|
281
281
|
await sock.sendMessage(jid, {
|
|
282
282
|
poll: {
|
|
283
|
-
name: '
|
|
284
|
-
values: ['
|
|
285
|
-
selectableCount: 1
|
|
283
|
+
name: 'Pilih salah satu',
|
|
284
|
+
values: ['Opsi A', 'Opsi B', 'Opsi C'],
|
|
285
|
+
selectableCount: 1 // 0 = boleh pilih banyak
|
|
286
|
+
}
|
|
287
|
+
})
|
|
288
|
+
|
|
289
|
+
// Poll dengan fitur tambahan
|
|
290
|
+
await sock.sendMessage(jid, {
|
|
291
|
+
poll: {
|
|
292
|
+
name: 'Nama Poll',
|
|
293
|
+
values: ['Opsi A', 'Opsi B'],
|
|
294
|
+
selectableCount: 1,
|
|
295
|
+
endDate: new Date('2025-12-31'),
|
|
296
|
+
hideVoter: true,
|
|
297
|
+
canAddOption: false,
|
|
298
|
+
toAnnouncementGroup: false
|
|
299
|
+
}
|
|
300
|
+
})
|
|
301
|
+
|
|
302
|
+
// Quiz (Poll dengan jawaban benar)
|
|
303
|
+
await sock.sendMessage(jid, {
|
|
304
|
+
poll: {
|
|
305
|
+
name: 'Ibu kota Indonesia?',
|
|
306
|
+
values: ['Jakarta', 'Surabaya', 'Bandung'],
|
|
307
|
+
selectableCount: 1,
|
|
308
|
+
pollType: 1, // 1 = QUIZ
|
|
309
|
+
correctAnswer: 'Jakarta'
|
|
286
310
|
}
|
|
287
311
|
})
|
|
288
312
|
```
|
|
@@ -299,6 +323,37 @@ await sock.sendAlbumMessage(jid, [
|
|
|
299
323
|
```
|
|
300
324
|
</details>
|
|
301
325
|
|
|
326
|
+
<details>
|
|
327
|
+
<summary><b>📆 Event</b></summary>
|
|
328
|
+
|
|
329
|
+
```js
|
|
330
|
+
await sock.sendMessage(jid, {
|
|
331
|
+
event: {
|
|
332
|
+
name: 'Nama Acara',
|
|
333
|
+
description: 'Deskripsi',
|
|
334
|
+
startDate: new Date('2026-12-01T10:00:00'),
|
|
335
|
+
endDate: new Date('2026-12-01T12:00:00'),
|
|
336
|
+
location: {
|
|
337
|
+
degreesLatitude: -6.2088,
|
|
338
|
+
degreesLongitude: 106.8456,
|
|
339
|
+
name: 'Monas, Jakarta'
|
|
340
|
+
},
|
|
341
|
+
extraGuestsAllowed: true
|
|
342
|
+
}
|
|
343
|
+
})
|
|
344
|
+
|
|
345
|
+
// Event dengan scheduled call
|
|
346
|
+
await sock.sendMessage(jid, {
|
|
347
|
+
event: {
|
|
348
|
+
name: 'Meeting Online',
|
|
349
|
+
startDate: new Date('2026-12-01T10:00:00'),
|
|
350
|
+
call: 'audio', // 'audio' | 'video'
|
|
351
|
+
isScheduleCall: true
|
|
352
|
+
}
|
|
353
|
+
})
|
|
354
|
+
```
|
|
355
|
+
</details>
|
|
356
|
+
|
|
302
357
|
<details>
|
|
303
358
|
<summary><b>👨💻 Interactive (Native Flow & Carousel)</b></summary>
|
|
304
359
|
|
|
@@ -333,6 +388,41 @@ await sock.sendMessage(jid, {
|
|
|
333
388
|
```
|
|
334
389
|
</details>
|
|
335
390
|
|
|
391
|
+
<details>
|
|
392
|
+
<summary><b>🤖 listMessage</b></summary>
|
|
393
|
+
|
|
394
|
+
```js
|
|
395
|
+
sock.sendMessage(jid, {
|
|
396
|
+
text: "Halo kak, pilih menu dibawah ya",
|
|
397
|
+
footer: "@PontaLabs",
|
|
398
|
+
title: "Menu Utama",
|
|
399
|
+
buttonText: "Buka Menu",
|
|
400
|
+
sections: [
|
|
401
|
+
{
|
|
402
|
+
title: "Menu",
|
|
403
|
+
rows: [
|
|
404
|
+
{
|
|
405
|
+
title: "Info Bot",
|
|
406
|
+
description: "Cek info bot",
|
|
407
|
+
rowId: ".info"
|
|
408
|
+
},
|
|
409
|
+
{
|
|
410
|
+
title: "Owner",
|
|
411
|
+
description: "Hubungi owner",
|
|
412
|
+
rowId: ".owner"
|
|
413
|
+
},
|
|
414
|
+
{
|
|
415
|
+
title: "Donasi",
|
|
416
|
+
description: "Donasi seikhlasnya",
|
|
417
|
+
rowId: ".donasi"
|
|
418
|
+
}
|
|
419
|
+
]
|
|
420
|
+
}
|
|
421
|
+
]
|
|
422
|
+
}, { quoted: message })
|
|
423
|
+
```
|
|
424
|
+
</details>
|
|
425
|
+
|
|
336
426
|
<details>
|
|
337
427
|
<summary><b>🔩 Raw / Legacy Buttons</b></summary>
|
|
338
428
|
|
|
@@ -586,87 +676,52 @@ await sock.sendMessage(jid, {
|
|
|
586
676
|
|
|
587
677
|
### 🤖 Rich Messages
|
|
588
678
|
|
|
589
|
-
>
|
|
590
|
-
>
|
|
591
|
-
> **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.
|
|
592
|
-
|
|
593
|
-
<details>
|
|
594
|
-
<summary><b>📌 Quick Start — Rich Message</b></summary>
|
|
679
|
+
> 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.
|
|
595
680
|
|
|
596
|
-
|
|
597
|
-
await sock.sendMessage(jid, {
|
|
598
|
-
richText: 'Halo! 👋'
|
|
599
|
-
}, { quoted: message })
|
|
600
|
-
```
|
|
681
|
+
**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)
|
|
601
682
|
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
```js
|
|
605
|
-
await sock.sendMessage(jid, {
|
|
606
|
-
items: [
|
|
607
|
-
build.richText('Halo! 👋'),
|
|
608
|
-
build.richTip('Dikirim dari PontaLabs')
|
|
609
|
-
]
|
|
610
|
-
})
|
|
611
|
-
```
|
|
683
|
+
---
|
|
612
684
|
|
|
613
|
-
|
|
685
|
+
#### 📝 Rich Text
|
|
614
686
|
|
|
615
|
-
|
|
687
|
+
> AI bot-styled markdown text rendered in `richResponseMessage`.
|
|
616
688
|
|
|
617
689
|
<details>
|
|
618
|
-
<summary><b
|
|
619
|
-
|
|
620
|
-
Rich markdown text yang dirender sebagai `GenAIMarkdownTextUXPrimitive`.
|
|
621
|
-
|
|
622
|
-
**Direct:**
|
|
690
|
+
<summary><b>Simple Text</b></summary>
|
|
623
691
|
|
|
624
692
|
```js
|
|
625
|
-
await sock.sendMessage(jid, {
|
|
626
|
-
richText: '*Halo!* Ini rich text dari bot.\nStatus: `success`\nWaktu: _120ms_'
|
|
627
|
-
}, { quoted: message })
|
|
693
|
+
await sock.sendMessage(jid, { richText: 'Halo! Ini pesan dari bot.' }, { quoted: message })
|
|
628
694
|
```
|
|
695
|
+
</details>
|
|
629
696
|
|
|
630
|
-
|
|
697
|
+
<details>
|
|
698
|
+
<summary><b>Markdown (bold, italic, inline code)</b></summary>
|
|
631
699
|
|
|
632
700
|
```js
|
|
633
701
|
await sock.sendMessage(jid, {
|
|
634
|
-
richText:
|
|
635
|
-
'Baris pertama.',
|
|
636
|
-
'Baris kedua.',
|
|
637
|
-
'Baris ketiga.'
|
|
638
|
-
]
|
|
702
|
+
richText: '*Hasil eksekusi:*\nStatus: `success`\nWaktu: _120ms_'
|
|
639
703
|
}, { quoted: message })
|
|
640
704
|
```
|
|
705
|
+
</details>
|
|
641
706
|
|
|
642
|
-
|
|
707
|
+
<details>
|
|
708
|
+
<summary><b>Multiple Paragraphs (Array)</b></summary>
|
|
643
709
|
|
|
644
710
|
```js
|
|
645
711
|
await sock.sendMessage(jid, {
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
]
|
|
649
|
-
})
|
|
712
|
+
richText: ['Baris pertama.', 'Baris kedua.', 'Baris ketiga.']
|
|
713
|
+
}, { quoted: message })
|
|
650
714
|
```
|
|
715
|
+
</details>
|
|
651
716
|
|
|
652
|
-
|
|
717
|
+
---
|
|
653
718
|
|
|
654
|
-
|
|
655
|
-
await sock.sendMessage(jid, {
|
|
656
|
-
items: [
|
|
657
|
-
{ text: 'Halo! 👋' }
|
|
658
|
-
]
|
|
659
|
-
})
|
|
660
|
-
```
|
|
719
|
+
#### 📝 Rich Html
|
|
661
720
|
|
|
662
|
-
|
|
721
|
+
> AI html rendered in `GenAIaeacdsnwHtmlPrimitive`.
|
|
663
722
|
|
|
664
723
|
<details>
|
|
665
|
-
<summary><b
|
|
666
|
-
|
|
667
|
-
Mengirim HTML langsung ke primitive `GenAIaeacdsnwHtmlPrimitive`.
|
|
668
|
-
|
|
669
|
-
**Direct `sendMessage`:**
|
|
724
|
+
<summary><b>Simple Html</b></summary>
|
|
670
725
|
|
|
671
726
|
```js
|
|
672
727
|
const html = `<!DOCTYPE html>
|
|
@@ -686,68 +741,16 @@ await sock.sendMessage(jid, {
|
|
|
686
741
|
richHtml: html
|
|
687
742
|
}, { quoted: message })
|
|
688
743
|
```
|
|
689
|
-
|
|
690
|
-
**Builder:**
|
|
691
|
-
|
|
692
|
-
```js
|
|
693
|
-
await sock.sendMessage(jid, {
|
|
694
|
-
items: [
|
|
695
|
-
build.richHtml(html)
|
|
696
|
-
]
|
|
697
|
-
})
|
|
698
|
-
```
|
|
699
|
-
|
|
700
|
-
**Raw item:**
|
|
701
|
-
|
|
702
|
-
```js
|
|
703
|
-
await sock.sendMessage(jid, {
|
|
704
|
-
items: [
|
|
705
|
-
{ html: html }
|
|
706
|
-
]
|
|
707
|
-
})
|
|
708
|
-
```
|
|
709
|
-
|
|
710
|
-
> HTML berjalan di sisi client/webview. Gunakan HTML/JavaScript yang kamu kontrol dan sesuaikan dengan dukungan client WhatsApp yang dituju.
|
|
711
|
-
|
|
712
744
|
</details>
|
|
713
|
-
<details>
|
|
714
|
-
<summary>👤 richCard — Entity Card</summary>
|
|
715
|
-
|
|
716
|
-
Membuat Card Entity/Profile langsung melalui `sendMessage()`. Tidak membutuhkan `build` atau `AIRich`.
|
|
717
745
|
|
|
718
|
-
|
|
719
|
-
await conn.sendMessage(m.chat, {
|
|
720
|
-
richCard: {
|
|
721
|
-
thumbnail_url: 'https://example.com/profile.jpg',
|
|
722
|
-
verification: true,
|
|
723
|
-
title: 'PontaLabs',
|
|
724
|
-
subtitle: 'Owner: Ponta',
|
|
725
|
-
description: 'Ini Ownernya',
|
|
726
|
-
entity_id: '6283857182374',
|
|
727
|
-
entity_url: 'https://wa.me/6283857182374',
|
|
728
|
-
profile_url: 'https://example.com/profile.jpg'
|
|
729
|
-
}
|
|
730
|
-
});
|
|
731
|
-
```
|
|
732
|
-
|
|
733
|
-
| Property | Type | Description |
|
|
734
|
-
|---|---|---|
|
|
735
|
-
| `thumbnail_url` | `string` | Thumbnail Card |
|
|
736
|
-
| `verification` | `boolean` | Status verified |
|
|
737
|
-
| `title` | `string` | Judul Entity |
|
|
738
|
-
| `subtitle` | `string` | Subjudul |
|
|
739
|
-
| `description` | `string` | Deskripsi |
|
|
740
|
-
| `entity_id` | `string` | ID Entity |
|
|
741
|
-
| `entity_url` | `string` | URL Entity |
|
|
742
|
-
| `profile_url` | `string` | URL fallback/profile |
|
|
746
|
+
---
|
|
743
747
|
|
|
744
|
-
|
|
748
|
+
#### 💻 Rich Code Block
|
|
745
749
|
|
|
750
|
+
> Syntax-highlighted code. Use `code` for single block, `codes` for multiple.
|
|
746
751
|
|
|
747
752
|
<details>
|
|
748
|
-
<summary><b
|
|
749
|
-
|
|
750
|
-
**Single block:**
|
|
753
|
+
<summary><b>Single Block</b></summary>
|
|
751
754
|
|
|
752
755
|
```js
|
|
753
756
|
await sock.sendMessage(jid, {
|
|
@@ -755,36 +758,50 @@ await sock.sendMessage(jid, {
|
|
|
755
758
|
language: 'javascript'
|
|
756
759
|
}, { quoted: message })
|
|
757
760
|
```
|
|
761
|
+
</details>
|
|
758
762
|
|
|
759
|
-
|
|
763
|
+
<details>
|
|
764
|
+
<summary><b>Multiple Blocks</b></summary>
|
|
760
765
|
|
|
761
766
|
```js
|
|
762
767
|
await sock.sendMessage(jid, {
|
|
763
768
|
codes: [
|
|
764
|
-
{ code: '
|
|
765
|
-
{ code: '
|
|
769
|
+
{ code: 'SELECT * FROM users WHERE id = 1;', language: 'sql' },
|
|
770
|
+
{ code: '{ "id": 1, "name": "Ponta", "role": "admin" }', language: 'json' }
|
|
766
771
|
]
|
|
767
772
|
}, { quoted: message })
|
|
768
773
|
```
|
|
774
|
+
</details>
|
|
769
775
|
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
```js
|
|
773
|
-
await sock.sendMessage(jid, {
|
|
774
|
-
items: [
|
|
775
|
-
build.richCode('console.log("hello")', 'javascript')
|
|
776
|
-
]
|
|
777
|
-
})
|
|
778
|
-
```
|
|
776
|
+
<details>
|
|
777
|
+
<summary><b>Supported Languages</b></summary>
|
|
779
778
|
|
|
780
|
-
|
|
779
|
+
| Language | Key |
|
|
780
|
+
|:---|:---|
|
|
781
|
+
| JavaScript | `javascript` · `js` |
|
|
782
|
+
| TypeScript | `typescript` · `ts` |
|
|
783
|
+
| Python | `python` · `py` |
|
|
784
|
+
| Bash / Shell | `bash` · `sh` · `zsh` |
|
|
785
|
+
| Go | `go` · `golang` |
|
|
786
|
+
| Rust | `rust` · `rs` |
|
|
787
|
+
| C / C++ | `c` · `h` · `cpp` · `c++` |
|
|
788
|
+
| C# | `csharp` · `cs` |
|
|
789
|
+
| CSS / HTML | `css` · `html` |
|
|
790
|
+
| PowerShell / CMD | `powershell` · `ps1` · `cmd` · `bat` |
|
|
791
|
+
| SQL / JSON | `sql` · `json` |
|
|
781
792
|
|
|
782
793
|
</details>
|
|
783
794
|
|
|
784
|
-
|
|
785
|
-
|
|
795
|
+
---
|
|
796
|
+
|
|
797
|
+
#### 📊 Rich Table
|
|
786
798
|
|
|
787
|
-
|
|
799
|
+
> Structured table with `title`, `headers`, and `rows`.
|
|
800
|
+
>
|
|
801
|
+
> ⚠️ 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).
|
|
802
|
+
|
|
803
|
+
<details>
|
|
804
|
+
<summary><b>Simple Table</b></summary>
|
|
788
805
|
|
|
789
806
|
```js
|
|
790
807
|
await sock.sendMessage(jid, {
|
|
@@ -799,37 +816,57 @@ await sock.sendMessage(jid, {
|
|
|
799
816
|
}
|
|
800
817
|
}, { quoted: message })
|
|
801
818
|
```
|
|
819
|
+
</details>
|
|
802
820
|
|
|
803
|
-
|
|
821
|
+
<details>
|
|
822
|
+
<summary><b>Table without Title</b></summary>
|
|
804
823
|
|
|
805
824
|
```js
|
|
806
825
|
await sock.sendMessage(jid, {
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
['
|
|
811
|
-
['
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
}
|
|
826
|
+
table: {
|
|
827
|
+
headers: ['Command', 'Description'],
|
|
828
|
+
rows: [
|
|
829
|
+
['.ping', 'Cek latency bot'],
|
|
830
|
+
['.info', 'Info bot'],
|
|
831
|
+
['.help', 'List semua command']
|
|
832
|
+
]
|
|
833
|
+
}
|
|
834
|
+
}, { quoted: message })
|
|
815
835
|
```
|
|
816
|
-
|
|
817
|
-
> Untuk `richResponse`, format `table` berbeda: gunakan array baris siap-pakai seperti `{ items: [...], isHeading }`, bukan `{ headers, rows }`.
|
|
818
|
-
|
|
819
836
|
</details>
|
|
820
837
|
|
|
821
838
|
<details>
|
|
822
|
-
<summary><b
|
|
823
|
-
|
|
824
|
-
**Single image:**
|
|
839
|
+
<summary><b>Data Only (no header)</b></summary>
|
|
825
840
|
|
|
826
841
|
```js
|
|
827
842
|
await sock.sendMessage(jid, {
|
|
828
|
-
|
|
843
|
+
table: {
|
|
844
|
+
rows: [
|
|
845
|
+
['RAM', '512 MB'],
|
|
846
|
+
['CPU', '4 Core'],
|
|
847
|
+
['Uptime', '99.9%']
|
|
848
|
+
]
|
|
849
|
+
}
|
|
829
850
|
}, { quoted: message })
|
|
830
851
|
```
|
|
852
|
+
</details>
|
|
853
|
+
|
|
854
|
+
---
|
|
855
|
+
|
|
856
|
+
#### 🖼️ Rich Images
|
|
857
|
+
|
|
858
|
+
> AI image grid. Single URL = single image, multiple URLs = carousel.
|
|
859
|
+
|
|
860
|
+
<details>
|
|
861
|
+
<summary><b>Single Image</b></summary>
|
|
862
|
+
|
|
863
|
+
```js
|
|
864
|
+
await sock.sendMessage(jid, { richImages: 'https://example.com/photo.jpg' }, { quoted: message })
|
|
865
|
+
```
|
|
866
|
+
</details>
|
|
831
867
|
|
|
832
|
-
|
|
868
|
+
<details>
|
|
869
|
+
<summary><b>Multiple Images (Grid)</b></summary>
|
|
833
870
|
|
|
834
871
|
```js
|
|
835
872
|
await sock.sendMessage(jid, {
|
|
@@ -840,156 +877,252 @@ await sock.sendMessage(jid, {
|
|
|
840
877
|
]
|
|
841
878
|
}, { quoted: message })
|
|
842
879
|
```
|
|
880
|
+
</details>
|
|
843
881
|
|
|
844
|
-
|
|
882
|
+
<details>
|
|
883
|
+
<summary><b>Inside items / richResponse</b></summary>
|
|
845
884
|
|
|
846
885
|
```js
|
|
886
|
+
// items
|
|
847
887
|
await sock.sendMessage(jid, {
|
|
848
888
|
items: [
|
|
849
|
-
|
|
889
|
+
{ text: 'Hasil foto hari ini:' },
|
|
890
|
+
{ images: ['https://example.com/1.jpg', 'https://example.com/2.jpg'] }
|
|
850
891
|
]
|
|
851
|
-
})
|
|
852
|
-
```
|
|
892
|
+
}, { quoted: message })
|
|
853
893
|
|
|
894
|
+
// richResponse
|
|
895
|
+
await sock.sendMessage(jid, {
|
|
896
|
+
richResponse: [
|
|
897
|
+
{ text: 'Lihat gambarnya:' },
|
|
898
|
+
{ images: 'https://example.com/banner.jpg' }
|
|
899
|
+
]
|
|
900
|
+
}, { quoted: message })
|
|
901
|
+
```
|
|
854
902
|
</details>
|
|
855
903
|
|
|
856
|
-
|
|
857
|
-
<summary><b>🎥 Rich Video — <code>richVideo</code> / <code>richVideo</code> builder</b></summary>
|
|
904
|
+
---
|
|
858
905
|
|
|
859
|
-
|
|
906
|
+
#### 🎥 Rich Video
|
|
907
|
+
|
|
908
|
+
> Video embed as AI animated media (`GenAIImaginePrimitive` with `imagine_type: ANIMATE`).
|
|
909
|
+
|
|
910
|
+
<details>
|
|
911
|
+
<summary><b>Shorthand URL</b></summary>
|
|
860
912
|
|
|
861
913
|
```js
|
|
862
|
-
await sock.sendMessage(jid, {
|
|
863
|
-
richVideo: 'https://example.com/clip.mp4'
|
|
864
|
-
}, { quoted: message })
|
|
914
|
+
await sock.sendMessage(jid, { richVideo: 'https://example.com/clip.mp4' }, { quoted: message })
|
|
865
915
|
```
|
|
916
|
+
</details>
|
|
866
917
|
|
|
867
|
-
|
|
918
|
+
<details>
|
|
919
|
+
<summary><b>Full Options</b></summary>
|
|
868
920
|
|
|
869
921
|
```js
|
|
870
922
|
await sock.sendMessage(jid, {
|
|
871
923
|
richVideo: {
|
|
872
924
|
url: 'https://example.com/clip.mp4',
|
|
873
|
-
mimeType: 'video/mp4',
|
|
874
|
-
duration: 15,
|
|
875
|
-
fallbackText: 'Preview video'
|
|
925
|
+
mimeType: 'video/mp4', // default: 'video/mp4'
|
|
926
|
+
duration: 15, // seconds, default: 10
|
|
927
|
+
fallbackText: 'Preview video' // default: '[ VIDEO - PontaCT ]'
|
|
876
928
|
}
|
|
877
929
|
}, { quoted: message })
|
|
878
930
|
```
|
|
931
|
+
</details>
|
|
879
932
|
|
|
880
|
-
|
|
933
|
+
<details>
|
|
934
|
+
<summary><b>Inside items / richResponse</b></summary>
|
|
881
935
|
|
|
882
936
|
```js
|
|
937
|
+
// items
|
|
883
938
|
await sock.sendMessage(jid, {
|
|
884
939
|
items: [
|
|
885
|
-
|
|
940
|
+
{ text: 'Cek videonya:' },
|
|
941
|
+
{ videoUrl: 'https://example.com/clip.mp4', duration: 20 }
|
|
886
942
|
]
|
|
887
|
-
})
|
|
888
|
-
```
|
|
943
|
+
}, { quoted: message })
|
|
889
944
|
|
|
945
|
+
// richResponse
|
|
946
|
+
await sock.sendMessage(jid, {
|
|
947
|
+
richResponse: [
|
|
948
|
+
{ text: 'Tutorial:' },
|
|
949
|
+
{ video: { url: 'https://example.com/tutorial.mp4', duration: 30 } }
|
|
950
|
+
]
|
|
951
|
+
}, { quoted: message })
|
|
952
|
+
```
|
|
890
953
|
</details>
|
|
891
954
|
|
|
892
|
-
|
|
893
|
-
|
|
955
|
+
---
|
|
956
|
+
|
|
957
|
+
#### 💡 Rich Suggestions
|
|
894
958
|
|
|
895
|
-
|
|
959
|
+
> Follow-up prompt pills — like native AI chat buttons.
|
|
960
|
+
|
|
961
|
+
<details>
|
|
962
|
+
<summary><b>Shorthand</b></summary>
|
|
896
963
|
|
|
897
964
|
```js
|
|
898
965
|
await sock.sendMessage(jid, {
|
|
899
966
|
richSuggestions: ['Coba lagi', 'Lihat detail', 'Batalkan']
|
|
900
967
|
}, { quoted: message })
|
|
901
968
|
```
|
|
969
|
+
</details>
|
|
902
970
|
|
|
903
|
-
|
|
971
|
+
<details>
|
|
972
|
+
<summary><b>Inside items / richResponse</b></summary>
|
|
904
973
|
|
|
905
974
|
```js
|
|
975
|
+
// items
|
|
906
976
|
await sock.sendMessage(jid, {
|
|
907
977
|
items: [
|
|
908
|
-
|
|
978
|
+
{ text: 'Mau lanjut ke mana?' },
|
|
979
|
+
{ suggestions: ['Halaman utama', 'Bantuan', 'Hubungi admin'] }
|
|
909
980
|
]
|
|
910
|
-
})
|
|
911
|
-
```
|
|
981
|
+
}, { quoted: message })
|
|
912
982
|
|
|
983
|
+
// richResponse
|
|
984
|
+
await sock.sendMessage(jid, {
|
|
985
|
+
richResponse: [
|
|
986
|
+
{ text: 'Hasil pencarian ditemukan.' },
|
|
987
|
+
{ suggestions: ['Tampilkan semua', 'Filter ulang', 'Export'] }
|
|
988
|
+
]
|
|
989
|
+
}, { quoted: message })
|
|
990
|
+
```
|
|
913
991
|
</details>
|
|
914
992
|
|
|
915
|
-
|
|
916
|
-
<summary><b>🔣 Rich LaTeX — <code>richLatex</code></b></summary>
|
|
993
|
+
---
|
|
917
994
|
|
|
918
|
-
|
|
995
|
+
#### 🔣 Rich LaTeX
|
|
996
|
+
|
|
997
|
+
> Math formula rendering as `GenAILatexItem` inline entity. `url` points to a rendered formula image (PNG/JPG from external LaTeX renderer).
|
|
998
|
+
|
|
999
|
+
<details>
|
|
1000
|
+
<summary><b>Shorthand URL</b></summary>
|
|
919
1001
|
|
|
920
1002
|
```js
|
|
921
1003
|
await sock.sendMessage(jid, {
|
|
922
1004
|
richLatex: 'https://latex.codecogs.com/png.latex?E%3Dmc%5E2'
|
|
923
1005
|
}, { quoted: message })
|
|
924
1006
|
```
|
|
1007
|
+
</details>
|
|
925
1008
|
|
|
926
|
-
|
|
1009
|
+
<details>
|
|
1010
|
+
<summary><b>Full Options</b></summary>
|
|
927
1011
|
|
|
928
1012
|
```js
|
|
929
1013
|
await sock.sendMessage(jid, {
|
|
930
1014
|
richLatex: {
|
|
931
1015
|
url: 'https://latex.codecogs.com/png.latex?E%3Dmc%5E2',
|
|
932
|
-
text: 'E = mc²',
|
|
933
|
-
width: 120,
|
|
934
|
-
height: 60,
|
|
935
|
-
font_height: 83.33,
|
|
936
|
-
padding: 15
|
|
1016
|
+
text: 'E = mc²', // label & fallback
|
|
1017
|
+
width: 120, // default: 100
|
|
1018
|
+
height: 60, // default: 100
|
|
1019
|
+
font_height: 83.33, // default: 83.33
|
|
1020
|
+
padding: 15 // default: 15
|
|
937
1021
|
}
|
|
938
1022
|
}, { quoted: message })
|
|
939
1023
|
```
|
|
940
|
-
|
|
941
1024
|
</details>
|
|
942
1025
|
|
|
943
1026
|
<details>
|
|
944
|
-
<summary><b
|
|
1027
|
+
<summary><b>Inside items / richResponse</b></summary>
|
|
1028
|
+
|
|
1029
|
+
```js
|
|
1030
|
+
// items
|
|
1031
|
+
await sock.sendMessage(jid, {
|
|
1032
|
+
items: [
|
|
1033
|
+
{ text: 'Rumus energi kinetik:' },
|
|
1034
|
+
{
|
|
1035
|
+
latexUrl: 'https://latex.codecogs.com/png.latex?E_k%3D%5Cfrac%7B1%7D%7B2%7Dmv%5E2',
|
|
1036
|
+
latexText: 'Ek = ½mv²',
|
|
1037
|
+
latexWidth: 150,
|
|
1038
|
+
latexHeight: 60
|
|
1039
|
+
}
|
|
1040
|
+
]
|
|
1041
|
+
}, { quoted: message })
|
|
1042
|
+
|
|
1043
|
+
// richResponse
|
|
1044
|
+
await sock.sendMessage(jid, {
|
|
1045
|
+
richResponse: [
|
|
1046
|
+
{ text: 'Solusi integral:' },
|
|
1047
|
+
{ latex: { url: 'https://latex.codecogs.com/png.latex?%5Cint%20x%5E2%20dx', text: '∫x² dx = x³/3 + C' } }
|
|
1048
|
+
]
|
|
1049
|
+
}, { quoted: message })
|
|
1050
|
+
```
|
|
1051
|
+
</details>
|
|
1052
|
+
|
|
1053
|
+
---
|
|
1054
|
+
|
|
1055
|
+
#### 🛍️ Rich Product
|
|
945
1056
|
|
|
946
|
-
|
|
1057
|
+
> Product card(s) as `GenAIProductItemCardPrimitive`. Object = single card, Array = horizontal scroll carousel.
|
|
1058
|
+
|
|
1059
|
+
<details>
|
|
1060
|
+
<summary><b>Single Product</b></summary>
|
|
947
1061
|
|
|
948
1062
|
```js
|
|
949
1063
|
await sock.sendMessage(jid, {
|
|
950
1064
|
richProduct: {
|
|
951
1065
|
title: 'Sepatu Adidas Samba',
|
|
952
1066
|
price_display_string: 'Rp 1.200.000',
|
|
953
|
-
description: 'Sepatu casual ikonik.',
|
|
1067
|
+
description: 'Sepatu casual ikonik, tersedia berbagai ukuran.',
|
|
954
1068
|
retailer_id: 'adidas_store',
|
|
955
|
-
thumbnail: {
|
|
956
|
-
url: 'https://example.com/adidas.jpg',
|
|
957
|
-
mime_type: 'image/jpeg',
|
|
958
|
-
width: 300,
|
|
959
|
-
height: 300
|
|
960
|
-
}
|
|
1069
|
+
thumbnail: { url: 'https://example.com/adidas.jpg', mime_type: 'image/jpeg', width: 300, height: 300 }
|
|
961
1070
|
}
|
|
962
1071
|
}, { quoted: message })
|
|
963
1072
|
```
|
|
1073
|
+
</details>
|
|
964
1074
|
|
|
965
|
-
|
|
1075
|
+
<details>
|
|
1076
|
+
<summary><b>Product Carousel</b></summary>
|
|
966
1077
|
|
|
967
1078
|
```js
|
|
968
1079
|
await sock.sendMessage(jid, {
|
|
969
1080
|
richProduct: [
|
|
970
|
-
{
|
|
971
|
-
|
|
1081
|
+
{
|
|
1082
|
+
title: 'Sepatu A',
|
|
1083
|
+
price_display_string: 'Rp 500.000',
|
|
1084
|
+
thumbnail: { url: 'https://example.com/a.jpg', mime_type: 'image/jpeg', width: 300, height: 300 }
|
|
1085
|
+
},
|
|
1086
|
+
{
|
|
1087
|
+
title: 'Sepatu B',
|
|
1088
|
+
price_display_string: 'Rp 750.000',
|
|
1089
|
+
thumbnail: { url: 'https://example.com/b.jpg', mime_type: 'image/jpeg', width: 300, height: 300 }
|
|
1090
|
+
}
|
|
972
1091
|
]
|
|
973
1092
|
}, { quoted: message })
|
|
974
1093
|
```
|
|
1094
|
+
</details>
|
|
975
1095
|
|
|
976
|
-
|
|
1096
|
+
<details>
|
|
1097
|
+
<summary><b>Inside items / richResponse</b></summary>
|
|
977
1098
|
|
|
978
1099
|
```js
|
|
1100
|
+
// items
|
|
979
1101
|
await sock.sendMessage(jid, {
|
|
980
1102
|
items: [
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
price_display_string: 'Rp 99.000'
|
|
984
|
-
})
|
|
1103
|
+
{ text: 'Rekomendasi produk hari ini:' },
|
|
1104
|
+
{ product: { title: 'Produk X', price_display_string: 'Rp 99.000' } }
|
|
985
1105
|
]
|
|
986
|
-
})
|
|
987
|
-
```
|
|
1106
|
+
}, { quoted: message })
|
|
988
1107
|
|
|
1108
|
+
// richResponse
|
|
1109
|
+
await sock.sendMessage(jid, {
|
|
1110
|
+
richResponse: [
|
|
1111
|
+
{ text: 'Pilih produkmu:' },
|
|
1112
|
+
{ product: [{ title: 'A' }, { title: 'B' }] }
|
|
1113
|
+
]
|
|
1114
|
+
}, { quoted: message })
|
|
1115
|
+
```
|
|
989
1116
|
</details>
|
|
990
1117
|
|
|
1118
|
+
---
|
|
1119
|
+
|
|
1120
|
+
#### 📰 Rich Post
|
|
1121
|
+
|
|
1122
|
+
> Post card(s) as `GenAIPostPrimitive`. Object = single post, Array = carousel.
|
|
1123
|
+
|
|
991
1124
|
<details>
|
|
992
|
-
<summary><b
|
|
1125
|
+
<summary><b>Single Post</b></summary>
|
|
993
1126
|
|
|
994
1127
|
```js
|
|
995
1128
|
await sock.sendMessage(jid, {
|
|
@@ -1002,25 +1135,29 @@ await sock.sendMessage(jid, {
|
|
|
1002
1135
|
}
|
|
1003
1136
|
}, { quoted: message })
|
|
1004
1137
|
```
|
|
1138
|
+
</details>
|
|
1005
1139
|
|
|
1006
|
-
|
|
1140
|
+
<details>
|
|
1141
|
+
<summary><b>Post Carousel</b></summary>
|
|
1007
1142
|
|
|
1008
1143
|
```js
|
|
1009
1144
|
await sock.sendMessage(jid, {
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
author_display_name: '@pontalabs',
|
|
1014
|
-
media_url: 'https://example.com/post.jpg'
|
|
1015
|
-
})
|
|
1145
|
+
richPost: [
|
|
1146
|
+
{ title: 'Post 1', author_display_name: '@user1', media_url: 'https://example.com/1.jpg' },
|
|
1147
|
+
{ title: 'Post 2', author_display_name: '@user2', media_url: 'https://example.com/2.jpg' }
|
|
1016
1148
|
]
|
|
1017
|
-
})
|
|
1149
|
+
}, { quoted: message })
|
|
1018
1150
|
```
|
|
1019
|
-
|
|
1020
1151
|
</details>
|
|
1021
1152
|
|
|
1153
|
+
---
|
|
1154
|
+
|
|
1155
|
+
#### 🎬 Rich Reels
|
|
1156
|
+
|
|
1157
|
+
> Reels carousel as `GenAIReelPrimitive` with `contentItemsMetadata`. Auto-injects `richResponseSourcesMetadata` with `provider: 'PontaCT'`.
|
|
1158
|
+
|
|
1022
1159
|
<details>
|
|
1023
|
-
<summary><b
|
|
1160
|
+
<summary><b>Single Reel</b></summary>
|
|
1024
1161
|
|
|
1025
1162
|
```js
|
|
1026
1163
|
await sock.sendMessage(jid, {
|
|
@@ -1038,362 +1175,328 @@ await sock.sendMessage(jid, {
|
|
|
1038
1175
|
}
|
|
1039
1176
|
}, { quoted: message })
|
|
1040
1177
|
```
|
|
1178
|
+
</details>
|
|
1041
1179
|
|
|
1042
|
-
|
|
1180
|
+
<details>
|
|
1181
|
+
<summary><b>Reels Carousel</b></summary>
|
|
1043
1182
|
|
|
1044
1183
|
```js
|
|
1045
1184
|
await sock.sendMessage(jid, {
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
title: '@
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1185
|
+
richReels: [
|
|
1186
|
+
{
|
|
1187
|
+
title: '@creator1',
|
|
1188
|
+
profileIconUrl: 'https://example.com/av1.jpg',
|
|
1189
|
+
thumbnailUrl: 'https://example.com/th1.jpg',
|
|
1190
|
+
videoUrl: 'https://example.com/r1.mp4',
|
|
1191
|
+
likes_count: 5000,
|
|
1192
|
+
reel_source: 'IG'
|
|
1193
|
+
},
|
|
1194
|
+
{
|
|
1195
|
+
title: '@creator2',
|
|
1196
|
+
profileIconUrl: 'https://example.com/av2.jpg',
|
|
1197
|
+
thumbnailUrl: 'https://example.com/th2.jpg',
|
|
1198
|
+
videoUrl: 'https://example.com/r2.mp4',
|
|
1199
|
+
likes_count: 8200,
|
|
1200
|
+
reel_source: 'TT'
|
|
1201
|
+
}
|
|
1052
1202
|
]
|
|
1053
|
-
})
|
|
1203
|
+
}, { quoted: message })
|
|
1054
1204
|
```
|
|
1055
|
-
|
|
1056
1205
|
</details>
|
|
1057
1206
|
|
|
1058
1207
|
<details>
|
|
1059
|
-
<summary><b
|
|
1208
|
+
<summary><b>📋 Fields Reference</b></summary>
|
|
1209
|
+
|
|
1210
|
+
| Field | Type | Default | Description |
|
|
1211
|
+
|:---|:---|:---:|:---|
|
|
1212
|
+
| `title` | `string` | — | Username / creator name |
|
|
1213
|
+
| `profileIconUrl` | `string` | — | Avatar URL |
|
|
1214
|
+
| `thumbnailUrl` | `string` | — | Thumbnail cover URL |
|
|
1215
|
+
| `videoUrl` | `string` | — | Video source URL |
|
|
1216
|
+
| `reels_title` | `string` | `''` | Reel title |
|
|
1217
|
+
| `likes_count` | `number` | `0` | Like count |
|
|
1218
|
+
| `shares_count` | `number` | `0` | Share count |
|
|
1219
|
+
| `view_count` | `number` | `0` | View count |
|
|
1220
|
+
| `reel_source` | `string` | `'IG'` | Source platform |
|
|
1221
|
+
| `is_verified` | `boolean` | `false` | Verified badge |
|
|
1222
|
+
|
|
1223
|
+
</details>
|
|
1224
|
+
|
|
1225
|
+
---
|
|
1226
|
+
|
|
1227
|
+
#### 🔍 Rich Sources
|
|
1060
1228
|
|
|
1061
|
-
**
|
|
1229
|
+
> Search result source list as `GenAISearchResultPrimitive`. Accepts full objects **or** shorthand `[faviconUrl, sourceUrl, displayName]`.
|
|
1230
|
+
|
|
1231
|
+
<details>
|
|
1232
|
+
<summary><b>Shorthand Array</b></summary>
|
|
1062
1233
|
|
|
1063
1234
|
```js
|
|
1064
1235
|
await sock.sendMessage(jid, {
|
|
1065
1236
|
richSources: [
|
|
1066
1237
|
['https://wikipedia.org/favicon.ico', 'https://wikipedia.org/wiki/Node.js', 'Wikipedia'],
|
|
1067
|
-
['https://nodejs.org/favicon.ico', 'https://nodejs.org/en/docs', 'Node.js Docs']
|
|
1238
|
+
['https://nodejs.org/favicon.ico', 'https://nodejs.org/en/docs', 'Node.js Docs'],
|
|
1239
|
+
['https://github.com/favicon.ico', 'https://github.com/nodejs/node', 'GitHub']
|
|
1068
1240
|
]
|
|
1069
1241
|
}, { quoted: message })
|
|
1070
1242
|
```
|
|
1243
|
+
</details>
|
|
1071
1244
|
|
|
1072
|
-
|
|
1245
|
+
<details>
|
|
1246
|
+
<summary><b>Full Object</b></summary>
|
|
1073
1247
|
|
|
1074
1248
|
```js
|
|
1075
1249
|
await sock.sendMessage(jid, {
|
|
1076
|
-
richSources: [
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
url: 'https://wikipedia.org/favicon.ico',
|
|
1083
|
-
mime_type: 'image/jpeg',
|
|
1084
|
-
width: 16,
|
|
1085
|
-
height: 16
|
|
1250
|
+
richSources: [
|
|
1251
|
+
{
|
|
1252
|
+
source_type: 'THIRD_PARTY',
|
|
1253
|
+
source_display_name: 'Wikipedia',
|
|
1254
|
+
source_subtitle: 'wikipedia.org',
|
|
1255
|
+
source_url: 'https://wikipedia.org/wiki/Node.js',
|
|
1256
|
+
favicon: { url: 'https://wikipedia.org/favicon.ico', mime_type: 'image/jpeg', width: 16, height: 16 }
|
|
1086
1257
|
}
|
|
1087
|
-
|
|
1258
|
+
]
|
|
1088
1259
|
}, { quoted: message })
|
|
1089
1260
|
```
|
|
1261
|
+
</details>
|
|
1090
1262
|
|
|
1091
|
-
|
|
1263
|
+
<details>
|
|
1264
|
+
<summary><b>Mixed Format</b></summary>
|
|
1092
1265
|
|
|
1093
1266
|
```js
|
|
1094
1267
|
await sock.sendMessage(jid, {
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
])
|
|
1268
|
+
richSources: [
|
|
1269
|
+
['https://wikipedia.org/fav.ico', 'https://wikipedia.org', 'Wikipedia'],
|
|
1270
|
+
{ source_type: 'THIRD_PARTY', source_display_name: 'Docs', source_url: 'https://docs.example.com' }
|
|
1099
1271
|
]
|
|
1100
|
-
})
|
|
1272
|
+
}, { quoted: message })
|
|
1101
1273
|
```
|
|
1102
|
-
|
|
1103
1274
|
</details>
|
|
1104
1275
|
|
|
1105
|
-
|
|
1106
|
-
<summary><b>📌 Rich Tip, Footer & Metadata — <code>richTip</code> / <code>richFooter</code> / <code>richMetadata</code></b></summary>
|
|
1276
|
+
---
|
|
1107
1277
|
|
|
1108
|
-
|
|
1109
|
-
await sock.sendMessage(jid, {
|
|
1110
|
-
richTip: 'Dihasilkan oleh AI · PontaLabs'
|
|
1111
|
-
}, { quoted: message })
|
|
1278
|
+
#### 📌 Rich Tip & Footer
|
|
1112
1279
|
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
}, { quoted: message })
|
|
1116
|
-
```
|
|
1280
|
+
> `richTip` — small metadata text above/center of message.
|
|
1281
|
+
> `richFooter` — metadata text below message (disclaimer / branding).
|
|
1117
1282
|
|
|
1118
|
-
|
|
1283
|
+
<details>
|
|
1284
|
+
<summary><b>Rich Tip</b></summary>
|
|
1119
1285
|
|
|
1120
1286
|
```js
|
|
1121
1287
|
await sock.sendMessage(jid, {
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
build.richMetadata('PontaLabs Rich Message'),
|
|
1125
|
-
build.richFooter('© PontaLabs')
|
|
1126
|
-
]
|
|
1127
|
-
})
|
|
1288
|
+
richTip: 'Dihasilkan oleh AI · pontalabs v0.3.4'
|
|
1289
|
+
}, { quoted: message })
|
|
1128
1290
|
```
|
|
1129
|
-
|
|
1130
1291
|
</details>
|
|
1131
1292
|
|
|
1132
1293
|
<details>
|
|
1133
|
-
<summary><b
|
|
1294
|
+
<summary><b>Rich Footer</b></summary>
|
|
1134
1295
|
|
|
1135
1296
|
```js
|
|
1136
1297
|
await sock.sendMessage(jid, {
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
]
|
|
1140
|
-
})
|
|
1298
|
+
richFooter: '© 2025 PontaCT · Data bersumber dari layanan publik'
|
|
1299
|
+
}, { quoted: message })
|
|
1141
1300
|
```
|
|
1142
|
-
|
|
1143
1301
|
</details>
|
|
1144
1302
|
|
|
1145
1303
|
<details>
|
|
1146
|
-
<summary><b
|
|
1304
|
+
<summary><b>Inside items / richResponse</b></summary>
|
|
1147
1305
|
|
|
1148
1306
|
```js
|
|
1307
|
+
// items
|
|
1149
1308
|
await sock.sendMessage(jid, {
|
|
1150
1309
|
items: [
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
}
|
|
1310
|
+
{ text: 'Hasil pencarian:' },
|
|
1311
|
+
{ sources: [['https://fav.ico', 'https://example.com', 'Example']] },
|
|
1312
|
+
{ tip: 'AI-generated content' },
|
|
1313
|
+
{ footer: '© PontaCT Baileys' }
|
|
1154
1314
|
]
|
|
1155
|
-
})
|
|
1156
|
-
```
|
|
1157
|
-
|
|
1158
|
-
</details>
|
|
1159
|
-
|
|
1160
|
-
<details>
|
|
1161
|
-
<summary><b>🔀 Mixed Rich — <code>items</code></b></summary>
|
|
1162
|
-
|
|
1163
|
-
Semua Rich item dapat dicampur dalam satu `items`. Urutan array menjadi urutan tampilan.
|
|
1315
|
+
}, { quoted: message })
|
|
1164
1316
|
|
|
1165
|
-
|
|
1317
|
+
// richResponse
|
|
1166
1318
|
await sock.sendMessage(jid, {
|
|
1167
|
-
|
|
1168
|
-
{ text: '
|
|
1169
|
-
{
|
|
1170
|
-
headers: ['Metric', 'Value'],
|
|
1171
|
-
rows: [
|
|
1172
|
-
['Uptime', '99.9%'],
|
|
1173
|
-
['Messages', '1.2K']
|
|
1174
|
-
]
|
|
1175
|
-
}},
|
|
1176
|
-
build.richCode('SELECT COUNT(*) FROM messages;', 'sql'),
|
|
1177
|
-
build.richHtml('<h2>Dashboard</h2>'),
|
|
1178
|
-
build.richSuggest('Refresh'),
|
|
1179
|
-
build.richFooter('Auto-generated · PontaLabs')
|
|
1319
|
+
richResponse: [
|
|
1320
|
+
{ text: 'Summary di sini.' },
|
|
1321
|
+
{ footer: '© PontaCT · pontalabs' }
|
|
1180
1322
|
]
|
|
1181
1323
|
}, { quoted: message })
|
|
1182
1324
|
```
|
|
1183
|
-
|
|
1184
|
-
**Item shorthand yang tersedia:**
|
|
1185
|
-
|
|
1186
|
-
<details>
|
|
1187
|
-
<summary><b>📋 Lihat semua key <code>items</code></b></summary>
|
|
1188
|
-
|
|
1189
|
-
- `{ text, inlineEntities? }` — Rich text
|
|
1190
|
-
- `{ code, language }` — Code block
|
|
1191
|
-
- `{ table }` — Table
|
|
1192
|
-
- `{ images }` — Image grid
|
|
1193
|
-
- `{ videoUrl, mimeType?, duration? }` — Video
|
|
1194
|
-
- `{ suggestions }` — Suggestion pills
|
|
1195
|
-
- `{ latexUrl, latexText?, latexWidth?, latexHeight? }` — LaTeX
|
|
1196
|
-
- `{ product }` — Product card
|
|
1197
|
-
- `{ post }` — Post card
|
|
1198
|
-
- `{ reels }` — Reels
|
|
1199
|
-
- `{ sources }` — Sources
|
|
1200
|
-
- `{ tip }` — Tip
|
|
1201
|
-
- `{ footer }` — Footer
|
|
1202
|
-
|
|
1203
1325
|
</details>
|
|
1204
1326
|
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
<details>
|
|
1208
|
-
<summary><b>🔗 Rich Response — <code>richResponse</code></b></summary>
|
|
1327
|
+
---
|
|
1209
1328
|
|
|
1210
|
-
|
|
1329
|
+
#### 🔀 Rich Mixed — `items`
|
|
1211
1330
|
|
|
1212
|
-
|
|
1331
|
+
<details>
|
|
1332
|
+
<summary><b>Text + Code + Table</b></summary>
|
|
1213
1333
|
|
|
1214
1334
|
```js
|
|
1215
1335
|
await sock.sendMessage(jid, {
|
|
1216
|
-
|
|
1217
|
-
{ text: '
|
|
1218
|
-
{ code: '
|
|
1219
|
-
{
|
|
1220
|
-
{
|
|
1336
|
+
items: [
|
|
1337
|
+
{ text: 'Query yang dijalankan:' },
|
|
1338
|
+
{ code: 'SELECT id, name, score FROM users ORDER BY score DESC LIMIT 3', language: 'sql' },
|
|
1339
|
+
{ text: 'Hasil:' },
|
|
1340
|
+
{
|
|
1341
|
+
table: {
|
|
1342
|
+
headers: ['id', 'name', 'score'],
|
|
1343
|
+
rows: [
|
|
1344
|
+
['1', 'Ponta', '98'],
|
|
1345
|
+
['2', 'Yue', '87'],
|
|
1346
|
+
['3', 'Frieren', '75']
|
|
1347
|
+
]
|
|
1348
|
+
}
|
|
1349
|
+
}
|
|
1221
1350
|
]
|
|
1222
1351
|
}, { quoted: message })
|
|
1223
1352
|
```
|
|
1224
1353
|
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
```js
|
|
1354
|
+
```
|
|
1355
|
+
// build delay (muncul satu satu)
|
|
1228
1356
|
await sock.sendMessage(jid, {
|
|
1229
|
-
|
|
1230
|
-
text: '
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
source_subtitle: 'nodejs.org',
|
|
1242
|
-
source_url: 'https://nodejs.org'
|
|
1243
|
-
}],
|
|
1244
|
-
__typename: 'GenAISearchCitationItem'
|
|
1357
|
+
items: [
|
|
1358
|
+
{ text: 'Query yang dijalankan:' },
|
|
1359
|
+
{ code: 'SELECT id, name, score FROM users ORDER BY score DESC LIMIT 3', language: 'sql' },
|
|
1360
|
+
{ text: 'Hasil:' },
|
|
1361
|
+
{
|
|
1362
|
+
table: {
|
|
1363
|
+
headers: ['id', 'name', 'score'],
|
|
1364
|
+
rows: [
|
|
1365
|
+
['1', 'Ponta', '98'],
|
|
1366
|
+
['2', 'Yue', '87'],
|
|
1367
|
+
['3', 'Frieren', '75']
|
|
1368
|
+
]
|
|
1245
1369
|
}
|
|
1246
|
-
}
|
|
1247
|
-
|
|
1370
|
+
}
|
|
1371
|
+
],
|
|
1372
|
+
buildDelay: 2500,
|
|
1248
1373
|
}, { quoted: message })
|
|
1249
1374
|
```
|
|
1375
|
+
</details>
|
|
1250
1376
|
|
|
1251
|
-
|
|
1377
|
+
<details>
|
|
1378
|
+
<summary><b>Text + Images + Video + Suggestions</b></summary>
|
|
1252
1379
|
|
|
1253
1380
|
```js
|
|
1254
1381
|
await sock.sendMessage(jid, {
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
]
|
|
1260
|
-
|
|
1261
|
-
})
|
|
1382
|
+
items: [
|
|
1383
|
+
{ text: '*Konten hari ini*' },
|
|
1384
|
+
{ images: ['https://example.com/1.jpg', 'https://example.com/2.jpg'] },
|
|
1385
|
+
{ videoUrl: 'https://example.com/preview.mp4', duration: 15 },
|
|
1386
|
+
{ suggestions: ['Lihat selengkapnya', 'Bagikan', 'Simpan'] }
|
|
1387
|
+
]
|
|
1388
|
+
}, { quoted: message })
|
|
1262
1389
|
```
|
|
1263
|
-
|
|
1264
|
-
> Berbeda dari `table` top-level / `items`, format table di `richResponse` harus berupa array row siap-pakai.
|
|
1265
|
-
|
|
1266
1390
|
</details>
|
|
1267
1391
|
|
|
1268
1392
|
<details>
|
|
1269
|
-
<summary><b
|
|
1270
|
-
|
|
1271
|
-
Builder interactive juga berada di namespace `build` dan dikirim melalui `sock.sendMessage()`.
|
|
1272
|
-
|
|
1273
|
-
**Native Flow Button:**
|
|
1393
|
+
<summary><b>Full Mixed (all types)</b></summary>
|
|
1274
1394
|
|
|
1275
1395
|
```js
|
|
1276
|
-
const button = build.button()
|
|
1277
|
-
.setTitle('Menu')
|
|
1278
|
-
.setBody('Pilih salah satu')
|
|
1279
|
-
.setFooter('PontaLabs')
|
|
1280
|
-
.addReply('Halo', 'hello')
|
|
1281
|
-
.addUrl('Website', 'https://example.com')
|
|
1282
|
-
.addCopy('Copy ID', 'ABC123')
|
|
1283
|
-
|
|
1284
1396
|
await sock.sendMessage(jid, {
|
|
1285
|
-
items: [
|
|
1286
|
-
}
|
|
1397
|
+
items: [
|
|
1398
|
+
{ text: '*Laporan Harian Bot*' },
|
|
1399
|
+
{ table: { headers: ['Metric', 'Value'], rows: [['Uptime', '99.9%'], ['Messages', '1.2K']] } },
|
|
1400
|
+
{ code: 'SELECT COUNT(*) FROM messages WHERE date = CURDATE()', language: 'sql' },
|
|
1401
|
+
{ text: 'Formula uptime:' },
|
|
1402
|
+
{
|
|
1403
|
+
latexUrl: 'https://latex.codecogs.com/png.latex?U%3D%5Cfrac%7Bt_u%7D%7Bt_t%7D%5Ctimes100',
|
|
1404
|
+
latexText: 'U = (tu/tt) × 100'
|
|
1405
|
+
},
|
|
1406
|
+
{ sources: [['https://example.com/fav.ico', 'https://example.com', 'Dashboard']] },
|
|
1407
|
+
{ suggestions: ['Refresh', 'Export PDF'] },
|
|
1408
|
+
{ footer: 'Auto-generated · PontaCT' }
|
|
1409
|
+
]
|
|
1410
|
+
}, { quoted: message })
|
|
1287
1411
|
```
|
|
1412
|
+
</details>
|
|
1288
1413
|
|
|
1289
|
-
|
|
1414
|
+
---
|
|
1290
1415
|
|
|
1291
|
-
|
|
1292
|
-
const buttons = build.buttonV2()
|
|
1293
|
-
.setBody('Pilih aksi')
|
|
1294
|
-
.setFooter('PontaLabs')
|
|
1295
|
-
.addButton('Yes')
|
|
1296
|
-
.addButton('No')
|
|
1416
|
+
#### 🔗 Rich Response — `richResponse`
|
|
1297
1417
|
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
})
|
|
1301
|
-
```
|
|
1302
|
-
|
|
1303
|
-
**Carousel:**
|
|
1418
|
+
<details>
|
|
1419
|
+
<summary><b>Inline Citation</b></summary>
|
|
1304
1420
|
|
|
1305
1421
|
```js
|
|
1306
|
-
const carousel = build.carousel()
|
|
1307
|
-
.setBody('Pilih produk')
|
|
1308
|
-
.setFooter('PontaLabs')
|
|
1309
|
-
.addCard(card)
|
|
1310
|
-
|
|
1311
1422
|
await sock.sendMessage(jid, {
|
|
1312
|
-
|
|
1313
|
-
|
|
1423
|
+
richResponse: [
|
|
1424
|
+
{
|
|
1425
|
+
text: 'Node.js {{SS_0}}¹{{/SS_0}} adalah runtime JavaScript. Dibuat oleh Ryan Dahl {{SS_1}}²{{/SS_1}} pada 2009.',
|
|
1426
|
+
inlineEntities: [
|
|
1427
|
+
{
|
|
1428
|
+
key: 'SS_0',
|
|
1429
|
+
metadata: {
|
|
1430
|
+
reference_id: 1,
|
|
1431
|
+
reference_url: 'https://nodejs.org',
|
|
1432
|
+
reference_title: 'Node.js Official',
|
|
1433
|
+
reference_display_name: 'nodejs.org',
|
|
1434
|
+
sources: [{
|
|
1435
|
+
source_type: 'THIRD_PARTY',
|
|
1436
|
+
source_display_name: 'nodejs.org',
|
|
1437
|
+
source_subtitle: 'nodejs.org',
|
|
1438
|
+
source_url: 'https://nodejs.org'
|
|
1439
|
+
}],
|
|
1440
|
+
__typename: 'GenAISearchCitationItem'
|
|
1441
|
+
}
|
|
1442
|
+
},
|
|
1443
|
+
{
|
|
1444
|
+
key: 'SS_1',
|
|
1445
|
+
metadata: {
|
|
1446
|
+
reference_id: 2,
|
|
1447
|
+
reference_url: 'https://wikipedia.org/wiki/Ryan_Dahl',
|
|
1448
|
+
reference_title: 'Ryan Dahl - Wikipedia',
|
|
1449
|
+
reference_display_name: 'Wikipedia',
|
|
1450
|
+
sources: [{
|
|
1451
|
+
source_type: 'THIRD_PARTY',
|
|
1452
|
+
source_display_name: 'Wikipedia',
|
|
1453
|
+
source_subtitle: 'wikipedia.org',
|
|
1454
|
+
source_url: 'https://wikipedia.org/wiki/Ryan_Dahl'
|
|
1455
|
+
}],
|
|
1456
|
+
__typename: 'GenAISearchCitationItem'
|
|
1457
|
+
}
|
|
1458
|
+
}
|
|
1459
|
+
]
|
|
1460
|
+
}
|
|
1461
|
+
]
|
|
1462
|
+
}, { quoted: message })
|
|
1314
1463
|
```
|
|
1315
|
-
|
|
1316
|
-
> `build.button()`, `build.buttonV2()`, dan `build.carousel()` tidak membutuhkan `sock` saat dibuat. Builder hanya menghasilkan payload.
|
|
1317
|
-
|
|
1318
1464
|
</details>
|
|
1319
1465
|
|
|
1320
1466
|
<details>
|
|
1321
|
-
<summary><b
|
|
1322
|
-
|
|
1323
|
-
`buildDelay` digunakan bersama `items` untuk melakukan progressive update pada target message yang sama.
|
|
1324
|
-
|
|
1325
|
-
```js
|
|
1326
|
-
await sock.sendMessage(jid, {
|
|
1327
|
-
items: [
|
|
1328
|
-
build.richText('⏳ Memproses...'),
|
|
1329
|
-
build.richText('🔍 Mencari data...'),
|
|
1330
|
-
build.richText('✅ Selesai!')
|
|
1331
|
-
],
|
|
1332
|
-
buildDelay: 1000
|
|
1333
|
-
})
|
|
1334
|
-
```
|
|
1335
|
-
|
|
1336
|
-
Dengan `buildDelay: 1000`, item berikutnya diproses setiap 1 detik dan update tetap menggunakan message ID target yang sama.
|
|
1337
|
-
|
|
1338
|
-
**Custom message ID:**
|
|
1467
|
+
<summary><b>Full Response — all types at once</b></summary>
|
|
1339
1468
|
|
|
1340
1469
|
```js
|
|
1341
1470
|
await sock.sendMessage(jid, {
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1471
|
+
richResponse: [
|
|
1472
|
+
{ text: '*Hasil Pencarian:* Node.js {{SS_0}}¹{{/SS_0}}', inlineEntities: [/* ... */] },
|
|
1473
|
+
{ images: ['https://example.com/nodejs.png'] },
|
|
1474
|
+
{ text: 'Cara install:' },
|
|
1475
|
+
{ code: 'npm install node', language: 'bash' },
|
|
1476
|
+
{
|
|
1477
|
+
table: [
|
|
1478
|
+
{ items: ['Version', 'LTS', 'Release'], isHeading: true },
|
|
1479
|
+
{ items: ['22.x', 'Yes', '2024'], isHeading: false },
|
|
1480
|
+
{ items: ['21.x', 'No', '2023'], isHeading: false }
|
|
1481
|
+
]
|
|
1482
|
+
},
|
|
1483
|
+
{ sources: [['https://nodejs.org/fav.ico', 'https://nodejs.org', 'Node.js']] },
|
|
1484
|
+
{ suggestions: ['Lihat changelog', 'Download', 'Docs'] },
|
|
1485
|
+
{ footer: 'PontaCT · pontalabs' }
|
|
1346
1486
|
],
|
|
1347
|
-
buildDelay:
|
|
1348
|
-
})
|
|
1487
|
+
buildDelay: 2500,
|
|
1488
|
+
}, { quoted: message })
|
|
1349
1489
|
```
|
|
1350
|
-
|
|
1351
|
-
> `buildDelay` hanya berlaku untuk `items` dan nilainya harus lebih besar dari `0`.
|
|
1352
|
-
|
|
1353
1490
|
</details>
|
|
1354
1491
|
|
|
1355
|
-
|
|
1356
|
-
<summary><b>🛠️ Advanced Rich Builder — <code>build.AIRich(sock)</code></b></summary>
|
|
1357
|
-
|
|
1358
|
-
Untuk state, node ID, replace, insert, delete, dan edit message gunakan `build.AIRich(sock)`.
|
|
1359
|
-
|
|
1360
|
-
```js
|
|
1361
|
-
const ai = build.AIRich(sock)
|
|
1362
|
-
|
|
1363
|
-
ai.addText('⏳ Loading...', { id: 'status' })
|
|
1364
|
-
ai.addTip('Mohon tunggu')
|
|
1365
|
-
|
|
1366
|
-
await ai.send(jid)
|
|
1367
|
-
|
|
1368
|
-
ai.addText('✅ Selesai!', { replace: 'status' })
|
|
1369
|
-
ai.delete('status')
|
|
1370
|
-
ai.addTip('Tambahan', { insertAt: 'status' })
|
|
1371
|
-
```
|
|
1372
|
-
|
|
1373
|
-
**Contoh edit:**
|
|
1374
|
-
|
|
1375
|
-
```js
|
|
1376
|
-
const ai = build.AIRich(sock)
|
|
1377
|
-
|
|
1378
|
-
ai.addText('⏳ Memproses...', { id: 'answer' })
|
|
1379
|
-
await ai.send(jid)
|
|
1380
|
-
|
|
1381
|
-
const result = await getAIResponse()
|
|
1382
|
-
|
|
1383
|
-
ai.addText(result, { replace: 'answer' })
|
|
1384
|
-
ai.addTip('Generated by AI')
|
|
1385
|
-
|
|
1386
|
-
await ai.sendEdit(jid)
|
|
1387
|
-
```
|
|
1492
|
+
---
|
|
1388
1493
|
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
</details>
|
|
1494
|
+
#### ⚙️ Rich Options
|
|
1392
1495
|
|
|
1393
1496
|
<details>
|
|
1394
|
-
<summary><b
|
|
1497
|
+
<summary><b><code>aiForwarded</code> — toggle label "Diteruskan dari bot AI"</b></summary>
|
|
1395
1498
|
|
|
1396
|
-
`
|
|
1499
|
+
> Default `false`. Set `true` kalau mau pesan diberi tag forwarded-from-AI-bot di `contextInfo`. Bisa dipakai bareng key rich manapun (`richText`, `items`, `richResponse`, dll).
|
|
1397
1500
|
|
|
1398
1501
|
```js
|
|
1399
1502
|
await sock.sendMessage(jid, {
|
|
@@ -1401,42 +1504,6 @@ await sock.sendMessage(jid, {
|
|
|
1401
1504
|
aiForwarded: true
|
|
1402
1505
|
}, { quoted: message })
|
|
1403
1506
|
```
|
|
1404
|
-
|
|
1405
|
-
Bisa digunakan bersama `richText`, `items`, `richResponse`, `richHtml`, dan key Rich lainnya.
|
|
1406
|
-
|
|
1407
|
-
</details>
|
|
1408
|
-
|
|
1409
|
-
<details>
|
|
1410
|
-
<summary><b>🔌 Legacy Compatibility</b></summary>
|
|
1411
|
-
|
|
1412
|
-
API Rich lama tetap kompatibel:
|
|
1413
|
-
|
|
1414
|
-
```js
|
|
1415
|
-
await sock.sendMessage(jid, {
|
|
1416
|
-
richText: 'Halo'
|
|
1417
|
-
})
|
|
1418
|
-
|
|
1419
|
-
await sock.sendMessage(jid, {
|
|
1420
|
-
items: [
|
|
1421
|
-
{ richText: 'Halo' },
|
|
1422
|
-
{ richTip: 'Testing' }
|
|
1423
|
-
]
|
|
1424
|
-
})
|
|
1425
|
-
```
|
|
1426
|
-
|
|
1427
|
-
Kamu juga dapat mencampur object Rich lama dengan `build.*`:
|
|
1428
|
-
|
|
1429
|
-
```js
|
|
1430
|
-
await sock.sendMessage(jid, {
|
|
1431
|
-
items: [
|
|
1432
|
-
{ richText: 'Shortcut lama' },
|
|
1433
|
-
build.richText('Builder baru'),
|
|
1434
|
-
{ richTip: 'Shortcut lama' },
|
|
1435
|
-
build.richTip('Builder baru')
|
|
1436
|
-
]
|
|
1437
|
-
})
|
|
1438
|
-
```
|
|
1439
|
-
|
|
1440
1507
|
</details>
|
|
1441
1508
|
|
|
1442
1509
|
---
|