@vinzsocket/baileys 3.2.5 → 3.2.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 CHANGED
@@ -5,7 +5,7 @@
5
5
  **A lightweight WebSocket library for WhatsApp Web Multi-Device**
6
6
 
7
7
  [![GitHub Repo](https://img.shields.io/badge/GitHub-VinzSocket/Baileys-blue?style=for-the-badge&logo=github)](https://github.com/VinzSocket/Baileys)
8
- ![Version](https://img.shields.io/badge/version-3.1.9-blue)
8
+ ![Version](https://img.shields.io/badge/version-3.2.6-blue)
9
9
  ![Node.js](https://img.shields.io/badge/Node.js-%3E%3D20-green)
10
10
  ![NPM](https://img.shields.io/badge/npm-@vinzsocket/baileys-red)
11
11
 
@@ -37,10 +37,6 @@ Library ini memungkinkan kamu berinteraksi langsung dengan **WhatsApp Web Multi-
37
37
  - Reaction, Mention, Quoted Message
38
38
  - View Once, Edit Message, Revoke Message
39
39
  - Location, Contact, Poll
40
- - **List Message** (flat & nested multi-section)
41
- - **Interactive Message** — semua Native Flow V7 button shape
42
- - Album, Event, Product, Request Payment
43
- - Group Status V2 (group story)
44
40
 
45
41
  ### 👥 Group Management
46
42
  - Create Group
@@ -68,317 +64,4 @@ Library ini memungkinkan kamu berinteraksi langsung dengan **WhatsApp Web Multi-
68
64
  ## 📦 Installation
69
65
 
70
66
  ```bash
71
- npm install @vinzsocket/baileys
72
- ```
73
-
74
- ---
75
-
76
- ## 🔔 Changelog v3.1.9
77
-
78
- - fix(process-message): only drop self-only protocolMessages from non-self senders
79
- - feat(dugong): tambah **nested list** (`nestedListMessage`) — list yang isinya ada list lagi
80
- - feat(dugong): export semua **Native Flow V7 button builder** (`nfButtonUrl`, `nfButtonCall`, `nfButtonCopy`, `nfButtonReminder`, `nfButtonCancelReminder`, `nfButtonAddress`, `nfButtonLocation`, `nfButtonQuickReply`, `nfButtonSingleSelect`, `nfButtonReviewPay`, `nfButtonReviewOrder`, `nfButtonMPM`)
81
- - feat(messages-send): wire `NESTED_LIST` case ke `sendMessage()` dengan proper `additionalNodes`
82
-
83
- ---
84
-
85
- ## 📨 Mengirim Pesan Interaktif
86
-
87
- Semua interactive message dikirim lewat `conn.sendMessage()`. Untuk bot yang pakai `simple.js`, gunakan wrapper `conn.sendInteractive()` / `conn.sendList()` / `conn.sendNestedList()` sesuai kebutuhan.
88
-
89
- ### Legacy List Message (sendList)
90
-
91
- ```js
92
- await conn.sendMessage(jid, {
93
- listMessage: {
94
- title: 'Pilih menu',
95
- description: 'Footer pesan',
96
- buttonText: '📋 Buka Menu',
97
- listType: 1,
98
- sections: [
99
- {
100
- title: '🎮 Kategori',
101
- rows: [
102
- { rowId: 'rpg_shop', title: '🏪 Shop', description: 'Beli item' },
103
- { rowId: 'rpg_inv', title: '🎒 Inventory', description: 'Lihat inventory' }
104
- ]
105
- }
106
- ]
107
- }
108
- })
109
- ```
110
-
111
- ---
112
-
113
- ### Nested List (list dalam list)
114
-
115
- Gunakan `nestedListMessage`. Rows yang punya field `rows` sendiri akan otomatis di-flatten jadi section baru.
116
-
117
- ```js
118
- await conn.sendMessage(jid, {
119
- nestedListMessage: {
120
- title: '🛒 Pilih Kategori & Item',
121
- buttonText: '📋 Buka Menu',
122
- footer: 'Harps-MD Shop',
123
- sections: [
124
- {
125
- title: '⚔️ Senjata',
126
- rows: [
127
- // flat row biasa
128
- { rowId: 'wpn_sword', title: '🗡️ Pedang', description: '50 ATK' },
129
- // nested row → dijadikan section baru
130
- {
131
- title: '🏹 Senjata Jarak Jauh',
132
- rows: [
133
- { rowId: 'wpn_bow', title: '🏹 Busur', description: '35 ATK' },
134
- { rowId: 'wpn_crossbow', title: '🔫 Crossbow', description: '45 ATK' }
135
- ]
136
- }
137
- ]
138
- },
139
- {
140
- title: '🛡️ Armor',
141
- rows: [
142
- { rowId: 'arm_light', title: '👕 Light Armor', description: '20 DEF' },
143
- { rowId: 'arm_heavy', title: '🛡️ Heavy Armor', description: '50 DEF' }
144
- ]
145
- }
146
- ]
147
- }
148
- })
149
- ```
150
-
151
- Hasil di WhatsApp: section *"⚔️ Senjata"* lalu section baru *"🏹 Senjata Jarak Jauh"* lalu *"🛡️ Armor"*.
152
-
153
- ---
154
-
155
- ## ⚡ Native Flow V7 Button Builders
156
-
157
- Import langsung dari library:
158
-
159
- ```js
160
- import {
161
- nfButtonUrl,
162
- nfButtonCall,
163
- nfButtonCopy,
164
- nfButtonReminder,
165
- nfButtonCancelReminder,
166
- nfButtonAddress,
167
- nfButtonLocation,
168
- nfButtonQuickReply,
169
- nfButtonSingleSelect,
170
- nfButtonReviewPay,
171
- nfButtonReviewOrder,
172
- nfButtonMPM
173
- } from '@vinzsocket/baileys/lib/Socket/dugong.js'
174
- ```
175
-
176
- ### Semua Button Type
177
-
178
- | Builder | `name` (proto) | Fungsi |
179
- |---|---|---|
180
- | `nfButtonUrl` | `cta_url` | Buka URL di browser |
181
- | `nfButtonCall` | `cta_call` | Langsung telepon |
182
- | `nfButtonCopy` | `cta_copy` | Salin teks/kode OTP |
183
- | `nfButtonReminder` | `cta_reminder` | Set reminder di kalender |
184
- | `nfButtonCancelReminder` | `cta_cancel_reminder` | Batalkan reminder |
185
- | `nfButtonAddress` | `address_message` | Isi & kirim alamat |
186
- | `nfButtonLocation` | `send_location` | Kirim lokasi GPS |
187
- | `nfButtonQuickReply` | `quick_reply` | Balas cepat dengan payload |
188
- | `nfButtonSingleSelect` | `single_select` | Dropdown / bottom sheet pilihan |
189
- | `nfButtonReviewPay` | `review_and_pay` | Review & bayar order |
190
- | `nfButtonReviewOrder` | `review_order` | Review order saja |
191
- | `nfButtonMPM` | `mpm` | Tampilkan katalog produk |
192
-
193
- ---
194
-
195
- ### Contoh: Tombol URL + Copy + Quick Reply
196
-
197
- ```js
198
- import { nfButtonUrl, nfButtonCopy, nfButtonQuickReply } from '@vinzsocket/baileys/lib/Socket/dugong.js'
199
-
200
- await conn.sendMessage(jid, {
201
- interactiveMessage: {
202
- title: '✅ Verifikasi Akun',
203
- footer: 'Harps-MD',
204
- buttons: [
205
- nfButtonUrl({
206
- displayText: '🌐 Buka Website',
207
- url: 'https://example.com'
208
- }),
209
- nfButtonCopy({
210
- displayText: '📋 Salin Kode',
211
- copyCode: 'ABC123'
212
- }),
213
- nfButtonQuickReply({
214
- id: 'confirm_yes',
215
- displayText: '✅ Konfirmasi'
216
- })
217
- ]
218
- }
219
- })
220
- ```
221
-
222
- ---
223
-
224
- ### Contoh: Tombol Single-Select (Dropdown Bottom Sheet)
225
-
226
- ```js
227
- import { nfButtonSingleSelect } from '@vinzsocket/baileys/lib/Socket/dugong.js'
228
-
229
- await conn.sendMessage(jid, {
230
- interactiveMessage: {
231
- title: '⚙️ Pilih Difficulty',
232
- footer: 'RPG Game',
233
- buttons: [
234
- nfButtonSingleSelect({
235
- displayText: '🎯 Pilih Level',
236
- sections: [
237
- {
238
- title: '🟢 Mudah',
239
- rows: [
240
- { id: 'diff_easy', title: 'Easy', description: 'Untuk pemula' },
241
- { id: 'diff_normal', title: 'Normal', description: 'Standar' }
242
- ]
243
- },
244
- {
245
- title: '🔴 Susah',
246
- rows: [
247
- { id: 'diff_hard', title: 'Hard', description: 'Untuk pro' },
248
- { id: 'diff_insane', title: 'Insane', description: 'GG' }
249
- ]
250
- }
251
- ]
252
- })
253
- ]
254
- }
255
- })
256
- ```
257
-
258
- ---
259
-
260
- ### Contoh: Interactive + Gambar
261
-
262
- ```js
263
- await conn.sendMessage(jid, {
264
- interactiveMessage: {
265
- title: '🎮 RPG Shop',
266
- footer: 'Pilih item yang mau dibeli',
267
- image: { url: 'https://example.com/shop.jpg' },
268
- buttons: [
269
- nfButtonQuickReply({ id: 'buy_sword', displayText: '🗡️ Beli Pedang' }),
270
- nfButtonQuickReply({ id: 'buy_shield', displayText: '🛡️ Beli Tameng' }),
271
- nfButtonUrl({ displayText: '📖 Lihat Katalog', url: 'https://example.com/catalog' })
272
- ]
273
- }
274
- })
275
- ```
276
-
277
- ---
278
-
279
- ## 🧩 buildNestedListMessage (standalone)
280
-
281
- Kalau mau build raw proto payload tanpa `sendMessage`:
282
-
283
- ```js
284
- import { buildNestedListMessage } from '@vinzsocket/baileys/lib/Socket/dugong.js'
285
-
286
- const payload = buildNestedListMessage({
287
- title: 'Menu Utama',
288
- buttonText: '📋 Buka',
289
- footer: 'Bot Footer',
290
- sections: [
291
- {
292
- title: 'Kategori 1',
293
- rows: [
294
- { rowId: 'a', title: 'Item A' },
295
- {
296
- title: 'Sub-kategori',
297
- rows: [
298
- { rowId: 'b1', title: 'Item B1' },
299
- { rowId: 'b2', title: 'Item B2' }
300
- ]
301
- }
302
- ]
303
- }
304
- ]
305
- })
306
- // payload → { listMessage: { title, description, buttonText, listType, sections } }
307
- ```
308
-
309
- ---
310
-
311
- ## ⚠️ Catatan Penting: Interactive Message Rendering
312
-
313
- WhatsApp butuh binary node hint tambahan agar interactive/button/list message **render** di client. Harps-Baileys sudah otomatis inject ini lewat `buildInteractiveAdditionalNodes()` di `messages-send.js`. **Jangan relay manual** tanpa `additionalNodes`.
314
-
315
- Kalau pakai `relayMessage` langsung:
316
-
317
- ```js
318
- import { buildInteractiveAdditionalNodes } from '@vinzsocket/baileys/lib/Utils/messages.js'
319
-
320
- await relayMessage(jid, msg.message, {
321
- messageId: msg.key.id,
322
- additionalNodes: buildInteractiveAdditionalNodes(jid, msg.message)
323
- })
324
- ```
325
-
326
- Node yang di-inject:
327
- - **List message** → `<biz><list type="product_list" v="2"/></biz>`
328
- - **Interactive/button/template/product** → `<biz><interactive type="native_flow" v="1"><native_flow name="mixed" v="9"/></interactive></biz>`
329
- - **1:1 chat (bukan grup)** → tambahan `<bot biz_bot="1"/>`
330
-
331
- ---
332
-
333
- ## 🔌 Quick Start
334
-
335
- ```js
336
- import makeWASocket, { useMultiFileAuthState } from '@vinzsocket/baileys'
337
-
338
- const { state, saveCreds } = await useMultiFileAuthState('./auth')
339
-
340
- const conn = makeWASocket({
341
- auth: state,
342
- printQRInTerminal: true
343
- })
344
-
345
- conn.ev.on('creds.update', saveCreds)
346
-
347
- conn.ev.on('messages.upsert', async ({ messages }) => {
348
- const msg = messages[0]
349
- if (!msg.message) return
350
- const text = msg.message.conversation || msg.message.extendedTextMessage?.text || ''
351
- const from = msg.key.remoteJid
352
-
353
- if (text === '!menu') {
354
- await conn.sendMessage(from, {
355
- nestedListMessage: {
356
- title: '📋 Main Menu',
357
- buttonText: 'Buka Menu',
358
- footer: 'Harps-MD Bot',
359
- sections: [
360
- {
361
- title: '🎮 Game',
362
- rows: [
363
- { rowId: 'rpg', title: '⚔️ RPG', description: 'Main RPG' },
364
- {
365
- title: '🏆 Kompetitif',
366
- rows: [
367
- { rowId: 'pvp', title: '⚔️ PvP' },
368
- { rowId: 'rank', title: '📊 Ranking' }
369
- ]
370
- }
371
- ]
372
- }
373
- ]
374
- }
375
- }, { quoted: msg })
376
- }
377
- })
378
- ```
379
-
380
- ---
381
-
382
- ## 📄 License
383
-
384
- MIT — © Alvin-B2T
67
+ npm install @vinzsocket/baileys