@nuiisweety/baileys 0.1.7 → 0.1.9

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.
@@ -0,0 +1,1950 @@
1
+ <div align="center">
2
+
3
+ <img src="https://raw.githubusercontent.com/NuiiS4TORU/-nuisockets/refs/heads/main/nuiisweety.png" width="100%"/>
4
+
5
+ # @nuiisweety/baileys
6
+
7
+ *Fork dari [`@whiskeysockets/baileys`](https://github.com/WhiskeySockets/Baileys) v7.0.0-rc11*
8
+ *dikembangkan dengan sepenuh hati oleh **NuiiS4TORU***
9
+
10
+ [![npm version](https://img.shields.io/badge/npm-0.1.8-pink?style=flat-square&logo=npm)](https://www.npmjs.com/package/@nuiisweety/baileys)
11
+ [![license](https://img.shields.io/badge/license-MIT-lavender?style=flat-square)](LICENSE)
12
+ [![based on](https://img.shields.io/badge/based%20on-@whiskeysockets%2Fbaileys-orchid?style=flat-square)](https://github.com/WhiskeySockets/Baileys)
13
+
14
+ </div>
15
+
16
+ ---
17
+
18
+ ## 🗺️ Navigasi
19
+
20
+ 🔌 **Koneksi & Setup** —
21
+ [Instalasi](#instalasi) ·
22
+ [QR Code](#koneksi-qr-code) ·
23
+ [Pairing Code](#koneksi-pairing-code) ·
24
+ [Browser Identity](#browser-identity) ·
25
+ [Opsi Koneksi](#opsi-koneksi)
26
+
27
+ 📨 **Handle Pesan** —
28
+ [Terima Pesan](#terima-pesan) ·
29
+ [Handle Grup](#handle-grup)
30
+
31
+ 📤 **Kirim Pesan** —
32
+ [Teks](#teks) ·
33
+ [Gambar](#gambar) ·
34
+ [Video](#video) ·
35
+ [Audio & Voice Note](#audio--voice-note) ·
36
+ [Dokumen](#dokumen) ·
37
+ [Sticker](#sticker) ·
38
+ [Lokasi](#lokasi) ·
39
+ [Kontak](#kontak)
40
+
41
+ 💬 **Interaksi** —
42
+ [Reaksi](#reaksi) ·
43
+ [Poll](#poll) ·
44
+ [Poll Result](#poll-result) ·
45
+ [Poll Update](#poll-update) ·
46
+ [Forward](#forward) ·
47
+ [Hapus](#hapus-pesan) ·
48
+ [Edit](#edit-pesan) ·
49
+ [Pin](#pin-pesan)
50
+
51
+ ✨ **Fitur Tambahan** —
52
+ [Album](#album) ·
53
+ [Event](#event) ·
54
+ [Group Status / Story](#group-status--group-story) ·
55
+ [Status Mention](#status-mention) ·
56
+ [Flow Reply](#flow-reply) ·
57
+ [Button Reply](#button-reply) ·
58
+ [Keep In Chat](#keep-in-chat) ·
59
+ [Scheduled Call](#scheduled-call) ·
60
+ [Group Invite](#group-invite) ·
61
+ [Product](#product)
62
+
63
+ 🎁 **Wrapper** —
64
+ [View Once](#view-once) ·
65
+ [View Once V2](#view-once-v2) ·
66
+ [Ephemeral](#ephemeral) ·
67
+ [Spoiler](#spoiler) ·
68
+ [Group Status Wrap](#group-status-wrap) ·
69
+ [Lottie Sticker](#lottie-sticker) ·
70
+ [AI Icon](#ai-icon) ·
71
+ [Secure Meta Label](#secure-meta-service-label)
72
+
73
+ 🎛️ **Interactive** —
74
+ [Buttons](#buttons) ·
75
+ [List Message](#list-message) ·
76
+ [Template Buttons](#template-buttons) ·
77
+ [Native Flow](#native-flow) ·
78
+ [Carousel](#carousel)
79
+
80
+ 🤖 **Rich Message (AI)** —
81
+ [Text](#addtext) ·
82
+ [Code Block](#addcode) ·
83
+ [Table](#addtable) ·
84
+ [Image](#addimage) ·
85
+ [Video](#addvideo) ·
86
+ [Source](#addsource) ·
87
+ [Reels](#addreels) ·
88
+ [Product Card](#addproduct) ·
89
+ [Post](#addpost) ·
90
+ [Tip](#addtip) ·
91
+ [Suggest](#addsuggest) ·
92
+ [Map](#map-rich) ·
93
+ [LaTeX](#latex-rich) ·
94
+ [Grid Image](#grid-image-rich) ·
95
+ [Inline Image](#inline-image-rich) ·
96
+ [Dynamic/GIF](#dynamic--gif-rich) ·
97
+ [Content Items](#content-items-rich) ·
98
+ [Gabungan (richResponse)](#rich-response-gabungan) ·
99
+ [Terima & Decode](#terima--decode-rich-message)
100
+
101
+ 🔧 **Lainnya** —
102
+ [List Reply](#list-reply) ·
103
+ [Sticker Pack](#sticker-pack) ·
104
+ [External Ad Reply](#external-ad-reply) ·
105
+ [Request Payment](#request-payment) ·
106
+ [Invoice](#invoice) ·
107
+ [Order](#order) ·
108
+ [Disappearing Messages](#disappearing-messages) ·
109
+ [Raw Message](#raw-message)
110
+
111
+ ---
112
+
113
+ ## 📦 Instalasi
114
+
115
+ ```js
116
+ // CommonJS
117
+ const { default: makeWASocket } = require('@nuiisweety/baileys')
118
+
119
+ // ESM
120
+ import makeWASocket from '@nuiisweety/baileys'
121
+ ```
122
+
123
+ ---
124
+
125
+ ## 📱 Koneksi QR Code
126
+
127
+ ```js
128
+ const {
129
+ default: makeWASocket,
130
+ useMultiFileAuthState,
131
+ DisconnectReason,
132
+ fetchLatestBaileysVersion
133
+ } = require('@nuiisweety/baileys')
134
+
135
+ async function start() {
136
+ const { state, saveCreds } = await useMultiFileAuthState('auth_info')
137
+ const { version } = await fetchLatestBaileysVersion()
138
+
139
+ const sock = makeWASocket({
140
+ version,
141
+ auth: state,
142
+ printQRInTerminal: true
143
+ })
144
+
145
+ sock.ev.on('creds.update', saveCreds)
146
+ sock.ev.on('connection.update', ({ connection, lastDisconnect }) => {
147
+ if (connection === 'close') {
148
+ const code = lastDisconnect?.error?.output?.statusCode
149
+ if (code !== DisconnectReason.loggedOut) start()
150
+ } else if (connection === 'open') {
151
+ console.log('Connected!')
152
+ }
153
+ })
154
+ }
155
+ start()
156
+ ```
157
+
158
+ ---
159
+
160
+ ## 🔑 Koneksi Pairing Code
161
+
162
+ > Cocok untuk server/VPS tanpa tampilan terminal.
163
+
164
+ ```js
165
+ const sock = makeWASocket({ version, auth: state, printQRInTerminal: false })
166
+
167
+ sock.ev.on('creds.update', saveCreds)
168
+ sock.ev.on('connection.update', ({ connection, lastDisconnect }) => {
169
+ if (connection === 'close') {
170
+ if (lastDisconnect?.error?.output?.statusCode !== DisconnectReason.loggedOut) start()
171
+ }
172
+ })
173
+
174
+ // Nomor HP format internasional tanpa +
175
+ if (!sock.authState.creds.registered) {
176
+ const code = await sock.requestPairingCode('628123456789')
177
+ console.log('Pairing code:', code)
178
+ }
179
+
180
+ // Custom pairing code (8 karakter)
181
+ const code = await sock.requestPairingCode('628123456789', 'NUYY2822')
182
+ ```
183
+
184
+ ---
185
+
186
+ ## 🌐 Browser Identity
187
+
188
+ ```js
189
+ const { Browsers } = require('@nuiisweety/baileys')
190
+
191
+ makeWASocket({
192
+ browser: Browsers.macOS('Chrome'), // Mac OS — Chrome
193
+ browser: Browsers.macOS('Firefox'), // Mac OS — Firefox
194
+ browser: Browsers.windows('Chrome'), // Windows — Chrome
195
+ browser: Browsers.ubuntu('Chrome'), // Ubuntu — Chrome
196
+ browser: Browsers.baileys('Chrome'), // Baileys — Chrome
197
+ browser: ['MyBot', 'Chrome', '1.0.0'] // custom
198
+ })
199
+ ```
200
+
201
+ ---
202
+
203
+ ## ⚙️ Opsi Koneksi
204
+
205
+ ```js
206
+ makeWASocket({
207
+ version,
208
+ auth: state,
209
+ printQRInTerminal: true,
210
+ browser: Browsers.macOS('Chrome'),
211
+ connectTimeoutMs: 20000,
212
+ keepAliveIntervalMs: 30000,
213
+ markOnlineOnConnect: true,
214
+ syncFullHistory: false,
215
+ generateHighQualityLinkPreview: false,
216
+ emitOwnEvents: true,
217
+ getMessage: async key => store?.messages?.[key.remoteJid]?.get(key.id)?.message
218
+ })
219
+ ```
220
+
221
+ ---
222
+
223
+ ## 📬 Terima Pesan
224
+
225
+ ```js
226
+ sock.ev.on('messages.upsert', async ({ messages, type }) => {
227
+ if (type !== 'notify') return
228
+
229
+ for (const m of messages) {
230
+ if (!m.message) continue
231
+ if (m.key.fromMe) continue
232
+
233
+ const jid = m.key.remoteJid
234
+ const isGroup = jid.endsWith('@g.us')
235
+ const sender = isGroup ? m.key.participant : jid
236
+
237
+ const text =
238
+ m.message.conversation ||
239
+ m.message.extendedTextMessage?.text ||
240
+ m.message.imageMessage?.caption ||
241
+ m.message.videoMessage?.caption || ''
242
+
243
+ await sock.readMessages([m.key])
244
+ await sock.sendPresenceUpdate('composing', jid)
245
+ }
246
+ })
247
+ ```
248
+
249
+ ---
250
+
251
+ ## 👥 Handle Grup
252
+
253
+ ```js
254
+ // Anggota masuk/keluar
255
+ sock.ev.on('group-participants.update', ({ id, participants, action }) => {
256
+ // action: 'add' | 'remove' | 'promote' | 'demote'
257
+ })
258
+
259
+ // Info grup diupdate
260
+ sock.ev.on('groups.update', updates => {})
261
+
262
+ // Metadata grup
263
+ const meta = await sock.groupMetadata(groupJid)
264
+ console.log(meta.subject, meta.participants)
265
+
266
+ // Semua grup
267
+ const groups = await sock.groupFetchAllParticipating()
268
+
269
+ // Tambah / keluarkan / promote / demote
270
+ await sock.groupParticipantsUpdate(groupJid, ['628xxx@s.whatsapp.net'], 'add')
271
+ await sock.groupParticipantsUpdate(groupJid, ['628xxx@s.whatsapp.net'], 'remove')
272
+ await sock.groupParticipantsUpdate(groupJid, ['628xxx@s.whatsapp.net'], 'promote')
273
+ await sock.groupParticipantsUpdate(groupJid, ['628xxx@s.whatsapp.net'], 'demote')
274
+
275
+ // Ubah nama / deskripsi
276
+ await sock.groupUpdateSubject(groupJid, 'Nama Baru')
277
+ await sock.groupUpdateDescription(groupJid, 'Deskripsi baru')
278
+
279
+ // Kunci / buka grup
280
+ await sock.groupSettingUpdate(groupJid, 'announcement')
281
+ await sock.groupSettingUpdate(groupJid, 'not_announcement')
282
+
283
+ // Mention semua anggota
284
+ const meta2 = await sock.groupMetadata(groupJid)
285
+ const members = meta2.participants.map(p => p.id)
286
+ await sock.sendMessage(groupJid, {
287
+ text: members.map(m => `@${m.split('@')[0]}`).join(' '),
288
+ mentions: members
289
+ })
290
+ ```
291
+
292
+ ---
293
+
294
+ ## 💬 Teks
295
+
296
+ ```js
297
+ await sock.sendMessage(jid, { text: 'Halo!' })
298
+
299
+ // Dengan mention
300
+ await sock.sendMessage(jid, {
301
+ text: '@628xxx halo!',
302
+ mentions: ['628xxx@s.whatsapp.net']
303
+ }, { quoted: m })
304
+ ```
305
+
306
+ ---
307
+
308
+ ## 🖼️ Gambar
309
+
310
+ ```js
311
+ // URL
312
+ await sock.sendMessage(jid, {
313
+ image: { url: 'https://example.com/image.jpg' },
314
+ caption: 'Keterangan'
315
+ })
316
+
317
+ // Buffer
318
+ await sock.sendMessage(jid, {
319
+ image: fs.readFileSync('image.jpg'),
320
+ caption: 'Keterangan'
321
+ })
322
+ ```
323
+
324
+ ---
325
+
326
+ ## 🎬 Video
327
+
328
+ ```js
329
+ await sock.sendMessage(jid, {
330
+ video: { url: 'https://example.com/video.mp4' },
331
+ caption: 'Keterangan',
332
+ gifPlayback: false // true = GIF looping
333
+ })
334
+
335
+ // Video note (bubble)
336
+ await sock.sendMessage(jid, {
337
+ video: fs.readFileSync('video.mp4'),
338
+ ptv: true
339
+ })
340
+ ```
341
+
342
+ ---
343
+
344
+ ## 🎙️ Audio & Voice Note
345
+
346
+ ```js
347
+ // Audio biasa
348
+ await sock.sendMessage(jid, {
349
+ audio: { url: 'https://example.com/audio.mp3' },
350
+ mimetype: 'audio/mpeg'
351
+ })
352
+
353
+ // Voice note (PTT)
354
+ await sock.sendMessage(jid, {
355
+ audio: fs.readFileSync('voice.ogg'),
356
+ mimetype: 'audio/ogg; codecs=opus',
357
+ ptt: true
358
+ })
359
+ ```
360
+
361
+ ---
362
+
363
+ ## 📄 Dokumen
364
+
365
+ ```js
366
+ await sock.sendMessage(jid, {
367
+ document: fs.readFileSync('file.pdf'),
368
+ mimetype: 'application/pdf',
369
+ fileName: 'dokumen.pdf',
370
+ caption: 'File ini'
371
+ })
372
+ ```
373
+
374
+ ---
375
+
376
+ ## 🎴 Sticker
377
+
378
+ ```js
379
+ await sock.sendMessage(jid, { sticker: fs.readFileSync('sticker.webp') })
380
+ ```
381
+
382
+ ---
383
+
384
+ ## 📍 Lokasi
385
+
386
+ ```js
387
+ await sock.sendMessage(jid, {
388
+ location: {
389
+ degreesLatitude: -6.2088,
390
+ degreesLongitude: 106.8456,
391
+ name: 'Monas',
392
+ address: 'Jakarta Pusat'
393
+ }
394
+ })
395
+ ```
396
+
397
+ ---
398
+
399
+ ## 👤 Kontak
400
+
401
+ ```js
402
+ await sock.sendMessage(jid, {
403
+ contacts: {
404
+ displayName: 'Nama',
405
+ contacts: [{
406
+ vcard: 'BEGIN:VCARD\nVERSION:3.0\nFN:Nama\nTEL:+62812345678\nEND:VCARD'
407
+ }]
408
+ }
409
+ })
410
+ ```
411
+
412
+ ---
413
+
414
+ ## ❤️ Reaksi
415
+
416
+ ```js
417
+ await sock.sendMessage(jid, { react: { text: '❤️', key: m.key } })
418
+
419
+ // Hapus reaksi
420
+ await sock.sendMessage(jid, { react: { text: '', key: m.key } })
421
+ ```
422
+
423
+ ---
424
+
425
+ ## 📊 Poll
426
+
427
+ ```js
428
+ await sock.sendMessage(jid, {
429
+ poll: {
430
+ name: 'Pilih salah satu',
431
+ values: ['Opsi A', 'Opsi B', 'Opsi C'],
432
+ selectableCount: 1 // 0 = boleh pilih banyak
433
+ }
434
+ })
435
+
436
+ // Poll dengan fitur tambahan
437
+ await sock.sendMessage(jid, {
438
+ poll: {
439
+ name: 'Nama Poll',
440
+ values: ['Opsi A', 'Opsi B'],
441
+ selectableCount: 1,
442
+ endDate: new Date('2025-12-31'),
443
+ hideVoter: true,
444
+ canAddOption: false,
445
+ toAnnouncementGroup: false
446
+ }
447
+ })
448
+
449
+ // Quiz (Poll dengan jawaban benar)
450
+ await sock.sendMessage(jid, {
451
+ poll: {
452
+ name: 'Ibu kota Indonesia?',
453
+ values: ['Jakarta', 'Surabaya', 'Bandung'],
454
+ selectableCount: 1,
455
+ pollType: 1, // 1 = QUIZ
456
+ correctAnswer: 'Jakarta'
457
+ }
458
+ })
459
+ ```
460
+
461
+ ---
462
+
463
+ ## 📈 Poll Result
464
+
465
+ ```js
466
+ await sock.sendMessage(jid, {
467
+ pollResult: {
468
+ name: 'Nama Poll',
469
+ votes: [
470
+ { name: 'Opsi A', voteCount: 10 },
471
+ { name: 'Opsi B', voteCount: 5 }
472
+ ],
473
+ pollType: 0 // 0 = POLL, 1 = QUIZ
474
+ }
475
+ })
476
+ ```
477
+
478
+ ---
479
+
480
+ ## 🔄 Poll Update
481
+
482
+ ```js
483
+ await sock.sendMessage(jid, {
484
+ pollUpdate: {
485
+ key: pollMessage.key,
486
+ vote: encryptedVotePayload,
487
+ metadata: optionalMetadata
488
+ }
489
+ })
490
+ ```
491
+
492
+ ---
493
+
494
+ ## ↗️ Forward
495
+
496
+ ```js
497
+ await sock.sendMessage(jid, {
498
+ forward: targetMessage,
499
+ force: true // paksa tampil sebagai forwarded
500
+ })
501
+ ```
502
+
503
+ ---
504
+
505
+ ## 🗑️ Hapus Pesan
506
+
507
+ ```js
508
+ await sock.sendMessage(jid, { delete: m.key })
509
+ ```
510
+
511
+ ---
512
+
513
+ ## ✏️ Edit Pesan
514
+
515
+ ```js
516
+ await sock.sendMessage(jid, {
517
+ text: 'Teks yang sudah diedit',
518
+ edit: m.key
519
+ })
520
+ ```
521
+
522
+ ---
523
+
524
+ ## 📌 Pin Pesan
525
+
526
+ ```js
527
+ // Pin
528
+ await sock.sendMessage(jid, {
529
+ pin: m.key,
530
+ type: 1,
531
+ time: 86400 // 86400=1hr | 604800=7hr | 2592000=30hr
532
+ })
533
+
534
+ // Unpin
535
+ await sock.sendMessage(jid, { pin: m.key, type: 2 })
536
+ ```
537
+
538
+ ---
539
+
540
+ ## 🗂️ Album
541
+
542
+ ```js
543
+ await sock.sendMessage(jid, {
544
+ album: [
545
+ { image: { url: 'https://example.com/1.jpg' }, caption: 'Foto 1' },
546
+ { image: { url: 'https://example.com/2.jpg' }, caption: 'Foto 2' },
547
+ { video: { url: 'https://example.com/vid.mp4' }, caption: 'Video' }
548
+ ]
549
+ })
550
+ // minimal 2 media
551
+ ```
552
+
553
+ ---
554
+
555
+ ## 📅 Event
556
+
557
+ ```js
558
+ await sock.sendMessage(jid, {
559
+ event: {
560
+ name: 'Nama Acara',
561
+ description: 'Deskripsi',
562
+ startDate: new Date('2025-12-01T10:00:00'),
563
+ endDate: new Date('2025-12-01T12:00:00'),
564
+ location: {
565
+ degreesLatitude: -6.2088,
566
+ degreesLongitude: 106.8456,
567
+ name: 'Monas, Jakarta'
568
+ },
569
+ extraGuestsAllowed: true
570
+ }
571
+ })
572
+
573
+ // Event dengan scheduled call
574
+ await sock.sendMessage(jid, {
575
+ event: {
576
+ name: 'Meeting Online',
577
+ startDate: new Date('2025-12-01T10:00:00'),
578
+ call: 'audio', // 'audio' | 'video'
579
+ isScheduleCall: true
580
+ }
581
+ })
582
+ ```
583
+
584
+ ---
585
+
586
+ ## 📖 Group Status / Group Story
587
+
588
+ ```js
589
+ // Teks
590
+ await sock.sendMessage(groupJid, {
591
+ groupStatusMessage: { text: 'Status teks' }
592
+ })
593
+
594
+ // Gambar
595
+ await sock.sendMessage(groupJid, {
596
+ groupStatusMessage: {
597
+ image: { url: 'https://example.com/image.jpg' },
598
+ caption: 'Keterangan'
599
+ }
600
+ })
601
+
602
+ // Video
603
+ await sock.sendMessage(groupJid, {
604
+ groupStatusMessage: {
605
+ video: { url: 'https://example.com/video.mp4' },
606
+ caption: 'Keterangan'
607
+ }
608
+ })
609
+ ```
610
+
611
+ ---
612
+
613
+ ## 🔁 Flow Reply
614
+
615
+ ```js
616
+ await sock.sendMessage(jid, {
617
+ flowReply: {
618
+ name: 'quick_reply',
619
+ paramsJson: '{"id":"btn1"}',
620
+ text: 'Teks balasan',
621
+ format: 1,
622
+ version: 1
623
+ }
624
+ })
625
+ ```
626
+
627
+ ---
628
+
629
+ ## 🔘 Button Reply
630
+
631
+ ```js
632
+ // Template button
633
+ await sock.sendMessage(jid, {
634
+ buttonReply: { displayText: 'Opsi yang dipilih', id: 'btn_id', index: 0 },
635
+ type: 'template'
636
+ })
637
+
638
+ // Plain button
639
+ await sock.sendMessage(jid, {
640
+ buttonReply: { displayText: 'Opsi yang dipilih', id: 'btn_id' },
641
+ type: 'plain'
642
+ })
643
+ ```
644
+
645
+ ---
646
+
647
+ ## 📎 Keep In Chat
648
+
649
+ ```js
650
+ await sock.sendMessage(jid, {
651
+ keep: m.key,
652
+ keepType: 1 // 1 = keep, 2 = unkeep
653
+ })
654
+ ```
655
+
656
+ ---
657
+
658
+ ## 📞 Scheduled Call
659
+
660
+ ```js
661
+ await sock.sendMessage(jid, {
662
+ call: {
663
+ time: Date.now() + 3600000,
664
+ type: 1, // 1 = voice, 2 = video
665
+ title: 'Meeting'
666
+ }
667
+ })
668
+ ```
669
+
670
+ ---
671
+
672
+ ## 🔗 Group Invite
673
+
674
+ ```js
675
+ await sock.sendMessage(jid, {
676
+ groupInvite: {
677
+ jid: 'xxx@g.us',
678
+ inviteCode: 'kode',
679
+ inviteExpiration: Date.now() + 86400000,
680
+ subject: 'Nama Grup',
681
+ text: 'Bergabunglah bersama kami'
682
+ }
683
+ })
684
+ ```
685
+
686
+ ---
687
+
688
+ ## 🛍️ Product
689
+
690
+ ```js
691
+ await sock.sendMessage(jid, {
692
+ product: {
693
+ productImage: fs.readFileSync('produk.jpg'),
694
+ productId: 'prod_123',
695
+ title: 'Nama Produk',
696
+ description: 'Deskripsi produk',
697
+ currencyCode: 'IDR',
698
+ priceAmount1000: 50000000,
699
+ retailerId: 'sku_001',
700
+ url: 'https://toko.example.com/produk'
701
+ },
702
+ businessOwnerJid: '628xxx@s.whatsapp.net' // wajib diisi
703
+ })
704
+ ```
705
+
706
+ ---
707
+
708
+ ## 👁️ View Once
709
+
710
+ ```js
711
+ await sock.sendMessage(jid, {
712
+ image: { url: 'https://example.com/image.jpg' },
713
+ viewOnce: true
714
+ })
715
+ ```
716
+
717
+ ---
718
+
719
+ ## 👁️ View Once V2
720
+
721
+ ```js
722
+ await sock.sendMessage(jid, {
723
+ image: { url: 'https://example.com/image.jpg' },
724
+ viewOnceV2: true
725
+ })
726
+
727
+ // viewOnceV2Extension
728
+ await sock.sendMessage(jid, {
729
+ image: { url: 'https://example.com/image.jpg' },
730
+ viewOnceV2Extension: true
731
+ })
732
+ ```
733
+
734
+ ---
735
+
736
+ ## ⏳ Ephemeral
737
+
738
+ ```js
739
+ await sock.sendMessage(jid, {
740
+ text: 'Pesan ini ephemeral',
741
+ ephemeral: true
742
+ })
743
+ ```
744
+
745
+ ---
746
+
747
+ ## 🙈 Spoiler
748
+
749
+ ```js
750
+ await sock.sendMessage(jid, {
751
+ image: { url: 'https://example.com/image.jpg' },
752
+ caption: 'Spoiler!',
753
+ spoiler: true
754
+ })
755
+ ```
756
+
757
+ ---
758
+
759
+ ## 🎭 Group Status Wrap
760
+
761
+ ```js
762
+ await sock.sendMessage(jid, {
763
+ text: 'Status di grup ini',
764
+ groupStatus: true
765
+ })
766
+ ```
767
+
768
+ ---
769
+
770
+ ## 🎞️ Lottie Sticker
771
+
772
+ ```js
773
+ await sock.sendMessage(jid, {
774
+ sticker: fs.readFileSync('sticker.webp'),
775
+ isLottie: true
776
+ })
777
+ ```
778
+
779
+ ---
780
+
781
+ ## 🤖 AI Icon
782
+
783
+ ```js
784
+ // Hanya untuk private chat (bukan grup)
785
+ await sock.sendMessage(jid, { text: 'Respons dari AI', ai: true })
786
+
787
+ await sock.sendMessage(jid, {
788
+ image: { url: 'https://example.com/image.jpg' },
789
+ caption: 'Dihasilkan oleh AI',
790
+ ai: true
791
+ })
792
+ ```
793
+
794
+ ---
795
+
796
+ ## 🔒 Secure Meta Service Label
797
+
798
+ ```js
799
+ await sock.sendMessage(jid, {
800
+ text: 'Pesan layanan resmi',
801
+ secureMetaServiceLabel: true
802
+ })
803
+ ```
804
+
805
+ ---
806
+
807
+ ## 🎛️ Buttons
808
+
809
+ ```js
810
+ // Teks dengan tombol
811
+ await sock.sendMessage(jid, {
812
+ text: 'Pilih salah satu',
813
+ footer: 'Footer pesan',
814
+ buttons: [
815
+ { id: 'btn1', text: 'Tombol 1' },
816
+ { id: 'btn2', text: 'Tombol 2' },
817
+ { id: 'btn3', text: 'Tombol 3' }
818
+ ]
819
+ })
820
+
821
+ // Gambar sebagai header
822
+ await sock.sendMessage(jid, {
823
+ image: { url: 'https://example.com/image.jpg' },
824
+ caption: 'Isi pesan',
825
+ footer: 'Footer',
826
+ buttons: [
827
+ { id: 'btn1', text: 'Pilih A' },
828
+ { id: 'btn2', text: 'Pilih B' }
829
+ ]
830
+ })
831
+
832
+ // Native flow button
833
+ await sock.sendMessage(jid, {
834
+ text: 'Pilih menu',
835
+ buttons: [{
836
+ text: 'Buka Menu',
837
+ sections: [{
838
+ title: 'Kategori A',
839
+ rows: [
840
+ { id: 'row1', title: 'Item 1', description: 'Deskripsi' },
841
+ { id: 'row2', title: 'Item 2' }
842
+ ]
843
+ }]
844
+ }]
845
+ })
846
+ ```
847
+
848
+ ---
849
+
850
+ ## 📋 List Message
851
+
852
+ ```js
853
+ await sock.sendMessage(jid, {
854
+ text: 'Silakan pilih',
855
+ title: 'Judul List',
856
+ buttonText: 'Buka Daftar',
857
+ footer: 'Footer pesan',
858
+ sections: [
859
+ {
860
+ title: 'Bagian 1',
861
+ rows: [
862
+ { id: 'row1', title: 'Pilihan A', description: 'Deskripsi A' },
863
+ { id: 'row2', title: 'Pilihan B', description: 'Deskripsi B' }
864
+ ]
865
+ },
866
+ {
867
+ title: 'Bagian 2',
868
+ rows: [
869
+ { id: 'row3', title: 'Pilihan C' }
870
+ ]
871
+ }
872
+ ]
873
+ })
874
+ ```
875
+
876
+ ---
877
+
878
+ ## 🗃️ Template Buttons
879
+
880
+ ```js
881
+ // Teks
882
+ await sock.sendMessage(jid, {
883
+ text: 'Pesan template',
884
+ footer: 'Footer',
885
+ id: 'template-unik',
886
+ templateButtons: [
887
+ { id: 'btn1', text: 'Quick Reply' },
888
+ { url: 'https://example.com', text: 'Kunjungi Website' },
889
+ { call: '+62812345678', text: 'Hubungi Kami' }
890
+ ]
891
+ })
892
+
893
+ // Gambar sebagai header
894
+ await sock.sendMessage(jid, {
895
+ image: { url: 'https://example.com/img.jpg' },
896
+ caption: 'Isi pesan',
897
+ title: 'Judul',
898
+ footer: 'Footer',
899
+ templateButtons: [
900
+ { id: 'btn1', text: 'Klik Sini' },
901
+ { url: 'https://example.com', text: 'Buka Link' }
902
+ ]
903
+ })
904
+ ```
905
+
906
+ ---
907
+
908
+ ## 🌊 Native Flow
909
+
910
+ ```js
911
+ // Teks dengan native flow buttons
912
+ await sock.sendMessage(jid, {
913
+ text: 'Pilih aksi',
914
+ footer: 'Footer pesan',
915
+ nativeFlow: [
916
+ { name: 'quick_reply', paramsJson: '{"id":"1"}', text: 'Opsi 1' },
917
+ { name: 'quick_reply', paramsJson: '{"id":"2"}', text: 'Opsi 2' }
918
+ ]
919
+ })
920
+
921
+ // Gambar sebagai header
922
+ await sock.sendMessage(jid, {
923
+ image: { url: 'https://example.com/img.jpg' },
924
+ caption: 'Isi pesan',
925
+ title: 'Judul',
926
+ subtitle: 'Subjudul',
927
+ footer: 'Footer',
928
+ nativeFlow: [
929
+ { name: 'quick_reply', paramsJson: '{"id":"1"}', text: 'Tombol 1' }
930
+ ]
931
+ })
932
+
933
+ // Dengan audio footer
934
+ await sock.sendMessage(jid, {
935
+ text: 'Pesan dengan audio footer',
936
+ audioFooter: fs.readFileSync('audio.ogg'),
937
+ nativeFlow: [
938
+ { name: 'quick_reply', paramsJson: '{"id":"1"}', text: 'OK' }
939
+ ]
940
+ })
941
+
942
+ // Wrap sebagai templateMessage
943
+ await sock.sendMessage(jid, {
944
+ text: 'Template interaktif',
945
+ nativeFlow: [
946
+ { name: 'quick_reply', paramsJson: '{"id":"1"}', text: 'Tombol' }
947
+ ],
948
+ interactiveAsTemplate: true,
949
+ id: 'template-id-unik'
950
+ })
951
+ ```
952
+
953
+ ---
954
+
955
+ ## 🎠 Carousel
956
+
957
+ ```js
958
+ await sock.sendMessage(jid, {
959
+ text: 'Carousel utama',
960
+ footer: 'Footer utama',
961
+ cards: [
962
+ {
963
+ image: { url: 'https://example.com/1.jpg' },
964
+ title: 'Kartu 1',
965
+ caption: 'Deskripsi kartu 1',
966
+ footer: 'Footer kartu 1',
967
+ nativeFlow: [
968
+ { name: 'quick_reply', paramsJson: '{"id":"c1"}', text: 'Pilih Ini' }
969
+ ]
970
+ },
971
+ {
972
+ image: { url: 'https://example.com/2.jpg' },
973
+ title: 'Kartu 2',
974
+ caption: 'Deskripsi kartu 2',
975
+ nativeFlow: [
976
+ { name: 'quick_reply', paramsJson: '{"id":"c2"}', text: 'Pilih Itu' }
977
+ ]
978
+ }
979
+ ]
980
+ })
981
+ ```
982
+
983
+ ---
984
+
985
+ ## 🏷️ Status Mention
986
+
987
+ ```js
988
+ // Kirim ke array JID untuk trigger status mention
989
+ await sock.sendMessage(['628xxx@s.whatsapp.net', 'yyy@g.us'], {
990
+ text: 'Hei kamu!',
991
+ backgroundColor: '#ff6b9d'
992
+ })
993
+
994
+ // Gambar dengan mention
995
+ await sock.sendMessage(['628xxx@s.whatsapp.net'], {
996
+ image: { url: 'https://example.com/image.jpg' },
997
+ caption: 'Untuk kamu'
998
+ })
999
+ ```
1000
+
1001
+ > Untuk grup, otomatis pakai `groupStatusMentionMessage`.
1002
+
1003
+ ---
1004
+
1005
+ ## 🤖 Rich Message (AI)
1006
+
1007
+ > Rich message menggunakan format `AIRichResponseMessage` yang tampil seperti respons AI di WhatsApp. Semua tipe di bawah bisa dipakai secara flat (field langsung) atau dikombinasikan via `richResponse: [...]`.
1008
+
1009
+ ### ✍️ addText
1010
+
1011
+ Kirim teks markdown sebagai AI Rich Response. Mendukung hyperlink, citation, dan LaTeX inline.
1012
+
1013
+ ```js
1014
+ await sock.sendMessage(jid, {
1015
+ contentText: 'Ini teks dari AI dengan *markdown* dan **bold**.',
1016
+ headerText: 'Judul',
1017
+ footerText: 'Footer',
1018
+ disclaimerText: 'Generated by AI'
1019
+ })
1020
+ ```
1021
+
1022
+ ---
1023
+
1024
+ ### 💻 addCode
1025
+
1026
+ Kirim blok kode dengan syntax highlighting.
1027
+
1028
+ ```js
1029
+ await sock.sendMessage(jid, {
1030
+ code: 'console.log("Hello World!")',
1031
+ language: 'javascript', // default: 'javascript'
1032
+ headerText: 'Contoh kode:',
1033
+ footerText: 'Semoga membantu',
1034
+ disclaimerText: 'Generated by AI'
1035
+ })
1036
+ ```
1037
+
1038
+ **Bahasa yang didukung:**
1039
+
1040
+ | Bahasa | Key |
1041
+ |--------|-----|
1042
+ | JavaScript | `javascript`, `js` |
1043
+ | TypeScript | `typescript`, `ts` |
1044
+ | Python | `python`, `py` |
1045
+ | Go | `go`, `golang` |
1046
+ | C++ | `cpp`, `c++` |
1047
+ | Rust | `rust`, `rs` |
1048
+ | Java | `java` |
1049
+ | PHP | `php` |
1050
+ | Ruby | `ruby`, `rb` |
1051
+ | Kotlin | `kotlin`, `kt` |
1052
+ | Swift | `swift` |
1053
+ | C | `c` |
1054
+ | SQL/MySQL/PostgreSQL | `sql`, `mysql`, `postgresql`, `sqlite` |
1055
+ | Bash/Shell | `bash`, `sh`, `shell` |
1056
+ | HTML | `html` |
1057
+ | CSS | `css` |
1058
+ | JSON | `json` |
1059
+ | YAML | `yaml`, `yml` |
1060
+
1061
+ ---
1062
+
1063
+ ### 📊 addTable
1064
+
1065
+ Kirim tabel dari array 2D. Baris pertama otomatis menjadi header.
1066
+
1067
+ ```js
1068
+ await sock.sendMessage(jid, {
1069
+ table: [
1070
+ ['Nama', 'Usia', 'Kota'], // baris pertama = header
1071
+ ['Hana', '20', 'Jakarta'],
1072
+ ['Risa', '22', 'Bandung'],
1073
+ ['Yuki', '21', 'Surabaya']
1074
+ ],
1075
+ title: 'Data Anggota',
1076
+ headerText: 'Berikut datanya',
1077
+ footerText: 'Data per Juni 2025'
1078
+ })
1079
+
1080
+ // Tanpa baris header
1081
+ await sock.sendMessage(jid, {
1082
+ table: [
1083
+ ['Item A', 'Rp 10.000'],
1084
+ ['Item B', 'Rp 20.000']
1085
+ ],
1086
+ noHeading: true,
1087
+ title: 'Daftar Harga'
1088
+ })
1089
+ ```
1090
+
1091
+ ---
1092
+
1093
+ ### 🖼️ addImage
1094
+
1095
+ Kirim satu atau beberapa gambar sebagai grid image di AI Rich Response.
1096
+
1097
+ ```js
1098
+ // Satu gambar
1099
+ await sock.sendMessage(jid, {
1100
+ richImage: 'https://example.com/photo.jpg',
1101
+ headerText: 'Gambar untuk kamu'
1102
+ })
1103
+
1104
+ // Beberapa gambar (grid)
1105
+ await sock.sendMessage(jid, {
1106
+ richImage: [
1107
+ 'https://example.com/photo1.jpg',
1108
+ 'https://example.com/photo2.jpg',
1109
+ 'https://example.com/photo3.jpg'
1110
+ ],
1111
+ headerText: 'Koleksi gambar',
1112
+ footerText: 'Semoga suka'
1113
+ })
1114
+ ```
1115
+
1116
+ > `image` menerima string URL atau array string URL. Berbeda dengan `gridImage` (format verbose), `image` adalah shorthand yang lebih praktis.
1117
+
1118
+ ---
1119
+
1120
+ ### 🎬 addVideo
1121
+
1122
+ Kirim satu atau beberapa video di AI Rich Response.
1123
+
1124
+ ```js
1125
+ // Satu video
1126
+ await sock.sendMessage(jid, {
1127
+ richVideo: 'https://example.com/video.mp4',
1128
+ headerText: 'Video untuk kamu'
1129
+ })
1130
+
1131
+ // Dengan durasi (format: 'url|durasi_detik')
1132
+ await sock.sendMessage(jid, {
1133
+ richVideo: 'https://example.com/video.mp4|120',
1134
+ headerText: 'Video berdurasi 2 menit'
1135
+ })
1136
+
1137
+ // Beberapa video
1138
+ await sock.sendMessage(jid, {
1139
+ richVideo: [
1140
+ 'https://example.com/video1.mp4|60',
1141
+ 'https://example.com/video2.mp4|90'
1142
+ ],
1143
+ headerText: 'Playlist video'
1144
+ })
1145
+ ```
1146
+
1147
+ > Format URL video: `'url'` atau `'url|durasi_detik'`. Durasi dalam satuan detik, default 0.
1148
+
1149
+ ---
1150
+
1151
+ ### 🔗 addSource
1152
+
1153
+ Kirim daftar sumber referensi/link sebagai search result card.
1154
+
1155
+ ```js
1156
+ await sock.sendMessage(jid, {
1157
+ source: [
1158
+ {
1159
+ url: 'https://example.com/artikel',
1160
+ title: 'Judul Artikel',
1161
+ display_name: 'Example.com',
1162
+ subtitle: 'Sumber terpercaya',
1163
+ favicon: 'https://example.com/favicon.ico'
1164
+ },
1165
+ {
1166
+ url: 'https://docs.example.com/api',
1167
+ title: 'Dokumentasi API',
1168
+ display_name: 'Docs',
1169
+ subtitle: 'Referensi lengkap'
1170
+ }
1171
+ ],
1172
+ headerText: 'Sumber referensi'
1173
+ })
1174
+ ```
1175
+
1176
+ **Field tiap sumber:**
1177
+
1178
+ | Field | Tipe | Keterangan |
1179
+ |-------|------|------------|
1180
+ | `url` | string | URL tujuan (wajib) |
1181
+ | `title` | string | Judul sumber |
1182
+ | `display_name` | string | Nama tampilan |
1183
+ | `subtitle` | string | Subjudul/deskripsi singkat |
1184
+ | `favicon` | string | URL favicon (opsional) |
1185
+ | `source_type` | string | Default `'THIRD_PARTY'` |
1186
+
1187
+ ---
1188
+
1189
+ ### 🎥 addReels
1190
+
1191
+ Kirim daftar reel/video carousel (horizontal scroll) seperti hasil rekomendasi konten.
1192
+
1193
+ ```js
1194
+ await sock.sendMessage(jid, {
1195
+ reels: [
1196
+ {
1197
+ username: 'creator1',
1198
+ videoUrl: 'https://example.com/reel1.mp4',
1199
+ thumbnailUrl: 'https://example.com/thumb1.jpg',
1200
+ profileIconUrl: 'https://example.com/avatar1.jpg',
1201
+ reels_title: 'Judul Reel 1',
1202
+ likes_count: 1200,
1203
+ view_count: 50000,
1204
+ shares_count: 300,
1205
+ reel_source: 'IG',
1206
+ is_verified: true
1207
+ },
1208
+ {
1209
+ username: 'creator2',
1210
+ videoUrl: 'https://example.com/reel2.mp4',
1211
+ thumbnailUrl: 'https://example.com/thumb2.jpg',
1212
+ profileIconUrl: 'https://example.com/avatar2.jpg',
1213
+ reels_title: 'Judul Reel 2',
1214
+ likes_count: 800,
1215
+ view_count: 20000,
1216
+ reel_source: 'TT' // TikTok
1217
+ }
1218
+ ],
1219
+ headerText: 'Rekomendasi video'
1220
+ })
1221
+ ```
1222
+
1223
+ **Field tiap reel:**
1224
+
1225
+ | Field | Tipe | Keterangan |
1226
+ |-------|------|------------|
1227
+ | `username` / `title` | string | Nama kreator |
1228
+ | `videoUrl` / `url` | string | URL video |
1229
+ | `thumbnailUrl` / `thumbnail` | string | URL thumbnail |
1230
+ | `profileIconUrl` / `profile_url` | string | URL foto profil |
1231
+ | `reels_title` | string | Judul reel |
1232
+ | `likes_count` / `like` | number | Jumlah like |
1233
+ | `view_count` / `view` | number | Jumlah views |
1234
+ | `shares_count` / `share` | number | Jumlah share |
1235
+ | `reel_source` / `source` | string | `'IG'`, `'TT'`, dll |
1236
+ | `is_verified` / `verified` | boolean | Akun terverifikasi |
1237
+
1238
+ ---
1239
+
1240
+ ### 🛍️ addProduct
1241
+
1242
+ Kirim kartu produk (single atau horizontal scroll untuk banyak produk).
1243
+
1244
+ ```js
1245
+ // Satu produk (Single layout)
1246
+ await sock.sendMessage(jid, {
1247
+ richProduct: {
1248
+ title: 'Nama Produk',
1249
+ brand: 'Nama Brand',
1250
+ price: 'Rp 150.000',
1251
+ sale_price: 'Rp 120.000',
1252
+ product_url: 'https://toko.example.com/produk',
1253
+ image_url: 'https://example.com/produk.jpg',
1254
+ icon_url: 'https://example.com/icon.jpg'
1255
+ },
1256
+ headerText: 'Rekomendasi produk untukmu'
1257
+ })
1258
+
1259
+ // Beberapa produk (HScroll layout)
1260
+ await sock.sendMessage(jid, {
1261
+ richProduct: [
1262
+ {
1263
+ title: 'Produk A',
1264
+ brand: 'Brand X',
1265
+ price: 'Rp 50.000',
1266
+ product_url: 'https://toko.example.com/a',
1267
+ image_url: 'https://example.com/a.jpg'
1268
+ },
1269
+ {
1270
+ title: 'Produk B',
1271
+ brand: 'Brand Y',
1272
+ price: 'Rp 75.000',
1273
+ sale_price: 'Rp 60.000',
1274
+ product_url: 'https://toko.example.com/b',
1275
+ image_url: 'https://example.com/b.jpg'
1276
+ }
1277
+ ],
1278
+ headerText: 'Produk pilihan hari ini'
1279
+ })
1280
+ ```
1281
+
1282
+ **Field tiap produk:**
1283
+
1284
+ | Field | Tipe | Keterangan |
1285
+ |-------|------|------------|
1286
+ | `title` | string | Nama produk |
1287
+ | `brand` | string | Nama brand |
1288
+ | `price` | string | Harga normal (teks bebas, mis. `'Rp 50.000'`) |
1289
+ | `sale_price` / `salePrice` | string | Harga diskon |
1290
+ | `product_url` / `url` | string | Link produk |
1291
+ | `image_url` / `image` | string | URL gambar utama |
1292
+ | `icon_url` / `icon` | string | URL gambar tambahan |
1293
+
1294
+ > Kirim object tunggal → **Single layout**. Kirim array → **HScroll layout**.
1295
+
1296
+ ---
1297
+
1298
+ ### 📝 addPost
1299
+
1300
+ Kirim kartu post sosial media (Instagram, TikTok, dll) dalam horizontal scroll.
1301
+
1302
+ ```js
1303
+ // Satu post
1304
+ await sock.sendMessage(jid, {
1305
+ richPost: {
1306
+ title: 'Judul Post',
1307
+ subtitle: 'Subjudul',
1308
+ username: 'namauser',
1309
+ profile_picture_url: 'https://example.com/avatar.jpg',
1310
+ is_verified: true,
1311
+ thumbnail_url: 'https://example.com/thumb.jpg',
1312
+ post_caption: 'Caption post ini',
1313
+ likes_count: 5000,
1314
+ comments_count: 200,
1315
+ shares_count: 100,
1316
+ post_url: 'https://instagram.com/p/xxx',
1317
+ post_deeplink: 'instagram://post/xxx',
1318
+ source_app: 'INSTAGRAM',
1319
+ footer_label: 'Lihat di Instagram',
1320
+ orientation: 'LANDSCAPE', // 'LANDSCAPE' | 'PORTRAIT'
1321
+ post_type: 'VIDEO' // 'VIDEO' | 'IMAGE'
1322
+ },
1323
+ headerText: 'Post terpopuler'
1324
+ })
1325
+
1326
+ // Beberapa post (carousel horizontal)
1327
+ await sock.sendMessage(jid, {
1328
+ richPost: [
1329
+ {
1330
+ username: 'user1',
1331
+ thumbnail_url: 'https://example.com/thumb1.jpg',
1332
+ post_caption: 'Caption post pertama',
1333
+ likes_count: 3000,
1334
+ post_url: 'https://instagram.com/p/aaa',
1335
+ source_app: 'INSTAGRAM'
1336
+ },
1337
+ {
1338
+ username: 'user2',
1339
+ thumbnail_url: 'https://example.com/thumb2.jpg',
1340
+ post_caption: 'Caption post kedua',
1341
+ likes_count: 1500,
1342
+ post_url: 'https://tiktok.com/@user2/video/yyy',
1343
+ source_app: 'TIKTOK'
1344
+ }
1345
+ ],
1346
+ headerText: 'Post trending hari ini'
1347
+ })
1348
+ ```
1349
+
1350
+ **Field tiap post:**
1351
+
1352
+ | Field | Tipe | Keterangan |
1353
+ |-------|------|------------|
1354
+ | `title` | string | Judul post |
1355
+ | `subtitle` | string | Subjudul |
1356
+ | `username` | string | Nama pengguna |
1357
+ | `profile_picture_url` / `profile_url` | string | URL foto profil |
1358
+ | `is_verified` / `verified` | boolean | Akun terverifikasi |
1359
+ | `thumbnail_url` / `thumbnail` | string | URL thumbnail post |
1360
+ | `post_caption` / `caption` | string | Caption/teks post |
1361
+ | `likes_count` / `like` | number | Jumlah like |
1362
+ | `comments_count` / `comment` | number | Jumlah komentar |
1363
+ | `shares_count` / `share` | number | Jumlah share |
1364
+ | `post_url` / `url` | string | URL post |
1365
+ | `post_deeplink` / `deeplink` | string | Deeplink aplikasi |
1366
+ | `source_app` / `source` | string | `'INSTAGRAM'`, `'TIKTOK'`, dll |
1367
+ | `footer_label` / `footer` | string | Teks footer |
1368
+ | `footer_icon` / `icon` | string | URL ikon footer |
1369
+ | `orientation` | string | `'LANDSCAPE'` atau `'PORTRAIT'` |
1370
+ | `post_type` | string | `'VIDEO'` atau `'IMAGE'` |
1371
+
1372
+ ---
1373
+
1374
+ ### 💡 addTip
1375
+
1376
+ Kirim teks pendek sebagai metadata/tip (tampil lebih kecil dan subtle).
1377
+
1378
+ ```js
1379
+ await sock.sendMessage(jid, {
1380
+ tip: 'Informasi ini dibuat oleh AI berdasarkan data terbaru.',
1381
+ headerText: 'Ringkasan'
1382
+ })
1383
+
1384
+ // Dikombinasikan dengan tipe lain
1385
+ await sock.sendMessage(jid, {
1386
+ contentText: 'Berikut jawabannya...',
1387
+ tip: 'Jawaban mungkin tidak selalu akurat. Verifikasi mandiri disarankan.'
1388
+ })
1389
+ ```
1390
+
1391
+ ---
1392
+
1393
+ ### 🔮 addSuggest
1394
+
1395
+ Kirim saran prompt follow-up sebagai pill buttons yang bisa langsung diklik user.
1396
+
1397
+ ```js
1398
+ // Satu saran
1399
+ await sock.sendMessage(jid, {
1400
+ contentText: 'Begitulah penjelasannya.',
1401
+ suggest: 'Jelaskan lebih detail'
1402
+ })
1403
+
1404
+ // Beberapa saran
1405
+ await sock.sendMessage(jid, {
1406
+ contentText: 'Apakah ada yang ingin kamu tanyakan?',
1407
+ suggest: [
1408
+ 'Contoh kodenya?',
1409
+ 'Apa perbedaannya?',
1410
+ 'Kapan sebaiknya digunakan?',
1411
+ 'Ada alternatif lain?'
1412
+ ]
1413
+ })
1414
+ ```
1415
+
1416
+ > Saran tampil sebagai pill button di bawah pesan. Saat user mengetuk salah satu, teks saran tersebut akan terkirim sebagai pesan baru.
1417
+
1418
+ ---
1419
+
1420
+ ### 🖼️ Grid Image (Rich)
1421
+
1422
+ Kirim grid gambar dengan format verbose (object URL lengkap).
1423
+
1424
+ > Untuk pemakaian praktis, gunakan shorthand [`image`](#addimage).
1425
+
1426
+ ```js
1427
+ // Object URL lengkap (recommended untuk kontrol penuh)
1428
+ await sock.sendMessage(jid, {
1429
+ gridImage: {
1430
+ gridImageUrl: {
1431
+ imagePreviewUrl: 'https://picsum.photos/id/10/300/300',
1432
+ imageHighResUrl: 'https://picsum.photos/id/10/1200/1200',
1433
+ sourceUrl: 'https://picsum.photos'
1434
+ },
1435
+ imageUrls: [
1436
+ {
1437
+ imagePreviewUrl: 'https://picsum.photos/id/11/300/300',
1438
+ imageHighResUrl: 'https://picsum.photos/id/11/1200/1200',
1439
+ sourceUrl: 'https://picsum.photos'
1440
+ }
1441
+ ]
1442
+ },
1443
+ headerText: 'Hasil pencarian gambar'
1444
+ })
1445
+
1446
+ // String URL (shorthand)
1447
+ await sock.sendMessage(jid, {
1448
+ gridImage: {
1449
+ gridImageUrl: 'https://picsum.photos/id/10/300/300',
1450
+ imageUrls: ['https://picsum.photos/id/11/300/300']
1451
+ },
1452
+ headerText: 'Hasil pencarian gambar'
1453
+ })
1454
+ ```
1455
+
1456
+ ---
1457
+
1458
+ ### 📸 Inline Image (Rich)
1459
+
1460
+ Kirim gambar yang muncul inline di dalam teks.
1461
+
1462
+ ```js
1463
+ await sock.sendMessage(jid, {
1464
+ inlineImage: {
1465
+ imageUrl: 'https://picsum.photos/id/237/300/300',
1466
+ imageText: 'Ilustrasi gambar',
1467
+ alignment: 2, // 0 = leading, 1 = trailing, 2 = center
1468
+ tapLinkUrl: 'https://picsum.photos'
1469
+ },
1470
+ headerText: 'Berikut ilustrasinya',
1471
+ footerText: 'Tap gambar untuk detail'
1472
+ })
1473
+ ```
1474
+
1475
+ ---
1476
+
1477
+ ### 🎞️ Dynamic / GIF (Rich)
1478
+
1479
+ Kirim animasi atau GIF.
1480
+
1481
+ ```js
1482
+ await sock.sendMessage(jid, {
1483
+ dynamic: {
1484
+ url: 'https://example.com/animation.gif',
1485
+ type: 2, // 1 = IMAGE, 2 = GIF
1486
+ version: 1,
1487
+ loopCount: 0 // 0 = loop selamanya
1488
+ },
1489
+ headerText: 'Animasi untuk kamu'
1490
+ })
1491
+ ```
1492
+
1493
+ ---
1494
+
1495
+ ### 🗺️ Map (Rich)
1496
+
1497
+ Kirim peta interaktif dengan anotasi lokasi.
1498
+
1499
+ ```js
1500
+ // Satu lokasi
1501
+ await sock.sendMessage(jid, {
1502
+ map: {
1503
+ centerLatitude: -6.2088,
1504
+ centerLongitude: 106.8456,
1505
+ latitudeDelta: 0.05,
1506
+ longitudeDelta: 0.05,
1507
+ showInfoList: true,
1508
+ annotations: [
1509
+ {
1510
+ number: 1,
1511
+ latitude: -6.2088,
1512
+ longitude: 106.8456,
1513
+ title: 'Jakarta Pusat',
1514
+ body: 'Ibu kota Indonesia'
1515
+ }
1516
+ ]
1517
+ },
1518
+ headerText: 'Lokasi yang kamu cari'
1519
+ })
1520
+
1521
+ // Multi-lokasi
1522
+ await sock.sendMessage(jid, {
1523
+ map: {
1524
+ centerLatitude: -7.2575,
1525
+ centerLongitude: 112.7521,
1526
+ latitudeDelta: 0.1,
1527
+ longitudeDelta: 0.1,
1528
+ showInfoList: true,
1529
+ annotations: [
1530
+ { number: 1, latitude: -7.2575, longitude: 112.7521, title: 'Surabaya', body: 'Kota Pahlawan' },
1531
+ { number: 2, latitude: -7.9797, longitude: 112.6304, title: 'Malang', body: 'Kota Bunga' }
1532
+ ]
1533
+ },
1534
+ headerText: 'Kota-kota di Jawa Timur'
1535
+ })
1536
+ ```
1537
+
1538
+ ---
1539
+
1540
+ ### 🧮 LaTeX (Rich)
1541
+
1542
+ Kirim rumus matematika dalam format LaTeX.
1543
+
1544
+ > `url` di setiap expression akan **otomatis di-generate** dari [latex.codecogs.com](https://latex.codecogs.com) jika tidak diisi.
1545
+
1546
+ ```js
1547
+ // Satu rumus
1548
+ await sock.sendMessage(jid, {
1549
+ latex: {
1550
+ text: 'Berikut rumus yang kamu minta:',
1551
+ expressions: [
1552
+ { expression: 'E = mc^2', width: 120, height: 40 }
1553
+ ]
1554
+ },
1555
+ headerText: 'Rumus Einstein',
1556
+ footerText: 'E = energi, m = massa, c = kecepatan cahaya'
1557
+ })
1558
+
1559
+ // Beberapa rumus
1560
+ await sock.sendMessage(jid, {
1561
+ latex: {
1562
+ text: 'Rumus-rumus fisika dasar:',
1563
+ expressions: [
1564
+ { expression: 'F = ma', width: 80, height: 35 },
1565
+ { expression: 'v = u + at', width: 100, height: 35 },
1566
+ { expression: 's = ut + \\frac{1}{2}at^2', width: 160, height: 50 }
1567
+ ]
1568
+ },
1569
+ headerText: 'Hukum Newton',
1570
+ disclaimerText: 'Fisika dasar kelas 10'
1571
+ })
1572
+ ```
1573
+
1574
+
1575
+
1576
+ ---
1577
+
1578
+ ### 🧮 generateLatexContent / sendLatex (Standalone)
1579
+
1580
+ Fungsi standalone kompatibel dengan upstream baileys. Bisa dipanggil langsung dari socket:
1581
+
1582
+ ```js
1583
+ const { generateLatexContent, generateLatexImageContent, generateLatexInlineImageContent } = require('@nuiisweety/baileys')
1584
+
1585
+ // sendLatex — URL auto-generate via codecogs jika tidak diisi
1586
+ await sock.sendLatex(jid, m, {
1587
+ text: 'Rumus Pythagoras:',
1588
+ expressions: [
1589
+ { latexExpression: 'a^2 + b^2 = c^2', width: 150, height: 45 }
1590
+ ],
1591
+ headerText: 'Matematika',
1592
+ footer: 'Semoga paham!'
1593
+ })
1594
+
1595
+ // sendLatexImage — render ke PNG dulu, lalu upload
1596
+ await sock.sendLatexImage(jid, m, {
1597
+ expressions: [{ latexExpression: 'E = mc^2' }]
1598
+ }, renderLatexToPng, sock.waUploadToServer)
1599
+
1600
+ // sendLatexInlineImage — render ke PNG, kirim sebagai InlineImage per expression
1601
+ await sock.sendLatexInlineImage(jid, m, {
1602
+ expressions: [{ latexExpression: '\\int_0^\\infty e^{-x} dx = 1' }]
1603
+ }, renderLatexToPng, sock.waUploadToServer)
1604
+ ```
1605
+
1606
+ ### 📊 sendTable / sendTableV2 / sendList (Standalone)
1607
+
1608
+ ```js
1609
+ // sendTable — format V1
1610
+ await sock.sendTable(jid, 'Data Kota', ['Kota', 'Populasi'], [['Jakarta', '10jt'], ['Surabaya', '3jt']], m)
1611
+
1612
+ // sendList
1613
+ await sock.sendList(jid, 'Daftar Belanja', ['Apel', 'Jeruk', 'Mangga'], m)
1614
+ ```
1615
+
1616
+ ### 💻 sendCodeBlock / sendCodeBlockV2 (Standalone)
1617
+
1618
+ ```js
1619
+ await sock.sendCodeBlock(jid, 'console.log("Hello")', m, { language: 'javascript', title: 'Contoh JS' })
1620
+ ```
1621
+
1622
+ ### 🔗 sendLink / sendLinkV2 (Standalone)
1623
+
1624
+ ```js
1625
+ await sock.sendLink(jid, 'Kunjungi dokumentasi ini', [{ url: 'https://docs.example.com', displayName: 'Docs' }], m)
1626
+ ```
1627
+
1628
+ ### 🎁 sendRichMessage / sendUnifiedResponse / captureUnifiedResponse (Standalone)
1629
+
1630
+ ```js
1631
+ // Kirim array submessage mentah
1632
+ await sock.sendRichMessage(jid, [
1633
+ { messageType: 2, messageText: 'Teks pertama' },
1634
+ { messageType: 2, messageText: 'Teks kedua' }
1635
+ ], m)
1636
+
1637
+ // Capture dan forward unified response
1638
+ const captured = sock.captureUnifiedResponse(existingMsg.message)
1639
+ if (captured) await sock.sendUnifiedResponse(jid, m, captured)
1640
+ ```
1641
+ ---
1642
+
1643
+ ### 📦 Content Items (Rich)
1644
+
1645
+ Kirim carousel konten (reel/video) dengan format verbose.
1646
+
1647
+ > Untuk pemakaian praktis, gunakan shorthand [`reels`](#addreels).
1648
+
1649
+ ```js
1650
+ await sock.sendMessage(jid, {
1651
+ contentItems: {
1652
+ contentType: 1, // 0 = DEFAULT, 1 = CAROUSEL
1653
+ items: [
1654
+ {
1655
+ kind: 'reel',
1656
+ title: 'Tutorial Coding JavaScript',
1657
+ profileIconUrl: 'https://example.com/avatar1.jpg',
1658
+ thumbnailUrl: 'https://example.com/thumb1.jpg',
1659
+ videoUrl: 'https://example.com/video1.mp4'
1660
+ },
1661
+ {
1662
+ kind: 'reel',
1663
+ title: 'Belajar React Hooks',
1664
+ profileIconUrl: 'https://example.com/avatar2.jpg',
1665
+ thumbnailUrl: 'https://example.com/thumb2.jpg',
1666
+ videoUrl: 'https://example.com/video2.mp4'
1667
+ }
1668
+ ]
1669
+ },
1670
+ headerText: 'Rekomendasi video'
1671
+ })
1672
+ ```
1673
+
1674
+ ---
1675
+
1676
+ ### 🔗 Links (Rich)
1677
+
1678
+ Kirim teks dengan inline citation/reference link.
1679
+
1680
+ ```js
1681
+ await sock.sendMessage(jid, {
1682
+ links: [
1683
+ {
1684
+ text: 'Kunjungi dokumentasi',
1685
+ title: 'Docs',
1686
+ displayName: 'Baileys Docs',
1687
+ url: 'https://example.com/docs',
1688
+ sources: [
1689
+ {
1690
+ displayName: 'Source 1',
1691
+ subtitle: 'Sumber terpercaya',
1692
+ url: 'https://example.com/source'
1693
+ }
1694
+ ]
1695
+ }
1696
+ ],
1697
+ headerText: 'Referensi',
1698
+ footerText: 'Semoga berguna'
1699
+ })
1700
+ ```
1701
+
1702
+ ---
1703
+
1704
+ ### 🎁 Rich Response (Gabungan)
1705
+
1706
+ Kirim kombinasi berbagai tipe Rich Message dalam satu pesan menggunakan mode array.
1707
+
1708
+ ```js
1709
+ // Kombinasi teks + kode + tabel
1710
+ await sock.sendMessage(jid, {
1711
+ richResponse: [
1712
+ { text: 'Penjelasan singkat:' },
1713
+ { code: 'const x = 1 + 1', language: 'javascript' },
1714
+ {
1715
+ table: [['Kolom A', 'Kolom B'], ['Nilai 1', 'Nilai 2']],
1716
+ title: 'Hasil'
1717
+ },
1718
+ { text: 'Semoga membantu ya!' }
1719
+ ],
1720
+ disclaimerText: 'Generated by AI'
1721
+ })
1722
+
1723
+ // Kombinasi dengan semua tipe baru
1724
+ await sock.sendMessage(jid, {
1725
+ richResponse: [
1726
+ { text: 'Berikut hasilnya:' },
1727
+ { richImage: ['https://example.com/img1.jpg', 'https://example.com/img2.jpg'] },
1728
+ { source: [{ url: 'https://example.com', title: 'Sumber Data' }] },
1729
+ { code: 'print("Hello")', language: 'python' },
1730
+ {
1731
+ product: [
1732
+ { title: 'Produk A', price: 'Rp 50.000', image_url: 'https://example.com/a.jpg', product_url: 'https://example.com/a' },
1733
+ { title: 'Produk B', price: 'Rp 75.000', image_url: 'https://example.com/b.jpg', product_url: 'https://example.com/b' }
1734
+ ]
1735
+ },
1736
+ {
1737
+ post: [
1738
+ { username: 'user1', thumbnail_url: 'https://example.com/t1.jpg', post_url: 'https://ig.com/p/aaa', source_app: 'INSTAGRAM', likes_count: 1000 }
1739
+ ]
1740
+ },
1741
+ { tip: 'Informasi ini dihasilkan secara otomatis.' },
1742
+ { suggest: ['Tanya lebih lanjut', 'Lihat contoh lain', 'Mulai dari awal'] }
1743
+ ],
1744
+ disclaimerText: 'Powered by AI'
1745
+ })
1746
+ ```
1747
+
1748
+ ---
1749
+
1750
+ ## 📥 Terima & Decode Rich Message
1751
+
1752
+ ```js
1753
+ const { normalizeMessageContent, parseRichMessage } = require('@nuiisweety/baileys')
1754
+
1755
+ sock.ev.on('messages.upsert', async ({ messages }) => {
1756
+ for (const msg of messages) {
1757
+ const inner = normalizeMessageContent(msg.message)
1758
+ const parsed = parseRichMessage(inner?.richResponseMessage)
1759
+
1760
+ if (!parsed) continue
1761
+
1762
+ for (const sub of parsed.submessages) {
1763
+ switch (sub.type) {
1764
+ case 'text':
1765
+ console.log('Teks:', sub.text)
1766
+ break
1767
+ case 'code':
1768
+ console.log('Kode (' + sub.language + '):', sub.raw)
1769
+ break
1770
+ case 'table':
1771
+ console.log('Tabel:', sub.title, sub.rows)
1772
+ break
1773
+ case 'gridImage':
1774
+ console.log('Grid Image:', sub.gridImageUrl, sub.imageUrls)
1775
+ break
1776
+ case 'inlineImage':
1777
+ console.log('Inline Image:', sub.imageUrl, sub.imageText)
1778
+ break
1779
+ case 'dynamic':
1780
+ console.log('Dynamic:', sub.url, sub.dynamicType === 2 ? 'GIF' : 'Image')
1781
+ break
1782
+ case 'map':
1783
+ console.log('Map:', sub.centerLatitude, sub.centerLongitude)
1784
+ break
1785
+ case 'latex':
1786
+ console.log('LaTeX:', sub.text, sub.expressions)
1787
+ break
1788
+ case 'contentItems':
1789
+ console.log('Content Items:', sub.contentType, sub.items)
1790
+ break
1791
+ }
1792
+ }
1793
+ }
1794
+ })
1795
+ ```
1796
+
1797
+ > `parseRichMessage` menerima `null` atau `undefined` dengan aman — return `null` jika tidak ada rich message.
1798
+
1799
+ ---
1800
+
1801
+ ## 📃 List Reply
1802
+
1803
+ ```js
1804
+ await sock.sendMessage(jid, {
1805
+ listReply: {
1806
+ title: 'Pilihan Saya',
1807
+ description: 'Deskripsi pilihan',
1808
+ id: 'row1' // selectedRowId dari baris yang dipilih
1809
+ }
1810
+ })
1811
+ ```
1812
+
1813
+ ---
1814
+
1815
+ ## 🎴 Sticker Pack
1816
+
1817
+ ```js
1818
+ await sock.sendMessage(jid, {
1819
+ cover: fs.readFileSync('cover.webp'), // wajib
1820
+ name: 'Pack Manis',
1821
+ publisher: 'NuiiS4TORU',
1822
+ description: 'Sticker pack cantik',
1823
+ stickers: [
1824
+ {
1825
+ data: fs.readFileSync('sticker1.webp'),
1826
+ emojis: ['🌸', '💕'],
1827
+ accessibilityLabel: 'stiker manis'
1828
+ },
1829
+ {
1830
+ data: { url: 'https://example.com/sticker2.webp' },
1831
+ emojis: ['🌷']
1832
+ }
1833
+ // maksimal 60 sticker
1834
+ ]
1835
+ })
1836
+ ```
1837
+
1838
+ ---
1839
+
1840
+ ## 📢 External Ad Reply
1841
+
1842
+ ```js
1843
+ await sock.sendMessage(jid, {
1844
+ text: 'Cek produk ini',
1845
+ externalAdReply: {
1846
+ title: 'Judul Iklan',
1847
+ body: 'Deskripsi iklan',
1848
+ thumbnail: fs.readFileSync('thumbnail.jpg'), // harus Buffer
1849
+ url: 'https://example.com/produk',
1850
+ mediaType: 1, // 1 = image
1851
+ largeThumbnail: false
1852
+ }
1853
+ })
1854
+ ```
1855
+
1856
+ ---
1857
+
1858
+ ## 💳 Request Payment
1859
+
1860
+ ```js
1861
+ await sock.sendMessage(jid, {
1862
+ text: 'Tolong transfer ya',
1863
+ requestPaymentFrom: '628xxx@s.whatsapp.net',
1864
+ amount1000: 50000000, // Rp 50.000 (unit 1/1000)
1865
+ currencyCodeIso4217: 'IDR',
1866
+ expiryTimestamp: Date.now() + 86400000 // kadaluarsa 1 hari
1867
+ })
1868
+ ```
1869
+
1870
+ ---
1871
+
1872
+ ## 🧾 Invoice
1873
+
1874
+ ```js
1875
+ // Dengan gambar
1876
+ await sock.sendMessage(jid, {
1877
+ image: fs.readFileSync('invoice.jpg'),
1878
+ invoiceNote: 'Invoice pembelian\nTotal: Rp 150.000'
1879
+ })
1880
+
1881
+ // Dengan PDF
1882
+ await sock.sendMessage(jid, {
1883
+ document: fs.readFileSync('invoice.pdf'),
1884
+ mimetype: 'application/pdf',
1885
+ fileName: 'invoice.pdf',
1886
+ invoiceNote: 'Terima kasih atas pesananmu'
1887
+ })
1888
+ ```
1889
+
1890
+ ---
1891
+
1892
+ ## 📦 Order
1893
+
1894
+ ```js
1895
+ await sock.sendMessage(jid, {
1896
+ order: {
1897
+ orderId: 'order_001',
1898
+ thumbnail: fs.readFileSync('produk.jpg'), // wajib
1899
+ itemCount: 3,
1900
+ status: 'PAYMENT_PENDING',
1901
+ surface: 'CATALOG',
1902
+ message: 'Pesanan kamu sedang diproses',
1903
+ orderTitle: 'Pesanan #001',
1904
+ sellerJid: '628xxx@s.whatsapp.net',
1905
+ token: 'token_unik',
1906
+ totalAmount1000: 150000000, // Rp 150.000
1907
+ totalCurrencyCode: 'IDR'
1908
+ }
1909
+ })
1910
+ ```
1911
+
1912
+ ---
1913
+
1914
+ ## 💨 Disappearing Messages
1915
+
1916
+ ```js
1917
+ // Aktifkan (86400 detik = 24 jam default)
1918
+ await sock.sendMessage(groupJid, { disappearingMessagesInChat: true })
1919
+
1920
+ // Nonaktifkan
1921
+ await sock.sendMessage(groupJid, { disappearingMessagesInChat: false })
1922
+
1923
+ // Durasi kustom (detik)
1924
+ await sock.sendMessage(groupJid, { disappearingMessagesInChat: 604800 }) // 7 hari
1925
+ ```
1926
+
1927
+ > Hanya berfungsi di grup (`@g.us`).
1928
+
1929
+ ---
1930
+
1931
+ ## ⚡ Raw Message
1932
+
1933
+ ```js
1934
+ await sock.sendMessage(jid, {
1935
+ raw: true,
1936
+ extendedTextMessage: {
1937
+ text: 'Pesan raw langsung ke proto'
1938
+ }
1939
+ })
1940
+ ```
1941
+
1942
+ > Ketika `raw: true` ada, semua properti lain diteruskan langsung sebagai WAProto message tanpa pemrosesan tambahan.
1943
+
1944
+ ---
1945
+
1946
+ <div align="center">
1947
+
1948
+ *Dibuat dengan dedikasi oleh **NuiiS4TORU***
1949
+
1950
+ </div>