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