combined-baileys 0.0.0-stage → 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 (141) hide show
  1. package/FORK-MERGE-AUDIT.md +56 -0
  2. package/LICENSE +22 -0
  3. package/NOTICE-THIRD-PARTY.md +27 -0
  4. package/README.md +473 -2
  5. package/WAProto/index.d.ts +15933 -0
  6. package/WAProto/index.js +115857 -0
  7. package/docs/examples/combined-compatibility.js +42 -0
  8. package/index.d.ts +122 -0
  9. package/lib/Compat/button-helper-v1.d.ts +17 -0
  10. package/lib/Compat/button-helper-v1.js +971 -0
  11. package/lib/Compat/button-helper-v1.mjs +13 -0
  12. package/lib/Compat/index.js +26 -0
  13. package/lib/Compat/mex-v1.js +46 -0
  14. package/lib/Compat/rich/a2ui.js +224 -0
  15. package/lib/Compat/rich/rich-carousel.js +227 -0
  16. package/lib/Compat/rich/rich-classic.js +142 -0
  17. package/lib/Compat/rich/rich-menu.js +227 -0
  18. package/lib/Compat/rich/rich-message.js +337 -0
  19. package/lib/Compat/rich/rich-webui.js +237 -0
  20. package/lib/Compat/socket.js +149 -0
  21. package/lib/Compat/voip-loader.js +5 -0
  22. package/lib/Defaults/combined-version.json +3 -0
  23. package/lib/Defaults/index.js +120 -0
  24. package/lib/Defaults/levvleys-version.json +3 -0
  25. package/lib/Signal/Group/ciphertext-message.js +15 -0
  26. package/lib/Signal/Group/group-session-builder.js +64 -0
  27. package/lib/Signal/Group/group_cipher.js +96 -0
  28. package/lib/Signal/Group/index.js +57 -0
  29. package/lib/Signal/Group/keyhelper.js +55 -0
  30. package/lib/Signal/Group/queue-job.js +57 -0
  31. package/lib/Signal/Group/sender-chain-key.js +34 -0
  32. package/lib/Signal/Group/sender-key-distribution-message.js +66 -0
  33. package/lib/Signal/Group/sender-key-message.js +69 -0
  34. package/lib/Signal/Group/sender-key-name.js +51 -0
  35. package/lib/Signal/Group/sender-key-record.js +53 -0
  36. package/lib/Signal/Group/sender-key-state.js +99 -0
  37. package/lib/Signal/Group/sender-message-key.js +29 -0
  38. package/lib/Signal/libsignal.js +184 -0
  39. package/lib/Socket/Client/index.js +18 -0
  40. package/lib/Socket/Client/types.js +13 -0
  41. package/lib/Socket/Client/websocket.js +72 -0
  42. package/lib/Socket/business.js +260 -0
  43. package/lib/Socket/chats.js +997 -0
  44. package/lib/Socket/communities.js +438 -0
  45. package/lib/Socket/dugong.js +464 -0
  46. package/lib/Socket/groups.js +332 -0
  47. package/lib/Socket/index.js +22 -0
  48. package/lib/Socket/messages-recv.js +1147 -0
  49. package/lib/Socket/messages-send.js +1007 -0
  50. package/lib/Socket/newsletter.js +305 -0
  51. package/lib/Socket/socket.js +646 -0
  52. package/lib/Socket/usync.js +70 -0
  53. package/lib/Store/index.js +8 -0
  54. package/lib/Store/make-in-memory-store.js +439 -0
  55. package/lib/Store/make-ordered-dictionary.js +81 -0
  56. package/lib/Store/object-repository.js +27 -0
  57. package/lib/Types/Auth.js +2 -0
  58. package/lib/Types/Call.js +2 -0
  59. package/lib/Types/Chat.js +4 -0
  60. package/lib/Types/Contact.js +2 -0
  61. package/lib/Types/Events.js +2 -0
  62. package/lib/Types/GroupMetadata.js +2 -0
  63. package/lib/Types/Label.js +27 -0
  64. package/lib/Types/LabelAssociation.js +9 -0
  65. package/lib/Types/Message.js +7 -0
  66. package/lib/Types/Newsletter.js +18 -0
  67. package/lib/Types/Product.js +2 -0
  68. package/lib/Types/Signal.js +2 -0
  69. package/lib/Types/Socket.js +2 -0
  70. package/lib/Types/State.js +2 -0
  71. package/lib/Types/USync.js +2 -0
  72. package/lib/Types/index.js +42 -0
  73. package/lib/Utils/auth-utils.js +199 -0
  74. package/lib/Utils/browser-utils.js +35 -0
  75. package/lib/Utils/business.js +234 -0
  76. package/lib/Utils/chat-utils.js +730 -0
  77. package/lib/Utils/crypto.js +193 -0
  78. package/lib/Utils/decode-wa-message.js +217 -0
  79. package/lib/Utils/event-buffer.js +518 -0
  80. package/lib/Utils/event-stream.js +63 -0
  81. package/lib/Utils/generics.js +425 -0
  82. package/lib/Utils/history.js +94 -0
  83. package/lib/Utils/index.js +36 -0
  84. package/lib/Utils/levvleys-event-stream.js +63 -0
  85. package/lib/Utils/link-preview.js +126 -0
  86. package/lib/Utils/logger.js +7 -0
  87. package/lib/Utils/lt-hash.js +51 -0
  88. package/lib/Utils/make-mutex.js +43 -0
  89. package/lib/Utils/message-retry-manager.js +185 -0
  90. package/lib/Utils/messages-media.js +895 -0
  91. package/lib/Utils/messages.js +1959 -0
  92. package/lib/Utils/noise-handler.js +150 -0
  93. package/lib/Utils/process-message.js +404 -0
  94. package/lib/Utils/rich-message-utils.d.ts +6 -0
  95. package/lib/Utils/rich-message-utils.js +156 -0
  96. package/lib/Utils/signal.js +153 -0
  97. package/lib/Utils/use-multi-file-auth-state.js +124 -0
  98. package/lib/Utils/validate-connection.js +229 -0
  99. package/lib/VoIP/audio-feeder.d.ts +15 -0
  100. package/lib/VoIP/audio-feeder.js +136 -0
  101. package/lib/VoIP/index.d.ts +48 -0
  102. package/lib/VoIP/index.js +285 -0
  103. package/lib/VoIP/package.json +1 -0
  104. package/lib/VoIP/relay-transport.d.ts +43 -0
  105. package/lib/VoIP/relay-transport.js +559 -0
  106. package/lib/VoIP/signaling.js +609 -0
  107. package/lib/VoIP/types.d.ts +69 -0
  108. package/lib/VoIP/types.js +17 -0
  109. package/lib/VoIP/wasm-engine.d.ts +103 -0
  110. package/lib/VoIP/wasm-engine.js +1214 -0
  111. package/lib/VoIP/worker-bootstrap.js +1042 -0
  112. package/lib/WABinary/constants.js +1303 -0
  113. package/lib/WABinary/decode.js +265 -0
  114. package/lib/WABinary/encode.js +250 -0
  115. package/lib/WABinary/generic-utils.js +110 -0
  116. package/lib/WABinary/index.js +21 -0
  117. package/lib/WABinary/jid-utils.js +85 -0
  118. package/lib/WABinary/types.js +2 -0
  119. package/lib/WAM/BinaryInfo.js +13 -0
  120. package/lib/WAM/constants.js +15350 -0
  121. package/lib/WAM/encode.js +155 -0
  122. package/lib/WAM/index.js +19 -0
  123. package/lib/WAUSync/Protocols/USyncContactProtocol.js +32 -0
  124. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +57 -0
  125. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +30 -0
  126. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +42 -0
  127. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +53 -0
  128. package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +24 -0
  129. package/lib/WAUSync/Protocols/index.js +20 -0
  130. package/lib/WAUSync/USyncQuery.js +89 -0
  131. package/lib/WAUSync/USyncUser.js +26 -0
  132. package/lib/WAUSync/index.js +19 -0
  133. package/lib/assets/wasm/loader.js +5 -0
  134. package/lib/assets/wasm/package.json +1 -0
  135. package/lib/assets/wasm/whatsapp.wasm +0 -0
  136. package/lib/assets/wasm/worker-modules.js +273 -0
  137. package/lib/index.js +96 -0
  138. package/lib/index.mjs +52 -0
  139. package/package.json +129 -4
  140. package/tools/scripts/lint.js +34 -0
  141. package/tools/test/compat.test.js +192 -0
@@ -0,0 +1,56 @@
1
+ # Fork merge audit — Combined Baileys 1.0.0
2
+
3
+ Developer: Echa · Project support: Dansz
4
+
5
+ ## Basis yang dipertahankan
6
+
7
+ - `dansz.zip` (basis proyek yang diserahkan kepada pengelola Combined Baileys) menjadi core runtime dan sumber utama `WAProto`, Signal, Socket, WABinary, multi-device, serta API Baileys yang sudah ada.
8
+ - Core `sendMessage` dan dispatcher kompatibilitas tidak diganti. Alias baru memanggil API yang sama agar payload lama tetap diproses oleh jalur aslinya.
9
+
10
+ ## Fitur yang digabung dan dipasang
11
+
12
+ | Sumber | Versi input | Integrasi pada dansz |
13
+ |---|---:|---|
14
+ | `@ryuu-reinzz/button-helper` | 2.2.3 | Native Flow validator/builder disediakan sebagai `sendBtnV3`, `sendBtnV4`, `sendButtonsV1`, dan subpath `button-helper/v1`. |
15
+ | `raiden-baileys` | 2.2.5 | Community socket methods dipasang sebagai layer tambahan; MEX query helper `executeMexV1`; rich classic, carousel, rich menu, WebUI, A2UI dan rich message helpers tersedia sebagai V1. |
16
+ | `lunaaa-baileys` | 9.0.23 | VoIP client, signaling, relay transport, audio feeder, WASM engine dan WASM asset disertakan sebagai `dansz/voip/v1` (eksperimental, opt-in). Custom `resolveLid` ditambahkan karena basis Dansz tidak menyediakan `signalRepository.lidMapping`. |
17
+
18
+ ## Sumber yang diaudit tetapi tidak disalin mentah
19
+
20
+ Arsip berikut diperiksa untuk membandingkan source/API dan fitur khusus:
21
+
22
+ - `aroyareinzu-baileys` 2.0.0
23
+ - `itsliaaa-baileys` 0.5.3
24
+ - `kelvdra-baileys` 1.0.7-rc.1
25
+ - `ryuu-reinzz-baileys` 5.5.0
26
+ - `ryuu-reinzz-baileys-cjs` 1.0.0-beta.1
27
+ - `ourin-remake-baileys` 2.0.4
28
+ - `zervonex-baileys` 4.0.0
29
+ - `ryuu-reinzz-haruka-lib` 4.0.3
30
+ - `ryuu-reinzz-luna-lib` 4.3.0
31
+ - `neoxr/wb` 6.0.5
32
+ - `@rexxhayanasi/elaina-baileys` 1.4.7
33
+ - `felicia-baileys` 1.0.4
34
+
35
+ Elaina dan Felicia menyediakan `bypassDownload` pada AI `MessageBuilder`: setelah relay pesan rich response, keduanya dapat mengirim protocol edit tipe 14. dansz mengadopsi pola tersebut secara opt-in melalui WebUI, `sendRichMessageV1(...)`, dispatcher `sendMessage(..., { bypassDownload: true })`, serta helper Rich Menu, Carousel, Classic List/Button dan A2UI. Opsi tetap opt-in; tanpa `bypassDownload: true`, pengiriman tetap memakai jalur normal. Ini bukan bypass untuk download/dekripsi media WhatsApp. Struktur `Socket`, `Signal`, `auth-utils`, dan `WAProto` dari kedua fork tidak ditimpa.
36
+
37
+ Banyak file mereka mengubah rangkaian Socket, Signal, `WAProto`, protobuf runtime, LID handling atau versi Node/dependency. Menyalin `messages-send.js`, `socket.js`, `WAProto` maupun layer socket secara keseluruhan akan menimpa perilaku core Dansz dan berisiko membuat multi-device rusak. Karena itu bagian-bagian tersebut tidak digabung sebagai overwrite.
38
+
39
+ ## Struktur direktori
40
+
41
+ Folder root diringkas menjadi empat direktori: `WAProto/`, `lib/`, `docs/`, dan `tools/`. Contoh serta lisensi pihak ketiga berada di `docs/`; skrip pemeriksaan dan tes berada di `tools/`. Entry point dan jalur ekspor paket tetap mengarah ke `lib/` dan `WAProto/`.
42
+
43
+ ## Batas yang disengaja
44
+
45
+ - Modul builder Raiden bernama `MessageBuilder.js` tidak disertakan. Berkas itu memuat ketentuan tambahan yang melarang redistribusi/reupload sebagai produk standalone; paket ini memang dimaksudkan untuk dipublikasikan ke GitHub/npm.
46
+ - Builder Kelvdra juga memuat ketentuan redistribusi tambahan serupa; tidak disalin.
47
+ - `sharp`, `jimp`, `canvas`, `better-sqlite3`, `ffmpeg-static`, `ffprobe-static` dan backend DB native tidak menjadi dependency wajib.
48
+ - VoIP tidak digabung ke socket core karena memerlukan `@roamhq/wrtc`, `ffmpeg` dan pemetaan PN→LID. API-nya opt-in dan harus diberi `resolveLid` sendiri jika map tidak tersedia.
49
+ - Integrasi server WhatsApp bersifat berubah-ubah; source berhasil dipaketkan bukan bukti bahwa semua endpoint internal akan diterima/dipresentasikan oleh WhatsApp untuk setiap akun/client.
50
+
51
+ ## Konvensi versi API
52
+
53
+ - `sendBtn` = alias default untuk payload interactive mentah (sama fungsi dengan `sendBtnV1`).
54
+ - `sendBtnV2` = shorthand `{ id, text }` → `quick_reply`.
55
+ - `sendBtnV3` dan `sendBtnV4` = dua varian Native Flow helper yang berbeda.
56
+ - Helper classic, carousel, rich menu, WebUI, A2UI dan MEX diberi suffix `V1` karena hanya satu implementasi yang dipasang saat ini. Bila port kompatibel kedua ditemukan, nama versi baru dapat ditambah tanpa mengganti V1.
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Echa (Combined Baileys project and original modifications)
4
+ Copyright (c) 2026 levvleys
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
@@ -0,0 +1,27 @@
1
+ # Third-party notices
2
+
3
+ Combined Baileys is developed by Echa with project support from Dansz. Copyright notices and license texts for components originating in other projects are retained where required; the project identity does not replace upstream ownership or licenses. Original core and third-party notices remain in `LICENSE` and `docs/licenses/`. The core runtime is based on the Baileys distribution supplied for this project; its original MIT copyright notice remains in `LICENSE`. The following additional modules were included from upstream packages; their source provenance and version are recorded below.
4
+
5
+ ## Raiden Baileys 2.2.5 — MIT
6
+
7
+ Community socket methods, MEX helper, and rich message helpers (`rich-classic.js`, `rich-carousel.js`, `rich-menu.js`, `rich-webui.js`, `a2ui.js`, `rich-message.js`) are derived from the MIT-licensed Raiden Baileys 2.2.5 package. Its original license is included at `docs/licenses/raiden/LICENSE`.
8
+
9
+ ## @ryuu-reinzz/button-helper 2.2.3 — ISC
10
+
11
+ Native Flow validation and helper functions are derived from `@ryuu-reinzz/button-helper` 2.2.3 by RyuuReinzz. The source package metadata declares the ISC license. The ISC license text is reproduced below.
12
+
13
+ Copyright (c) RyuuReinzz
14
+
15
+ Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18
+
19
+ ## Luna Baileys 9.0.23 — MIT
20
+
21
+ The VoIP client, signaling, relay transport, audio feeder, WASM engine and associated WASM loader assets are derived from Luna Baileys 9.0.23. Its original license is included at `docs/licenses/luna/LICENSE`.
22
+
23
+ - `bypassDownload` AI-rich follow-up edit pattern was reviewed against `@rexxhayanasi/elaina-baileys` 1.4.7 and `felicia-baileys` 1.0.4. Only the small protocol-edit integration pattern was adapted; their socket, Signal, auth, and WAProto implementations were not copied. Original MIT notices are retained at `docs/licenses/elaina/LICENSE` and `docs/licenses/felicia/LICENSE`.
24
+
25
+ ## libsignal 6.x — GPL-3.0
26
+
27
+ The runtime dependency `libsignal` is resolved from the public npm package at `^6.0.0`. Its published license is GPL-3.0. Review the dependency's complete license terms before distributing applications or bundles that include it.
package/README.md CHANGED
@@ -1,3 +1,474 @@
1
- # Temporary Holding Version
1
+ <div align="center">
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ <h1 align='center'><img alt="Baileys logo" src="https://raw.githubusercontent.com/DanszPedia/banners/main/aseets/logo1.png" height="75"/></h1>
4
+ <h1>combined-baileys</h1>
5
+ <p><em>WhatsApp Web Multi-Device library for Node.js, with interactive messages and optional Rich rendering helpers.</em></p>
6
+
7
+ <p>
8
+ <a href="https://github.com/DanszPedia/remake-baileys">
9
+ <img src="https://img.shields.io/badge/GitHub-DanszPedia%2Fremake--baileys-181717?logo=github" alt="GitHub repository" />
10
+ </a>
11
+ </a>
12
+ <a href="https://www.npmjs.com/package/felicia-baileys">
13
+ <img src="https://img.shields.io/npm/dt/combined-baileys?color=blueviolet&label=downloads&logo=npm" alt="npm downloads" />
14
+ </a>
15
+ <a href="https://www.npmjs.com/package/combined-baileys">
16
+ <img src="https://img.shields.io/badge/npm-combined--baileys-CB3837?logo=npm&logoColor=white" alt="npm package" />
17
+ </a>
18
+ <img src="https://img.shields.io/badge/version-1.0.0-blueviolet" alt="Version 1.0.0" />
19
+ <img src="https://img.shields.io/badge/Node.js-%3E%3D20-339933?logo=node.js&logoColor=white" alt="Node.js 20 or newer" />
20
+ <img src="https://img.shields.io/badge/Module-CommonJS%20%2B%20ESM-yellow" alt="CommonJS and ESM" />
21
+ </p>
22
+
23
+ <p>
24
+ <a href="https://whatsapp.com/channel/0029ValoF8i2phHP3yOAOx31">
25
+ <img src="https://img.shields.io/badge/Join-WhatsApp%20Channel-25D366?logo=whatsapp&logoColor=white" alt="WhatsApp Channel" />
26
+ </a>
27
+ </p>
28
+
29
+ <p><strong>Developer:</strong> Echa &nbsp;·&nbsp; <strong>Project support:</strong> Dansz</p>
30
+
31
+ </div>
32
+
33
+ > [!CAUTION]
34
+ > **⚠️Penting! Catatan:** `combined-baileys` adalah library WhatsApp Web tidak resmi. Proyek ini tidak berafiliasi dengan, tidak disponsori oleh, dan tidak didukung oleh WhatsApp atau Meta. Proyek ini hanya untuk bersenang-senang dan untuk penguna pribadi. fork/library/baileys ini adalah modifikasi (mod). Jika ada sesuatu yang tidak di inginnkan bukan tanggung jawab kami. Gunakan dengan bijak, bertanggung jawab dan patuhi ketentuan layanan serta hukum yang berlaku.
35
+
36
+ ---
37
+
38
+ ## Tentang proyek
39
+
40
+ `combined-baileys` merupakan library WhatsApp Multi-Device untuk Node.js. Proyek ini mempertahankan pola penggunaan socket Baileys dan menambahkan beberapa helper agar pengiriman pesan interaktif dan Rich lebih praktis.
41
+
42
+ Paket menyediakan entry CommonJS dan ESM. Jadi, proyek bot yang memakai `require()` maupun `import` bisa menggunakan paket yang sama tanpa harus mengganti seluruh struktur aplikasinya.
43
+
44
+ ### Fitur utama
45
+
46
+ | Fitur | Keterangan |
47
+ |---|---|
48
+ | WhatsApp Multi-Device | Koneksi socket, autentikasi, event, dan pengiriman pesan. |
49
+ | CommonJS + ESM | Bisa digunakan dari proyek CJS maupun ESM. |
50
+ | Rich Response | Teks, potongan kode, tabel, tautan, dan konten rich yang didukung. |
51
+ | Optional Rich bypass | Opsi tambahan untuk mengirim follow-up edit protokol pada jenis pesan Rich tertentu. |
52
+ | Interactive message | Helper untuk native-flow dan interactive message. |
53
+ | Carousel | Builder carousel dan interactive carousel. |
54
+ | Rich Menu & WebUI | Helper untuk rich menu dan HTML WebUI. |
55
+ | A2UI | Builder dan pengiriman widget A2UI. |
56
+ | Classic message | Helper untuk tombol klasik dan list klasik. |
57
+ | Group & Community | Method pengelolaan grup dan komunitas yang tersedia pada socket. |
58
+ | Newsletter / Channel | Method newsletter tersedia dan dipanggil secara eksplisit oleh aplikasi. |
59
+ | VoIP eksperimental | Modul terpisah; memerlukan konfigurasi dan dependency tambahan. |
60
+
61
+ ## Daftar isi
62
+
63
+ - [Persyaratan](#persyaratan)
64
+ - [Instalasi](#instalasi)
65
+ - [Memulai koneksi](#memulai-koneksi)
66
+ - [Mengirim pesan](#mengirim-pesan)
67
+ - [Rich Response](#rich-response)
68
+ - [Rich bypass](#rich-bypass)
69
+ - [Helper Rich lainnya](#helper-rich-lainnya)
70
+ - [Membaca pesan Rich](#membaca-pesan-rich)
71
+ - [Session dan kompatibilitas](#session-dan-kompatibilitas)
72
+ - [Newsletter dan auto-join](#newsletter-dan-auto-join)
73
+ - [Dependency opsional](#dependency-opsional)
74
+ - [Lisensi dan atribusi](#lisensi-dan-atribusi)
75
+
76
+ ## Persyaratan
77
+
78
+ - Node.js 20 atau lebih baru.
79
+ - Koneksi internet untuk menghubungkan socket ke WhatsApp.
80
+ - Akun WhatsApp yang dapat digunakan untuk proses pairing.
81
+
82
+ ## Instalasi
83
+
84
+ Jika paket sudah tersedia di npm:
85
+
86
+ ```bash
87
+ npm install combined-baileys
88
+ ```
89
+
90
+ Memasang versi tertentu:
91
+
92
+ ```bash
93
+ npm install combined-baileys@1.0.0
94
+ npm install combined-baileys@latest
95
+ npm install combined-baileys@^1.1.1
96
+ ```
97
+
98
+ Memasang langsung dari folder hasil clone atau extract:
99
+
100
+ ```bash
101
+ npm install ./path/ke/combined-baileys
102
+ ```
103
+
104
+ Repository proyek: <https://github.com/DanszPedia/remake-baileys>
105
+
106
+ ## Memulai koneksi
107
+
108
+ ### CommonJS
109
+
110
+ ```js
111
+ const {
112
+ default: makeWASocket,
113
+ useMultiFileAuthState,
114
+ fetchLatestBaileysVersion
115
+ } = require('combined-baileys')
116
+
117
+ async function startBot() {
118
+ const { state, saveCreds } = await useMultiFileAuthState('./session')
119
+ const { version } = await fetchLatestBaileysVersion()
120
+
121
+ const sock = makeWASocket({
122
+ auth: state,
123
+ version,
124
+ printQRInTerminal: true
125
+ })
126
+
127
+ sock.ev.on('creds.update', saveCreds)
128
+
129
+ sock.ev.on('connection.update', ({ connection, lastDisconnect, qr }) => {
130
+ if (qr) console.log('Scan QR untuk login')
131
+ if (connection === 'open') console.log('WhatsApp terhubung')
132
+ if (connection === 'close') {
133
+ console.log('Koneksi terputus:', lastDisconnect?.error)
134
+ }
135
+ })
136
+
137
+ return sock
138
+ }
139
+
140
+ startBot().catch(console.error)
141
+ ```
142
+
143
+ ### ESM
144
+
145
+ ```js
146
+ import makeWASocket, {
147
+ useMultiFileAuthState,
148
+ fetchLatestBaileysVersion
149
+ } from 'combined-baileys'
150
+
151
+ const { state, saveCreds } = await useMultiFileAuthState('./session')
152
+ const { version } = await fetchLatestBaileysVersion()
153
+ const sock = makeWASocket({ auth: state, version })
154
+
155
+ sock.ev.on('creds.update', saveCreds)
156
+ ```
157
+
158
+ ## Mengirim pesan
159
+
160
+ Pesan teks biasa tetap menggunakan API `sendMessage`:
161
+
162
+ ```js
163
+ await sock.sendMessage(m.chat, {
164
+ text: 'Halo dari Combined Baileys!'
165
+ })
166
+ ```
167
+
168
+ Alias `sendMsg` juga tersedia:
169
+
170
+ ```js
171
+ await sock.sendMsg(m.chat, {
172
+ text: 'Halo juga!'
173
+ })
174
+ ```
175
+
176
+ ## Rich Response
177
+
178
+ Rich Response bisa berisi teks, kode, tabel, tautan, dan beberapa bagian dalam satu pesan.
179
+
180
+ ### Teks dan kode
181
+
182
+ ```js
183
+ const { tokenizeCode } = require('combined-baileys')
184
+
185
+ await sock.sendMessage(m.chat, {
186
+ disclaimerText: '© Echa · Combined Baileys',
187
+ richResponse: [
188
+ { text: 'Contoh kode JavaScript' },
189
+ {
190
+ language: 'javascript',
191
+ code: tokenizeCode('const greeting = "Hello!"', 'javascript')
192
+ },
193
+ { text: 'Kode di atas membuat sebuah variabel.' }
194
+ ]
195
+ }, {
196
+ quoted: m
197
+ })
198
+ ```
199
+
200
+ ### Tabel
201
+
202
+ ```js
203
+ await sock.sendMessage(m.chat, {
204
+ title: 'Daftar pemain',
205
+ table: [
206
+ ['Nama', 'Level', 'Status'],
207
+ ['Dani', '12', 'Online'],
208
+ ['Raka', '8', 'Offline']
209
+ ],
210
+ footerText: 'Data permainan'
211
+ })
212
+ ```
213
+
214
+ ### Tautan
215
+
216
+ ```js
217
+ await sock.sendMessage(m.chat, {
218
+ headerText: 'Referensi',
219
+ links: [
220
+ {
221
+ text: 'Dokumentasi Node.js',
222
+ url: 'https://nodejs.org',
223
+ title: 'Node.js'
224
+ }
225
+ ]
226
+ })
227
+ ```
228
+
229
+ ## Rich bypass
230
+
231
+ `bypassDownload` merupakan opsi tambahan untuk jenis pesan Rich yang didukung. Saat diaktifkan, library mengirim pesan awal lalu mengirim follow-up edit protokol tipe 14 yang merujuk ke pesan tersebut. Pada client WhatsApp yang mendukung format ini, mekanisme tersebut dapat membantu Rich ditampilkan atau diperbarui tanpa menunggu alur render normal.
232
+
233
+ Opsi ini **tidak aktif secara default**. Tambahkan `bypassDownload: true` hanya pada pesan yang ingin memakai mekanisme tersebut. Jika opsi dihilangkan atau diisi `false`, pesan dikirim melalui jalur normal.
234
+
235
+ Perlu diingat: ini bukan bypass untuk mengunduh atau mendekripsi foto, video, maupun dokumen. Hasil tampilan tetap bergantung pada versi dan dukungan aplikasi WhatsApp penerima.
236
+
237
+ ### Rich Response dengan bypass
238
+
239
+ ```js
240
+ await sock.sendMessage(m.chat, {
241
+ disclaimerText: '© Echa · Combined Baileys',
242
+ richResponse: [
243
+ { text: 'Contoh kode JavaScript' },
244
+ {
245
+ language: 'javascript',
246
+ code: tokenizeCode(code, language)
247
+ },
248
+ { text: `Ini adalah code ${languageName} yang ada di ${fileName}` }
249
+ ]
250
+ }, {
251
+ quoted: m,
252
+ bypassDownload: true
253
+ })
254
+ ```
255
+
256
+ ### Tabel dengan bypass
257
+
258
+ ```js
259
+ await sock.sendMessage(m.chat, {
260
+ title: 'Inventaris',
261
+ table: [
262
+ ['Item', 'Jumlah'],
263
+ ['Koin', '250'],
264
+ ['Energi', '80']
265
+ ]
266
+ }, {
267
+ bypassDownload: true
268
+ })
269
+ ```
270
+
271
+ ### Pengiriman normal
272
+
273
+ Kalau ingin pesan dikirim tanpa follow-up bypass, cukup jangan menambahkan opsinya:
274
+
275
+ ```js
276
+ await sock.sendMessage(m.chat, {
277
+ richResponse: [
278
+ { text: 'Pesan Rich dengan pengiriman normal.' }
279
+ ]
280
+ })
281
+ ```
282
+
283
+ ### Opsi tambahan
284
+
285
+ | Opsi | Kegunaan |
286
+ |---|---|
287
+ | `bypassDownload` | Mengaktifkan follow-up edit protokol. Default `false`. |
288
+ | `forwardWrapper` | Mengatur wrapper `botForwardedMessage` pada pesan edit. Default `true`. |
289
+ | `editMessageId` | ID khusus untuk pesan edit lanjutan. |
290
+
291
+ Jika pengiriman pesan pertama berhasil tetapi follow-up edit gagal, error dapat membawa properti `relayedKey`. Periksa pesan tersebut sebelum mencoba mengirim ulang agar tidak membuat pesan duplikat.
292
+
293
+ ## Helper Rich lainnya
294
+
295
+ Selain melalui `sendMessage`, beberapa helper dapat dipanggil langsung dari socket.
296
+
297
+ ### WebUI / HTML
298
+
299
+ ```js
300
+ const html = `<!doctype html>
301
+ <html>
302
+ <body>
303
+ <h1>Halo!</h1>
304
+ <p>Ini contoh tampilan WebUI.</p>
305
+ </body>
306
+ </html>`
307
+
308
+ await sock.sendWebUIV1(m.chat, html, 'Ourin WebUI', {
309
+ bypassDownload: true
310
+ })
311
+ ```
312
+
313
+ ### Rich Menu
314
+
315
+ ```js
316
+ await sock.sendRichMenuV1(m.chat, {
317
+ header: {
318
+ title: 'Menu Bot'
319
+ },
320
+ body: {
321
+ title: 'Pilih layanan',
322
+ buttons: [
323
+ { label: 'Menu utama', toast: 'Membuka menu utama' },
324
+ { label: 'Bantuan', toast: 'Membuka bantuan' }
325
+ ]
326
+ },
327
+ footer: {
328
+ text: 'Buka website',
329
+ url: 'https://example.com'
330
+ }
331
+ }, {
332
+ bypassDownload: true
333
+ })
334
+ ```
335
+
336
+ ### Carousel
337
+
338
+ ```js
339
+ await sock.sendCarouselV1(m.chat, {
340
+ text: 'Pilih produk',
341
+ footer: 'Combined Baileys',
342
+ cards: [
343
+ {
344
+ text: 'Produk A tersedia',
345
+ header: { title: 'Produk A', subtitle: 'Paket basic' },
346
+ buttons: [
347
+ { type: 'quick_reply', displayText: 'Pilih A', id: '.buy_a' }
348
+ ]
349
+ },
350
+ {
351
+ text: 'Produk B tersedia',
352
+ header: { title: 'Produk B', subtitle: 'Paket premium' },
353
+ buttons: [
354
+ { type: 'quick_reply', displayText: 'Pilih B', id: '.buy_b' }
355
+ ]
356
+ }
357
+ ]
358
+ }, {
359
+ bypassDownload: true
360
+ })
361
+ ```
362
+
363
+ ### Interactive message
364
+
365
+ ```js
366
+ await sock.sendInteractiveV1(m.chat, {
367
+ title: 'Pilih menu',
368
+ buttons: [
369
+ { name: 'quick_reply', buttonParamsJson: JSON.stringify({ display_text: 'Menu', id: '.menu' }) },
370
+ { name: 'cta_url', buttonParamsJson: JSON.stringify({ display_text: 'Website', url: 'https://example.com' }) }
371
+ ]
372
+ }, {
373
+ bypassDownload: true
374
+ })
375
+ ```
376
+
377
+ ### A2UI
378
+
379
+ ```js
380
+ const { A2UI } = require('combined-baileys/rich/a2ui/v1')
381
+
382
+ const ui = new A2UI()
383
+ const heading = ui.text('Halo Combined Baileys', { variant: 'h1' })
384
+ const action = ui.button(heading, {
385
+ action: { call: 'openUrl', args: { url: 'https://example.com' } }
386
+ })
387
+ ui.root([heading, action])
388
+
389
+ await sock.sendA2UIV1(m.chat, {
390
+ a2ui: ui,
391
+ bodyText: 'Contoh widget A2UI',
392
+ bypassDownload: true
393
+ })
394
+ ```
395
+
396
+ ### Tombol klasik dan list
397
+
398
+ ```js
399
+ await sock.sendClassicBtnV1(m.chat, {
400
+ text: 'Pilih tombol',
401
+ footer: 'Combined Baileys',
402
+ buttons: [
403
+ { buttonId: '.menu', buttonText: 'Menu' },
404
+ { buttonId: '.owner', buttonText: 'Owner' }
405
+ ]
406
+ }, {
407
+ bypassDownload: true
408
+ })
409
+
410
+ await sock.sendListV1(m.chat, {
411
+ title: 'Daftar menu',
412
+ description: 'Pilih salah satu menu',
413
+ buttonText: 'Buka daftar',
414
+ sections: [{
415
+ title: 'Umum',
416
+ rows: [
417
+ { title: 'Menu', description: 'Menampilkan menu', rowId: '.menu' },
418
+ { title: 'Ping', description: 'Cek kecepatan bot', rowId: '.ping' }
419
+ ]
420
+ }]
421
+ }, {
422
+ bypassDownload: true
423
+ })
424
+ ```
425
+
426
+ Format interactive, carousel, A2UI, dan rich UI menggunakan struktur pesan khusus WhatsApp. Pesan yang berhasil dikirim oleh server belum tentu ditampilkan dengan cara yang sama di semua versi client.
427
+
428
+ ## Membaca pesan Rich
429
+
430
+ Untuk membuat atau memproses konten Rich, beberapa utilitas tersedia dari paket utama:
431
+
432
+ ```js
433
+ const {
434
+ tokenizeCode,
435
+ prepareRichResponseMessage
436
+ } = require('combined-baileys')
437
+ ```
438
+
439
+ `tokenizeCode()` membantu membagi kode menjadi blok yang memiliki tipe highlight. `prepareRichResponseMessage()` menyiapkan payload Rich Response dari objek konten.
440
+
441
+ ## Session dan kompatibilitas
442
+
443
+ Jika bot sudah memiliki session, lakukan backup sebelum mengganti dependency. Uji library dengan salinan folder session terlebih dahulu. Jangan menghapus file session lama selama proses uji.
444
+
445
+ Core socket, Signal, `WAProto`, dan autentikasi memiliki keterkaitan dengan format kredensial serta protokol. Menggabungkan file socket atau auth dari fork lain secara sembarangan dapat membuat session tidak kompatibel.
446
+
447
+ ## Newsletter dan auto-join
448
+
449
+ Library menyediakan method newsletter seperti `newsletterFollow()` dan `newsletterUnfollow()` untuk dipanggil secara eksplisit oleh aplikasi. Method tersebut bukan proses auto-join yang berjalan otomatis ketika socket dibuat atau bot mulai terhubung.
450
+
451
+ Aplikasi yang memakai method follow tetap harus menentukan sendiri kapan dan channel mana yang akan diikuti. Periksa kode bot apabila ingin memastikan tidak ada pemanggilan follow dari sisi aplikasi.
452
+
453
+ ## Dependency opsional
454
+
455
+ Beberapa integrasi dapat memerlukan paket tambahan. Dependency berikut bersifat opsional dan tidak semuanya dibutuhkan untuk menjalankan socket dasar.
456
+
457
+ | Paket | Kegunaan |
458
+ |---|---|
459
+ | `@roamhq/wrtc` | Transport WebRTC untuk fitur VoIP. |
460
+ | `audio-decode` | Dekode audio tambahan. |
461
+ | `fluent-ffmpeg` | Integrasi FFmpeg. |
462
+ | `jimp` / `sharp` | Pemrosesan gambar. |
463
+ | `link-preview-js` | Pembuatan link preview. |
464
+ | `qrcode-terminal` | Tampilan QR di terminal. |
465
+
466
+ Fitur VoIP bersifat eksperimental dan memerlukan konfigurasi tambahan, termasuk dukungan WebRTC serta executable FFmpeg pada sistem.
467
+
468
+ ## Lisensi dan atribusi
469
+
470
+ Copyright © Echa. Project support by Dansz.
471
+
472
+ Lisensi proyek dan pemberitahuan komponen pihak ketiga mengikuti berkas `LICENSE` dan `NOTICE-THIRD-PARTY.md` di repository. Komponen yang berasal dari proyek lain tetap tunduk pada lisensi dan atribusi masing-masing.
473
+
474
+ Repository: <https://github.com/DanszPedia/remake-baileys>