@alannxd/baileys 6.2.7 → 6.2.8

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 (45) hide show
  1. package/README.md +440 -203
  2. package/lib/Defaults/index.js +2 -2
  3. package/lib/Socket/Client/websocket.js +35 -5
  4. package/lib/Socket/chats.js +0 -5
  5. package/lib/Socket/index.js +1 -9
  6. package/lib/Socket/luxu.js +4 -5
  7. package/lib/Socket/messages-recv.js +1 -1
  8. package/lib/Socket/messages-send.js +56 -114
  9. package/lib/Socket/mex.js +38 -51
  10. package/lib/Socket/newsletter.js +276 -745
  11. package/lib/Socket/socket.js +27 -161
  12. package/lib/Socket/username.js +204 -206
  13. package/lib/Store/make-in-memory-store.js +1 -47
  14. package/lib/Types/Mex.js +2 -76
  15. package/lib/Utils/browser-utils.js +1 -0
  16. package/lib/Utils/generics.js +2 -2
  17. package/lib/Utils/index.js +0 -1
  18. package/lib/Utils/messages-media.js +0 -82
  19. package/lib/Utils/messages.js +2 -136
  20. package/lib/WAUSync/Protocols/USyncContactProtocol.js +50 -52
  21. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +52 -55
  22. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +25 -28
  23. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +36 -37
  24. package/lib/WAUSync/Protocols/USyncUsernameProtocol.js +23 -25
  25. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +51 -0
  26. package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +29 -0
  27. package/lib/WAUSync/Protocols/index.js +6 -12
  28. package/lib/WAUSync/USyncQuery.js +96 -149
  29. package/lib/WAUSync/USyncUser.js +29 -54
  30. package/lib/WAUSync/index.js +4 -3
  31. package/lib/index.js +5 -2
  32. package/package.json +14 -13
  33. package/lib/Socket/graphql.js +0 -716
  34. package/lib/Socket/interop.js +0 -463
  35. package/lib/Socket/message-builder.js +0 -475
  36. package/lib/Socket/privacy.js +0 -318
  37. package/lib/Utils/sticker.js +0 -133
  38. package/lib/Utils/use-sqlite-auth-state.js +0 -162
  39. package/lib/WAUSync/Protocols/USyncBotProfileProtocol.js +0 -53
  40. package/lib/WAUSync/Protocols/USyncBusinessProtocol.js +0 -43
  41. package/lib/WAUSync/Protocols/USyncFeatureProtocol.js +0 -58
  42. package/lib/WAUSync/Protocols/USyncLIDProtocol.js +0 -30
  43. package/lib/WAUSync/Protocols/USyncPictureProtocol.js +0 -32
  44. package/lib/WAUSync/Protocols/USyncSidelistProtocol.js +0 -28
  45. package/lib/WAUSync/Protocols/USyncTextStatusProtocol.js +0 -38
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # <div align='center'>Baileys - Typescript/Javascript WhatsApp Web API</div>
2
2
 
3
3
  <p align="center">
4
- <img src="https://img2.pixhost.to/images/9521/751472173_alan.jpg" alt="Thumbnail" />
4
+ <img src="https://img3.pixhost.to/images/6052/775950487_alanwinter.jpg" alt="Thumbnail" />
5
5
  </p>
6
6
 
7
7
  <div align='center'>
@@ -16,30 +16,50 @@
16
16
 
17
17
  </div>
18
18
 
19
- WhatsApp Baileys is an open-source library designed to help developers build automation solutions and integrations with WhatsApp efficiently and directly. Using websocket technology without the need for a browser, this library supports a wide range of features such as message management, chat handling, group administration, as well as interactive messages and action buttons for a more dynamic user experience.
19
+ WhatsApp Baileys is an open-source TypeScript/JavaScript library designed for developers who need direct and flexible integration with WhatsApp Web. It allows applications to establish WhatsApp connections through WebSocket communication without requiring a browser such as Chrome or Chromium.
20
20
 
21
- Actively developed and maintained, baileys continuously receives updates to enhance stability and performance. One of the main focuses is to improve the pairing and authentication processes to be more stable and secure. Pairing features can be customized with your own codes, making the process more reliable and less prone to interruptions.
21
+ This library provides a modular interface for authentication, session management, message processing, event handling, and raw message relay. It can be integrated into various Node.js applications, including automation systems, business bots, customer service platforms, notification services, and other communication-related projects.
22
22
 
23
- This library is highly suitable for building business bots, chat automation systems, customer service solutions, and various other communication automation applications that require high stability and comprehensive features. With a lightweight and modular design, baileys is easy to integrate into different systems and platforms.
23
+ The project also focuses on making the authentication and pairing workflow easier to integrate into custom applications. QR authentication and pairing code authentication can be combined with persistent session storage, allowing applications to reconnect without requiring users to authenticate every time the process restarts.
24
+
25
+ Baileys is designed to provide developers with direct access to WhatsApp Web functionality while keeping the implementation relatively lightweight. Because the library operates through a WebSocket connection rather than browser automation, it can be deployed on environments such as Linux servers, VPS instances, Docker containers, and development environments such as Termux.
26
+
27
+ This project is developed and maintained independently and is not affiliated with WhatsApp or Meta.
24
28
 
25
29
  ---
26
30
 
27
31
  ### Main Features and Advantages
28
32
 
29
- - Supports automatic and custom pairing processes
30
- - Fixes previous pairing issues that often caused failures or disconnections
31
- - Supports interactive messages, action buttons, and dynamic menus
32
- - Efficient automatic session management for reliable operation
33
- - Compatible with the latest multi-device features from WhatsApp
34
- - Lightweight, stable, and easy to integrate into various systems
35
- - Suitable for developing bots, automation, and complete communication solutions
36
- - Comprehensive documentation and example codes to facilitate development
33
+ - WhatsApp Web connection through WebSocket
34
+ - QR Code authentication
35
+ - Pairing Code authentication
36
+ - Multi-device authentication
37
+ - Persistent local session management
38
+ - Automatic credential updates
39
+ - `sendMessage` support
40
+ - `relayMessage` support
41
+ - Raw message object support
42
+ - Custom message structures
43
+ - Interactive messages and action buttons
44
+ - Poll and quiz message support
45
+ - Product and order message support
46
+ - Group-related message functionality
47
+ - Event-based message and connection handling
48
+ - Lightweight Node.js integration
49
+ - Suitable for VPS, Linux, Docker, and Termux environments
50
+ - Ready-to-use examples for common use cases
37
51
 
38
52
  ---
39
53
 
40
54
  ## Getting Started
41
55
 
42
- Begin by installing the library via your preferred package manager, then follow the provided configuration guide. You can also utilize the ready-made example codes to understand how the features work. Use session storage and interactive messaging features to build complete, stable solutions tailored to your business or project needs.
56
+ Before starting development, make sure Node.js 20 or newer is installed on your environment.
57
+
58
+ Install the package using npm, configure the authentication state, then create a WhatsApp socket using `makeWASocket()`.
59
+
60
+ The simplest setup uses `useMultiFileAuthState()` to store authentication data locally. Once the credentials have been saved, the same session can be reused when the application is restarted.
61
+
62
+ The examples below use CommonJS syntax so they can be integrated directly into most existing Node.js projects.
43
63
 
44
64
  ---
45
65
 
@@ -48,297 +68,485 @@ Begin by installing the library via your preferred package manager, then follow
48
68
  - [Requirements](#requirements)
49
69
  - [Install](#install)
50
70
  - [Quick Start](#quick-start)
51
- - [QR Code login](#login-with-qr-code)
52
- - [Pairing Code login](#login-with-pairing-code)
53
- - [Store](#store)
54
71
  - [Sending Messages](#sending-messages)
55
- - [Generic send / relay](#generic-send--relay)
56
- - [Simple senders](#simple-senders)
57
- - [Special message types](#special-message-types)
72
+ - [Raw Message Relay](#raw-message-relay)
73
+ - [Relay Examples](#relay-examples)
58
74
  - [Events](#events)
59
- - [Examples](#examples)
60
- - [Known Limitations](#known-limitations)
61
- - [Why Choose WhatsApp Baileys?](#why-choose-whatsapp-baileys?)
75
+ - [Authentication](#authentication)
76
+ - [Complete Example](#complete-example)
77
+ - [Why Choose WhatsApp Baileys?](#why-choose-whatsapp-baileys)
62
78
  - [Technical Notes](#technical-notes)
63
79
  - [Contact Developer](#contact-developer)
64
- - [Contributors](#contributors-outside-the-baileys-code)
80
+ - [Contributors outside the Baileys code](#contributors-outside-the-baileys-code)
81
+ - [Credits](#credits)
82
+ - [Disclaimer](#disclaimer)
83
+
84
+ ---
65
85
 
66
86
  ## Requirements
67
87
 
68
88
  - Node.js **>= 20**
69
- - Optional peer deps depending on the features you use: `sharp` or `jimp` (image processing), `link-preview-js` (link previews), `audio-decode` (audio waveform)
89
+ - npm
90
+ - Internet connection
91
+ - A WhatsApp account for authentication
92
+
93
+ Depending on the features being used, additional dependencies may be required by the project.
94
+
95
+ ---
70
96
 
71
97
  ## Install
72
98
 
99
+ Install the package using npm:
100
+
73
101
  ```bash
74
102
  npm install @alannxd/baileys
75
103
  ```
76
104
 
77
- Or alias it as `baileys` / `@whiskeysockets/baileys` in your `package.json`:
105
+ Or use it as an alias while keeping the standard Baileys package name in your source code:
78
106
 
79
107
  ```json
80
108
  {
81
109
  "dependencies": {
82
- "@alannxd/baileys": "latest"
110
+ "@whiskeysockets/baileys": "npm:@alannxd/baileys@latest"
83
111
  }
84
112
  }
85
113
  ```
86
114
 
115
+ Then import it using:
116
+
87
117
  ```js
88
- import makeWASocket from '@alannxd/baileys'
89
- // or, CommonJS:
90
- const { default: makeWASocket } = require('@alannxd/baileys')
118
+ const makeWASocket =
119
+ require('@whiskeysockets/baileys').default
120
+
121
+ const {
122
+ useMultiFileAuthState
123
+ } = require('@whiskeysockets/baileys')
91
124
  ```
92
125
 
126
+ ---
127
+
93
128
  ## Quick Start
94
129
 
95
- ### Login with QR Code
130
+ The following example creates a basic WhatsApp connection, stores authentication credentials locally, and listens for connection updates.
96
131
 
97
132
  ```js
98
- import makeWASocket, { Browsers, useMultiFileAuthState } from '@alannxd/baileys'
133
+ const makeWASocket =
134
+ require('@whiskeysockets/baileys').default
135
+
136
+ const {
137
+ useMultiFileAuthState
138
+ } = require('@whiskeysockets/baileys')
139
+
140
+ async function start() {
141
+ const { state, saveCreds } =
142
+ await useMultiFileAuthState('./session')
143
+
144
+ const sock = makeWASocket({
145
+ auth: state
146
+ })
147
+
148
+ sock.ev.on(
149
+ 'creds.update',
150
+ saveCreds
151
+ )
152
+
153
+ sock.ev.on(
154
+ 'connection.update',
155
+ ({ connection }) => {
156
+ console.log(
157
+ 'Connection:',
158
+ connection
159
+ )
160
+ }
161
+ )
162
+ }
99
163
 
100
- const { state, saveCreds } = await useMultiFileAuthState('auth_info')
164
+ start()
165
+ ```
101
166
 
102
- const client = makeWASocket({
103
- browser: Browsers.ubuntu('Chrome'),
104
- printQRInTerminal: true,
105
- auth: state
106
- })
167
+ The authentication state is stored inside the `session/` directory. Once authenticated, the same session can be reused when the application starts again.
107
168
 
108
- client.ev.on('creds.update', saveCreds)
169
+ ---
170
+
171
+ ## Sending Messages
172
+
173
+ ### Text Message
174
+
175
+ ```js
176
+ await sock.sendMessage(
177
+ '628xxxxxxxxxx@s.whatsapp.net',
178
+ {
179
+ text: 'Hello'
180
+ }
181
+ )
109
182
  ```
110
183
 
111
- ### Login with Pairing Code
184
+ ### Image Message
112
185
 
113
186
  ```js
114
- import makeWASocket, { Browsers, fetchLatestWAWebVersion, useMultiFileAuthState } from '@alannxd/baileys'
115
-
116
- const { state, saveCreds } = await useMultiFileAuthState('auth_info')
117
- const { version } = await fetchLatestWAWebVersion()
118
-
119
- const client = makeWASocket({
120
- browser: Browsers.ubuntu('Chrome'),
121
- printQRInTerminal: false,
122
- version,
123
- auth: state
124
- })
125
-
126
- client.ev.on('creds.update', saveCreds)
127
-
128
- if (!client.authState?.creds?.registered) {
129
- const phoneNumber = '628XXXXXXXXXX' // international format, no '+'
130
- const code = await client.requestPairingCode(phoneNumber)
131
- // custom pairing code (8 characters):
132
- // const code = await client.requestPairingCode(phoneNumber, 'YYYYYYYY')
133
- console.log('Pairing code:', code)
134
- }
187
+ await sock.sendMessage(
188
+ '628xxxxxxxxxx@s.whatsapp.net',
189
+ {
190
+ image: {
191
+ url: './image.jpg'
192
+ },
193
+ caption: 'Hello'
194
+ }
195
+ )
196
+ ```
197
+
198
+ ### Video Message
199
+
200
+ ```js
201
+ await sock.sendMessage(
202
+ '628xxxxxxxxxx@s.whatsapp.net',
203
+ {
204
+ video: {
205
+ url: './video.mp4'
206
+ },
207
+ caption: 'Hello'
208
+ }
209
+ )
135
210
  ```
136
211
 
137
- ## Store
212
+ ---
213
+
214
+ ## Raw Message Relay
138
215
 
139
- `makeInMemoryStore` builds a local cache of chats/contacts/messages, which
140
- Baileys does not persist automatically by default.
216
+ `relayMessage()` digunakan untuk mengirim raw message object secara langsung.
217
+
218
+ Metode ini berguna ketika aplikasi membutuhkan kontrol yang lebih langsung terhadap struktur message dibandingkan penggunaan helper `sendMessage()` biasa.
141
219
 
142
220
  ```js
143
- import makeWASocket, { makeInMemoryStore } from '@alannxd/baileys'
144
- import pino from 'pino'
221
+ await sock.relayMessage(
222
+ target,
223
+ message,
224
+ {
225
+ messageId: message.key.id
226
+ }
227
+ )
228
+ ```
145
229
 
146
- const store = makeInMemoryStore({
147
- logger: pino().child({ level: 'silent', stream: 'store' })
148
- })
230
+ ### `Alanself`
149
231
 
150
- const client = makeWASocket({ /* ...other options */ })
151
- store.bind(client.ev)
232
+ Library ini menyediakan opsi tambahan `Alanself` pada relay message:
152
233
 
153
- client.ev.on('contacts.upsert', () => {
154
- console.log('New contact:', Object.values(store.contacts))
155
- })
234
+ ```js
235
+ await sock.relayMessage(
236
+ target,
237
+ message,
238
+ {
239
+ messageId: message.key.id,
240
+ Alanself: true
241
+ }
242
+ )
156
243
  ```
157
244
 
158
- Need a persistent store (Redis, etc.)? Use `makeCacheManagerStore` — see [API Reference](docs/API.md#store-libstore).
245
+ `Alanself: true` digunakan pada implementasi tertentu untuk mengatur bagaimana pesan hasil relay diperlakukan terhadap sinkronisasi pesan milik perangkat pengirim.
246
+
247
+ Karena opsi ini merupakan bagian dari modifikasi/penyesuaian project, perilakunya dapat bergantung pada implementasi socket yang digunakan.
248
+
249
+ ---
159
250
 
160
- ### Saving the store to a file
251
+ ## Relay Examples
161
252
 
162
- `makeInMemoryStore` can read/write its state to a local JSON file, so it
163
- survives restarts without needing an external database:
253
+ ### Conversation
164
254
 
165
255
  ```js
166
- const store = makeInMemoryStore({ /* ... */ })
256
+ await sock.relayMessage(
257
+ jid,
258
+ {
259
+ conversation: 'Hello'
260
+ },
261
+ {
262
+ Alanself: true
263
+ }
264
+ )
265
+ ```
167
266
 
168
- // load once on startup, then auto-save every 10s
169
- const stopAutoSave = store.writeToFileInterval('./store.json')
267
+ ### Extended Text
170
268
 
171
- process.on('SIGINT', () => {
172
- stopAutoSave()
173
- process.exit(0)
174
- })
269
+ ```js
270
+ await sock.relayMessage(
271
+ jid,
272
+ {
273
+ extendedTextMessage: {
274
+ text: 'Hello'
275
+ }
276
+ },
277
+ {
278
+ Alanself: true
279
+ }
280
+ )
175
281
  ```
176
282
 
177
- Or handle it manually with `store.readFromFile(path)` / `store.writeToFile(path)` — see [API Reference](docs/API.md#file-persistence-makeinmemorystore) for details.
283
+ Raw message relay memungkinkan developer menggunakan struktur message yang lebih spesifik sesuai kebutuhan aplikasinya.
178
284
 
179
- ## Sending Messages
285
+ ---
286
+
287
+ ## Events
180
288
 
181
- ### Generic send / relay
289
+ Semua event tersedia melalui `sock.ev`.
290
+
291
+ ### Connection
292
+
293
+ ```js
294
+ sock.ev.on(
295
+ 'connection.update',
296
+ ({ connection }) => {
297
+ console.log(
298
+ 'Connection:',
299
+ connection
300
+ )
301
+ }
302
+ )
303
+ ```
304
+
305
+ ### Incoming Message
182
306
 
183
307
  ```js
184
- // relayMessage — send a raw message object, bypassing the sendMessage pipeline
185
- await client.relayMessage(jid, { conversation: 'Hello from Baileys' }, {})
308
+ sock.ev.on(
309
+ 'messages.upsert',
310
+ ({ messages }) => {
311
+ for (const message of messages) {
312
+ console.log(
313
+ 'Incoming:',
314
+ message.message
315
+ )
316
+ }
317
+ }
318
+ )
319
+ ```
186
320
 
187
- // sendMessage — the common way to send a message
188
- await client.sendMessage(jid, { text: 'Hello from Baileys' })
321
+ ### Credentials
322
+
323
+ ```js
324
+ sock.ev.on(
325
+ 'creds.update',
326
+ saveCreds
327
+ )
189
328
  ```
190
329
 
191
- ### Simple senders
330
+ Event system memungkinkan aplikasi menangani berbagai perubahan secara asynchronous, termasuk status koneksi, pesan masuk, pembaruan credential, dan event lain yang tersedia pada socket.
331
+
332
+ ---
333
+
334
+ ## Authentication
192
335
 
193
- All the `sendX` functions below are shortcuts on top of `sendMessage`.
336
+ Session disimpan secara lokal menggunakan:
194
337
 
195
338
  ```js
196
- await client.sendText(jid, 'Hi!', { contextInfo: { mentionedJid: [jid] } })
197
- await client.sendImage(jid, { url: './photo.jpg' }, 'image caption')
198
- await client.sendVideo(jid, { url: './clip.mp4' }, 'video caption')
199
- await client.sendAudio(jid, { url: './clip.mp3' })
200
- await client.sendLocation(jid, 'Location name', -6.2, 106.8, 'https://maps.example', '1234567890')
201
- await client.sendPoll(jid, 'Pick one', ['Option 1', 'Option 2', 'Option 3'], /* multiSelect */ true)
202
- await client.sendQuiz(jid, 'Correct answer?', ['1', '2', '3'], /* correctIndex */ '2')
339
+ useMultiFileAuthState()
340
+ ```
341
+
342
+ Contoh struktur session:
343
+
344
+ ```text
345
+ session/
346
+ ├── creds.json
347
+ ├── app-state-sync-key-*.json
348
+ └── ...
203
349
  ```
204
350
 
205
- ### Special message types
351
+ Folder tersebut berisi informasi authentication yang memungkinkan aplikasi mempertahankan session WhatsApp.
206
352
 
207
- Handled internally by the `Socket/luxu.js` helper, invoked automatically via
208
- `sendMessage`/`relayMessage` whenever the content includes one of the fields below.
353
+ Jangan upload folder `session` ke repository publik.
354
+
355
+ Tambahkan ke `.gitignore`:
356
+
357
+ ```gitignore
358
+ session/
359
+ node_modules/
360
+ .env
361
+ ```
362
+
363
+ Credential session sebaiknya diperlakukan sebagai data sensitif karena dapat digunakan untuk mempertahankan authentication pada perangkat yang menjalankan aplikasi.
364
+
365
+ ---
366
+
367
+ ## Complete Example
209
368
 
210
369
  ```js
211
- // Product message (catalog)
212
- await client.relayMessage(jid, {
213
- productMessage: {
214
- title: 'Product Name',
215
- description: 'Product description',
216
- thumbnail: { url: './product.jpg' },
217
- productId: 'PRODUCT_ID',
218
- retailerId: 'RETAILER_ID',
219
- url: 'https://store.example/product',
220
- body: 'Body text',
221
- footer: 'Footer text',
222
- priceAmount1000: 72502, // price x 1000
223
- currencyCode: 'IDR'
370
+ const makeWASocket =
371
+ require('@whiskeysockets/baileys').default
372
+
373
+ const {
374
+ useMultiFileAuthState
375
+ } = require('@whiskeysockets/baileys')
376
+
377
+ async function start() {
378
+ const { state, saveCreds } =
379
+ await useMultiFileAuthState('./session')
380
+
381
+ const sock = makeWASocket({
382
+ auth: state
383
+ })
384
+
385
+ sock.ev.on(
386
+ 'creds.update',
387
+ saveCreds
388
+ )
389
+
390
+ sock.ev.on(
391
+ 'connection.update',
392
+ ({ connection }) => {
393
+ console.log(
394
+ '[ CONNECTION ]',
395
+ connection
396
+ )
397
+ }
398
+ )
399
+
400
+ async function sendText(jid, text) {
401
+ return sock.sendMessage(
402
+ jid,
403
+ { text }
404
+ )
224
405
  }
225
- }, {})
226
-
227
- // Order message
228
- await client.sendMessage(jid, {
229
- thumbnail: fs.readFileSync('./thumb.jpg'),
230
- message: 'Order details',
231
- orderTitle: 'Store Name',
232
- totalAmount1000: 72502,
233
- totalCurrencyCode: 'IDR'
234
- }, { quoted: m })
235
-
236
- // Poll result snapshot (usually from a newsletter)
237
- await client.sendMessage(jid, {
238
- pollResultMessage: {
239
- name: 'Poll Title',
240
- options: [{ optionName: 'Option 1' }, { optionName: 'Option 2' }],
241
- newsletter: { newsletterName: 'Newsletter Name', newsletterJid: '1234567890@newsletter' }
406
+
407
+ async function relay(jid, message) {
408
+ return sock.relayMessage(
409
+ jid,
410
+ message,
411
+ {
412
+ messageId: message.key.id,
413
+ Alanself: true
414
+ }
415
+ )
242
416
  }
243
- })
244
-
245
- // Interactive message (button)
246
- await client.sendMessage(jid, {
247
- image: { url: './banner.jpg' },
248
- text: 'Message body',
249
- title: 'Title',
250
- footer: 'Footer',
251
- interactiveButtons: [{
252
- name: 'cta_url',
253
- buttonParamsJson: JSON.stringify({ display_text: 'Visit', url: 'https://example.com' })
254
- }]
255
- })
256
-
257
- // Group member label
258
- await client.sendMessage(jid, {
259
- groupLabel: { labelText: 'Admin' }
260
- })
261
-
262
- // Broadcast to specific group members
263
- await client.sendMessageMembers(jid, { extendedTextMessage: { text: 'Announcement' } }, {})
417
+ }
418
+
419
+ start()
264
420
  ```
265
421
 
266
- > Fields like `sender` and `participant: true` in the second argument of
267
- > `sendMessage`/`relayMessage` are used for group-participant send context — see
268
- > [`docs/API.md`](docs/API.md) for details on each socket layer.
422
+ ---
269
423
 
270
- ## Events
424
+ ## Why Choose WhatsApp Baileys?
425
+
426
+ Baileys memberikan pendekatan yang relatif ringan untuk membuat aplikasi yang terhubung dengan WhatsApp Web tanpa harus menjalankan browser automation.
427
+
428
+ Beberapa karakteristik utama yang membuat library ini cocok untuk berbagai kebutuhan development:
429
+
430
+ - **Direct WebSocket Connection**
431
+ Aplikasi dapat berkomunikasi dengan WhatsApp Web melalui koneksi WebSocket tanpa membutuhkan browser sebagai perantara.
432
+
433
+ - **Flexible Authentication**
434
+ Mendukung authentication berbasis QR Code maupun Pairing Code serta penyimpanan session secara lokal.
271
435
 
272
- All interaction happens through events on `client.ev`:
436
+ - **Multi-Device Support**
437
+ Mendukung sistem multi-device WhatsApp sehingga aplikasi dapat digunakan dengan mekanisme authentication modern.
438
+
439
+ - **Raw Message Access**
440
+ `relayMessage()` memungkinkan developer bekerja dengan message object secara lebih langsung ketika `sendMessage()` standar tidak cukup untuk kebutuhan tertentu.
441
+
442
+ - **Event-Based Architecture**
443
+ Berbagai aktivitas dapat dipantau menggunakan event seperti `connection.update`, `messages.upsert`, dan `creds.update`.
444
+
445
+ - **Lightweight Deployment**
446
+ Dapat digunakan pada VPS, Linux server, Docker, maupun Termux tanpa memerlukan browser automation.
447
+
448
+ - **Flexible Integration**
449
+ API dapat digunakan sebagai bagian dari bot, automation system, notification service, customer service application, maupun project Node.js lainnya.
450
+
451
+ - **Customizable**
452
+ Karena source dan struktur library dapat dikembangkan lebih lanjut, developer dapat menyesuaikannya dengan kebutuhan aplikasi masing-masing.
453
+
454
+ ---
455
+
456
+ ## Technical Notes
457
+
458
+ ### Node.js Version
459
+
460
+ Library ditujukan untuk environment Node.js versi:
461
+
462
+ ```text
463
+ Node.js >= 20
464
+ ```
465
+
466
+ Menggunakan versi Node.js yang sesuai membantu memastikan fitur JavaScript modern dan dependency dapat berjalan sebagaimana mestinya.
467
+
468
+ ### Authentication State
469
+
470
+ Authentication state menggunakan:
273
471
 
274
472
  ```js
275
- client.ev.on('connection.update', ({ connection, lastDisconnect }) => {
276
- console.log('Connection status:', connection)
277
- })
473
+ useMultiFileAuthState()
474
+ ```
278
475
 
279
- client.ev.on('messages.upsert', ({ messages, type }) => {
280
- for (const m of messages) {
281
- console.log('Incoming message:', m.message)
282
- }
283
- })
476
+ Credential harus tetap disimpan melalui:
284
477
 
285
- client.ev.on('creds.update', saveCreds)
478
+ ```js
479
+ sock.ev.on(
480
+ 'creds.update',
481
+ saveCreds
482
+ )
286
483
  ```
287
484
 
288
- See the full list of events in `lib/Types/Events.js`.
485
+ Hal tersebut memungkinkan perubahan credential ditulis ke session secara otomatis.
289
486
 
290
- ## Examples
487
+ ### Raw Relay
291
488
 
292
- Ready-to-run scripts live in [`examples/`](examples):
489
+ `relayMessage()` bekerja menggunakan raw message object.
293
490
 
294
- - [`examples/qr-login.js`](examples/qr-login.js) — QR login with auto-reconnect
295
- - [`examples/pairing-code.js`](examples/pairing-code.js) — pairing code login
296
- - [`examples/store-usage.js`](examples/store-usage.js) — using the in-memory store
491
+ Contoh:
297
492
 
298
- ## Known Limitations
493
+ ```js
494
+ await sock.relayMessage(
495
+ jid,
496
+ message,
497
+ {
498
+ messageId: message.key.id,
499
+ Alanself: true
500
+ }
501
+ )
502
+ ```
299
503
 
300
- - **No `.d.ts` for `lib/`** — only `WAProto` ships TypeScript types. Full autocomplete requires the TS source, which isn't included in this build.
301
- - **Console banner on import** — every time the package is `import`ed, an ASCII art banner and promotional link are printed to stdout. In production or multi-instance setups this becomes log noise.
302
- - **`optionHash` for per-option image polls** is not implemented — it appears to require further reverse-engineering at the WhatsApp APK level.
303
- - See [`docs/API.md`](docs/API.md#️-important-notes) for other technical notes.
504
+ Struktur message yang dikirim harus sesuai dengan format message yang dapat diproses oleh socket.
304
505
 
305
- ## Why Choose WhatsApp Baileys?
506
+ ### Environment
306
507
 
307
- Because this library offers high stability, full features, and an actively improved pairing process. It is ideal for developers aiming to create professional and secure WhatsApp automation solutions. Support for the latest WhatsApp features ensures compatibility with platform updates.
508
+ Library dapat digunakan pada berbagai environment Node.js, termasuk:
308
509
 
309
- ---
510
+ ```text
511
+ Linux
512
+ VPS
513
+ Docker
514
+ Termux
515
+ Local Development
516
+ ```
310
517
 
311
- ### Technical Notes
518
+ ### Session Security
312
519
 
313
- - Supports custom pairing codes that are stable and secure
314
- - Fixes previous issues related to pairing and authentication
315
- - Features interactive messages and action buttons for dynamic menu creation
316
- - Automatic and efficient session management for long-term stability
317
- - Compatible with the latest multi-device features from WhatsApp
318
- - Easy to integrate and customize based on your needs
319
- - Perfect for developing bots, customer service automation, and other communication applications
320
- - Has 1 newsletter follow, only the developer's WhatsApp channel: [WhatsApp Channel](https://whatsapp.com/channel/0029Vb3IiqTL7UVP9A9n0w1x)
520
+ Folder session sebaiknya tidak dibagikan, dikirim ke orang lain, atau diupload ke repository publik.
321
521
 
322
- ---
522
+ Jika session tidak sengaja terekspos, authentication dapat berisiko disalahgunakan.
523
+
524
+ ### WhatsApp Web Compatibility
323
525
 
324
- For complete documentation, installation guides, and implementation examples, please visit the official repository and community forums. We continually update and improve this library to meet the needs of developers and users of modern WhatsApp automation solutions.
526
+ WhatsApp dapat melakukan perubahan pada sisi Web maupun protocol. Karena itu, perubahan pada WhatsApp dapat menyebabkan bagian tertentu dari library membutuhkan update atau penyesuaian.
325
527
 
326
- **Thank you for choosing WhatsApp Baileys as your WhatsApp automation solution!**
528
+ Developer yang menggunakan library ini sebaiknya memperhatikan update dependency dan perubahan compatibility secara berkala.
327
529
 
530
+ ### Additional Features
531
+
532
+ Project ini juga menyediakan berbagai kemampuan message seperti interactive message, action button, poll, quiz, product message, order message, group-related message, dan beberapa struktur message lainnya tergantung versi library yang digunakan.
328
533
 
329
534
  ---
330
535
 
536
+ ## Contact Developer
537
+
538
+ Untuk pertanyaan, support, laporan bug, collaboration, atau informasi mengenai project:
331
539
 
332
- ### Contact Developer
540
+ - **Telegram:** [Telegram Contact](https://t.me/alannxd)
541
+ - **WhatsApp Channel:** [Channel WhatsApp](https://whatsapp.com/channel/0029Vb3IiqTL7UVP9A9n0w1x)
333
542
 
334
- For questions, support, or collaboration, feel free to contact the developer:
543
+ Untuk informasi terbaru mengenai project dan update library, silakan mengikuti channel yang tersedia.
335
544
 
336
- - **Telegram**: [Telegram Contact](https://t.me/alannxd)
337
- - **Channel WhatsApp**: [Channel WhatsApp](https://whatsapp.com/channel/0029Vb3IiqTL7UVP9A9n0w1x)
545
+ ---
338
546
 
339
- ### Contributors outside the Baileys code
547
+ ## Contributors outside the Baileys code
340
548
 
341
- Thanks to the following awesome contributors who help improve this project
549
+ Thanks to the following awesome contributors who help improve this project.
342
550
 
343
551
  <table>
344
552
  <tr>
@@ -352,10 +560,11 @@ Thanks to the following awesome contributors who help improve this project
352
560
  <td align="center">
353
561
  <a href="https://github.com/Xazepysk">
354
562
  <img src="https://github.com/XazepysK.png" width="80px;" style="border-radius:50%;" alt="Contributor"/>
355
- <br /><sub><b>Xaz zepysK</b></sub>
563
+ <br />
564
+ <sub><b>Xaz zepysK</b></sub>
356
565
  </a>
357
566
  </td>
358
- <td align="center">
567
+ <td align="center">
359
568
  <a href="https://github.com/kiuur">
360
569
  <img src="https://github.com/kiuur.png" width="80px;" style="border-radius:50%;" alt="Contributor"/>
361
570
  <br />
@@ -370,4 +579,32 @@ Thanks to the following awesome contributors who help improve this project
370
579
  </a>
371
580
  </td>
372
581
  </tr>
373
- </table>
582
+ </table>
583
+
584
+ ---
585
+
586
+ ## Credits
587
+
588
+ <div align="center">
589
+
590
+ **AlannXD**
591
+
592
+ Developer & Maintainer
593
+
594
+ <br>
595
+
596
+ Based on:
597
+
598
+ **Baileys**
599
+
600
+ </div>
601
+
602
+ ---
603
+
604
+ ## Disclaimer
605
+
606
+ Project ini dibuat untuk keperluan **development dan educational**.
607
+
608
+ Developer tidak bertanggung jawab atas penyalahgunaan library, pembatasan akun, kehilangan session, atau pelanggaran Terms of Service WhatsApp.
609
+
610
+ Gunakan library secara bertanggung jawab dan ikuti ketentuan layanan WhatsApp yang berlaku.