@nuiisweety/baileys 0.1.12 → 0.1.13
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 +284 -3
- package/README.md.bak +283 -2
- package/lib/Utils/messages.js +172 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*Fork dari [`@whiskeysockets/baileys`](https://github.com/WhiskeySockets/Baileys) v7.0.0-rc11*
|
|
8
8
|
*dikembangkan dengan sepenuh hati oleh **NuiiS4TORU***
|
|
9
9
|
|
|
10
|
-
[](https://www.npmjs.com/package/@nuiisweety/baileys)
|
|
11
11
|
[](LICENSE)
|
|
12
12
|
[](https://github.com/WhiskeySockets/Baileys)
|
|
13
13
|
|
|
@@ -77,7 +77,11 @@
|
|
|
77
77
|
[List Message](#list-message) ·
|
|
78
78
|
[Template Buttons](#template-buttons) ·
|
|
79
79
|
[Native Flow](#native-flow) ·
|
|
80
|
-
[Carousel](#carousel)
|
|
80
|
+
[Carousel](#carousel) ·
|
|
81
|
+
[Shop Message](#shop-message) ·
|
|
82
|
+
[Collection Message](#collection-message) ·
|
|
83
|
+
[Order Status Message](#order-status-message) ·
|
|
84
|
+
[Product List Message](#product-list-message)
|
|
81
85
|
|
|
82
86
|
🤖 **Rich Message (AI)** —
|
|
83
87
|
[Text](#addtext) ·
|
|
@@ -1259,7 +1263,118 @@ await sock.sendMessage(jid, {
|
|
|
1259
1263
|
})
|
|
1260
1264
|
```
|
|
1261
1265
|
|
|
1262
|
-
> **Tipe tombol ditentukan otomatis** dari field yang ada:
|
|
1266
|
+
> **Tipe tombol ditentukan otomatis** dari field yang ada:
|
|
1267
|
+
>
|
|
1268
|
+
> | Field pada button | Native Flow yang dihasilkan |
|
|
1269
|
+
> |---|---|
|
|
1270
|
+
> | `id` | `quick_reply` |
|
|
1271
|
+
> | `url` | `cta_url` |
|
|
1272
|
+
> | `copy` | `cta_copy` |
|
|
1273
|
+
> | `call` | `cta_call` |
|
|
1274
|
+
> | `sections` | `single_select` |
|
|
1275
|
+
> | `catalog` | `cta_catalog` |
|
|
1276
|
+
> | `reminder: true` | `cta_reminder` |
|
|
1277
|
+
> | `cancelReminder: true` | `cta_cancel_reminder` |
|
|
1278
|
+
> | `address: true` | `address_message` |
|
|
1279
|
+
> | `location: true` | `send_location` |
|
|
1280
|
+
> | `webview` | `open_webview` |
|
|
1281
|
+
> | `productId` | `mpm` |
|
|
1282
|
+
> | `transactionId` | `wa_payment_transaction_details` |
|
|
1283
|
+
> | `catalogProduct` | `automated_greeting_message_view_catalog` |
|
|
1284
|
+
> | `flow` | `galaxy_message` (WA Flow) |
|
|
1285
|
+
>
|
|
1286
|
+
> Bisa juga pakai `name` + `paramsJson` langsung untuk kontrol penuh. `text` atau `buttonText` keduanya diterima. Field `icon` opsional (string uppercase, e.g. `'CHECK'`, `'LINK'`).
|
|
1287
|
+
|
|
1288
|
+
```js
|
|
1289
|
+
// Catalog button — buka katalog bisnis
|
|
1290
|
+
await sock.sendMessage(jid, {
|
|
1291
|
+
text: 'Lihat produk kami',
|
|
1292
|
+
nativeFlow: [
|
|
1293
|
+
{ catalog: '628xxx', text: 'Buka Katalog' }
|
|
1294
|
+
]
|
|
1295
|
+
})
|
|
1296
|
+
|
|
1297
|
+
// Reminder button
|
|
1298
|
+
await sock.sendMessage(jid, {
|
|
1299
|
+
text: 'Ingatkan saya',
|
|
1300
|
+
nativeFlow: [
|
|
1301
|
+
{ reminder: true, text: 'Set Pengingat' },
|
|
1302
|
+
{ cancelReminder: true, text: 'Batalkan Pengingat' }
|
|
1303
|
+
]
|
|
1304
|
+
})
|
|
1305
|
+
|
|
1306
|
+
// Address & Location button
|
|
1307
|
+
await sock.sendMessage(jid, {
|
|
1308
|
+
text: 'Butuh info lokasi',
|
|
1309
|
+
nativeFlow: [
|
|
1310
|
+
{ address: true, text: 'Bagikan Alamat' },
|
|
1311
|
+
{ location: true, text: 'Kirim Lokasi' }
|
|
1312
|
+
]
|
|
1313
|
+
})
|
|
1314
|
+
|
|
1315
|
+
// Open Webview button
|
|
1316
|
+
await sock.sendMessage(jid, {
|
|
1317
|
+
text: 'Buka halaman web',
|
|
1318
|
+
nativeFlow: [
|
|
1319
|
+
{ webview: 'https://example.com', text: 'Buka', inAppWebview: true }
|
|
1320
|
+
]
|
|
1321
|
+
})
|
|
1322
|
+
|
|
1323
|
+
// MPM — Multi-product message button
|
|
1324
|
+
await sock.sendMessage(jid, {
|
|
1325
|
+
text: 'Produk pilihan',
|
|
1326
|
+
nativeFlow: [
|
|
1327
|
+
{ productId: '8816262248471474', text: 'Lihat Produk' }
|
|
1328
|
+
]
|
|
1329
|
+
})
|
|
1330
|
+
|
|
1331
|
+
// Payment transaction details button
|
|
1332
|
+
await sock.sendMessage(jid, {
|
|
1333
|
+
text: 'Detail pembayaran',
|
|
1334
|
+
nativeFlow: [
|
|
1335
|
+
{ transactionId: '12345848', text: 'Lihat Detail' }
|
|
1336
|
+
]
|
|
1337
|
+
})
|
|
1338
|
+
|
|
1339
|
+
// Automated greeting catalog button
|
|
1340
|
+
await sock.sendMessage(jid, {
|
|
1341
|
+
text: 'Halo! Cek katalog kami',
|
|
1342
|
+
nativeFlow: [
|
|
1343
|
+
{
|
|
1344
|
+
catalogProduct: { bizPhone: '628xxx', productId: '12345' },
|
|
1345
|
+
text: 'Lihat Katalog'
|
|
1346
|
+
}
|
|
1347
|
+
]
|
|
1348
|
+
})
|
|
1349
|
+
|
|
1350
|
+
// WA Flow (galaxy_message)
|
|
1351
|
+
await sock.sendMessage(jid, {
|
|
1352
|
+
text: 'Isi formulir pendaftaran',
|
|
1353
|
+
nativeFlow: [
|
|
1354
|
+
{
|
|
1355
|
+
flow: {
|
|
1356
|
+
mode: 'published',
|
|
1357
|
+
flowId: '1307913409923914',
|
|
1358
|
+
flowToken: '1:1307913409923914:293680f87029f5a13d1ec5e35e718af3',
|
|
1359
|
+
flowCta: 'Daftar Sekarang',
|
|
1360
|
+
flowAction: 'navigate',
|
|
1361
|
+
flowActionPayload: {
|
|
1362
|
+
screen: 'QUESTION_ONE',
|
|
1363
|
+
params: { user_id: '123456789' }
|
|
1364
|
+
},
|
|
1365
|
+
flowMetadata: {
|
|
1366
|
+
flow_json_version: '201',
|
|
1367
|
+
data_api_protocol: 'v2',
|
|
1368
|
+
flow_name: 'Lead Qualification',
|
|
1369
|
+
data_api_version: 'v2',
|
|
1370
|
+
categories: ['Lead Generation']
|
|
1371
|
+
}
|
|
1372
|
+
},
|
|
1373
|
+
text: 'Buka Flow'
|
|
1374
|
+
}
|
|
1375
|
+
]
|
|
1376
|
+
})
|
|
1377
|
+
```
|
|
1263
1378
|
|
|
1264
1379
|
</details>
|
|
1265
1380
|
|
|
@@ -1298,6 +1413,172 @@ await sock.sendMessage(jid, {
|
|
|
1298
1413
|
|
|
1299
1414
|
---
|
|
1300
1415
|
|
|
1416
|
+
<details>
|
|
1417
|
+
<summary>🏪 Shop Message</summary>
|
|
1418
|
+
|
|
1419
|
+
Menampilkan storefront toko bisnis WhatsApp. Bisa dengan header teks, gambar, video, dokumen, lokasi, atau produk.
|
|
1420
|
+
|
|
1421
|
+
```js
|
|
1422
|
+
// Teks biasa
|
|
1423
|
+
await sock.sendMessage(jid, {
|
|
1424
|
+
text: 'Kunjungi toko kami!',
|
|
1425
|
+
title: 'Toko Kami',
|
|
1426
|
+
subtitle: 'Produk terbaik',
|
|
1427
|
+
footer: 'Belanja sekarang',
|
|
1428
|
+
shop: {
|
|
1429
|
+
surface: 1, // 1 | 2 | 3 | 4
|
|
1430
|
+
id: 'https://example.com'
|
|
1431
|
+
}
|
|
1432
|
+
})
|
|
1433
|
+
|
|
1434
|
+
// Dengan gambar
|
|
1435
|
+
await sock.sendMessage(jid, {
|
|
1436
|
+
image: { url: 'https://example.com/banner.jpg' },
|
|
1437
|
+
caption: 'Promo spesial hari ini!',
|
|
1438
|
+
title: 'Toko Kami',
|
|
1439
|
+
subtitle: 'Diskon 50%',
|
|
1440
|
+
footer: 'Tap untuk belanja',
|
|
1441
|
+
hasMediaAttachment: true,
|
|
1442
|
+
shop: {
|
|
1443
|
+
surface: 1,
|
|
1444
|
+
id: 'https://example.com'
|
|
1445
|
+
}
|
|
1446
|
+
})
|
|
1447
|
+
|
|
1448
|
+
// Dengan video
|
|
1449
|
+
await sock.sendMessage(jid, {
|
|
1450
|
+
video: { url: 'https://example.com/promo.mp4' },
|
|
1451
|
+
caption: 'Tonton promo kami!',
|
|
1452
|
+
title: 'Promo Bulan Ini',
|
|
1453
|
+
footer: 'Belanja sekarang',
|
|
1454
|
+
hasMediaAttachment: true,
|
|
1455
|
+
shop: { surface: 2, id: 'https://example.com' }
|
|
1456
|
+
})
|
|
1457
|
+
```
|
|
1458
|
+
|
|
1459
|
+
</details>
|
|
1460
|
+
|
|
1461
|
+
---
|
|
1462
|
+
|
|
1463
|
+
<details>
|
|
1464
|
+
<summary>📦 Collection Message</summary>
|
|
1465
|
+
|
|
1466
|
+
Menampilkan koleksi produk dari bisnis WhatsApp.
|
|
1467
|
+
|
|
1468
|
+
```js
|
|
1469
|
+
// Teks biasa
|
|
1470
|
+
await sock.sendMessage(jid, {
|
|
1471
|
+
text: 'Koleksi terbaru kami',
|
|
1472
|
+
title: 'Koleksi Musim Ini',
|
|
1473
|
+
subtitle: 'Pilihan terbaik',
|
|
1474
|
+
footer: 'Lihat semua',
|
|
1475
|
+
collection: {
|
|
1476
|
+
bizJid: '628xxx@s.whatsapp.net',
|
|
1477
|
+
id: 'collection-id-123',
|
|
1478
|
+
version: 1
|
|
1479
|
+
}
|
|
1480
|
+
})
|
|
1481
|
+
|
|
1482
|
+
// Dengan gambar
|
|
1483
|
+
await sock.sendMessage(jid, {
|
|
1484
|
+
image: { url: 'https://example.com/collection.jpg' },
|
|
1485
|
+
caption: 'Temukan koleksi terbaru!',
|
|
1486
|
+
title: 'Koleksi Baru',
|
|
1487
|
+
subtitle: 'Limited edition',
|
|
1488
|
+
footer: 'Stok terbatas!',
|
|
1489
|
+
hasMediaAttachment: true,
|
|
1490
|
+
collection: {
|
|
1491
|
+
bizJid: '628xxx@s.whatsapp.net',
|
|
1492
|
+
id: 'collection-id-456',
|
|
1493
|
+
version: 1
|
|
1494
|
+
}
|
|
1495
|
+
})
|
|
1496
|
+
```
|
|
1497
|
+
|
|
1498
|
+
</details>
|
|
1499
|
+
|
|
1500
|
+
---
|
|
1501
|
+
|
|
1502
|
+
<details>
|
|
1503
|
+
<summary>📦 Order Status Message</summary>
|
|
1504
|
+
|
|
1505
|
+
Mengirim kartu status pesanan dengan tampilan native WhatsApp (menggunakan `order_status` native flow, dibungkus view once).
|
|
1506
|
+
|
|
1507
|
+
```js
|
|
1508
|
+
await sock.sendMessage(jid, {
|
|
1509
|
+
orderStatus: {
|
|
1510
|
+
image: 'path/to/image.jpg', // string path, URL, atau Buffer — wajib
|
|
1511
|
+
title: 'Status Pesananmu', // judul header
|
|
1512
|
+
text: 'Pesananmu sedang diproses.',
|
|
1513
|
+
footer: 'Terima kasih sudah belanja!',
|
|
1514
|
+
referenceId: 'ORDER-001', // ID referensi pesanan
|
|
1515
|
+
status: 'PROCESSING', // PROCESSING | COMPLETED | CANCELLED | dst
|
|
1516
|
+
subtotalValue: 50000, // subtotal dalam satuan terkecil
|
|
1517
|
+
subtotalOffset: 100, // pembagi (100 = dalam rupiah)
|
|
1518
|
+
taxValue: 5000,
|
|
1519
|
+
taxOffset: 100,
|
|
1520
|
+
currency: 'IDR'
|
|
1521
|
+
}
|
|
1522
|
+
})
|
|
1523
|
+
|
|
1524
|
+
// Status pesanan selesai
|
|
1525
|
+
await sock.sendMessage(jid, {
|
|
1526
|
+
orderStatus: {
|
|
1527
|
+
image: { url: 'https://example.com/order.jpg' },
|
|
1528
|
+
title: 'Pesanan Selesai! 🎉',
|
|
1529
|
+
text: 'Pesananmu telah dikirim.',
|
|
1530
|
+
referenceId: 'ORDER-789',
|
|
1531
|
+
status: 'COMPLETED',
|
|
1532
|
+
subtotalValue: 150000,
|
|
1533
|
+
subtotalOffset: 100,
|
|
1534
|
+
taxValue: 0,
|
|
1535
|
+
taxOffset: 100,
|
|
1536
|
+
currency: 'IDR'
|
|
1537
|
+
}
|
|
1538
|
+
}, { quoted: m })
|
|
1539
|
+
```
|
|
1540
|
+
|
|
1541
|
+
> ⚠️ `image` wajib diisi — `orderStatus` selalu dibungkus dalam viewOnceMessage.
|
|
1542
|
+
|
|
1543
|
+
</details>
|
|
1544
|
+
|
|
1545
|
+
---
|
|
1546
|
+
|
|
1547
|
+
<details>
|
|
1548
|
+
<summary>🛒 Product List Message</summary>
|
|
1549
|
+
|
|
1550
|
+
Menampilkan list produk bisnis (hanya berfungsi di private chat).
|
|
1551
|
+
|
|
1552
|
+
```js
|
|
1553
|
+
await sock.sendMessage(jid, {
|
|
1554
|
+
text: 'Pilih produk yang kamu inginkan',
|
|
1555
|
+
title: 'Produk Pilihan',
|
|
1556
|
+
buttonText: 'Lihat Daftar Produk',
|
|
1557
|
+
footer: 'Stok terbatas!',
|
|
1558
|
+
businessOwnerJid: '628xxx@s.whatsapp.net',
|
|
1559
|
+
thumbnail: { url: 'https://example.com/thumbnail.jpg' }, // opsional
|
|
1560
|
+
productList: [
|
|
1561
|
+
{
|
|
1562
|
+
title: 'Kategori Makanan',
|
|
1563
|
+
products: [
|
|
1564
|
+
{ productId: '111222333' },
|
|
1565
|
+
{ productId: '444555666' }
|
|
1566
|
+
]
|
|
1567
|
+
},
|
|
1568
|
+
{
|
|
1569
|
+
title: 'Kategori Minuman',
|
|
1570
|
+
products: [
|
|
1571
|
+
{ productId: '777888999' }
|
|
1572
|
+
]
|
|
1573
|
+
}
|
|
1574
|
+
]
|
|
1575
|
+
})
|
|
1576
|
+
```
|
|
1577
|
+
|
|
1578
|
+
</details>
|
|
1579
|
+
|
|
1580
|
+
---
|
|
1581
|
+
|
|
1301
1582
|
<details>
|
|
1302
1583
|
<summary>🏷️ Status Mention</summary>
|
|
1303
1584
|
|
package/README.md.bak
CHANGED
|
@@ -77,7 +77,11 @@
|
|
|
77
77
|
[List Message](#list-message) ·
|
|
78
78
|
[Template Buttons](#template-buttons) ·
|
|
79
79
|
[Native Flow](#native-flow) ·
|
|
80
|
-
[Carousel](#carousel)
|
|
80
|
+
[Carousel](#carousel) ·
|
|
81
|
+
[Shop Message](#shop-message) ·
|
|
82
|
+
[Collection Message](#collection-message) ·
|
|
83
|
+
[Order Status Message](#order-status-message) ·
|
|
84
|
+
[Product List Message](#product-list-message)
|
|
81
85
|
|
|
82
86
|
🤖 **Rich Message (AI)** —
|
|
83
87
|
[Text](#addtext) ·
|
|
@@ -1259,7 +1263,118 @@ await sock.sendMessage(jid, {
|
|
|
1259
1263
|
})
|
|
1260
1264
|
```
|
|
1261
1265
|
|
|
1262
|
-
> **Tipe tombol ditentukan otomatis** dari field yang ada:
|
|
1266
|
+
> **Tipe tombol ditentukan otomatis** dari field yang ada:
|
|
1267
|
+
>
|
|
1268
|
+
> | Field pada button | Native Flow yang dihasilkan |
|
|
1269
|
+
> |---|---|
|
|
1270
|
+
> | `id` | `quick_reply` |
|
|
1271
|
+
> | `url` | `cta_url` |
|
|
1272
|
+
> | `copy` | `cta_copy` |
|
|
1273
|
+
> | `call` | `cta_call` |
|
|
1274
|
+
> | `sections` | `single_select` |
|
|
1275
|
+
> | `catalog` | `cta_catalog` |
|
|
1276
|
+
> | `reminder: true` | `cta_reminder` |
|
|
1277
|
+
> | `cancelReminder: true` | `cta_cancel_reminder` |
|
|
1278
|
+
> | `address: true` | `address_message` |
|
|
1279
|
+
> | `location: true` | `send_location` |
|
|
1280
|
+
> | `webview` | `open_webview` |
|
|
1281
|
+
> | `productId` | `mpm` |
|
|
1282
|
+
> | `transactionId` | `wa_payment_transaction_details` |
|
|
1283
|
+
> | `catalogProduct` | `automated_greeting_message_view_catalog` |
|
|
1284
|
+
> | `flow` | `galaxy_message` (WA Flow) |
|
|
1285
|
+
>
|
|
1286
|
+
> Bisa juga pakai `name` + `paramsJson` langsung untuk kontrol penuh. `text` atau `buttonText` keduanya diterima. Field `icon` opsional (string uppercase, e.g. `'CHECK'`, `'LINK'`).
|
|
1287
|
+
|
|
1288
|
+
```js
|
|
1289
|
+
// Catalog button — buka katalog bisnis
|
|
1290
|
+
await sock.sendMessage(jid, {
|
|
1291
|
+
text: 'Lihat produk kami',
|
|
1292
|
+
nativeFlow: [
|
|
1293
|
+
{ catalog: '628xxx', text: 'Buka Katalog' }
|
|
1294
|
+
]
|
|
1295
|
+
})
|
|
1296
|
+
|
|
1297
|
+
// Reminder button
|
|
1298
|
+
await sock.sendMessage(jid, {
|
|
1299
|
+
text: 'Ingatkan saya',
|
|
1300
|
+
nativeFlow: [
|
|
1301
|
+
{ reminder: true, text: 'Set Pengingat' },
|
|
1302
|
+
{ cancelReminder: true, text: 'Batalkan Pengingat' }
|
|
1303
|
+
]
|
|
1304
|
+
})
|
|
1305
|
+
|
|
1306
|
+
// Address & Location button
|
|
1307
|
+
await sock.sendMessage(jid, {
|
|
1308
|
+
text: 'Butuh info lokasi',
|
|
1309
|
+
nativeFlow: [
|
|
1310
|
+
{ address: true, text: 'Bagikan Alamat' },
|
|
1311
|
+
{ location: true, text: 'Kirim Lokasi' }
|
|
1312
|
+
]
|
|
1313
|
+
})
|
|
1314
|
+
|
|
1315
|
+
// Open Webview button
|
|
1316
|
+
await sock.sendMessage(jid, {
|
|
1317
|
+
text: 'Buka halaman web',
|
|
1318
|
+
nativeFlow: [
|
|
1319
|
+
{ webview: 'https://example.com', text: 'Buka', inAppWebview: true }
|
|
1320
|
+
]
|
|
1321
|
+
})
|
|
1322
|
+
|
|
1323
|
+
// MPM — Multi-product message button
|
|
1324
|
+
await sock.sendMessage(jid, {
|
|
1325
|
+
text: 'Produk pilihan',
|
|
1326
|
+
nativeFlow: [
|
|
1327
|
+
{ productId: '8816262248471474', text: 'Lihat Produk' }
|
|
1328
|
+
]
|
|
1329
|
+
})
|
|
1330
|
+
|
|
1331
|
+
// Payment transaction details button
|
|
1332
|
+
await sock.sendMessage(jid, {
|
|
1333
|
+
text: 'Detail pembayaran',
|
|
1334
|
+
nativeFlow: [
|
|
1335
|
+
{ transactionId: '12345848', text: 'Lihat Detail' }
|
|
1336
|
+
]
|
|
1337
|
+
})
|
|
1338
|
+
|
|
1339
|
+
// Automated greeting catalog button
|
|
1340
|
+
await sock.sendMessage(jid, {
|
|
1341
|
+
text: 'Halo! Cek katalog kami',
|
|
1342
|
+
nativeFlow: [
|
|
1343
|
+
{
|
|
1344
|
+
catalogProduct: { bizPhone: '628xxx', productId: '12345' },
|
|
1345
|
+
text: 'Lihat Katalog'
|
|
1346
|
+
}
|
|
1347
|
+
]
|
|
1348
|
+
})
|
|
1349
|
+
|
|
1350
|
+
// WA Flow (galaxy_message)
|
|
1351
|
+
await sock.sendMessage(jid, {
|
|
1352
|
+
text: 'Isi formulir pendaftaran',
|
|
1353
|
+
nativeFlow: [
|
|
1354
|
+
{
|
|
1355
|
+
flow: {
|
|
1356
|
+
mode: 'published',
|
|
1357
|
+
flowId: '1307913409923914',
|
|
1358
|
+
flowToken: '1:1307913409923914:293680f87029f5a13d1ec5e35e718af3',
|
|
1359
|
+
flowCta: 'Daftar Sekarang',
|
|
1360
|
+
flowAction: 'navigate',
|
|
1361
|
+
flowActionPayload: {
|
|
1362
|
+
screen: 'QUESTION_ONE',
|
|
1363
|
+
params: { user_id: '123456789' }
|
|
1364
|
+
},
|
|
1365
|
+
flowMetadata: {
|
|
1366
|
+
flow_json_version: '201',
|
|
1367
|
+
data_api_protocol: 'v2',
|
|
1368
|
+
flow_name: 'Lead Qualification',
|
|
1369
|
+
data_api_version: 'v2',
|
|
1370
|
+
categories: ['Lead Generation']
|
|
1371
|
+
}
|
|
1372
|
+
},
|
|
1373
|
+
text: 'Buka Flow'
|
|
1374
|
+
}
|
|
1375
|
+
]
|
|
1376
|
+
})
|
|
1377
|
+
```
|
|
1263
1378
|
|
|
1264
1379
|
</details>
|
|
1265
1380
|
|
|
@@ -1298,6 +1413,172 @@ await sock.sendMessage(jid, {
|
|
|
1298
1413
|
|
|
1299
1414
|
---
|
|
1300
1415
|
|
|
1416
|
+
<details>
|
|
1417
|
+
<summary>🏪 Shop Message</summary>
|
|
1418
|
+
|
|
1419
|
+
Menampilkan storefront toko bisnis WhatsApp. Bisa dengan header teks, gambar, video, dokumen, lokasi, atau produk.
|
|
1420
|
+
|
|
1421
|
+
```js
|
|
1422
|
+
// Teks biasa
|
|
1423
|
+
await sock.sendMessage(jid, {
|
|
1424
|
+
text: 'Kunjungi toko kami!',
|
|
1425
|
+
title: 'Toko Kami',
|
|
1426
|
+
subtitle: 'Produk terbaik',
|
|
1427
|
+
footer: 'Belanja sekarang',
|
|
1428
|
+
shop: {
|
|
1429
|
+
surface: 1, // 1 | 2 | 3 | 4
|
|
1430
|
+
id: 'https://example.com'
|
|
1431
|
+
}
|
|
1432
|
+
})
|
|
1433
|
+
|
|
1434
|
+
// Dengan gambar
|
|
1435
|
+
await sock.sendMessage(jid, {
|
|
1436
|
+
image: { url: 'https://example.com/banner.jpg' },
|
|
1437
|
+
caption: 'Promo spesial hari ini!',
|
|
1438
|
+
title: 'Toko Kami',
|
|
1439
|
+
subtitle: 'Diskon 50%',
|
|
1440
|
+
footer: 'Tap untuk belanja',
|
|
1441
|
+
hasMediaAttachment: true,
|
|
1442
|
+
shop: {
|
|
1443
|
+
surface: 1,
|
|
1444
|
+
id: 'https://example.com'
|
|
1445
|
+
}
|
|
1446
|
+
})
|
|
1447
|
+
|
|
1448
|
+
// Dengan video
|
|
1449
|
+
await sock.sendMessage(jid, {
|
|
1450
|
+
video: { url: 'https://example.com/promo.mp4' },
|
|
1451
|
+
caption: 'Tonton promo kami!',
|
|
1452
|
+
title: 'Promo Bulan Ini',
|
|
1453
|
+
footer: 'Belanja sekarang',
|
|
1454
|
+
hasMediaAttachment: true,
|
|
1455
|
+
shop: { surface: 2, id: 'https://example.com' }
|
|
1456
|
+
})
|
|
1457
|
+
```
|
|
1458
|
+
|
|
1459
|
+
</details>
|
|
1460
|
+
|
|
1461
|
+
---
|
|
1462
|
+
|
|
1463
|
+
<details>
|
|
1464
|
+
<summary>📦 Collection Message</summary>
|
|
1465
|
+
|
|
1466
|
+
Menampilkan koleksi produk dari bisnis WhatsApp.
|
|
1467
|
+
|
|
1468
|
+
```js
|
|
1469
|
+
// Teks biasa
|
|
1470
|
+
await sock.sendMessage(jid, {
|
|
1471
|
+
text: 'Koleksi terbaru kami',
|
|
1472
|
+
title: 'Koleksi Musim Ini',
|
|
1473
|
+
subtitle: 'Pilihan terbaik',
|
|
1474
|
+
footer: 'Lihat semua',
|
|
1475
|
+
collection: {
|
|
1476
|
+
bizJid: '628xxx@s.whatsapp.net',
|
|
1477
|
+
id: 'collection-id-123',
|
|
1478
|
+
version: 1
|
|
1479
|
+
}
|
|
1480
|
+
})
|
|
1481
|
+
|
|
1482
|
+
// Dengan gambar
|
|
1483
|
+
await sock.sendMessage(jid, {
|
|
1484
|
+
image: { url: 'https://example.com/collection.jpg' },
|
|
1485
|
+
caption: 'Temukan koleksi terbaru!',
|
|
1486
|
+
title: 'Koleksi Baru',
|
|
1487
|
+
subtitle: 'Limited edition',
|
|
1488
|
+
footer: 'Stok terbatas!',
|
|
1489
|
+
hasMediaAttachment: true,
|
|
1490
|
+
collection: {
|
|
1491
|
+
bizJid: '628xxx@s.whatsapp.net',
|
|
1492
|
+
id: 'collection-id-456',
|
|
1493
|
+
version: 1
|
|
1494
|
+
}
|
|
1495
|
+
})
|
|
1496
|
+
```
|
|
1497
|
+
|
|
1498
|
+
</details>
|
|
1499
|
+
|
|
1500
|
+
---
|
|
1501
|
+
|
|
1502
|
+
<details>
|
|
1503
|
+
<summary>📦 Order Status Message</summary>
|
|
1504
|
+
|
|
1505
|
+
Mengirim kartu status pesanan dengan tampilan native WhatsApp (menggunakan `order_status` native flow, dibungkus view once).
|
|
1506
|
+
|
|
1507
|
+
```js
|
|
1508
|
+
await sock.sendMessage(jid, {
|
|
1509
|
+
orderStatus: {
|
|
1510
|
+
image: 'path/to/image.jpg', // string path, URL, atau Buffer — wajib
|
|
1511
|
+
title: 'Status Pesananmu', // judul header
|
|
1512
|
+
text: 'Pesananmu sedang diproses.',
|
|
1513
|
+
footer: 'Terima kasih sudah belanja!',
|
|
1514
|
+
referenceId: 'ORDER-001', // ID referensi pesanan
|
|
1515
|
+
status: 'PROCESSING', // PROCESSING | COMPLETED | CANCELLED | dst
|
|
1516
|
+
subtotalValue: 50000, // subtotal dalam satuan terkecil
|
|
1517
|
+
subtotalOffset: 100, // pembagi (100 = dalam rupiah)
|
|
1518
|
+
taxValue: 5000,
|
|
1519
|
+
taxOffset: 100,
|
|
1520
|
+
currency: 'IDR'
|
|
1521
|
+
}
|
|
1522
|
+
})
|
|
1523
|
+
|
|
1524
|
+
// Status pesanan selesai
|
|
1525
|
+
await sock.sendMessage(jid, {
|
|
1526
|
+
orderStatus: {
|
|
1527
|
+
image: { url: 'https://example.com/order.jpg' },
|
|
1528
|
+
title: 'Pesanan Selesai! 🎉',
|
|
1529
|
+
text: 'Pesananmu telah dikirim.',
|
|
1530
|
+
referenceId: 'ORDER-789',
|
|
1531
|
+
status: 'COMPLETED',
|
|
1532
|
+
subtotalValue: 150000,
|
|
1533
|
+
subtotalOffset: 100,
|
|
1534
|
+
taxValue: 0,
|
|
1535
|
+
taxOffset: 100,
|
|
1536
|
+
currency: 'IDR'
|
|
1537
|
+
}
|
|
1538
|
+
}, { quoted: m })
|
|
1539
|
+
```
|
|
1540
|
+
|
|
1541
|
+
> ⚠️ `image` wajib diisi — `orderStatus` selalu dibungkus dalam viewOnceMessage.
|
|
1542
|
+
|
|
1543
|
+
</details>
|
|
1544
|
+
|
|
1545
|
+
---
|
|
1546
|
+
|
|
1547
|
+
<details>
|
|
1548
|
+
<summary>🛒 Product List Message</summary>
|
|
1549
|
+
|
|
1550
|
+
Menampilkan list produk bisnis (hanya berfungsi di private chat).
|
|
1551
|
+
|
|
1552
|
+
```js
|
|
1553
|
+
await sock.sendMessage(jid, {
|
|
1554
|
+
text: 'Pilih produk yang kamu inginkan',
|
|
1555
|
+
title: 'Produk Pilihan',
|
|
1556
|
+
buttonText: 'Lihat Daftar Produk',
|
|
1557
|
+
footer: 'Stok terbatas!',
|
|
1558
|
+
businessOwnerJid: '628xxx@s.whatsapp.net',
|
|
1559
|
+
thumbnail: { url: 'https://example.com/thumbnail.jpg' }, // opsional
|
|
1560
|
+
productList: [
|
|
1561
|
+
{
|
|
1562
|
+
title: 'Kategori Makanan',
|
|
1563
|
+
products: [
|
|
1564
|
+
{ productId: '111222333' },
|
|
1565
|
+
{ productId: '444555666' }
|
|
1566
|
+
]
|
|
1567
|
+
},
|
|
1568
|
+
{
|
|
1569
|
+
title: 'Kategori Minuman',
|
|
1570
|
+
products: [
|
|
1571
|
+
{ productId: '777888999' }
|
|
1572
|
+
]
|
|
1573
|
+
}
|
|
1574
|
+
]
|
|
1575
|
+
})
|
|
1576
|
+
```
|
|
1577
|
+
|
|
1578
|
+
</details>
|
|
1579
|
+
|
|
1580
|
+
---
|
|
1581
|
+
|
|
1301
1582
|
<details>
|
|
1302
1583
|
<summary>🏷️ Status Mention</summary>
|
|
1303
1584
|
|
package/lib/Utils/messages.js
CHANGED
|
@@ -545,6 +545,37 @@ const prepareNativeFlowButtons = (message) => {
|
|
|
545
545
|
else if (hasOptionalProperty(button, 'sections') && !!button.sections) {
|
|
546
546
|
return { name: 'single_select', buttonParamsJson: JSON.stringify({ title: buttonText || '📋 Select', sections: button.sections, icon: buttonIcon }) };
|
|
547
547
|
}
|
|
548
|
+
else if (hasOptionalProperty(button, 'catalog') && !!button.catalog) {
|
|
549
|
+
return { name: 'cta_catalog', buttonParamsJson: JSON.stringify({ display_text: buttonText || '🛍️ Catalog', business_phone_number: button.catalog, icon: buttonIcon }) };
|
|
550
|
+
}
|
|
551
|
+
else if (hasOptionalProperty(button, 'reminder') && button.reminder === true) {
|
|
552
|
+
return { name: 'cta_reminder', buttonParamsJson: JSON.stringify({ display_text: buttonText || '⏰ Remind Me', icon: buttonIcon }) };
|
|
553
|
+
}
|
|
554
|
+
else if (hasOptionalProperty(button, 'cancelReminder') && button.cancelReminder === true) {
|
|
555
|
+
return { name: 'cta_cancel_reminder', buttonParamsJson: JSON.stringify({ display_text: buttonText || '❌ Cancel Reminder', icon: buttonIcon }) };
|
|
556
|
+
}
|
|
557
|
+
else if (hasOptionalProperty(button, 'address') && button.address === true) {
|
|
558
|
+
return { name: 'address_message', buttonParamsJson: JSON.stringify({ display_text: buttonText || '📍 Share Address', icon: buttonIcon }) };
|
|
559
|
+
}
|
|
560
|
+
else if (hasOptionalProperty(button, 'location') && button.location === true) {
|
|
561
|
+
return { name: 'send_location', buttonParamsJson: JSON.stringify({ display_text: buttonText || '📍 Send Location', icon: buttonIcon }) };
|
|
562
|
+
}
|
|
563
|
+
else if (hasOptionalProperty(button, 'webview') && !!button.webview) {
|
|
564
|
+
return { name: 'open_webview', buttonParamsJson: JSON.stringify({ title: buttonText || '🌐 Open', link: { in_app_webview: button.inAppWebview !== false, url: button.webview }, icon: buttonIcon }) };
|
|
565
|
+
}
|
|
566
|
+
else if (hasOptionalProperty(button, 'productId') && !!button.productId) {
|
|
567
|
+
return { name: 'mpm', buttonParamsJson: JSON.stringify({ display_text: buttonText || '🛒 View Product', product_id: button.productId, icon: buttonIcon }) };
|
|
568
|
+
}
|
|
569
|
+
else if (hasOptionalProperty(button, 'transactionId') && !!button.transactionId) {
|
|
570
|
+
return { name: 'wa_payment_transaction_details', buttonParamsJson: JSON.stringify({ display_text: buttonText || '💳 Payment Details', transaction_id: button.transactionId, icon: buttonIcon }) };
|
|
571
|
+
}
|
|
572
|
+
else if (hasOptionalProperty(button, 'catalogProduct') && !!button.catalogProduct) {
|
|
573
|
+
return { name: 'automated_greeting_message_view_catalog', buttonParamsJson: JSON.stringify({ display_text: buttonText || '🛍️ View Catalog', business_phone_number: button.catalogProduct.bizPhone, catalog_product_id: button.catalogProduct.productId, icon: buttonIcon }) };
|
|
574
|
+
}
|
|
575
|
+
else if (hasOptionalProperty(button, 'flow') && !!button.flow) {
|
|
576
|
+
const f = button.flow;
|
|
577
|
+
return { name: 'galaxy_message', buttonParamsJson: JSON.stringify({ mode: f.mode || 'published', flow_message_version: f.flowMessageVersion || '3', flow_token: f.flowToken, flow_id: f.flowId, flow_cta: buttonText || f.flowCta || '▶️ Open Flow', flow_action: f.flowAction || 'navigate', flow_action_payload: f.flowActionPayload, flow_metadata: f.flowMetadata, icon: buttonIcon }) };
|
|
578
|
+
}
|
|
548
579
|
return button;
|
|
549
580
|
}),
|
|
550
581
|
messageParamsJson: JSON.stringify(messageParamsJson),
|
|
@@ -1171,6 +1202,147 @@ export const generateWAMessageContent = async (message, options) => {
|
|
|
1171
1202
|
}
|
|
1172
1203
|
m = { interactiveMessage };
|
|
1173
1204
|
}
|
|
1205
|
+
else if (hasNonNullishProperty(message, 'shop')) {
|
|
1206
|
+
const interactiveMessage = {
|
|
1207
|
+
shopStorefrontMessage: {
|
|
1208
|
+
surface: message.shop.surface || 1,
|
|
1209
|
+
id: message.shop.id,
|
|
1210
|
+
messageVersion: 1
|
|
1211
|
+
}
|
|
1212
|
+
};
|
|
1213
|
+
if (hasOptionalProperty(message, 'text')) {
|
|
1214
|
+
interactiveMessage.body = { text: message.text };
|
|
1215
|
+
}
|
|
1216
|
+
else if (hasOptionalProperty(message, 'caption')) {
|
|
1217
|
+
const isValidHeader = hasValidInteractiveHeader(m);
|
|
1218
|
+
interactiveMessage.header = {
|
|
1219
|
+
title: message.title || '',
|
|
1220
|
+
subtitle: message.subtitle || '',
|
|
1221
|
+
hasMediaAttachment: isValidHeader
|
|
1222
|
+
};
|
|
1223
|
+
interactiveMessage.body = { text: message.caption };
|
|
1224
|
+
Object.assign(interactiveMessage.header, m);
|
|
1225
|
+
}
|
|
1226
|
+
if (hasOptionalProperty(message, 'title') && !hasOptionalProperty(message, 'caption')) {
|
|
1227
|
+
interactiveMessage.header = {
|
|
1228
|
+
title: message.title,
|
|
1229
|
+
subtitle: message.subtitle || null,
|
|
1230
|
+
hasMediaAttachment: false
|
|
1231
|
+
};
|
|
1232
|
+
}
|
|
1233
|
+
if (hasOptionalProperty(message, 'footer')) {
|
|
1234
|
+
interactiveMessage.footer = { text: message.footer };
|
|
1235
|
+
}
|
|
1236
|
+
m = { interactiveMessage };
|
|
1237
|
+
}
|
|
1238
|
+
else if (hasNonNullishProperty(message, 'collection')) {
|
|
1239
|
+
const interactiveMessage = {
|
|
1240
|
+
collectionMessage: {
|
|
1241
|
+
bizJid: message.collection.bizJid,
|
|
1242
|
+
id: message.collection.id,
|
|
1243
|
+
messageVersion: message.collection.version || 1
|
|
1244
|
+
}
|
|
1245
|
+
};
|
|
1246
|
+
if (hasOptionalProperty(message, 'text')) {
|
|
1247
|
+
interactiveMessage.body = { text: message.text };
|
|
1248
|
+
}
|
|
1249
|
+
else if (hasOptionalProperty(message, 'caption')) {
|
|
1250
|
+
const isValidHeader = hasValidInteractiveHeader(m);
|
|
1251
|
+
interactiveMessage.header = {
|
|
1252
|
+
title: message.title || '',
|
|
1253
|
+
subtitle: message.subtitle || '',
|
|
1254
|
+
hasMediaAttachment: isValidHeader
|
|
1255
|
+
};
|
|
1256
|
+
interactiveMessage.body = { text: message.caption };
|
|
1257
|
+
Object.assign(interactiveMessage.header, m);
|
|
1258
|
+
}
|
|
1259
|
+
if (hasOptionalProperty(message, 'title') && !hasOptionalProperty(message, 'caption')) {
|
|
1260
|
+
interactiveMessage.header = {
|
|
1261
|
+
title: message.title,
|
|
1262
|
+
subtitle: message.subtitle || null,
|
|
1263
|
+
hasMediaAttachment: false
|
|
1264
|
+
};
|
|
1265
|
+
}
|
|
1266
|
+
if (hasOptionalProperty(message, 'footer')) {
|
|
1267
|
+
interactiveMessage.footer = { text: message.footer };
|
|
1268
|
+
}
|
|
1269
|
+
m = { interactiveMessage };
|
|
1270
|
+
}
|
|
1271
|
+
else if (hasNonNullishProperty(message, 'orderStatus')) {
|
|
1272
|
+
const os = message.orderStatus;
|
|
1273
|
+
if (!os.image) {
|
|
1274
|
+
throw new Boom('"image" wajib diisi untuk orderStatus', { statusCode: 400 });
|
|
1275
|
+
}
|
|
1276
|
+
let imageInput = os.image;
|
|
1277
|
+
if (typeof imageInput === 'string' && !imageInput.startsWith('http://') && !imageInput.startsWith('https://')) {
|
|
1278
|
+
const { promises: fsPromises } = await import('fs');
|
|
1279
|
+
imageInput = await fsPromises.readFile(imageInput);
|
|
1280
|
+
}
|
|
1281
|
+
const media = await prepareWAMessageMedia({ image: imageInput }, options);
|
|
1282
|
+
m = {
|
|
1283
|
+
viewOnceMessage: {
|
|
1284
|
+
message: {
|
|
1285
|
+
messageContextInfo: {
|
|
1286
|
+
deviceListMetadata: {},
|
|
1287
|
+
deviceListMetadataVersion: 2
|
|
1288
|
+
},
|
|
1289
|
+
interactiveMessage: proto.Message.InteractiveMessage.create({
|
|
1290
|
+
header: {
|
|
1291
|
+
title: os.title || 'Status Pesanan',
|
|
1292
|
+
hasMediaAttachment: true,
|
|
1293
|
+
...media
|
|
1294
|
+
},
|
|
1295
|
+
body: { text: os.text || 'Silakan cek status pesanan Anda.' },
|
|
1296
|
+
footer: { text: os.footer || '' },
|
|
1297
|
+
nativeFlowMessage: {
|
|
1298
|
+
buttons: [{
|
|
1299
|
+
name: 'order_status',
|
|
1300
|
+
buttonParamsJson: JSON.stringify({
|
|
1301
|
+
reference_id: os.referenceId || 'ORDER-001',
|
|
1302
|
+
order: {
|
|
1303
|
+
status: os.status || 'PROCESSING',
|
|
1304
|
+
subtotal: {
|
|
1305
|
+
value: os.subtotalValue || 0,
|
|
1306
|
+
offset: os.subtotalOffset || 100
|
|
1307
|
+
},
|
|
1308
|
+
tax: {
|
|
1309
|
+
value: os.taxValue || 0,
|
|
1310
|
+
offset: os.taxOffset || 100
|
|
1311
|
+
},
|
|
1312
|
+
currency: os.currency || 'IDR'
|
|
1313
|
+
}
|
|
1314
|
+
})
|
|
1315
|
+
}]
|
|
1316
|
+
}
|
|
1317
|
+
})
|
|
1318
|
+
}
|
|
1319
|
+
}
|
|
1320
|
+
};
|
|
1321
|
+
}
|
|
1322
|
+
else if (hasNonNullishProperty(message, 'productList')) {
|
|
1323
|
+
let thumbnail = null;
|
|
1324
|
+
if (message.thumbnail) {
|
|
1325
|
+
const { imageMessage } = await prepareWAMessageMedia({ image: message.thumbnail }, options);
|
|
1326
|
+
thumbnail = imageMessage;
|
|
1327
|
+
}
|
|
1328
|
+
m = {
|
|
1329
|
+
listMessage: {
|
|
1330
|
+
title: message.title,
|
|
1331
|
+
buttonText: message.buttonText || 'Lihat Produk',
|
|
1332
|
+
footerText: message.footer,
|
|
1333
|
+
description: message.text,
|
|
1334
|
+
productListInfo: {
|
|
1335
|
+
productSections: message.productList,
|
|
1336
|
+
headerImage: {
|
|
1337
|
+
productId: message.productList?.[0]?.products?.[0]?.productId,
|
|
1338
|
+
jpegThumbnail: thumbnail?.jpegThumbnail || null
|
|
1339
|
+
},
|
|
1340
|
+
businessOwnerJid: message.businessOwnerJid
|
|
1341
|
+
},
|
|
1342
|
+
listType: proto.Message.ListMessage.ListType.PRODUCT_LIST
|
|
1343
|
+
}
|
|
1344
|
+
};
|
|
1345
|
+
}
|
|
1174
1346
|
else if (hasNonNullishProperty(message, 'requestPaymentFrom')) {
|
|
1175
1347
|
const requestPaymentMessage = {
|
|
1176
1348
|
amount: {
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuiisweety/baileys",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1.
|
|
5
|
-
"description": "A WebSockets library for interacting with WhatsApp Web — forked STRICTLY from @whiskeysockets/baileys only, NOT from any other baileys fork. Modified by
|
|
4
|
+
"version": "0.1.13",
|
|
5
|
+
"description": "A WebSockets library for interacting with WhatsApp Web — forked STRICTLY from @whiskeysockets/baileys only, NOT from any other baileys fork. Modified by © NuiiS4TORU.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"whatsapp",
|
|
8
8
|
"automation"
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"url": "git@github.com:WhiskeySockets/Baileys.git"
|
|
13
13
|
},
|
|
14
14
|
"license": "MIT",
|
|
15
|
-
"author": "
|
|
15
|
+
"author": "© NuiiS4TORU (based on WhiskeySockets/Baileys)",
|
|
16
16
|
"main": "lib/index.js",
|
|
17
17
|
"types": "lib/index.d.ts",
|
|
18
18
|
"files": [
|