rixleys 1.0.0

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.
Files changed (128) hide show
  1. package/LICENSE +21 -0
  2. package/README.MD +2969 -0
  3. package/WAProto/GenerateStatics.sh +4 -0
  4. package/WAProto/WAProto.proto +5479 -0
  5. package/WAProto/index.js +97692 -0
  6. package/WAProto/p.html +1 -0
  7. package/engine-requirements.js +10 -0
  8. package/lib/Defaults/index.js +120 -0
  9. package/lib/Defaults/rixleys-version.json +3 -0
  10. package/lib/Signal/Group/ciphertext-message.js +15 -0
  11. package/lib/Signal/Group/group-session-builder.js +64 -0
  12. package/lib/Signal/Group/group_cipher.js +96 -0
  13. package/lib/Signal/Group/index.js +57 -0
  14. package/lib/Signal/Group/keyhelper.js +55 -0
  15. package/lib/Signal/Group/queue-job.js +57 -0
  16. package/lib/Signal/Group/sender-chain-key.js +34 -0
  17. package/lib/Signal/Group/sender-key-distribution-message.js +66 -0
  18. package/lib/Signal/Group/sender-key-message.js +69 -0
  19. package/lib/Signal/Group/sender-key-name.js +51 -0
  20. package/lib/Signal/Group/sender-key-record.js +53 -0
  21. package/lib/Signal/Group/sender-key-state.js +99 -0
  22. package/lib/Signal/Group/sender-message-key.js +29 -0
  23. package/lib/Signal/core/.eslintrc.json +31 -0
  24. package/lib/Signal/core/CODE_OF_CONDUCT.md +102 -0
  25. package/lib/Signal/core/LICENSE +621 -0
  26. package/lib/Signal/core/README.md +64 -0
  27. package/lib/Signal/core/SECURITY.md +78 -0
  28. package/lib/Signal/core/generate-proto.sh +1 -0
  29. package/lib/Signal/core/index.d.ts +55 -0
  30. package/lib/Signal/core/index.js +10 -0
  31. package/lib/Signal/core/protos/WhisperTextProtocol.proto +28 -0
  32. package/lib/Signal/core/src/.eslintrc.json +31 -0
  33. package/lib/Signal/core/src/WhisperTextProtocol.js +933 -0
  34. package/lib/Signal/core/src/base_key_type.js +7 -0
  35. package/lib/Signal/core/src/chain_type.js +6 -0
  36. package/lib/Signal/core/src/crypto.d.ts +19 -0
  37. package/lib/Signal/core/src/crypto.js +98 -0
  38. package/lib/Signal/core/src/curve.d.ts +22 -0
  39. package/lib/Signal/core/src/curve.js +142 -0
  40. package/lib/Signal/core/src/errors.js +33 -0
  41. package/lib/Signal/core/src/keyhelper.js +45 -0
  42. package/lib/Signal/core/src/numeric_fingerprint.js +72 -0
  43. package/lib/Signal/core/src/protobufs.js +10 -0
  44. package/lib/Signal/core/src/protocol_address.js +40 -0
  45. package/lib/Signal/core/src/queue_job.js +69 -0
  46. package/lib/Signal/core/src/session_builder.js +164 -0
  47. package/lib/Signal/core/src/session_cipher.js +336 -0
  48. package/lib/Signal/core/src/session_record.js +316 -0
  49. package/lib/Signal/libsignal.js +184 -0
  50. package/lib/Socket/Client/index.js +18 -0
  51. package/lib/Socket/Client/types.js +13 -0
  52. package/lib/Socket/Client/websocket.js +72 -0
  53. package/lib/Socket/business.js +260 -0
  54. package/lib/Socket/chats.js +997 -0
  55. package/lib/Socket/groups.js +418 -0
  56. package/lib/Socket/index.js +238 -0
  57. package/lib/Socket/messages-recv.js +1106 -0
  58. package/lib/Socket/messages-send.js +882 -0
  59. package/lib/Socket/newsletter.js +250 -0
  60. package/lib/Socket/socket.js +646 -0
  61. package/lib/Socket/usync.js +70 -0
  62. package/lib/Store/index.js +8 -0
  63. package/lib/Store/make-in-memory-store.js +439 -0
  64. package/lib/Store/make-ordered-dictionary.js +81 -0
  65. package/lib/Store/object-repository.js +27 -0
  66. package/lib/Types/Auth.js +2 -0
  67. package/lib/Types/Call.js +2 -0
  68. package/lib/Types/Chat.js +4 -0
  69. package/lib/Types/Contact.js +2 -0
  70. package/lib/Types/Events.js +2 -0
  71. package/lib/Types/GroupMetadata.js +2 -0
  72. package/lib/Types/Label.js +27 -0
  73. package/lib/Types/LabelAssociation.js +9 -0
  74. package/lib/Types/Message.js +7 -0
  75. package/lib/Types/Newsletter.js +18 -0
  76. package/lib/Types/Product.js +2 -0
  77. package/lib/Types/Signal.js +2 -0
  78. package/lib/Types/Socket.js +2 -0
  79. package/lib/Types/State.js +2 -0
  80. package/lib/Types/USync.js +2 -0
  81. package/lib/Types/index.js +42 -0
  82. package/lib/Utils/auth-utils.js +199 -0
  83. package/lib/Utils/browser-utils.js +35 -0
  84. package/lib/Utils/business.js +234 -0
  85. package/lib/Utils/chat-utils.js +730 -0
  86. package/lib/Utils/crypto.js +193 -0
  87. package/lib/Utils/decode-wa-message.js +217 -0
  88. package/lib/Utils/event-buffer.js +518 -0
  89. package/lib/Utils/generics.js +467 -0
  90. package/lib/Utils/history.js +94 -0
  91. package/lib/Utils/index.js +36 -0
  92. package/lib/Utils/link-preview.js +151 -0
  93. package/lib/Utils/logger.js +7 -0
  94. package/lib/Utils/lt-hash.js +51 -0
  95. package/lib/Utils/make-mutex.js +43 -0
  96. package/lib/Utils/message-retry-manager.js +185 -0
  97. package/lib/Utils/messages-media.js +879 -0
  98. package/lib/Utils/messages.js +1049 -0
  99. package/lib/Utils/noise-handler.js +150 -0
  100. package/lib/Utils/process-message.js +404 -0
  101. package/lib/Utils/rixleys-event-stream.js +63 -0
  102. package/lib/Utils/serializer.js +238 -0
  103. package/lib/Utils/signal.js +153 -0
  104. package/lib/Utils/use-multi-file-auth-state.js +124 -0
  105. package/lib/Utils/validate-connection.js +229 -0
  106. package/lib/WABinary/constants.js +1303 -0
  107. package/lib/WABinary/decode.js +265 -0
  108. package/lib/WABinary/encode.js +250 -0
  109. package/lib/WABinary/generic-utils.js +110 -0
  110. package/lib/WABinary/index.js +21 -0
  111. package/lib/WABinary/jid-utils.js +85 -0
  112. package/lib/WABinary/types.js +2 -0
  113. package/lib/WAM/BinaryInfo.js +13 -0
  114. package/lib/WAM/constants.js +15350 -0
  115. package/lib/WAM/encode.js +155 -0
  116. package/lib/WAM/index.js +19 -0
  117. package/lib/WAUSync/Protocols/USyncContactProtocol.js +32 -0
  118. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +57 -0
  119. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +30 -0
  120. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +42 -0
  121. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +53 -0
  122. package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +24 -0
  123. package/lib/WAUSync/Protocols/index.js +20 -0
  124. package/lib/WAUSync/USyncQuery.js +89 -0
  125. package/lib/WAUSync/USyncUser.js +26 -0
  126. package/lib/WAUSync/index.js +19 -0
  127. package/lib/index.js +54 -0
  128. package/package.json +113 -0
package/README.MD ADDED
@@ -0,0 +1,2969 @@
1
+ # <div align="center">Rixleys</div>
2
+
3
+ <div align="center">
4
+
5
+ [![npm version](https://img.shields.io/npm/v/rixleys.svg)](https://www.npmjs.com/package/rixleys)
6
+ [![License](https://img.shields.io/badge/license-GPL%203-blue.svg)](LICENSE)
7
+ [![Downloads](https://img.shields.io/npm/dm/rixleys.svg)](https://www.npmjs.com/package/rixleys)
8
+
9
+ <br/>
10
+
11
+ > **⚡ Rixleys WhatsApp Library**
12
+ > *Modifikasi dari Wileys (NaufalYupra) • Dimodifikasi oleh **RizkyFx** ✨*
13
+
14
+ </div>
15
+
16
+ ## ✨ Fitur Utama
17
+
18
+ - 🚀 **Modern & Cepat** - Dibangun dengan TypeScript dan arsitektur terbaru
19
+ - 🔧 **Perbaikan @lid & @jid** - Mengatasi masalah @lid ke @pn di grup WhatsApp secara otomatis
20
+ - 🤖 **Built-in Client Wrapper** - Inisialisasi instan dengan auto reconnect, auto pairing code, dan auto clean session
21
+ - 📬 **Built-in Message Serializer** - Ekstraksi properti `m.senderJid`, `m.senderLid`, `m.isGroup`, `m.quoted`, `m.reply()`, dan download media
22
+ - 🛠️ **Group & Chat Shortcuts** - Helper method praktis `sock.kickMember`, `sock.openGroup`, `sock.deleteMessage`, dll.
23
+ - 📱 **Dukungan Multi-Device** - Mendukung koneksi multi-device WhatsApp
24
+ - 🔐 **Enkripsi End-to-End** - Komunikasi terenkripsi penuh
25
+ - 📨 **Semua Jenis Pesan** - Teks, media, buttons, interactive flow, polling, newsletter, event, order, katalog, dll.
26
+
27
+ ## ⚠️ Peringatan
28
+
29
+ Proyek ini tidak berafiliasi, terkait, diotorisasi, didukung, atau terhubung secara resmi dengan WhatsApp atau anak perusahaannya. Gunakan dengan bijak dan hindari spam.
30
+
31
+ ## 📦 Instalasi
32
+
33
+ ```bash
34
+ npm i rixleys
35
+ # atau versi terbaru:
36
+ npm i rixleys@latest
37
+ ```
38
+
39
+ ---
40
+
41
+ ## 🚀 Mulai Cepat
42
+
43
+ ### 1. Inisialisasi Socket (High-Level Wrapper)
44
+
45
+ ```javascript
46
+ import { makeWASocket } from "rixleys"
47
+ // atau CommonJS: const { makeWASocket } = require("rixleys")
48
+
49
+ const bot = new makeWASocket({
50
+ sessionName: "session-folder", // Folder sesi (default: "auth-session")
51
+ usePairingCode: true, // true = pairing code, false = QR code terminal
52
+ phoneNumber: "6281234567890", // Nomor WhatsApp (wajib jika usePairingCode = true)
53
+ autoReconnect: true, // Auto-reconnect cerdas jika koneksi terputus
54
+ maxReconnectAttempts: 10, // Batas maksimal percobaan reconnect
55
+ autoCleanSessionOnLogout: true // Otomatis hapus folder sesi jika logout/banned
56
+ })
57
+
58
+ // Event messages.upsert sudah otomatis ter-serialize
59
+ bot.ev.on("messages.upsert", async ({ messages }) => {
60
+ const m = messages[0]
61
+ if (!m || !m.message) return
62
+
63
+ console.log(`📩 Pesan dari @${m.Pn} di ${m.isGroup ? "Grup" : "Privat"}: ${m.text}`)
64
+
65
+ if (m.text === "ping") {
66
+ await m.reply("pong! 🏓")
67
+ }
68
+ })
69
+ ```
70
+
71
+ ---
72
+
73
+ ## 📬 Serializer & Message Wrapper (`serialize` / `smsg`)
74
+
75
+ Rixleys menyediakan serializer pesan bawaan untuk mempermudah akses properti dan aksi pesan.
76
+
77
+ ### Properti & Method:
78
+
79
+ | Properti / Method | Tipe | Penjelasan |
80
+ |---|---|---|
81
+ | `m.senderJid` | `string` | JID nomor WhatsApp pengirim (`628xxx@s.whatsapp.net`). Otomatis di-resolve dari nomor asli jika format pesan berupa LID. |
82
+ | `m.senderLid` | `string \| null` | ID LID pengirim (`xxx@lid`) jika tersedia. |
83
+ | `m.isGroup` | `boolean` | `true` jika pesan berasal dari grup (`@g.us`), `false` jika pesan privat. |
84
+ | `m.sender` | `string` | Alias untuk `m.senderJid`. |
85
+ | `m.Pn` | `string` | Nomor telepon murni pengirim (contoh: `6281234567890`). |
86
+ | `m.chat` | `string` | ID target chat / grup (`remoteJid`). |
87
+ | `m.mtype` | `string` | Tipe konten pesan (contoh: `conversation`, `extendedTextMessage`, `imageMessage`, dll). |
88
+ | `m.text` / `m.body` | `string` | Isi teks pesan atau caption media. |
89
+ | `m.reply(text, options)` | `Function` | Membalas pesan saat ini secara instan dengan otomatis mention sender. |
90
+ | `m.react(emoji)` | `Function` | Mengirim reaksi emoji ke pesan saat ini. |
91
+ | `m.quoted` | `object \| null` | Objek pesan yang di-quote/reply (jika ada). |
92
+ | `m.quoted.senderJid` | `string` | JID WhatsApp dari pengirim pesan yang di-quote. |
93
+ | `m.quoted.senderLid` | `string \| null` | LID dari pengirim pesan yang di-quote. |
94
+ | `m.quoted.text` | `string` | Teks dari pesan yang di-quote. |
95
+ | `await m.quoted.download()` | `AsyncFunction` | Mengunduh media dari quoted message dan mengembalikan `Buffer`. |
96
+ | `await m.quoted.delete()` | `AsyncFunction` | Menghapus pesan yang di-quote. |
97
+
98
+ ---
99
+
100
+ ## 🛠️ Method & Helper Praktis Socket
101
+
102
+ ### 1. Pesan
103
+ ```javascript
104
+ // Kirim Pesan
105
+ await sock.sendMessage(jid, content, options);
106
+
107
+ // Hapus Pesan
108
+ await sock.deleteMessage(jid, msg.key);
109
+ ```
110
+
111
+ ### 2. Manajemen Anggota Grup
112
+ ```javascript
113
+ // Kick / Keluarkan Anggota
114
+ await sock.kickMember(chatId, targetJid);
115
+
116
+ // Tambah Anggota
117
+ await sock.addMember(chatId, targetJid);
118
+
119
+ // Jadikan Admin (Promote)
120
+ await sock.promoteMember(chatId, targetJid);
121
+
122
+ // Turunkan Dari Admin (Demote)
123
+ await sock.demoteMember(chatId, targetJid);
124
+ ```
125
+
126
+ ### 3. Pengaturan Grup
127
+ ```javascript
128
+ // Buka & Tutup Grup (Announcement)
129
+ await sock.openGroup(chatId); // Semua anggota bisa chat
130
+ await sock.closeGroup(chatId); // Hanya admin yang bisa chat
131
+
132
+ // Kunci & Buka Kunci Edit Info Grup (Locked)
133
+ await sock.lockGroup(chatId); // Hanya admin yang bisa edit info grup
134
+ await sock.unlockGroup(chatId); // Semua anggota bisa edit info grup
135
+
136
+ // Update Nama & Deskripsi Grup
137
+ await sock.updateGroupSubject(chatId, "Nama Baru");
138
+ await sock.updateGroupDescription(chatId, "Deskripsi Baru");
139
+
140
+ // Kirim Status / Cerita Grup (SWGC - Group Status V2)
141
+ await sock.sendStatusGc(chatId, { text: "Pengumuman di Status Grup!" });
142
+ await sock.sendStatusGc(chatId, { image: imageBuffer, caption: "Foto status grup" });
143
+ await sock.sendStatusGc(chatId, { video: videoBuffer, caption: "Video status grup" });
144
+ await sock.sendStatusGc(chatId, { audio: audioBuffer, ptt: true });
145
+ ```
146
+
147
+ ---
148
+
149
+ ## 📨 Format & Jenis Pengiriman Pesan (Payloads)
150
+
151
+ Berikut referensi lengkap payload pesan yang didukung melalui `sock.sendMessage(jid, content, options)`:
152
+
153
+ ```ts
154
+ const jid: string
155
+ const content: AnyMessageContent
156
+ const options: MiscMessageGenerationOptions
157
+
158
+ sock.sendMessage(jid, content, options)
159
+ ```
160
+
161
+ ### Non-Media Messages
162
+
163
+ #### Text Message
164
+ ```ts
165
+ await sock.sendMessage(jid, { text: 'hello word' })
166
+ ```
167
+
168
+ #### Quote Message (works with all types)
169
+ ```ts
170
+ await sock.sendMessage(jid, { text: 'hello word' }, { quoted: message })
171
+ ```
172
+
173
+ #### Mention User (works with most types)
174
+ - @number is to mention in text, it's optional
175
+ ```ts
176
+ await sock.sendMessage(
177
+ jid,
178
+ {
179
+ text: '@12345678901',
180
+ mentions: ['12345678901@s.whatsapp.net']
181
+ }
182
+ )
183
+ ```
184
+
185
+ #### Forward Messages
186
+ - You need to have message object, can be retrieved from [store](#implementing-a-data-store) or use a [message](https://baileys.whiskeysockets.io/types/WAMessage.html) object
187
+ ```ts
188
+ const msg = getMessageFromStore() // implement this on your end
189
+ await sock.sendMessage(jid, { forward: msg, force: true or number }) // WA forward the message!
190
+ ```
191
+
192
+ #### Location Message
193
+ ```ts
194
+ await sock.sendMessage(
195
+ jid,
196
+ {
197
+ location: {
198
+ degreesLatitude: 24.121231,
199
+ degreesLongitude: 55.1121221
200
+ }
201
+ }
202
+ )
203
+ ```
204
+
205
+ #### Live Location Message
206
+ ```ts
207
+ await sock.sendMessage(
208
+ jid,
209
+ {
210
+ location: {
211
+ degreesLatitude: 24.121231,
212
+ degreesLongitude: 55.1121221
213
+ },
214
+ live: true
215
+ }
216
+ )
217
+ ```
218
+ #### Contact Message
219
+ ```ts
220
+ const vcard = 'BEGIN:VCARD\n' // metadata of the contact card
221
+ + 'VERSION:3.0\n'
222
+ + 'FN:Jeff Singh\n' // full name
223
+ + 'ORG:Ashoka Uni\n' // the organization of the contact
224
+ + 'TELtype=CELLtype=VOICEwaid=911234567890:+91 12345 67890\n' // WhatsApp ID + phone number
225
+ + 'END:VCARD'
226
+
227
+ await sock.sendMessage(
228
+ id,
229
+ {
230
+ contacts: {
231
+ displayName: 'Itsukichann',
232
+ contacts: [{ vcard }]
233
+ }
234
+ }
235
+ )
236
+ ```
237
+
238
+ #### Reaction Message
239
+ - You need to pass the key of message, you can retrieve from [store](#implementing-a-data-store) or use a [key](https://baileys.whiskeysockets.io/types/WAMessageKey.html) object
240
+ ```ts
241
+ await sock.sendMessage(
242
+ jid,
243
+ {
244
+ react: {
245
+ text: '💖', // use an empty string to remove the reaction
246
+ key: message.key
247
+ }
248
+ }
249
+ )
250
+ ```
251
+
252
+ #### Pin Message
253
+ - You need to pass the key of message, you can retrieve from [store](#implementing-a-data-store) or use a [key](https://baileys.whiskeysockets.io/types/WAMessageKey.html) object
254
+
255
+ - Time can be:
256
+
257
+ | Time | Seconds |
258
+ |-------|----------------|
259
+ | 24h | 86.400 |
260
+ | 7d | 604.800 |
261
+ | 30d | 2.592.000 |
262
+
263
+ ```ts
264
+ await sock.sendMessage(
265
+ jid,
266
+ {
267
+ pin: {
268
+ type: 1, // 2 to remove
269
+ time: 86400,
270
+ key: Key
271
+ }
272
+ }
273
+ )
274
+ ```
275
+
276
+ ### Keep Message
277
+ ```ts
278
+ await sock.sendMessage(
279
+ jid,
280
+ {
281
+ keep: {
282
+ key: Key,
283
+ type: 1 // or 2
284
+ }
285
+ }
286
+ )
287
+ ```
288
+
289
+ #### Poll Message
290
+ ```ts
291
+ await sock.sendMessage(
292
+ jid,
293
+ {
294
+ poll: {
295
+ name: 'My Poll',
296
+ values: ['Option 1', 'Option 2', ...],
297
+ selectableCount: 1,
298
+ toAnnouncementGroup: false // or true
299
+ }
300
+ }
301
+ )
302
+ ```
303
+
304
+ #### Poll Result Message
305
+ ```ts
306
+ await sock.sendMessage(
307
+ jid,
308
+ {
309
+ pollResult: {
310
+ name: 'Hi',
311
+ values: [
312
+ [
313
+ 'Option 1',
314
+ 1000
315
+ ],
316
+ [
317
+ 'Option 2',
318
+ 2000
319
+ ]
320
+ ]
321
+ }
322
+ }
323
+ )
324
+ ```
325
+
326
+ ### Call Message
327
+ ```ts
328
+ await sock.sendMessage(
329
+ jid,
330
+ {
331
+ call: {
332
+ name: 'Hay',
333
+ type: 1 // 2 for video
334
+ }
335
+ }
336
+ )
337
+ ```
338
+
339
+ ### Event Message
340
+ ```ts
341
+ await sock.sendMessage(
342
+ jid,
343
+ {
344
+ event: {
345
+ isCanceled: false, // or true
346
+ name: 'holiday together!',
347
+ description: 'who wants to come along?',
348
+ location: {
349
+ degreesLatitude: 24.121231,
350
+ degreesLongitude: 55.1121221,
351
+ name: 'name'
352
+ },
353
+ call: 'audio', // or 'video'
354
+ startTime: number,
355
+ endTime: number,
356
+ extraGuestsAllowed: true // or false
357
+ }
358
+ }
359
+ )
360
+ ```
361
+
362
+ ### Order Message
363
+ ```ts
364
+ await sock.sendMessage(
365
+ jid,
366
+ {
367
+ order: {
368
+ orderId: '574xxx',
369
+ thumbnail: 'your_thumbnail',
370
+ itemCount: 'your_count',
371
+ status: 'your_status', // INQUIRY || ACCEPTED || DECLINED
372
+ surface: 'CATALOG',
373
+ message: 'your_caption',
374
+ orderTitle: "your_title",
375
+ sellerJid: 'your_jid'',
376
+ token: 'your_token',
377
+ totalAmount1000: 'your_amount',
378
+ totalCurrencyCode: 'IDR'
379
+ }
380
+ }
381
+ )
382
+ ```
383
+
384
+ ### Product Message
385
+ ```ts
386
+ await sock.sendMessage(
387
+ jid,
388
+ {
389
+ product: {
390
+ productImage: { // for using buffer >> productImage: your_buffer
391
+ url: your_url
392
+ },
393
+ productId: 'your_id',
394
+ title: 'your_title',
395
+ description: 'your_description',
396
+ currencyCode: 'IDR',
397
+ priceAmount1000: 'your_amount',
398
+ retailerId: 'your_reid', // optional use if needed
399
+ url: 'your_url', // optional use if needed
400
+ productImageCount: 'your_imageCount',
401
+ firstImageId: 'your_image', // optional use if needed
402
+ salePriceAmount1000: 'your_priceSale',
403
+ signedUrl: 'your_url' // optional use if needed
404
+ },
405
+ businessOwnerJid: 'your_jid'
406
+ }
407
+ )
408
+ ```
409
+
410
+ ### Payment Message
411
+ ```ts
412
+ await sock.sendMessage(
413
+ jid,
414
+ {
415
+ payment: {
416
+ note: 'Hi!',
417
+ currency: 'IDR', // optional
418
+ offset: 0, // optional
419
+ amount: '10000', // optional
420
+ expiry: 0, // optional
421
+ from: '628xxxx@s.whatsapp.net', // optional
422
+ image: { // optional
423
+ placeholderArgb: "your_background", // optional
424
+ textArgb: "your_text", // optional
425
+ subtextArgb: "your_subtext" // optional
426
+ }
427
+ }
428
+ }
429
+ )
430
+ ```
431
+
432
+ #### Payment Invite Message
433
+ ```ts
434
+ await sock.sendMessage(
435
+ id,
436
+ {
437
+ paymentInvite: {
438
+ type: number, // 1 || 2 || 3
439
+ expiry: 0
440
+ }
441
+ }
442
+ )
443
+ ```
444
+
445
+ ### Admin Invite Message
446
+ ```ts
447
+ await sock.sendMessage(
448
+ jid,
449
+ {
450
+ adminInvite: {
451
+ jid: '123xxx@newsletter',
452
+ name: 'newsletter_name',
453
+ caption: 'Please be my channel admin',
454
+ expiration: 86400,
455
+ jpegThumbnail: Buffer // optional
456
+ }
457
+ }
458
+ )
459
+ ```
460
+
461
+ ### Group Invite Message
462
+ ```ts
463
+ await sock.sendMessage(
464
+ jid,
465
+ {
466
+ groupInvite: {
467
+ jid: '123xxx@g.us',
468
+ name: 'group_name',
469
+ caption: 'Please Join My Whatsapp Group',
470
+ code: 'code_invite',
471
+ expiration: 86400,
472
+ jpegThumbnail: Buffer, // optional
473
+ }
474
+ }
475
+ )
476
+ ```
477
+
478
+ ### Sticker Pack Message
479
+ ```ts
480
+ // I don't know why the sticker doesn't appear
481
+ await sock.sendMessage(
482
+ jid,
483
+ {
484
+ stickerPack: {
485
+ name: 'Hiii',
486
+ publisher: 'By Itsukichann',
487
+ description: 'Hello',
488
+ cover: Buffer, // Image buffer
489
+ stickers: [{
490
+ sticker: { url: 'https://example.com/1234kjd.webp' },
491
+ emojis: ['❤'], // optional
492
+ accessibilityLabel: '', // optional
493
+ isLottie: Boolean, // optional
494
+ isAnimated: Boolean // optional
495
+ },
496
+ {
497
+ sticker: Buffer,
498
+ emojis: ['❤'], // optional
499
+ accessibilityLabel: '', // optional
500
+ isLottie: Boolean, // optional
501
+ isAnimated: Boolean // optional
502
+ }]
503
+ }
504
+ }
505
+ )
506
+ ```
507
+
508
+ ### Share Phone Number Message
509
+ ```ts
510
+ await sock.sendMessage(
511
+ jid,
512
+ {
513
+ sharePhoneNumber: {
514
+ }
515
+ }
516
+ )
517
+ ```
518
+
519
+ ### Request Phone Number Message
520
+ ```ts
521
+ await sock.sendMessage(
522
+ jid,
523
+ {
524
+ requestPhoneNumber: {
525
+ }
526
+ }
527
+ )
528
+ ```
529
+
530
+ ### Buttons Reply Message
531
+ ```ts
532
+ // List
533
+ await sock.sendMessage(
534
+ jid,
535
+ {
536
+ buttonReply: {
537
+ name: 'Hii',
538
+ description: 'description',
539
+ rowId: 'ID'
540
+ },
541
+ type: 'list'
542
+ }
543
+ )
544
+ // Plain
545
+ await sock.sendMessage(
546
+ jid,
547
+ {
548
+ buttonReply: {
549
+ displayText: 'Hii',
550
+ id: 'ID'
551
+ },
552
+ type: 'plain'
553
+ }
554
+ )
555
+
556
+ // Template
557
+ await sock.sendMessage(
558
+ jid,
559
+ {
560
+ buttonReply: {
561
+ displayText: 'Hii',
562
+ id: 'ID',
563
+ index: 'number'
564
+ },
565
+ type: 'template'
566
+ }
567
+ )
568
+
569
+ // Interactive
570
+ await sock.sendMessage(
571
+ jid,
572
+ {
573
+ buttonReply: {
574
+ body: 'Hii',
575
+ nativeFlows: {
576
+ name: 'menu_options',
577
+ paramsJson: JSON.stringify({ id: 'ID', description: 'description' })
578
+ version: 1 // 2 | 3
579
+ }
580
+ },
581
+ type: 'interactive'
582
+ }
583
+ )
584
+ ```
585
+
586
+ ### Buttons Message
587
+ ```ts
588
+ await sock.sendMessage(
589
+ jid,
590
+ {
591
+ text: 'This is a button message!', // image: buffer or // image: { url: url } If you want to use images
592
+ caption: 'caption', // Use this if you are using an image or video
593
+ footer: 'Hello World!',
594
+ buttons: [{
595
+ buttonId: 'Id1',
596
+ buttonText: {
597
+ displayText: 'Button 1'
598
+ }
599
+ },
600
+ {
601
+ buttonId: 'Id2',
602
+ buttonText: {
603
+ displayText: 'Button 2'
604
+ }
605
+ },
606
+ {
607
+ buttonId: 'Id3',
608
+ buttonText: {
609
+ displayText: 'Button 3'
610
+ }
611
+ }]
612
+ }
613
+ )
614
+ ```
615
+
616
+ ### Buttons List Message
617
+ ```ts
618
+ // Just working in a private chat
619
+ await sock.sendMessage(
620
+ jid,
621
+ {
622
+ text: 'This is a list!',
623
+ footer: 'Hello World!',
624
+ title: 'Amazing boldfaced list title',
625
+ buttonText: 'Required, text on the button to view the list',
626
+ sections: [
627
+ {
628
+ title: 'Section 1',
629
+ rows: [{
630
+ title: 'Option 1',
631
+ rowId: 'option1'
632
+ },
633
+ {
634
+ title: 'Option 2',
635
+ rowId: 'option2',
636
+ description: 'This is a description'
637
+ }]
638
+ },
639
+ {
640
+ title: 'Section 2',
641
+ rows: [{
642
+ title: 'Option 3',
643
+ rowId: 'option3'
644
+ },
645
+ {
646
+ title: 'Option 4',
647
+ rowId: 'option4',
648
+ description: 'This is a description V2'
649
+ }]
650
+ }]
651
+ }
652
+ )
653
+ ```
654
+
655
+ ### Buttons Product List Message
656
+ ```ts
657
+ // Just working in a private chat
658
+ await sock.sendMessage(
659
+ jid,
660
+ {
661
+ text: 'This is a list!',
662
+ footer: 'Hello World!',
663
+ title: 'Amazing boldfaced list title',
664
+ buttonText: 'Required, text on the button to view the list',
665
+ productList: [{
666
+ title: 'This is a title',
667
+ products: [
668
+ {
669
+ productId: '1234'
670
+ },
671
+ {
672
+ productId: '5678'
673
+ }
674
+ ]
675
+ }],
676
+ businessOwnerJid: '628xxx@s.whatsapp.net',
677
+ thumbnail: 'https://example.com/jdbenkksjs.jpg' // or buffer
678
+ }
679
+ )
680
+ ```
681
+
682
+ ### Buttons Cards Message
683
+ ```ts
684
+ await sock.sendMessage(
685
+ jid,
686
+ {
687
+ text: 'Body Message',
688
+ title: 'Title Message',
689
+ subtile: 'Subtitle Message',
690
+ footer: 'Footer Message',
691
+ cards: [
692
+ {
693
+ image: { url: 'https://example.com/jdbenkksjs.jpg' }, // or buffer
694
+ title: 'Title Cards',
695
+ body: 'Body Cards',
696
+ footer: 'Footer Cards',
697
+ buttons: [
698
+ {
699
+ name: 'quick_reply',
700
+ buttonParamsJson: JSON.stringify({
701
+ display_text: 'Display Button',
702
+ id: 'ID'
703
+ })
704
+ },
705
+ {
706
+ name: 'cta_url',
707
+ buttonParamsJson: JSON.stringify({
708
+ display_text: 'Display Button',
709
+ url: 'https://www.example.com'
710
+ })
711
+ }
712
+ ]
713
+ },
714
+ {
715
+ video: { url: 'https://example.com/jdbenkksjs.mp4' }, // or buffer
716
+ title: 'Title Cards',
717
+ body: 'Body Cards',
718
+ footer: 'Footer Cards',
719
+ buttons: [
720
+ {
721
+ name: 'quick_reply',
722
+ buttonParamsJson: JSON.stringify({
723
+ display_text: 'Display Button',
724
+ id: 'ID'
725
+ })
726
+ },
727
+ {
728
+ name: 'cta_url',
729
+ buttonParamsJson: JSON.stringify({
730
+ display_text: 'Display Button',
731
+ url: 'https://www.example.com'
732
+ })
733
+ }
734
+ ]
735
+ }
736
+ ]
737
+ }
738
+ )
739
+ ```
740
+
741
+ ### Buttons Template Message
742
+ ```ts
743
+ // This no longer works
744
+ await sock.sendMessage(
745
+ jid,
746
+ {
747
+ text: 'This is a template message!',
748
+ footer: 'Hello World!',
749
+ templateButtons: [{
750
+ index: 1,
751
+ urlButton: {
752
+ displayText: 'Follow Me',
753
+ url: 'https://whatsapp.com/channel/0029Vag9VSI2ZjCocqa2lB1y'
754
+ },
755
+ },
756
+ {
757
+ index: 2,
758
+ callButton: {
759
+ displayText: 'Call Me!',
760
+ phoneNumber: '628xxx'
761
+ },
762
+ },
763
+ {
764
+ index: 3,
765
+ quickReplyButton: {
766
+ displayText: 'This is a reply, just like normal buttons!',
767
+ id: 'id-like-buttons-message'
768
+ },
769
+ }]
770
+ }
771
+ )
772
+ ```
773
+
774
+ ### Buttons Interactive Message
775
+ ```ts
776
+ await sock.sendMessage(
777
+ jid,
778
+ {
779
+ text: 'This is an Interactive message!',
780
+ title: 'Hiii',
781
+ subtitle: 'There is a subtitle',
782
+ footer: 'Hello World!',
783
+ interactiveButtons: [
784
+ {
785
+ name: 'quick_reply',
786
+ buttonParamsJson: JSON.stringify({
787
+ display_text: 'Click Me!',
788
+ id: 'your_id'
789
+ })
790
+ },
791
+ {
792
+ name: 'cta_url',
793
+ buttonParamsJson: JSON.stringify({
794
+ display_text: 'Follow Me',
795
+ url: 'https://whatsapp.com/channel/0029Vag9VSI2ZjCocqa2lB1y',
796
+ merchant_url: 'https://whatsapp.com/channel/0029Vag9VSI2ZjCocqa2lB1y'
797
+ })
798
+ },
799
+ {
800
+ name: 'cta_copy',
801
+ buttonParamsJson: JSON.stringify({
802
+ display_text: 'Click Me!',
803
+ copy_code: 'https://whatsapp.com/channel/0029Vag9VSI2ZjCocqa2lB1y'
804
+ })
805
+ },
806
+ {
807
+ name: 'cta_call',
808
+ buttonParamsJson: JSON.stringify({
809
+ display_text: 'Call Me!',
810
+ phone_number: '628xxx'
811
+ })
812
+ },
813
+ {
814
+ name: 'cta_catalog',
815
+ buttonParamsJson: JSON.stringify({
816
+ business_phone_number: '628xxx'
817
+ })
818
+ },
819
+ {
820
+ name: 'cta_reminder',
821
+ buttonParamsJson: JSON.stringify({
822
+ display_text: '...'
823
+ })
824
+ },
825
+ {
826
+ name: 'cta_cancel_reminder',
827
+ buttonParamsJson: JSON.stringify({
828
+ display_text: '...'
829
+ })
830
+ },
831
+ {
832
+ name: 'address_message',
833
+ buttonParamsJson: JSON.stringify({
834
+ display_text: '...'
835
+ })
836
+ },
837
+ {
838
+ name: 'send_location',
839
+ buttonParamsJson: JSON.stringify({
840
+ display_text: '...'
841
+ })
842
+ },
843
+ {
844
+ name: 'open_webview',
845
+ buttonParamsJson: JSON.stringify({
846
+ title: 'Follow Me!',
847
+ link: {
848
+ in_app_webview: true, // or false
849
+ url: 'https://whatsapp.com/channel/0029Vag9VSI2ZjCocqa2lB1y'
850
+ }
851
+ })
852
+ },
853
+ {
854
+ name: 'mpm',
855
+ buttonParamsJson: JSON.stringify({
856
+ product_id: '8816262248471474'
857
+ })
858
+ },
859
+ {
860
+ name: 'wa_payment_transaction_details',
861
+ buttonParamsJson: JSON.stringify({
862
+ transaction_id: '12345848'
863
+ })
864
+ },
865
+ {
866
+ name: 'automated_greeting_message_view_catalog',
867
+ buttonParamsJson: JSON.stringify({
868
+ business_phone_number: '628xxx',
869
+ catalog_product_id: '12345'
870
+ })
871
+ },
872
+ {
873
+ name: 'galaxy_message',
874
+ buttonParamsJson: JSON.stringify({
875
+ mode: 'published',
876
+ flow_message_version: '3',
877
+ flow_token: '1:1307913409923914:293680f87029f5a13d1ec5e35e718af3',
878
+ flow_id: '1307913409923914',
879
+ flow_cta: 'Itsukichann kawaii >\\<',
880
+ flow_action: 'navigate',
881
+ flow_action_payload: {
882
+ screen: 'QUESTION_ONE',
883
+ params: {
884
+ user_id: '123456789',
885
+ referral: 'campaign_xyz'
886
+ }
887
+ },
888
+ flow_metadata: {
889
+ flow_json_version: '201',
890
+ data_api_protocol: 'v2',
891
+ flow_name: 'Lead Qualification [en]',
892
+ data_api_version: 'v2',
893
+ categories: ['Lead Generation', 'Sales']
894
+ }
895
+ })
896
+ },
897
+ {
898
+ name: 'single_select',
899
+ buttonParamsJson: JSON.stringify({
900
+ title: 'Click Me!',
901
+ sections: [
902
+ {
903
+ title: 'Title 1',
904
+ highlight_label: 'Highlight label 1',
905
+ rows: [
906
+ {
907
+ header: 'Header 1',
908
+ title: 'Title 1',
909
+ description: 'Description 1',
910
+ id: 'Id 1'
911
+ },
912
+ {
913
+ header: 'Header 2',
914
+ title: 'Title 2',
915
+ description: 'Description 2',
916
+ id: 'Id 2'
917
+ }
918
+ ]
919
+ }
920
+ ]
921
+ })
922
+ }
923
+ ]
924
+ }
925
+ )
926
+
927
+ // If you want to use an image
928
+ await sock.sendMessage(
929
+ jid,
930
+ {
931
+ image: {
932
+ url: 'https://example.com/jdbenkksjs.jpg'
933
+ },
934
+ caption: 'Body',
935
+ title: 'Title',
936
+ subtitle: 'Subtitle',
937
+ footer: 'Footer',
938
+ interactiveButtons: [
939
+ {
940
+ name: 'quick_reply',
941
+ buttonParamsJson: JSON.stringify({
942
+ display_text: 'DisplayText',
943
+ id: 'ID1'
944
+ })
945
+ }
946
+ ],
947
+ hasMediaAttachment: false // or true
948
+ }
949
+ )
950
+
951
+ // If you want to use an video
952
+ await sock.sendMessage(
953
+ jid,
954
+ {
955
+ video: {
956
+ url: 'https://example.com/jdbenkksjs.mp4'
957
+ },
958
+ caption: 'Body',
959
+ title: 'Title',
960
+ subtitle: 'Subtitle',
961
+ footer: 'Footer',
962
+ interactiveButtons: [
963
+ {
964
+ name: 'quick_reply',
965
+ buttonParamsJson: JSON.stringify({
966
+ display_text: 'DisplayText',
967
+ id: 'ID1'
968
+ })
969
+ }
970
+ ],
971
+ hasMediaAttachment: false // or true
972
+ }
973
+ )
974
+
975
+ // If you want to use an document
976
+ await sock.sendMessage(
977
+ jid,
978
+ {
979
+ document: {
980
+ url: 'https://example.com/jdbenkksjs.jpg'
981
+ },
982
+ mimetype: 'image/jpeg',
983
+ jpegThumbnail: await sock.resize('https://example.com/jdbenkksjs.jpg', 320, 320),
984
+ caption: 'Body',
985
+ title: 'Title',
986
+ subtitle: 'Subtitle',
987
+ footer: 'Footer',
988
+ interactiveButtons: [
989
+ {
990
+ name: 'quick_reply',
991
+ buttonParamsJson: JSON.stringify({
992
+ display_text: 'DisplayText',
993
+ id: 'ID1'
994
+ })
995
+ }
996
+ ],
997
+ hasMediaAttachment: false // or true
998
+ }
999
+ )
1000
+
1001
+ // If you want to use an location
1002
+ await sock.sendMessage(
1003
+ jid,
1004
+ {
1005
+ location: {
1006
+ degressLatitude: -0,
1007
+ degressLongitude: 0,
1008
+ name: 'Hi'
1009
+ },
1010
+ caption: 'Body',
1011
+ title: 'Title',
1012
+ subtitle: 'Subtitle',
1013
+ footer: 'Footer',
1014
+ interactiveButtons: [
1015
+ {
1016
+ name: 'quick_reply',
1017
+ buttonParamsJson: JSON.stringify({
1018
+ display_text: 'DisplayText',
1019
+ id: 'ID1'
1020
+ })
1021
+ }
1022
+ ],
1023
+ hasMediaAttachment: false // or true
1024
+ }
1025
+ )
1026
+
1027
+ // if you want to use an product
1028
+ await sock.sendMessage(
1029
+ jid,
1030
+ {
1031
+ product: {
1032
+ productImage: {
1033
+ url: 'https://example.com/jdbenkksjs.jpg'
1034
+ },
1035
+ productId: '836xxx',
1036
+ title: 'Title',
1037
+ description: 'Description',
1038
+ currencyCode: 'IDR',
1039
+ priceAmount1000: '283xxx',
1040
+ retailerId: 'Itsukichann',
1041
+ url: 'https://example.com',
1042
+ productImageCount: 1
1043
+ },
1044
+ businessOwnerJid: '628xxx@s.whatsapp.net',
1045
+ caption: 'Body',
1046
+ title: 'Title',
1047
+ subtitle: 'Subtitle',
1048
+ footer: 'Footer',
1049
+ interactiveButtons: [
1050
+ {
1051
+ name: 'quick_reply',
1052
+ buttonParamsJson: JSON.stringify({
1053
+ display_text: 'DisplayText',
1054
+ id: 'ID1'
1055
+ })
1056
+ }
1057
+ ],
1058
+ hasMediaAttachment: false // or true
1059
+ }
1060
+ )
1061
+ ```
1062
+
1063
+ ### Buttons Interactive Message PIX
1064
+ ```ts
1065
+ await sock.sendMessage(
1066
+ jid,
1067
+ {
1068
+ text: '', // This string is required. Even it's empty.
1069
+ interactiveButtons: [
1070
+ {
1071
+ name: 'payment_info',
1072
+ buttonParamsJson: JSON.stringify({
1073
+ payment_settings: [{
1074
+ type: "pix_static_code",
1075
+ pix_static_code: {
1076
+ merchant_name: 'itsukichann kawaii >\\\\\\<',
1077
+ key: 'example@itsukichan.com',
1078
+ key_type: 'EMAIL' // PHONE || EMAIL || CPF || EVP
1079
+ }
1080
+ }]
1081
+ })
1082
+ }
1083
+ ],
1084
+ }
1085
+ )
1086
+ ```
1087
+
1088
+ ### Buttons Interactive Message PAY
1089
+ ```ts
1090
+ await sock.sendMessage(
1091
+ jid,
1092
+ {
1093
+ text: '', // This string is required. Even it's empty.
1094
+ interactiveButtons: [
1095
+ {
1096
+ name: 'review_and_pay',
1097
+ buttonParamsJson: JSON.stringify({
1098
+ currency: 'IDR',
1099
+ payment_configuration: '',
1100
+ payment_type: '',
1101
+ total_amount: {
1102
+ value: '999999999',
1103
+ offset: '100'
1104
+ },
1105
+ reference_id: '45XXXXX',
1106
+ type: 'physical-goods',
1107
+ payment_method: 'confirm',
1108
+ payment_status: 'captured',
1109
+ payment_timestamp: Math.floor(Date.now() / 1000),
1110
+ order: {
1111
+ status: 'completed',
1112
+ description: '',
1113
+ subtotal: {
1114
+ value: '0',
1115
+ offset: '100'
1116
+ },
1117
+ order_type: 'PAYMENT_REQUEST',
1118
+ items: [{
1119
+ retailer_id: 'your_retailer_id',
1120
+ name: 'Itsukichann Kawaii >\\\<',
1121
+ amount: {
1122
+ value: '999999999',
1123
+ offset: '100'
1124
+ },
1125
+ quantity: '1',
1126
+ }]
1127
+ },
1128
+ additional_note: 'Itsukichann Kawaii >\\\<',
1129
+ native_payment_methods: [],
1130
+ share_payment_status: false
1131
+ })
1132
+ }
1133
+ ],
1134
+ }
1135
+ )
1136
+ ```
1137
+
1138
+ ### Status Mentions Message
1139
+ ```ts
1140
+ const jidat = [
1141
+ '123451679@g.us',
1142
+ '124848899@g.us',
1143
+ '111384848@g.us',
1144
+ '62689xxxx@s.whatsapp.net',
1145
+ '62xxxxxxx@s.whatsapp.net'
1146
+ ]
1147
+ // Text
1148
+ await sock.sendStatusMentions(
1149
+ {
1150
+ text: 'Hello Everyone :3',
1151
+ font: 2, // optional
1152
+ textColor: 'FF0000', // optional
1153
+ backgroundColor: '#000000' // optional
1154
+ },
1155
+ jids // Limit to 5 mentions per status
1156
+ )
1157
+
1158
+ // Image
1159
+ await sock.sendStatusMentions(
1160
+ {
1161
+ Image: { url: 'https://example.com/ruriooe.jpg' }, or image buffer
1162
+ caption: 'Hello Everyone :3' // optional
1163
+ },
1164
+ jids // Limit to 5 mentions per status
1165
+ )
1166
+
1167
+ // Video
1168
+ await sock.sendStatusMentions(
1169
+ {
1170
+ video: { url: 'https://example.com/ruriooe.mp4' }, or video buffer
1171
+ caption: 'Hello Everyone :3' // optional
1172
+ },
1173
+ jids // Limit to 5 mentions per status
1174
+ )
1175
+
1176
+ // Audio
1177
+ await sock.sendStatusMentions(
1178
+ {
1179
+ audio: { url: 'https://example.com/ruriooe.mp3' }, or audio buffer
1180
+ backgroundColor: '#000000', // optional
1181
+ mimetype: 'audio/mp4',
1182
+ ppt: true
1183
+ },
1184
+ jids // Limit to 5 mentions per status
1185
+ )
1186
+ ```
1187
+
1188
+ ### Shop Message
1189
+ ```ts
1190
+ await sock.sendMessage(
1191
+ jid,
1192
+ {
1193
+ text: 'Body',
1194
+ title: 'Title',
1195
+ subtitle: 'Subtitle',
1196
+ footer: 'Footer',
1197
+ shop: {
1198
+ surface: 1, // 2 | 3 | 4
1199
+ id: 'https://example.com'
1200
+ },
1201
+ viewOnce: true
1202
+ }
1203
+ )
1204
+
1205
+ // Image
1206
+ await sock.sendMessage(
1207
+ jid,
1208
+ {
1209
+ image: {
1210
+ url: 'https://example.com/jdbenkksjs.jpg'
1211
+ },
1212
+ caption: 'Body',
1213
+ title: 'Title',
1214
+ subtitle: 'Subtitle',
1215
+ footer: 'Footer',
1216
+ shop: {
1217
+ surface: 1, // 2 | 3 | 4
1218
+ id: 'https://example.com'
1219
+ },
1220
+ hasMediaAttachment: false, // or true
1221
+ viewOnce: true
1222
+ }
1223
+ )
1224
+
1225
+ // Video
1226
+ await sock.sendMessage(
1227
+ jid,
1228
+ {
1229
+ video: {
1230
+ url: 'https://example.com/jdbenkksjs.jpg'
1231
+ },
1232
+ caption: 'Body',
1233
+ title: 'Title',
1234
+ subtitle: 'Subtitle',
1235
+ footer: 'Footer',
1236
+ shop: {
1237
+ surface: 1, // 2 | 3 | 4
1238
+ id: 'https://example.com'
1239
+ },
1240
+ hasMediaAttachment: false, // or true
1241
+ viewOnce: true
1242
+ }
1243
+ )
1244
+
1245
+ // Document
1246
+ await sock.sendMessage(
1247
+ jid,
1248
+ {
1249
+ document: {
1250
+ url: 'https://example.com/jdbenkksjs.jpg'
1251
+ },
1252
+ mimetype: 'image/jpeg',
1253
+ jpegThumbnail: await sock.resize('https://example.com/jdbenkksjs.jpg', 320, 320),
1254
+ caption: 'Body',
1255
+ title: 'Title',
1256
+ subtitle: 'Subtitle',
1257
+ footer: 'Footer',
1258
+ shop: {
1259
+ surface: 1, // 2 | 3 | 4
1260
+ id: 'https://example.com'
1261
+ },
1262
+ hasMediaAttachment: false, // or true,
1263
+ viewOnce: true
1264
+ }
1265
+ )
1266
+
1267
+ // Location
1268
+ await sock.sendMessage(
1269
+ jid,
1270
+ {
1271
+ location: {
1272
+ degressLatitude: -0,
1273
+ degressLongitude: 0,
1274
+ name: 'Hi'
1275
+ },
1276
+ caption: 'Body',
1277
+ title: 'Title',
1278
+ subtitle: 'Subtitle',
1279
+ footer: 'Footer',
1280
+ shop: {
1281
+ surface: 1, // 2 | 3 | 4
1282
+ id: 'https://example.com'
1283
+ },
1284
+ hasMediaAttachment: false, // or true
1285
+ viewOnce: true
1286
+ }
1287
+ )
1288
+
1289
+ // Product
1290
+ await sock.sendMessage(
1291
+ jid,
1292
+ {
1293
+ product: {
1294
+ productImage: {
1295
+ url: 'https://example.com/jdbenkksjs.jpg'
1296
+ },
1297
+ productId: '836xxx',
1298
+ title: 'Title',
1299
+ description: 'Description',
1300
+ currencyCode: 'IDR',
1301
+ priceAmount1000: '283xxx',
1302
+ retailerId: 'Itsukichann',
1303
+ url: 'https://example.com',
1304
+ productImageCount: 1
1305
+ },
1306
+ businessOwnerJid: '628xxx@s.whatsapp.net',
1307
+ caption: 'Body',
1308
+ title: 'Title',
1309
+ subtitle: 'Subtitle',
1310
+ footer: 'Footer',
1311
+ shop: {
1312
+ surface: 1, // 2 | 3 | 4
1313
+ id: 'https://example.com'
1314
+ },
1315
+ hasMediaAttachment: false, // or true
1316
+ viewOnce: true
1317
+ }
1318
+ )
1319
+ ```
1320
+ ### Collection Message
1321
+ ```ts
1322
+ await sock.sendMessage(
1323
+ jid,
1324
+ {
1325
+ text: 'Body',
1326
+ title: 'Title',
1327
+ subtitle: 'Subtitle',
1328
+ footer: 'Footer',
1329
+ collection: {
1330
+ bizJid: 'jid',
1331
+ id: 'https://example.com',
1332
+ version: 1
1333
+ },
1334
+ viewOnce: true
1335
+ }
1336
+ )
1337
+
1338
+ // Image
1339
+ await sock.sendMessage(
1340
+ jid,
1341
+ {
1342
+ image: {
1343
+ url: 'https://example.com/jdbenkksjs.jpg'
1344
+ },
1345
+ caption: 'Body',
1346
+ title: 'Title',
1347
+ subtitle: 'Subtitle',
1348
+ footer: 'Footer',
1349
+ collection: {
1350
+ bizJid: 'jid',
1351
+ id: 'https://example.com',
1352
+ version: 1
1353
+ },
1354
+ hasMediaAttachment: false, // or true
1355
+ viewOnce: true
1356
+ }
1357
+ )
1358
+
1359
+ // Video
1360
+ await sock.sendMessage(
1361
+ jid,
1362
+ {
1363
+ video: {
1364
+ url: 'https://example.com/jdbenkksjs.jpg'
1365
+ },
1366
+ caption: 'Body',
1367
+ title: 'Title',
1368
+ subtitle: 'Subtitle',
1369
+ footer: 'Footer',
1370
+ collection: {
1371
+ bizJid: 'jid',
1372
+ id: 'https://example.com',
1373
+ version: 1
1374
+ },
1375
+ hasMediaAttachment: false, // or true
1376
+ viewOnce: true
1377
+ }
1378
+ )
1379
+
1380
+ // Document
1381
+ await sock.sendMessage(
1382
+ jid,
1383
+ {
1384
+ document: {
1385
+ url: 'https://example.com/jdbenkksjs.jpg'
1386
+ },
1387
+ mimetype: 'image/jpeg',
1388
+ jpegThumbnail: await sock.resize('https://example.com/jdbenkksjs.jpg', 320, 320),
1389
+ caption: 'Body',
1390
+ title: 'Title',
1391
+ subtitle: 'Subtitle',
1392
+ footer: 'Footer',
1393
+ collection: {
1394
+ bizJid: 'jid',
1395
+ id: 'https://example.com',
1396
+ version: 1
1397
+ },
1398
+ hasMediaAttachment: false, // or true,
1399
+ viewOnce: true
1400
+ }
1401
+ )
1402
+
1403
+ // Location
1404
+ await sock.sendMessage(
1405
+ jid,
1406
+ {
1407
+ location: {
1408
+ degressLatitude: -0,
1409
+ degressLongitude: 0,
1410
+ name: 'Hi'
1411
+ },
1412
+ caption: 'Body',
1413
+ title: 'Title',
1414
+ subtitle: 'Subtitle',
1415
+ footer: 'Footer',
1416
+ collection: {
1417
+ bizJid: 'jid',
1418
+ id: 'https://example.com',
1419
+ version: 1
1420
+ },
1421
+ hasMediaAttachment: false, // or true
1422
+ viewOnce: true
1423
+ }
1424
+ )
1425
+
1426
+ // Product
1427
+ await sock.sendMessage(
1428
+ jid,
1429
+ {
1430
+ product: {
1431
+ productImage: {
1432
+ url: 'https://example.com/jdbenkksjs.jpg'
1433
+ },
1434
+ productId: '836xxx',
1435
+ title: 'Title',
1436
+ description: 'Description',
1437
+ currencyCode: 'IDR',
1438
+ priceAmount1000: '283xxx',
1439
+ retailerId: 'Itsukichann',
1440
+ url: 'https://example.com',
1441
+ productImageCount: 1
1442
+ },
1443
+ businessOwnerJid: '628xxx@s.whatsapp.net',
1444
+ caption: 'Body',
1445
+ title: 'Title',
1446
+ subtitle: 'Subtitle',
1447
+ footer: 'Footer',
1448
+ collection: {
1449
+ bizJid: 'jid',
1450
+ id: 'https://example.com',
1451
+ version: 1
1452
+ },
1453
+ hasMediaAttachment: false, // or true
1454
+ viewOnce: true
1455
+ }
1456
+ )
1457
+ ```
1458
+
1459
+ ### AI Icon Feature
1460
+ ```ts
1461
+ await sock.sendMessage(
1462
+ jid,
1463
+ {
1464
+ text: 'Hi'
1465
+ }, {
1466
+ ai: true // Add ai usage and change it to true
1467
+ }
1468
+ )
1469
+
1470
+ // If using relay
1471
+ await sock.relayMessage(
1472
+ jid,
1473
+ {
1474
+ extendedTextMessage: {
1475
+ text: 'Hi'
1476
+ }
1477
+ }, {
1478
+ AI: true // Use capital letters
1479
+ }
1480
+ )
1481
+ ```
1482
+
1483
+ ### Sending Messages with Link Previews
1484
+
1485
+ Link preview sudah **built-in otomatis** di Rixleys tanpa perlu dependensi tambahan:
1486
+
1487
+ ```ts
1488
+ await sock.sendMessage(
1489
+ jid,
1490
+ {
1491
+ text: 'Halo! Kunjungi web resmi: https://google.com'
1492
+ }
1493
+ )
1494
+ ```
1495
+
1496
+ ### Media Messages
1497
+
1498
+ Sending media (video, stickers, images) is easier & more efficient than ever.
1499
+
1500
+ > [!NOTE]
1501
+ > In media messages, you can pass `{ stream: Stream }` or `{ url: Url }` or `Buffer` directly, you can see more [here](https://baileys.whiskeysockets.io/types/WAMediaUpload.html)
1502
+
1503
+ - When specifying a media url, Baileys never loads the entire buffer into memory it even encrypts the media as a readable stream.
1504
+
1505
+ > [!TIP]
1506
+ > It's recommended to use Stream or Url to save memory
1507
+
1508
+ #### Gif Message
1509
+ - Whatsapp doesn't support `.gif` files, that's why we send gifs as common `.mp4` video with `gifPlayback` flag
1510
+ ```ts
1511
+ await sock.sendMessage(
1512
+ jid,
1513
+ {
1514
+ video: fs.readFileSync('Media/ma_gif.mp4'),
1515
+ caption: 'hello word',
1516
+ gifPlayback: true
1517
+ }
1518
+ )
1519
+ ```
1520
+
1521
+ #### Video Message
1522
+ ```ts
1523
+ await sock.sendMessage(
1524
+ id,
1525
+ {
1526
+ video: {
1527
+ url: './Media/ma_gif.mp4'
1528
+ },
1529
+ caption: 'hello word',
1530
+ }
1531
+ )
1532
+ ```
1533
+
1534
+ #### Video Ptv Message
1535
+ ```ts
1536
+ await sock.sendMessage(
1537
+ id,
1538
+ {
1539
+ video: {
1540
+ url: './Media/ma_gif.mp4'
1541
+ },
1542
+ ptv: true
1543
+ }
1544
+ )
1545
+ ```
1546
+
1547
+ #### Audio Message
1548
+ - To audio message work in all devices you need to convert with some tool like `ffmpeg` with this flags:
1549
+ ```bash
1550
+ codec: libopus //ogg file
1551
+ ac: 1 //one channel
1552
+ avoid_negative_ts
1553
+ make_zero
1554
+ ```
1555
+ - Example:
1556
+ ```bash
1557
+ ffmpeg -i input.mp4 -avoid_negative_ts make_zero -ac 1 output.ogg
1558
+ ```
1559
+ ```ts
1560
+ await sock.sendMessage(
1561
+ jid,
1562
+ {
1563
+ audio: {
1564
+ url: './Media/audio.mp3'
1565
+ },
1566
+ mimetype: 'audio/mp4'
1567
+ }
1568
+ )
1569
+ ```
1570
+
1571
+ #### Image Message
1572
+ ```ts
1573
+ await sock.sendMessage(
1574
+ id,
1575
+ {
1576
+ image: {
1577
+ url: './Media/ma_img.png'
1578
+ },
1579
+ caption: 'hello word'
1580
+ }
1581
+ )
1582
+ ```
1583
+
1584
+ ### Album Message
1585
+ ```ts
1586
+ await sock.sendMessage(
1587
+ id,
1588
+ {
1589
+ album: [{
1590
+ image: {
1591
+ url: 'https://example.com/itsukichan.jpg'
1592
+ },
1593
+ caption: 'Hay'
1594
+ }, {
1595
+ image: Buffer,
1596
+ caption: 'Hay'
1597
+ }, {
1598
+ video: {
1599
+ url: 'https://example.com/itsukichan.mp4'
1600
+ },
1601
+ caption: 'Hay'
1602
+ }, {
1603
+ video: Buffer,
1604
+ caption: 'Hay'
1605
+ }
1606
+ }
1607
+ )
1608
+ ```
1609
+
1610
+ #### View Once Message
1611
+
1612
+ - You can send all messages above as `viewOnce`, you only need to pass `viewOnce: true` in content object
1613
+
1614
+ ```ts
1615
+ await sock.sendMessage(
1616
+ id,
1617
+ {
1618
+ image: {
1619
+ url: './Media/ma_img.png'
1620
+ },
1621
+ viewOnce: true, //works with video, audio too
1622
+ caption: 'hello word'
1623
+ }
1624
+ )
1625
+ ```
1626
+
1627
+ # Baileys - Sending Messages
1628
+
1629
+ Cuplikan bagian **Sending Messages** dari README Baileys.
1630
+
1631
+ ## Sending Messages
1632
+
1633
+ - Send all types of messages with a single function
1634
+ - **[Here](https://baileys.whiskeysockets.io/types/AnyMessageContent.html) you can see all message contents supported, like text message**
1635
+ - **[Here](https://baileys.whiskeysockets.io/types/MiscMessageGenerationOptions.html) you can see all options supported, like quote message**
1636
+
1637
+ ```ts
1638
+ const jid: string
1639
+ const content: AnyMessageContent
1640
+ const options: MiscMessageGenerationOptions
1641
+
1642
+ sock.sendMessage(jid, content, options)
1643
+ ```
1644
+
1645
+ ### Non-Media Messages
1646
+
1647
+ #### Text Message
1648
+ ```ts
1649
+ await sock.sendMessage(jid, { text: 'hello word' })
1650
+ ```
1651
+
1652
+ #### Quote Message (works with all types)
1653
+ ```ts
1654
+ await sock.sendMessage(jid, { text: 'hello word' }, { quoted: message })
1655
+ ```
1656
+
1657
+ #### Mention User (works with most types)
1658
+ - @number is to mention in text, it's optional
1659
+ ```ts
1660
+ await sock.sendMessage(
1661
+ jid,
1662
+ {
1663
+ text: '@12345678901',
1664
+ mentions: ['12345678901@s.whatsapp.net']
1665
+ }
1666
+ )
1667
+ ```
1668
+
1669
+ #### Forward Messages
1670
+ - You need to have message object, can be retrieved from [store](#implementing-a-data-store) or use a [message](https://baileys.whiskeysockets.io/types/WAMessage.html) object
1671
+ ```ts
1672
+ const msg = getMessageFromStore() // implement this on your end
1673
+ await sock.sendMessage(jid, { forward: msg, force: true or number }) // WA forward the message!
1674
+ ```
1675
+
1676
+ #### Location Message
1677
+ ```ts
1678
+ await sock.sendMessage(
1679
+ jid,
1680
+ {
1681
+ location: {
1682
+ degreesLatitude: 24.121231,
1683
+ degreesLongitude: 55.1121221
1684
+ }
1685
+ }
1686
+ )
1687
+ ```
1688
+
1689
+ #### Live Location Message
1690
+ ```ts
1691
+ await sock.sendMessage(
1692
+ jid,
1693
+ {
1694
+ location: {
1695
+ degreesLatitude: 24.121231,
1696
+ degreesLongitude: 55.1121221
1697
+ },
1698
+ live: true
1699
+ }
1700
+ )
1701
+ ```
1702
+ #### Contact Message
1703
+ ```ts
1704
+ const vcard = 'BEGIN:VCARD\n' // metadata of the contact card
1705
+ + 'VERSION:3.0\n'
1706
+ + 'FN:Jeff Singh\n' // full name
1707
+ + 'ORG:Ashoka Uni\n' // the organization of the contact
1708
+ + 'TELtype=CELLtype=VOICEwaid=911234567890:+91 12345 67890\n' // WhatsApp ID + phone number
1709
+ + 'END:VCARD'
1710
+
1711
+ await sock.sendMessage(
1712
+ id,
1713
+ {
1714
+ contacts: {
1715
+ displayName: 'Itsukichann',
1716
+ contacts: [{ vcard }]
1717
+ }
1718
+ }
1719
+ )
1720
+ ```
1721
+
1722
+ #### Reaction Message
1723
+ - You need to pass the key of message, you can retrieve from [store](#implementing-a-data-store) or use a [key](https://baileys.whiskeysockets.io/types/WAMessageKey.html) object
1724
+ ```ts
1725
+ await sock.sendMessage(
1726
+ jid,
1727
+ {
1728
+ react: {
1729
+ text: '💖', // use an empty string to remove the reaction
1730
+ key: message.key
1731
+ }
1732
+ }
1733
+ )
1734
+ ```
1735
+
1736
+ #### Pin Message
1737
+ - You need to pass the key of message, you can retrieve from [store](#implementing-a-data-store) or use a [key](https://baileys.whiskeysockets.io/types/WAMessageKey.html) object
1738
+
1739
+ - Time can be:
1740
+
1741
+ | Time | Seconds |
1742
+ |-------|----------------|
1743
+ | 24h | 86.400 |
1744
+ | 7d | 604.800 |
1745
+ | 30d | 2.592.000 |
1746
+
1747
+ ```ts
1748
+ await sock.sendMessage(
1749
+ jid,
1750
+ {
1751
+ pin: {
1752
+ type: 1, // 2 to remove
1753
+ time: 86400,
1754
+ key: Key
1755
+ }
1756
+ }
1757
+ )
1758
+ ```
1759
+
1760
+ ### Keep Message
1761
+ ```ts
1762
+ await sock.sendMessage(
1763
+ jid,
1764
+ {
1765
+ keep: {
1766
+ key: Key,
1767
+ type: 1 // or 2
1768
+ }
1769
+ }
1770
+ )
1771
+ ```
1772
+
1773
+ #### Poll Message
1774
+ ```ts
1775
+ await sock.sendMessage(
1776
+ jid,
1777
+ {
1778
+ poll: {
1779
+ name: 'My Poll',
1780
+ values: ['Option 1', 'Option 2', ...],
1781
+ selectableCount: 1,
1782
+ toAnnouncementGroup: false // or true
1783
+ }
1784
+ }
1785
+ )
1786
+ ```
1787
+
1788
+ #### Poll Result Message
1789
+ ```ts
1790
+ await sock.sendMessage(
1791
+ jid,
1792
+ {
1793
+ pollResult: {
1794
+ name: 'Hi',
1795
+ values: [
1796
+ [
1797
+ 'Option 1',
1798
+ 1000
1799
+ ],
1800
+ [
1801
+ 'Option 2',
1802
+ 2000
1803
+ ]
1804
+ ]
1805
+ }
1806
+ }
1807
+ )
1808
+ ```
1809
+
1810
+ ### Call Message
1811
+ ```ts
1812
+ await sock.sendMessage(
1813
+ jid,
1814
+ {
1815
+ call: {
1816
+ name: 'Hay',
1817
+ type: 1 // 2 for video
1818
+ }
1819
+ }
1820
+ )
1821
+ ```
1822
+
1823
+ ### Event Message
1824
+ ```ts
1825
+ await sock.sendMessage(
1826
+ jid,
1827
+ {
1828
+ event: {
1829
+ isCanceled: false, // or true
1830
+ name: 'holiday together!',
1831
+ description: 'who wants to come along?',
1832
+ location: {
1833
+ degreesLatitude: 24.121231,
1834
+ degreesLongitude: 55.1121221,
1835
+ name: 'name'
1836
+ },
1837
+ call: 'audio', // or 'video'
1838
+ startTime: number,
1839
+ endTime: number,
1840
+ extraGuestsAllowed: true // or false
1841
+ }
1842
+ }
1843
+ )
1844
+ ```
1845
+
1846
+ ### Order Message
1847
+ ```ts
1848
+ await sock.sendMessage(
1849
+ jid,
1850
+ {
1851
+ order: {
1852
+ orderId: '574xxx',
1853
+ thumbnail: 'your_thumbnail',
1854
+ itemCount: 'your_count',
1855
+ status: 'your_status', // INQUIRY || ACCEPTED || DECLINED
1856
+ surface: 'CATALOG',
1857
+ message: 'your_caption',
1858
+ orderTitle: "your_title",
1859
+ sellerJid: 'your_jid'',
1860
+ token: 'your_token',
1861
+ totalAmount1000: 'your_amount',
1862
+ totalCurrencyCode: 'IDR'
1863
+ }
1864
+ }
1865
+ )
1866
+ ```
1867
+
1868
+ ### Product Message
1869
+ ```ts
1870
+ await sock.sendMessage(
1871
+ jid,
1872
+ {
1873
+ product: {
1874
+ productImage: { // for using buffer >> productImage: your_buffer
1875
+ url: your_url
1876
+ },
1877
+ productId: 'your_id',
1878
+ title: 'your_title',
1879
+ description: 'your_description',
1880
+ currencyCode: 'IDR',
1881
+ priceAmount1000: 'your_amount',
1882
+ retailerId: 'your_reid', // optional use if needed
1883
+ url: 'your_url', // optional use if needed
1884
+ productImageCount: 'your_imageCount',
1885
+ firstImageId: 'your_image', // optional use if needed
1886
+ salePriceAmount1000: 'your_priceSale',
1887
+ signedUrl: 'your_url' // optional use if needed
1888
+ },
1889
+ businessOwnerJid: 'your_jid'
1890
+ }
1891
+ )
1892
+ ```
1893
+
1894
+ ### Payment Message
1895
+ ```ts
1896
+ await sock.sendMessage(
1897
+ jid,
1898
+ {
1899
+ payment: {
1900
+ note: 'Hi!',
1901
+ currency: 'IDR', // optional
1902
+ offset: 0, // optional
1903
+ amount: '10000', // optional
1904
+ expiry: 0, // optional
1905
+ from: '628xxxx@s.whatsapp.net', // optional
1906
+ image: { // optional
1907
+ placeholderArgb: "your_background", // optional
1908
+ textArgb: "your_text", // optional
1909
+ subtextArgb: "your_subtext" // optional
1910
+ }
1911
+ }
1912
+ }
1913
+ )
1914
+ ```
1915
+
1916
+ #### Payment Invite Message
1917
+ ```ts
1918
+ await sock.sendMessage(
1919
+ id,
1920
+ {
1921
+ paymentInvite: {
1922
+ type: number, // 1 || 2 || 3
1923
+ expiry: 0
1924
+ }
1925
+ }
1926
+ )
1927
+ ```
1928
+
1929
+ ### Admin Invite Message
1930
+ ```ts
1931
+ await sock.sendMessage(
1932
+ jid,
1933
+ {
1934
+ adminInvite: {
1935
+ jid: '123xxx@newsletter',
1936
+ name: 'newsletter_name',
1937
+ caption: 'Please be my channel admin',
1938
+ expiration: 86400,
1939
+ jpegThumbnail: Buffer // optional
1940
+ }
1941
+ }
1942
+ )
1943
+ ```
1944
+
1945
+ ### Group Invite Message
1946
+ ```ts
1947
+ await sock.sendMessage(
1948
+ jid,
1949
+ {
1950
+ groupInvite: {
1951
+ jid: '123xxx@g.us',
1952
+ name: 'group_name',
1953
+ caption: 'Please Join My Whatsapp Group',
1954
+ code: 'code_invite',
1955
+ expiration: 86400,
1956
+ jpegThumbnail: Buffer, // optional
1957
+ }
1958
+ }
1959
+ )
1960
+ ```
1961
+
1962
+ ### Sticker Pack Message
1963
+ ```ts
1964
+ // I don't know why the sticker doesn't appear
1965
+ await sock.sendMessage(
1966
+ jid,
1967
+ {
1968
+ stickerPack: {
1969
+ name: 'Hiii',
1970
+ publisher: 'By Itsukichann',
1971
+ description: 'Hello',
1972
+ cover: Buffer, // Image buffer
1973
+ stickers: [{
1974
+ sticker: { url: 'https://example.com/1234kjd.webp' },
1975
+ emojis: ['❤'], // optional
1976
+ accessibilityLabel: '', // optional
1977
+ isLottie: Boolean, // optional
1978
+ isAnimated: Boolean // optional
1979
+ },
1980
+ {
1981
+ sticker: Buffer,
1982
+ emojis: ['❤'], // optional
1983
+ accessibilityLabel: '', // optional
1984
+ isLottie: Boolean, // optional
1985
+ isAnimated: Boolean // optional
1986
+ }]
1987
+ }
1988
+ }
1989
+ )
1990
+ ```
1991
+
1992
+ ### Share Phone Number Message
1993
+ ```ts
1994
+ await sock.sendMessage(
1995
+ jid,
1996
+ {
1997
+ sharePhoneNumber: {
1998
+ }
1999
+ }
2000
+ )
2001
+ ```
2002
+
2003
+ ### Request Phone Number Message
2004
+ ```ts
2005
+ await sock.sendMessage(
2006
+ jid,
2007
+ {
2008
+ requestPhoneNumber: {
2009
+ }
2010
+ }
2011
+ )
2012
+ ```
2013
+
2014
+ ### Buttons Reply Message
2015
+ ```ts
2016
+ // List
2017
+ await sock.sendMessage(
2018
+ jid,
2019
+ {
2020
+ buttonReply: {
2021
+ name: 'Hii',
2022
+ description: 'description',
2023
+ rowId: 'ID'
2024
+ },
2025
+ type: 'list'
2026
+ }
2027
+ )
2028
+ // Plain
2029
+ await sock.sendMessage(
2030
+ jid,
2031
+ {
2032
+ buttonReply: {
2033
+ displayText: 'Hii',
2034
+ id: 'ID'
2035
+ },
2036
+ type: 'plain'
2037
+ }
2038
+ )
2039
+
2040
+ // Template
2041
+ await sock.sendMessage(
2042
+ jid,
2043
+ {
2044
+ buttonReply: {
2045
+ displayText: 'Hii',
2046
+ id: 'ID',
2047
+ index: 'number'
2048
+ },
2049
+ type: 'template'
2050
+ }
2051
+ )
2052
+
2053
+ // Interactive
2054
+ await sock.sendMessage(
2055
+ jid,
2056
+ {
2057
+ buttonReply: {
2058
+ body: 'Hii',
2059
+ nativeFlows: {
2060
+ name: 'menu_options',
2061
+ paramsJson: JSON.stringify({ id: 'ID', description: 'description' })
2062
+ version: 1 // 2 | 3
2063
+ }
2064
+ },
2065
+ type: 'interactive'
2066
+ }
2067
+ )
2068
+ ```
2069
+
2070
+ ### Buttons Message
2071
+ ```ts
2072
+ await sock.sendMessage(
2073
+ jid,
2074
+ {
2075
+ text: 'This is a button message!', // image: buffer or // image: { url: url } If you want to use images
2076
+ caption: 'caption', // Use this if you are using an image or video
2077
+ footer: 'Hello World!',
2078
+ buttons: [{
2079
+ buttonId: 'Id1',
2080
+ buttonText: {
2081
+ displayText: 'Button 1'
2082
+ }
2083
+ },
2084
+ {
2085
+ buttonId: 'Id2',
2086
+ buttonText: {
2087
+ displayText: 'Button 2'
2088
+ }
2089
+ },
2090
+ {
2091
+ buttonId: 'Id3',
2092
+ buttonText: {
2093
+ displayText: 'Button 3'
2094
+ }
2095
+ }]
2096
+ }
2097
+ )
2098
+ ```
2099
+
2100
+ ### Buttons List Message
2101
+ ```ts
2102
+ // Just working in a private chat
2103
+ await sock.sendMessage(
2104
+ jid,
2105
+ {
2106
+ text: 'This is a list!',
2107
+ footer: 'Hello World!',
2108
+ title: 'Amazing boldfaced list title',
2109
+ buttonText: 'Required, text on the button to view the list',
2110
+ sections: [
2111
+ {
2112
+ title: 'Section 1',
2113
+ rows: [{
2114
+ title: 'Option 1',
2115
+ rowId: 'option1'
2116
+ },
2117
+ {
2118
+ title: 'Option 2',
2119
+ rowId: 'option2',
2120
+ description: 'This is a description'
2121
+ }]
2122
+ },
2123
+ {
2124
+ title: 'Section 2',
2125
+ rows: [{
2126
+ title: 'Option 3',
2127
+ rowId: 'option3'
2128
+ },
2129
+ {
2130
+ title: 'Option 4',
2131
+ rowId: 'option4',
2132
+ description: 'This is a description V2'
2133
+ }]
2134
+ }]
2135
+ }
2136
+ )
2137
+ ```
2138
+
2139
+ ### Buttons Product List Message
2140
+ ```ts
2141
+ // Just working in a private chat
2142
+ await sock.sendMessage(
2143
+ jid,
2144
+ {
2145
+ text: 'This is a list!',
2146
+ footer: 'Hello World!',
2147
+ title: 'Amazing boldfaced list title',
2148
+ buttonText: 'Required, text on the button to view the list',
2149
+ productList: [{
2150
+ title: 'This is a title',
2151
+ products: [
2152
+ {
2153
+ productId: '1234'
2154
+ },
2155
+ {
2156
+ productId: '5678'
2157
+ }
2158
+ ]
2159
+ }],
2160
+ businessOwnerJid: '628xxx@s.whatsapp.net',
2161
+ thumbnail: 'https://example.com/jdbenkksjs.jpg' // or buffer
2162
+ }
2163
+ )
2164
+ ```
2165
+
2166
+ ### Buttons Cards Message
2167
+ ```ts
2168
+ await sock.sendMessage(
2169
+ jid,
2170
+ {
2171
+ text: 'Body Message',
2172
+ title: 'Title Message',
2173
+ subtile: 'Subtitle Message',
2174
+ footer: 'Footer Message',
2175
+ cards: [
2176
+ {
2177
+ image: { url: 'https://example.com/jdbenkksjs.jpg' }, // or buffer
2178
+ title: 'Title Cards',
2179
+ body: 'Body Cards',
2180
+ footer: 'Footer Cards',
2181
+ buttons: [
2182
+ {
2183
+ name: 'quick_reply',
2184
+ buttonParamsJson: JSON.stringify({
2185
+ display_text: 'Display Button',
2186
+ id: 'ID'
2187
+ })
2188
+ },
2189
+ {
2190
+ name: 'cta_url',
2191
+ buttonParamsJson: JSON.stringify({
2192
+ display_text: 'Display Button',
2193
+ url: 'https://www.example.com'
2194
+ })
2195
+ }
2196
+ ]
2197
+ },
2198
+ {
2199
+ video: { url: 'https://example.com/jdbenkksjs.mp4' }, // or buffer
2200
+ title: 'Title Cards',
2201
+ body: 'Body Cards',
2202
+ footer: 'Footer Cards',
2203
+ buttons: [
2204
+ {
2205
+ name: 'quick_reply',
2206
+ buttonParamsJson: JSON.stringify({
2207
+ display_text: 'Display Button',
2208
+ id: 'ID'
2209
+ })
2210
+ },
2211
+ {
2212
+ name: 'cta_url',
2213
+ buttonParamsJson: JSON.stringify({
2214
+ display_text: 'Display Button',
2215
+ url: 'https://www.example.com'
2216
+ })
2217
+ }
2218
+ ]
2219
+ }
2220
+ ]
2221
+ }
2222
+ )
2223
+ ```
2224
+
2225
+ ### Buttons Template Message
2226
+ ```ts
2227
+ // This no longer works
2228
+ await sock.sendMessage(
2229
+ jid,
2230
+ {
2231
+ text: 'This is a template message!',
2232
+ footer: 'Hello World!',
2233
+ templateButtons: [{
2234
+ index: 1,
2235
+ urlButton: {
2236
+ displayText: 'Follow Me',
2237
+ url: 'https://whatsapp.com/channel/0029Vag9VSI2ZjCocqa2lB1y'
2238
+ },
2239
+ },
2240
+ {
2241
+ index: 2,
2242
+ callButton: {
2243
+ displayText: 'Call Me!',
2244
+ phoneNumber: '628xxx'
2245
+ },
2246
+ },
2247
+ {
2248
+ index: 3,
2249
+ quickReplyButton: {
2250
+ displayText: 'This is a reply, just like normal buttons!',
2251
+ id: 'id-like-buttons-message'
2252
+ },
2253
+ }]
2254
+ }
2255
+ )
2256
+ ```
2257
+
2258
+ ### Buttons Interactive Message
2259
+ ```ts
2260
+ await sock.sendMessage(
2261
+ jid,
2262
+ {
2263
+ text: 'This is an Interactive message!',
2264
+ title: 'Hiii',
2265
+ subtitle: 'There is a subtitle',
2266
+ footer: 'Hello World!',
2267
+ interactiveButtons: [
2268
+ {
2269
+ name: 'quick_reply',
2270
+ buttonParamsJson: JSON.stringify({
2271
+ display_text: 'Click Me!',
2272
+ id: 'your_id'
2273
+ })
2274
+ },
2275
+ {
2276
+ name: 'cta_url',
2277
+ buttonParamsJson: JSON.stringify({
2278
+ display_text: 'Follow Me',
2279
+ url: 'https://whatsapp.com/channel/0029Vag9VSI2ZjCocqa2lB1y',
2280
+ merchant_url: 'https://whatsapp.com/channel/0029Vag9VSI2ZjCocqa2lB1y'
2281
+ })
2282
+ },
2283
+ {
2284
+ name: 'cta_copy',
2285
+ buttonParamsJson: JSON.stringify({
2286
+ display_text: 'Click Me!',
2287
+ copy_code: 'https://whatsapp.com/channel/0029Vag9VSI2ZjCocqa2lB1y'
2288
+ })
2289
+ },
2290
+ {
2291
+ name: 'cta_call',
2292
+ buttonParamsJson: JSON.stringify({
2293
+ display_text: 'Call Me!',
2294
+ phone_number: '628xxx'
2295
+ })
2296
+ },
2297
+ {
2298
+ name: 'cta_catalog',
2299
+ buttonParamsJson: JSON.stringify({
2300
+ business_phone_number: '628xxx'
2301
+ })
2302
+ },
2303
+ {
2304
+ name: 'cta_reminder',
2305
+ buttonParamsJson: JSON.stringify({
2306
+ display_text: '...'
2307
+ })
2308
+ },
2309
+ {
2310
+ name: 'cta_cancel_reminder',
2311
+ buttonParamsJson: JSON.stringify({
2312
+ display_text: '...'
2313
+ })
2314
+ },
2315
+ {
2316
+ name: 'address_message',
2317
+ buttonParamsJson: JSON.stringify({
2318
+ display_text: '...'
2319
+ })
2320
+ },
2321
+ {
2322
+ name: 'send_location',
2323
+ buttonParamsJson: JSON.stringify({
2324
+ display_text: '...'
2325
+ })
2326
+ },
2327
+ {
2328
+ name: 'open_webview',
2329
+ buttonParamsJson: JSON.stringify({
2330
+ title: 'Follow Me!',
2331
+ link: {
2332
+ in_app_webview: true, // or false
2333
+ url: 'https://whatsapp.com/channel/0029Vag9VSI2ZjCocqa2lB1y'
2334
+ }
2335
+ })
2336
+ },
2337
+ {
2338
+ name: 'mpm',
2339
+ buttonParamsJson: JSON.stringify({
2340
+ product_id: '8816262248471474'
2341
+ })
2342
+ },
2343
+ {
2344
+ name: 'wa_payment_transaction_details',
2345
+ buttonParamsJson: JSON.stringify({
2346
+ transaction_id: '12345848'
2347
+ })
2348
+ },
2349
+ {
2350
+ name: 'automated_greeting_message_view_catalog',
2351
+ buttonParamsJson: JSON.stringify({
2352
+ business_phone_number: '628xxx',
2353
+ catalog_product_id: '12345'
2354
+ })
2355
+ },
2356
+ {
2357
+ name: 'galaxy_message',
2358
+ buttonParamsJson: JSON.stringify({
2359
+ mode: 'published',
2360
+ flow_message_version: '3',
2361
+ flow_token: '1:1307913409923914:293680f87029f5a13d1ec5e35e718af3',
2362
+ flow_id: '1307913409923914',
2363
+ flow_cta: 'Itsukichann kawaii >\\<',
2364
+ flow_action: 'navigate',
2365
+ flow_action_payload: {
2366
+ screen: 'QUESTION_ONE',
2367
+ params: {
2368
+ user_id: '123456789',
2369
+ referral: 'campaign_xyz'
2370
+ }
2371
+ },
2372
+ flow_metadata: {
2373
+ flow_json_version: '201',
2374
+ data_api_protocol: 'v2',
2375
+ flow_name: 'Lead Qualification [en]',
2376
+ data_api_version: 'v2',
2377
+ categories: ['Lead Generation', 'Sales']
2378
+ }
2379
+ })
2380
+ },
2381
+ {
2382
+ name: 'single_select',
2383
+ buttonParamsJson: JSON.stringify({
2384
+ title: 'Click Me!',
2385
+ sections: [
2386
+ {
2387
+ title: 'Title 1',
2388
+ highlight_label: 'Highlight label 1',
2389
+ rows: [
2390
+ {
2391
+ header: 'Header 1',
2392
+ title: 'Title 1',
2393
+ description: 'Description 1',
2394
+ id: 'Id 1'
2395
+ },
2396
+ {
2397
+ header: 'Header 2',
2398
+ title: 'Title 2',
2399
+ description: 'Description 2',
2400
+ id: 'Id 2'
2401
+ }
2402
+ ]
2403
+ }
2404
+ ]
2405
+ })
2406
+ }
2407
+ ]
2408
+ }
2409
+ )
2410
+
2411
+ // If you want to use an image
2412
+ await sock.sendMessage(
2413
+ jid,
2414
+ {
2415
+ image: {
2416
+ url: 'https://example.com/jdbenkksjs.jpg'
2417
+ },
2418
+ caption: 'Body',
2419
+ title: 'Title',
2420
+ subtitle: 'Subtitle',
2421
+ footer: 'Footer',
2422
+ interactiveButtons: [
2423
+ {
2424
+ name: 'quick_reply',
2425
+ buttonParamsJson: JSON.stringify({
2426
+ display_text: 'DisplayText',
2427
+ id: 'ID1'
2428
+ })
2429
+ }
2430
+ ],
2431
+ hasMediaAttachment: false // or true
2432
+ }
2433
+ )
2434
+
2435
+ // If you want to use an video
2436
+ await sock.sendMessage(
2437
+ jid,
2438
+ {
2439
+ video: {
2440
+ url: 'https://example.com/jdbenkksjs.mp4'
2441
+ },
2442
+ caption: 'Body',
2443
+ title: 'Title',
2444
+ subtitle: 'Subtitle',
2445
+ footer: 'Footer',
2446
+ interactiveButtons: [
2447
+ {
2448
+ name: 'quick_reply',
2449
+ buttonParamsJson: JSON.stringify({
2450
+ display_text: 'DisplayText',
2451
+ id: 'ID1'
2452
+ })
2453
+ }
2454
+ ],
2455
+ hasMediaAttachment: false // or true
2456
+ }
2457
+ )
2458
+
2459
+ // If you want to use an document
2460
+ await sock.sendMessage(
2461
+ jid,
2462
+ {
2463
+ document: {
2464
+ url: 'https://example.com/jdbenkksjs.jpg'
2465
+ },
2466
+ mimetype: 'image/jpeg',
2467
+ jpegThumbnail: await sock.resize('https://example.com/jdbenkksjs.jpg', 320, 320),
2468
+ caption: 'Body',
2469
+ title: 'Title',
2470
+ subtitle: 'Subtitle',
2471
+ footer: 'Footer',
2472
+ interactiveButtons: [
2473
+ {
2474
+ name: 'quick_reply',
2475
+ buttonParamsJson: JSON.stringify({
2476
+ display_text: 'DisplayText',
2477
+ id: 'ID1'
2478
+ })
2479
+ }
2480
+ ],
2481
+ hasMediaAttachment: false // or true
2482
+ }
2483
+ )
2484
+
2485
+ // If you want to use an location
2486
+ await sock.sendMessage(
2487
+ jid,
2488
+ {
2489
+ location: {
2490
+ degressLatitude: -0,
2491
+ degressLongitude: 0,
2492
+ name: 'Hi'
2493
+ },
2494
+ caption: 'Body',
2495
+ title: 'Title',
2496
+ subtitle: 'Subtitle',
2497
+ footer: 'Footer',
2498
+ interactiveButtons: [
2499
+ {
2500
+ name: 'quick_reply',
2501
+ buttonParamsJson: JSON.stringify({
2502
+ display_text: 'DisplayText',
2503
+ id: 'ID1'
2504
+ })
2505
+ }
2506
+ ],
2507
+ hasMediaAttachment: false // or true
2508
+ }
2509
+ )
2510
+
2511
+ // if you want to use an product
2512
+ await sock.sendMessage(
2513
+ jid,
2514
+ {
2515
+ product: {
2516
+ productImage: {
2517
+ url: 'https://example.com/jdbenkksjs.jpg'
2518
+ },
2519
+ productId: '836xxx',
2520
+ title: 'Title',
2521
+ description: 'Description',
2522
+ currencyCode: 'IDR',
2523
+ priceAmount1000: '283xxx',
2524
+ retailerId: 'Itsukichann',
2525
+ url: 'https://example.com',
2526
+ productImageCount: 1
2527
+ },
2528
+ businessOwnerJid: '628xxx@s.whatsapp.net',
2529
+ caption: 'Body',
2530
+ title: 'Title',
2531
+ subtitle: 'Subtitle',
2532
+ footer: 'Footer',
2533
+ interactiveButtons: [
2534
+ {
2535
+ name: 'quick_reply',
2536
+ buttonParamsJson: JSON.stringify({
2537
+ display_text: 'DisplayText',
2538
+ id: 'ID1'
2539
+ })
2540
+ }
2541
+ ],
2542
+ hasMediaAttachment: false // or true
2543
+ }
2544
+ )
2545
+ ```
2546
+
2547
+ ### Buttons Interactive Message PIX
2548
+ ```ts
2549
+ await sock.sendMessage(
2550
+ jid,
2551
+ {
2552
+ text: '', // This string is required. Even it's empty.
2553
+ interactiveButtons: [
2554
+ {
2555
+ name: 'payment_info',
2556
+ buttonParamsJson: JSON.stringify({
2557
+ payment_settings: [{
2558
+ type: "pix_static_code",
2559
+ pix_static_code: {
2560
+ merchant_name: 'itsukichann kawaii >\\\\\\<',
2561
+ key: 'example@itsukichan.com',
2562
+ key_type: 'EMAIL' // PHONE || EMAIL || CPF || EVP
2563
+ }
2564
+ }]
2565
+ })
2566
+ }
2567
+ ],
2568
+ }
2569
+ )
2570
+ ```
2571
+
2572
+ ### Buttons Interactive Message PAY
2573
+ ```ts
2574
+ await sock.sendMessage(
2575
+ jid,
2576
+ {
2577
+ text: '', // This string is required. Even it's empty.
2578
+ interactiveButtons: [
2579
+ {
2580
+ name: 'review_and_pay',
2581
+ buttonParamsJson: JSON.stringify({
2582
+ currency: 'IDR',
2583
+ payment_configuration: '',
2584
+ payment_type: '',
2585
+ total_amount: {
2586
+ value: '999999999',
2587
+ offset: '100'
2588
+ },
2589
+ reference_id: '45XXXXX',
2590
+ type: 'physical-goods',
2591
+ payment_method: 'confirm',
2592
+ payment_status: 'captured',
2593
+ payment_timestamp: Math.floor(Date.now() / 1000),
2594
+ order: {
2595
+ status: 'completed',
2596
+ description: '',
2597
+ subtotal: {
2598
+ value: '0',
2599
+ offset: '100'
2600
+ },
2601
+ order_type: 'PAYMENT_REQUEST',
2602
+ items: [{
2603
+ retailer_id: 'your_retailer_id',
2604
+ name: 'Itsukichann Kawaii >\\\<',
2605
+ amount: {
2606
+ value: '999999999',
2607
+ offset: '100'
2608
+ },
2609
+ quantity: '1',
2610
+ }]
2611
+ },
2612
+ additional_note: 'Itsukichann Kawaii >\\\<',
2613
+ native_payment_methods: [],
2614
+ share_payment_status: false
2615
+ })
2616
+ }
2617
+ ],
2618
+ }
2619
+ )
2620
+ ```
2621
+
2622
+ ### Status Mentions Message
2623
+ ```ts
2624
+ const jidat = [
2625
+ '123451679@g.us',
2626
+ '124848899@g.us',
2627
+ '111384848@g.us',
2628
+ '62689xxxx@s.whatsapp.net',
2629
+ '62xxxxxxx@s.whatsapp.net'
2630
+ ]
2631
+ // Text
2632
+ await sock.sendStatusMentions(
2633
+ {
2634
+ text: 'Hello Everyone :3',
2635
+ font: 2, // optional
2636
+ textColor: 'FF0000', // optional
2637
+ backgroundColor: '#000000' // optional
2638
+ },
2639
+ jids // Limit to 5 mentions per status
2640
+ )
2641
+
2642
+ // Image
2643
+ await sock.sendStatusMentions(
2644
+ {
2645
+ Image: { url: 'https://example.com/ruriooe.jpg' }, or image buffer
2646
+ caption: 'Hello Everyone :3' // optional
2647
+ },
2648
+ jids // Limit to 5 mentions per status
2649
+ )
2650
+
2651
+ // Video
2652
+ await sock.sendStatusMentions(
2653
+ {
2654
+ video: { url: 'https://example.com/ruriooe.mp4' }, or video buffer
2655
+ caption: 'Hello Everyone :3' // optional
2656
+ },
2657
+ jids // Limit to 5 mentions per status
2658
+ )
2659
+
2660
+ // Audio
2661
+ await sock.sendStatusMentions(
2662
+ {
2663
+ audio: { url: 'https://example.com/ruriooe.mp3' }, or audio buffer
2664
+ backgroundColor: '#000000', // optional
2665
+ mimetype: 'audio/mp4',
2666
+ ppt: true
2667
+ },
2668
+ jids // Limit to 5 mentions per status
2669
+ )
2670
+ ```
2671
+
2672
+ ### Shop Message
2673
+ ```ts
2674
+ await sock.sendMessage(
2675
+ jid,
2676
+ {
2677
+ text: 'Body',
2678
+ title: 'Title',
2679
+ subtitle: 'Subtitle',
2680
+ footer: 'Footer',
2681
+ shop: {
2682
+ surface: 1, // 2 | 3 | 4
2683
+ id: 'https://example.com'
2684
+ },
2685
+ viewOnce: true
2686
+ }
2687
+ )
2688
+
2689
+ // Image
2690
+ await sock.sendMessage(
2691
+ jid,
2692
+ {
2693
+ image: {
2694
+ url: 'https://example.com/jdbenkksjs.jpg'
2695
+ },
2696
+ caption: 'Body',
2697
+ title: 'Title',
2698
+ subtitle: 'Subtitle',
2699
+ footer: 'Footer',
2700
+ shop: {
2701
+ surface: 1, // 2 | 3 | 4
2702
+ id: 'https://example.com'
2703
+ },
2704
+ hasMediaAttachment: false, // or true
2705
+ viewOnce: true
2706
+ }
2707
+ )
2708
+
2709
+ // Video
2710
+ await sock.sendMessage(
2711
+ jid,
2712
+ {
2713
+ video: {
2714
+ url: 'https://example.com/jdbenkksjs.jpg'
2715
+ },
2716
+ caption: 'Body',
2717
+ title: 'Title',
2718
+ subtitle: 'Subtitle',
2719
+ footer: 'Footer',
2720
+ shop: {
2721
+ surface: 1, // 2 | 3 | 4
2722
+ id: 'https://example.com'
2723
+ },
2724
+ hasMediaAttachment: false, // or true
2725
+ viewOnce: true
2726
+ }
2727
+ )
2728
+
2729
+ // Document
2730
+ await sock.sendMessage(
2731
+ jid,
2732
+ {
2733
+ document: {
2734
+ url: 'https://example.com/jdbenkksjs.jpg'
2735
+ },
2736
+ mimetype: 'image/jpeg',
2737
+ jpegThumbnail: await sock.resize('https://example.com/jdbenkksjs.jpg', 320, 320),
2738
+ caption: 'Body',
2739
+ title: 'Title',
2740
+ subtitle: 'Subtitle',
2741
+ footer: 'Footer',
2742
+ shop: {
2743
+ surface: 1, // 2 | 3 | 4
2744
+ id: 'https://example.com'
2745
+ },
2746
+ hasMediaAttachment: false, // or true,
2747
+ viewOnce: true
2748
+ }
2749
+ )
2750
+
2751
+ // Location
2752
+ await sock.sendMessage(
2753
+ jid,
2754
+ {
2755
+ location: {
2756
+ degressLatitude: -0,
2757
+ degressLongitude: 0,
2758
+ name: 'Hi'
2759
+ },
2760
+ caption: 'Body',
2761
+ title: 'Title',
2762
+ subtitle: 'Subtitle',
2763
+ footer: 'Footer',
2764
+ shop: {
2765
+ surface: 1, // 2 | 3 | 4
2766
+ id: 'https://example.com'
2767
+ },
2768
+ hasMediaAttachment: false, // or true
2769
+ viewOnce: true
2770
+ }
2771
+ )
2772
+
2773
+ // Product
2774
+ await sock.sendMessage(
2775
+ jid,
2776
+ {
2777
+ product: {
2778
+ productImage: {
2779
+ url: 'https://example.com/jdbenkksjs.jpg'
2780
+ },
2781
+ productId: '836xxx',
2782
+ title: 'Title',
2783
+ description: 'Description',
2784
+ currencyCode: 'IDR',
2785
+ priceAmount1000: '283xxx',
2786
+ retailerId: 'Itsukichann',
2787
+ url: 'https://example.com',
2788
+ productImageCount: 1
2789
+ },
2790
+ businessOwnerJid: '628xxx@s.whatsapp.net',
2791
+ caption: 'Body',
2792
+ title: 'Title',
2793
+ subtitle: 'Subtitle',
2794
+ footer: 'Footer',
2795
+ shop: {
2796
+ surface: 1, // 2 | 3 | 4
2797
+ id: 'https://example.com'
2798
+ },
2799
+ hasMediaAttachment: false, // or true
2800
+ viewOnce: true
2801
+ }
2802
+ )
2803
+ ```
2804
+ ### Collection Message
2805
+ ```ts
2806
+ await sock.sendMessage(
2807
+ jid,
2808
+ {
2809
+ text: 'Body',
2810
+ title: 'Title',
2811
+ subtitle: 'Subtitle',
2812
+ footer: 'Footer',
2813
+ collection: {
2814
+ bizJid: 'jid',
2815
+ id: 'https://example.com',
2816
+ version: 1
2817
+ },
2818
+ viewOnce: true
2819
+ }
2820
+ )
2821
+
2822
+ // Image
2823
+ await sock.sendMessage(
2824
+ jid,
2825
+ {
2826
+ image: {
2827
+ url: 'https://example.com/jdbenkksjs.jpg'
2828
+ },
2829
+ caption: 'Body',
2830
+ title: 'Title',
2831
+ subtitle: 'Subtitle',
2832
+ footer: 'Footer',
2833
+ collection: {
2834
+ bizJid: 'jid',
2835
+ id: 'https://example.com',
2836
+ version: 1
2837
+ },
2838
+ hasMediaAttachment: false, // or true
2839
+ viewOnce: true
2840
+ }
2841
+ )
2842
+
2843
+ // Video
2844
+ await sock.sendMessage(
2845
+ jid,
2846
+ {
2847
+ video: {
2848
+ url: 'https://example.com/jdbenkksjs.jpg'
2849
+ },
2850
+ caption: 'Body',
2851
+ title: 'Title',
2852
+ subtitle: 'Subtitle',
2853
+ footer: 'Footer',
2854
+ collection: {
2855
+ bizJid: 'jid',
2856
+ id: 'https://example.com',
2857
+ version: 1
2858
+ },
2859
+ hasMediaAttachment: false, // or true
2860
+ viewOnce: true
2861
+ }
2862
+ )
2863
+
2864
+ // Document
2865
+ await sock.sendMessage(
2866
+ jid,
2867
+ {
2868
+ document: {
2869
+ url: 'https://example.com/jdbenkksjs.jpg'
2870
+ },
2871
+ mimetype: 'image/jpeg',
2872
+ jpegThumbnail: await sock.resize('https://example.com/jdbenkksjs.jpg', 320, 320),
2873
+ caption: 'Body',
2874
+ title: 'Title',
2875
+ subtitle: 'Subtitle',
2876
+ footer: 'Footer',
2877
+ collection: {
2878
+ bizJid: 'jid',
2879
+ id: 'https://example.com',
2880
+ version: 1
2881
+ },
2882
+ hasMediaAttachment: false, // or true,
2883
+ viewOnce: true
2884
+ }
2885
+ )
2886
+
2887
+ // Location
2888
+ await sock.sendMessage(
2889
+ jid,
2890
+ {
2891
+ location: {
2892
+ degressLatitude: -0,
2893
+ degressLongitude: 0,
2894
+ name: 'Hi'
2895
+ },
2896
+ caption: 'Body',
2897
+ title: 'Title',
2898
+ subtitle: 'Subtitle',
2899
+ footer: 'Footer',
2900
+ collection: {
2901
+ bizJid: 'jid',
2902
+ id: 'https://example.com',
2903
+ version: 1
2904
+ },
2905
+ hasMediaAttachment: false, // or true
2906
+ viewOnce: true
2907
+ }
2908
+ )
2909
+
2910
+ // Product
2911
+ await sock.sendMessage(
2912
+ jid,
2913
+ {
2914
+ product: {
2915
+ productImage: {
2916
+ url: 'https://example.com/jdbenkksjs.jpg'
2917
+ },
2918
+ productId: '836xxx',
2919
+ title: 'Title',
2920
+ description: 'Description',
2921
+ currencyCode: 'IDR',
2922
+ priceAmount1000: '283xxx',
2923
+ retailerId: 'Itsukichann',
2924
+ url: 'https://example.com',
2925
+ productImageCount: 1
2926
+ },
2927
+ businessOwnerJid: '628xxx@s.whatsapp.net',
2928
+ caption: 'Body',
2929
+ title: 'Title',
2930
+ subtitle: 'Subtitle',
2931
+ footer: 'Footer',
2932
+ collection: {
2933
+ bizJid: 'jid',
2934
+ id: 'https://example.com',
2935
+ version: 1
2936
+ },
2937
+ hasMediaAttachment: false, // or true
2938
+ viewOnce: true
2939
+ }
2940
+ )
2941
+ ```
2942
+
2943
+ ### AI Icon Feature
2944
+ ```ts
2945
+ await sock.sendMessage(
2946
+ jid,
2947
+ {
2948
+ text: 'Hi'
2949
+ }, {
2950
+ ai: true // Add ai usage and change it to true
2951
+ }
2952
+ )
2953
+
2954
+ // If using relay
2955
+ await sock.relayMessage(
2956
+ jid,
2957
+ {
2958
+ extendedTextMessage: {
2959
+ text: 'Hi'
2960
+ }
2961
+ }, {
2962
+ AI: true // Use capital letters
2963
+ }
2964
+ )
2965
+ ```
2966
+
2967
+ ## 📄 Lisensi
2968
+
2969
+ Didistribusikan di bawah Lisensi GPL-3.0. Lihat [LICENSE](LICENSE) untuk info lebih lanjut.