@alannxd/baileys 6.1.4 → 6.1.7

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 (55) hide show
  1. package/LICENSE +4 -1
  2. package/README.md +205 -281
  3. package/lib/Defaults/index.js +1 -1
  4. package/lib/Socket/chats.js +5 -0
  5. package/lib/Socket/graphql.js +716 -0
  6. package/lib/Socket/index.js +9 -1
  7. package/lib/Socket/interop.js +463 -0
  8. package/lib/Socket/message-builder.js +475 -0
  9. package/lib/Socket/messages-recv.js +1 -1
  10. package/lib/Socket/messages-send.js +106 -30
  11. package/lib/Socket/mex.js +51 -39
  12. package/lib/Socket/newsletter.js +729 -242
  13. package/lib/Socket/privacy.js +318 -0
  14. package/lib/Socket/socket.js +163 -16
  15. package/lib/Socket/username.js +225 -136
  16. package/lib/Store/make-in-memory-store.js +47 -1
  17. package/lib/Types/Mex.js +76 -2
  18. package/lib/Utils/index.js +1 -0
  19. package/lib/Utils/messages-media.js +82 -0
  20. package/lib/Utils/messages.js +143 -2
  21. package/lib/Utils/sticker.js +133 -0
  22. package/lib/Utils/use-sqlite-auth-state.js +162 -0
  23. package/lib/WAUSync/Protocols/USyncBotProfileProtocol.js +53 -0
  24. package/lib/WAUSync/Protocols/USyncBusinessProtocol.js +43 -0
  25. package/lib/WAUSync/Protocols/USyncContactProtocol.js +52 -50
  26. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +55 -52
  27. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +28 -25
  28. package/lib/WAUSync/Protocols/USyncFeatureProtocol.js +58 -0
  29. package/lib/WAUSync/Protocols/USyncLIDProtocol.js +30 -0
  30. package/lib/WAUSync/Protocols/USyncPictureProtocol.js +32 -0
  31. package/lib/WAUSync/Protocols/USyncSidelistProtocol.js +28 -0
  32. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +37 -36
  33. package/lib/WAUSync/Protocols/USyncTextStatusProtocol.js +38 -0
  34. package/lib/WAUSync/Protocols/USyncUsernameProtocol.js +25 -23
  35. package/lib/WAUSync/Protocols/index.js +12 -6
  36. package/lib/WAUSync/USyncQuery.js +149 -96
  37. package/lib/WAUSync/USyncUser.js +54 -29
  38. package/lib/WAUSync/index.js +3 -4
  39. package/lib/index.js +2 -3
  40. package/package.json +20 -21
  41. package/WAProto/fix-import.js +0 -29
  42. package/lib/Defaults/baileys-version.json +0 -3
  43. package/lib/Defaults/phonenumber-mcc.json +0 -223
  44. package/lib/Signal/Group/queue-job.js +0 -57
  45. package/lib/Socket/Client/abstract-socket-client.js +0 -13
  46. package/lib/Socket/Client/mobile-socket-client.js +0 -65
  47. package/lib/Socket/Client/web-socket-client.js +0 -62
  48. package/lib/Socket/community.js +0 -392
  49. package/lib/Socket/dugong.js +0 -637
  50. package/lib/Socket/registration.js +0 -167
  51. package/lib/Socket/usync.js +0 -69
  52. package/lib/Types/Newsletter.js +0 -38
  53. package/lib/Utils/baileys-event-stream.js +0 -63
  54. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +0 -51
  55. package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +0 -29
package/LICENSE CHANGED
@@ -1,6 +1,9 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2025 Rajeh Taher/WhiskeySockets
3
+ Copyright (c) 2026 alannxd (AlannXD) and contributors
4
+
5
+ Based on Baileys (https://github.com/WhiskeySockets/Baileys), originally
6
+ created by Adhiraj Singh and the WhiskeySockets community, also MIT licensed.
4
7
 
5
8
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
9
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -43,338 +43,264 @@ Begin by installing the library via your preferred package manager, then follow
43
43
 
44
44
  ---
45
45
 
46
- ## Add Function ( Simple code )
47
-
48
- # AlannXD Baileys
46
+ ## Table of Contents
47
+
48
+ - [Requirements](#requirements)
49
+ - [Install](#install)
50
+ - [Quick Start](#quick-start)
51
+ - [QR Code login](#login-with-qr-code)
52
+ - [Pairing Code login](#login-with-pairing-code)
53
+ - [Store](#store)
54
+ - [Sending Messages](#sending-messages)
55
+ - [Generic send / relay](#generic-send--relay)
56
+ - [Simple senders](#simple-senders)
57
+ - [Special message types](#special-message-types)
58
+ - [Events](#events)
59
+ - [Examples](#examples)
60
+ - [Known Limitations](#known-limitations)
61
+ - [Why Choose WhatsApp Baileys?](#why-choose-whatsapp-baileys?)
62
+ - [Technical Notes](#technical-notes)
63
+ - [Contact Developer](#contact-developer)
64
+ - [Contributors](#contributors-outside-the-baileys-code)
65
+
66
+ ## Requirements
67
+
68
+ - 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)
70
+
71
+ ## Install
72
+
73
+ ```bash
74
+ npm install @alannxd/baileys
75
+ ```
49
76
 
50
- Simple WhatsApp Web API Library Based On Baileys.
77
+ Or alias it as `baileys` / `@whiskeysockets/baileys` in your `package.json`:
51
78
 
52
- ---
53
-
54
- ## Usage
55
79
  ```json
56
- "depencies": {
57
- "@alannxd/baileys": "latest"
58
- // or "@whiskeysocket/baileys": "npm:@alannxd/baileys"
80
+ {
81
+ "dependencies": {
82
+ "@alannxd/baileys": "latest"
83
+ }
59
84
  }
60
85
  ```
61
- ## Import
62
- ```javascript
63
- const {
64
- default: makeWASocket,
65
- // Other function
66
- } = require('@alannxd/baileys');
86
+
87
+ ```js
88
+ import makeWASocket from '@alannxd/baileys'
89
+ // or, CommonJS:
90
+ const { default: makeWASocket } = require('@alannxd/baileys')
67
91
  ```
68
92
 
69
- ---
70
- # How To Connect To Whatsapp
71
- ## With QR Code
72
- ```javascript
73
- const {
74
- default: makeWASocket,
75
- Browsers
76
- } = require('@alannxd/baileys');
93
+ ## Quick Start
94
+
95
+ ### Login with QR Code
96
+
97
+ ```js
98
+ import makeWASocket, { Browsers, useMultiFileAuthState } from '@alannxd/baileys'
99
+
100
+ const { state, saveCreds } = await useMultiFileAuthState('auth_info')
77
101
 
78
102
  const client = makeWASocket({
79
103
  browser: Browsers.ubuntu('Chrome'),
80
- printQRInTerminal: true
104
+ printQRInTerminal: true,
105
+ auth: state
81
106
  })
107
+
108
+ client.ev.on('creds.update', saveCreds)
82
109
  ```
83
110
 
84
- ## Connect With Number
85
- ```javascript
86
- const {
87
- default: makeWASocket,
88
- fetchLatestWAWebVersion,
89
- Browsers
90
- } = require('@alannxd/baileys');
111
+ ### Login with Pairing Code
112
+
113
+ ```js
114
+ import makeWASocket, { Browsers, fetchLatestWAWebVersion, useMultiFileAuthState } from '@alannxd/baileys'
115
+
116
+ const { state, saveCreds } = await useMultiFileAuthState('auth_info')
117
+ const { version } = await fetchLatestWAWebVersion()
91
118
 
92
119
  const client = makeWASocket({
93
120
  browser: Browsers.ubuntu('Chrome'),
94
121
  printQRInTerminal: false,
95
- version: fetchLatestWAWebVersion()
96
- aiLabel: false // enable for ai label in every message are bot send
97
- // Other options
98
- });
122
+ version,
123
+ auth: state
124
+ })
99
125
 
100
- const number = "628XXXXX";
101
- const code = await client.requestPairingCode(number.trim) //Use : (number, "YYYYYYYY") for custom-pairing
126
+ client.ev.on('creds.update', saveCreds)
102
127
 
103
- console.log("Ur pairing code : " + code)
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
+ }
104
135
  ```
105
136
 
106
- # Store Data
107
- ```javascript
108
- const {
109
- default: makeWASocket,
110
- makeInMemoryStore
111
- } = require('@alannxd/baileys');
112
- const pino = require('pino');
137
+ ## Store
138
+
139
+ `makeInMemoryStore` builds a local cache of chats/contacts/messages, which
140
+ Baileys does not persist automatically by default.
141
+
142
+ ```js
143
+ import makeWASocket, { makeInMemoryStore } from '@alannxd/baileys'
144
+ import pino from 'pino'
113
145
 
114
146
  const store = makeInMemoryStore({
115
147
  logger: pino().child({ level: 'silent', stream: 'store' })
116
- });
117
- const client = makeWASocket({
118
- // option
119
- });
148
+ })
149
+
150
+ const client = makeWASocket({ /* ...other options */ })
120
151
  store.bind(client.ev)
121
152
 
122
153
  client.ev.on('contacts.upsert', () => {
123
- console.log('Get new contact: ' + Object.values(store.contacts()));
154
+ console.log('New contact:', Object.values(store.contacts))
124
155
  })
125
156
  ```
126
- # Sending messages
127
-
128
- ## send/relay message with participant
129
- ```javascript
130
- await client.relayMessage(m.chat, {
131
- conversation: "Alann Winter's"
132
- }, {
133
- participant: true
134
- })
135
- // or
136
- await client.sendMessage(m.chat, {
137
- text: "Alann Winter's"
138
- }, {
139
- participant: true
140
- })
141
- ```
142
- ## send orderMessage
143
- ```javascript
144
- const fs = require('fs');
145
- const AlannXd = fs.readFileSync('./AlannXd');
146
-
147
- await client.sendMessage(m.chat, {
148
- thumbnail: AlannXd,
149
- message: "Gotta get a grip",
150
- orderTitle: "Alann-Winters",
151
- totalAmount1000: 72502,
152
- totalCurrencyCode: "IDR"
153
- }, { quoted:m })
154
- ```
155
157
 
156
- ## send pollResultSnapshotMessage
157
- ```javascript
158
- await client.sendMessage(m.chat, {
159
- pollResultMessage: {
160
- name: "Alann-Winters",
161
- options: [
162
- {
163
- optionName: "poll 1"
164
- },
165
- {
166
- optionName: "poll 2"
167
- }
168
- ],
169
- newsletter: {
170
- newsletterName: "ALANNXD | HOLOW",
171
- newsletterJid: "1@newsletter"
172
- }
173
- }
174
- })
175
- ```
158
+ Need a persistent store (Redis, etc.)? Use `makeCacheManagerStore` — see [API Reference](docs/API.md#store-libstore).
176
159
 
177
- ## send productMessage
178
- ```javascript
179
- await client.relayMessage(m.chat, {
180
- productMessage {
181
- title: "AlannWinter's",
182
- description: "zazaza...",
183
- thumbnail: { url: "./AlannXd" },
184
- productId: "EXAMPLE_TOKEN",
185
- retailerId: "EXAMPLE_RETAILER_ID",
186
- url: "https://t.me/alannxd",
187
- body: "Apalah ya",
188
- footer: "Footer",
189
- buttons: [
190
- {
191
- name: "cta_url",
192
- buttonParamsJson: "{\"display_text\":\"AlannWinters\",\"url\":\"https://t.me/alannxd\"}"
193
- }
194
- ],
195
- priceAmount1000: 72502,
196
- currencyCode: "IDR"
197
- }
160
+ ### Saving the store to a file
161
+
162
+ `makeInMemoryStore` can read/write its state to a local JSON file, so it
163
+ survives restarts without needing an external database:
164
+
165
+ ```js
166
+ const store = makeInMemoryStore({ /* ... */ })
167
+
168
+ // load once on startup, then auto-save every 10s
169
+ const stopAutoSave = store.writeToFileInterval('./store.json')
170
+
171
+ process.on('SIGINT', () => {
172
+ stopAutoSave()
173
+ process.exit(0)
198
174
  })
199
175
  ```
200
176
 
201
- ## send interactiveMessage
202
- ```javascript
203
- await client.sendMessage(m.chat, {
204
- image: { url: "./alxd.jpg" },
205
- text: "body",
206
- title: "title", // if media, should put title in
207
- footer: "footer",
208
- interactiveButtons: [
209
- {
210
- name: "single_select",
211
- buttonParamsJson: JSON.stringify({
212
- title: "\0"
213
- })
214
- }
215
- ],
216
- messageParams: JSON.stringify({
217
- bottom_sheet: {
218
- /** ot params **/
219
- }
220
- })
221
- })
177
+ Or handle it manually with `store.readFromFile(path)` / `store.writeToFile(path)` — see [API Reference](docs/API.md#file-persistence-makeinmemorystore) for details.
178
+
179
+ ## Sending Messages
180
+
181
+ ### Generic send / relay
182
+
183
+ ```js
184
+ // relayMessage — send a raw message object, bypassing the sendMessage pipeline
185
+ await client.relayMessage(jid, { conversation: 'Hello from Baileys' }, {})
186
+
187
+ // sendMessage — the common way to send a message
188
+ await client.sendMessage(jid, { text: 'Hello from Baileys' })
222
189
  ```
223
190
 
224
- ## send member label
225
- ```javascript
226
- await client.sendMessage(m.chat, {
227
- groupLabel: {
228
- labelText: "Tag anggota tercantum di sini"
229
- }
230
- })
191
+ ### Simple senders
192
+
193
+ All the `sendX` functions below are shortcuts on top of `sendMessage`.
194
+
195
+ ```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')
231
203
  ```
232
204
 
233
- ## send message to members in group
234
- ```javascript
235
- await client.sendMessageMembers(m.chat, {
236
- extendedTextMessage: {
237
- text: "woik sialan"
205
+ ### Special message types
206
+
207
+ Handled internally by the `Socket/luxu.js` helper, invoked automatically via
208
+ `sendMessage`/`relayMessage` whenever the content includes one of the fields below.
209
+
210
+ ```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'
238
224
  }
239
225
  }, {})
240
- ```
241
- # Simple sendMessage
242
226
 
243
- ## send text
244
- ```javascript
245
- await client.sendText(m.chat, "AlannWinters", {
246
- contextInfo: {
247
- mentionedJid: [m.chat]
248
- }
249
- }, {
250
- key: {
251
- remoteJid: "status@broadcast",
252
- participant: m.sender,
253
- fromMe: true
254
- },
255
- message: {
256
- conversation: "\0"
257
- }
258
- })
259
- ```
260
- ## send image
261
- ```javascript
262
- await client.sendImage(m.chat, { url: "./alxd.jpg" }, "AlannWinters", {
263
- contextInfo: {
264
- mentionedJid: [m.chat]
265
- }
266
- }, {
267
- key: {
268
- remoteJid: "status@broadcast",
269
- participant: m.sender,
270
- fromMe: true
271
- },
272
- message: {
273
- conversation: "\0"
274
- }
275
- })
276
- ```
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 })
277
235
 
278
- ## send video
279
- ```javascript
280
- await client.sendVideo(m.chat, { url: "./alanxd.mp4" }, "AlannWinters", {
281
- contextInfo: {
282
- mentionedJid: [m.chat]
283
- }
284
- }, {
285
- key: {
286
- remoteJid: "status@broadcast",
287
- participant: m.sender,
288
- fromMe: true
289
- },
290
- message: {
291
- conversation: "\0"
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' }
292
242
  }
293
243
  })
294
- ```
295
244
 
296
- ## send audio
297
- ```javascript
298
- await client.sendAudio(m.chat, { url: "./alanxd.mp3" }, {
299
- contextInfo: {
300
- mentionedJid: [m.chat]
301
- }
302
- }, {
303
- key: {
304
- remoteJid: "status@broadcast",
305
- participant: m.sender,
306
- fromMe: true
307
- },
308
- message: {
309
- conversation: "\0"
310
- }
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
+ }]
311
255
  })
312
- ```
313
256
 
314
- ## send location
315
- ```javascript
316
- await client.sendLocation(m.chat, "AlannWinters", 90.0, 90.0, "https://t.me/alannxd", "1234567890", {
317
- contextInfo: {
318
- mentionedJid: [m.chat]
319
- }
320
- }, {
321
- key: {
322
- remoteJid: "status@broadcast",
323
- participant: m.sender,
324
- fromMe: true
325
- },
326
- message: {
327
- conversation: "\0"
328
- }
257
+ // Group member label
258
+ await client.sendMessage(jid, {
259
+ groupLabel: { labelText: 'Admin' }
329
260
  })
330
- ```
331
261
 
332
- ## send polling
333
- ```javascript
334
- await client.sendPoll(m.chat, "AlannWinters", ["1", "2", "3"], true, {
335
- contextInfo: {
336
- mentionedJid: [m.chat]
337
- }
338
- }, {
339
- key: {
340
- remoteJid: "status@broadcast",
341
- participant: m.sender,
342
- fromMe: true
343
- },
344
- message: {
345
- conversation: "\0"
346
- }
347
- })
262
+ // Broadcast to specific group members
263
+ await client.sendMessageMembers(jid, { extendedTextMessage: { text: 'Announcement' } }, {})
348
264
  ```
349
265
 
350
- ## send quiz
351
- ```javascript
352
- await client.sendQuiz(m.chat, "AlannWinters", ["1", "2", "3"], "2", {
353
- contextInfo: {
354
- mentionedJid: [m.chat]
355
- }
356
- }, {
357
- key: {
358
- remoteJid: "status@broadcast",
359
- participant: m.sender,
360
- fromMe: true
361
- },
362
- message: {
363
- conversation: "\0"
364
- }
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.
269
+
270
+ ## Events
271
+
272
+ All interaction happens through events on `client.ev`:
273
+
274
+ ```js
275
+ client.ev.on('connection.update', ({ connection, lastDisconnect }) => {
276
+ console.log('Connection status:', connection)
365
277
  })
366
- ```
367
278
 
368
- ## send status mention
369
- ```javascript
370
- await client.statusMention(m.chat, {
371
- extendedTextMessage: {
372
- text: "AlannWinters"
279
+ client.ev.on('messages.upsert', ({ messages, type }) => {
280
+ for (const m of messages) {
281
+ console.log('Incoming message:', m.message)
373
282
  }
374
283
  })
284
+
285
+ client.ev.on('creds.update', saveCreds)
375
286
  ```
376
287
 
377
- ---
288
+ See the full list of events in `lib/Types/Events.js`.
289
+
290
+ ## Examples
291
+
292
+ Ready-to-run scripts live in [`examples/`](examples):
293
+
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
297
+
298
+ ## Known Limitations
299
+
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.
378
304
 
379
305
  ## Why Choose WhatsApp Baileys?
380
306
 
@@ -424,10 +350,9 @@ Thanks to the following awesome contributors who help improve this project
424
350
  </a>
425
351
  </td>
426
352
  <td align="center">
427
- <a href="https://github.com/tenka-san">
428
- <img src="https://github.com/tenka-san.png" width="80px;" style="border-radius:50%;" alt="Developer"/>
429
- <br />
430
- <sub><b>D | Yuukey-7eppeli</b></sub>
353
+ <a href="https://github.com/Xazepysk">
354
+ <img src="https://github.com/XazepysK.png" width="80px;" style="border-radius:50%;" alt="Contributor"/>
355
+ <br /><sub><b>Xaz zepysK</b></sub>
431
356
  </a>
432
357
  </td>
433
358
  <td align="center">
@@ -445,5 +370,4 @@ Thanks to the following awesome contributors who help improve this project
445
370
  </a>
446
371
  </td>
447
372
  </tr>
448
- </table>
449
-
373
+ </table>
@@ -2,7 +2,7 @@ import { proto } from '../../WAProto/index.js';
2
2
  import { makeLibSignalRepository } from '../Signal/libsignal.js';
3
3
  import { Browsers } from '../Utils/browser-utils.js';
4
4
  import logger from '../Utils/logger.js';
5
- const version = [2, 3000, 1035194821];
5
+ const version = [2, 3000, 1043857760];
6
6
  export const UNAUTHORIZED_CODES = [401, 403, 419];
7
7
  export const DEFAULT_ORIGIN = 'https://web.whatsapp.com';
8
8
  export const CALL_VIDEO_PREFIX = 'https://call.whatsapp.com/video/';
@@ -397,6 +397,11 @@ export const makeChatsSocket = (config) => {
397
397
  return {
398
398
  onMutation(mutation) {
399
399
  processSyncAction(mutation, ev, authState.creds.me, isInitialSync ? { accountSettings: authState.creds.accountSettings } : undefined, logger);
400
+ const nctSalt = mutation?.syncAction?.value?.nctSaltSyncAction?.salt;
401
+ if (nctSalt?.length) {
402
+ authState.keys.set({ 'nct-salt': { default: Buffer.from(nctSalt) } })
403
+ .catch(err => logger?.debug({ err: err?.message }, 'failed to store nct salt'));
404
+ }
400
405
  }
401
406
  };
402
407
  };