@neelegirl/baileys 2.1.8 → 2.2.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.
- package/README.md +75 -1586
- package/lib/Defaults/baileys-version.json +1 -1
- package/lib/Defaults/index.d.ts +18 -31
- package/lib/Signal/libsignal.d.ts +3 -8
- package/lib/Signal/libsignal.js +79 -288
- package/lib/Socket/chats.js +2 -3
- package/lib/Socket/socket.js +3 -3
- package/lib/Types/Auth.d.ts +2 -15
- package/lib/Types/Contact.d.ts +1 -2
- package/lib/Types/Events.d.ts +1 -4
- package/lib/Types/Message.d.ts +5 -1
- package/lib/Types/Signal.d.ts +1 -16
- package/lib/Types/Socket.d.ts +4 -10
- package/lib/Utils/decode-wa-message.d.ts +4 -4
- package/lib/Utils/decode-wa-message.js +36 -10
- package/lib/Utils/generics.d.ts +4 -3
- package/lib/Utils/generics.js +8 -6
- package/lib/Utils/history.d.ts +4 -11
- package/lib/Utils/history.js +38 -77
- package/lib/Utils/index.d.ts +1 -4
- package/lib/Utils/index.js +1 -2
- package/lib/Utils/message-retry-manager.js +4 -4
- package/lib/Utils/process-message.d.ts +2 -3
- package/lib/Utils/process-message.js +2 -28
- package/lib/WABinary/jid-utils.d.ts +4 -21
- package/lib/WABinary/jid-utils.js +8 -50
- package/package.json +44 -28
- package/WAProto/GenerateStatics.sh +0 -3
- package/WAProto/fix-imports.js +0 -81
- package/engine-requirements.js +0 -10
- package/lib/Signal/lid-mapping.d.ts +0 -23
- package/lib/Signal/lid-mapping.js +0 -278
- package/lib/Utils/browser-utils.d.ts +0 -1
- package/lib/Utils/browser-utils.js +0 -10
package/README.md
CHANGED
|
@@ -1,195 +1,63 @@
|
|
|
1
|
-
<div align="center">
|
|
2
|
-
|
|
3
1
|
# @neelegirl/baileys
|
|
4
2
|
|
|
5
|
-
|
|
6
|
-
### Conservative merge strategy based on WhiskeySockets/Baileys
|
|
7
|
-
|
|
8
|
-
[](https://www.npmjs.com/package/@neelegirl/baileys)
|
|
9
|
-
[](https://nodejs.org)
|
|
10
|
-
[](LICENSE)
|
|
11
|
-
[](https://www.npmjs.com/package/@neelegirl/baileys)
|
|
12
|
-
[](https://github.com/WhiskeySockets/Baileys)
|
|
13
|
-
|
|
14
|
-
---
|
|
15
|
-
|
|
16
|
-
<p align="center">
|
|
17
|
-
<img src="https://files.catbox.moe/phppor.JPG" width="760" alt="@neelegirl/baileys" />
|
|
18
|
-
</p>
|
|
19
|
-
|
|
20
|
-
| Package | Version | Main goal |
|
|
21
|
-
|---|---:|---|
|
|
22
|
-
| `@neelegirl/baileys` | `2.1.8` | Stable Neelegirl fork with preserved project-specific runtime behavior |
|
|
23
|
-
|
|
24
|
-
[Installation](#installation) · [Quickstart](#quickstart) · [Protected logic](#protected-logic) · [Device and LID notes](#device-and-lid-notes) · [Verified exports](#verified-exports) · [Release notes](#release-notes)
|
|
25
|
-
|
|
26
|
-
</div>
|
|
27
|
-
|
|
28
|
-
---
|
|
29
|
-
|
|
30
|
-
## Table of Contents
|
|
31
|
-
|
|
32
|
-
- [Overview](#overview)
|
|
33
|
-
- [Why this fork exists](#why-this-fork-exists)
|
|
34
|
-
- [Protected logic](#protected-logic)
|
|
35
|
-
- [What was updated in 2.1.8](#what-was-updated-in-218)
|
|
36
|
-
- [Installation](#installation)
|
|
37
|
-
- [Imports](#imports)
|
|
38
|
-
- [Quickstart](#quickstart)
|
|
39
|
-
- [Session storage](#session-storage)
|
|
40
|
-
- [Socket configuration notes](#socket-configuration-notes)
|
|
41
|
-
- [Messages and media](#messages-and-media)
|
|
42
|
-
- [Device and LID notes](#device-and-lid-notes)
|
|
43
|
-
- [Event notes](#event-notes)
|
|
44
|
-
- [Verified exports](#verified-exports)
|
|
45
|
-
- [Known limits](#known-limits)
|
|
46
|
-
- [Release notes](#release-notes)
|
|
47
|
-
- [Disclaimer](#disclaimer)
|
|
48
|
-
|
|
49
|
-
## Overview
|
|
50
|
-
|
|
51
|
-
`@neelegirl/baileys` is the local CommonJS-oriented Neelegirl fork of Baileys used in this stack. It is meant to keep existing Neelegirl-specific behavior stable while still absorbing compatible fixes from the public WhiskeySockets/Baileys project where that improves correctness.
|
|
52
|
-
|
|
53
|
-
This package was rechecked against the public WhiskeySockets/Baileys repository on `2026-03-19`. The merge strategy is conservative by design:
|
|
54
|
-
|
|
55
|
-
- keep working Neelegirl runtime behavior
|
|
56
|
-
- adopt compatible fixes
|
|
57
|
-
- avoid blind upstream replacement
|
|
58
|
-
- avoid destructive refactors in project-critical paths
|
|
59
|
-
|
|
60
|
-
## Why this fork exists
|
|
61
|
-
|
|
62
|
-
The local package differs from upstream for practical reasons:
|
|
3
|
+

|
|
63
4
|
|
|
64
|
-
|
|
65
|
-
|---|---|
|
|
66
|
-
| Module format | Keep CommonJS entrypoints and local consumer compatibility |
|
|
67
|
-
| QR flow | Preserve the existing project-specific QR behavior |
|
|
68
|
-
| Message IDs | Preserve `NEELE`-specific message-ID behavior |
|
|
69
|
-
| Device mapping | Keep project-specific platform and device labeling logic |
|
|
70
|
-
| Logging and watch behavior | Avoid breaking existing Neelegirl operational workflows |
|
|
71
|
-
| LID and JID handling | Extend carefully where current Baileys behavior improves compatibility |
|
|
5
|
+
Conservative Neelegirl-maintained CommonJS WhatsApp Web client based on WhiskeySockets/Baileys, prepared for local use and publish review without removing project-specific behavior.
|
|
72
6
|
|
|
73
|
-
##
|
|
7
|
+
## Reference Status
|
|
74
8
|
|
|
75
|
-
|
|
9
|
+
- Public reference checked on 2026-03-20 against `WhiskeySockets/Baileys` `master`
|
|
10
|
+
- Reference HEAD: `d0779026958ca607e4efd4abef8ba89d581e7027`
|
|
11
|
+
- Public upstream package version at that snapshot: `7.0.0-rc.9`
|
|
76
12
|
|
|
77
|
-
|
|
78
|
-
- `NEELE` message-ID generation and related custom handling
|
|
79
|
-
- existing Neelegirl branding and log output
|
|
80
|
-
- existing device, watch, and platform-specific behavior
|
|
81
|
-
- existing custom community and message-stub handling
|
|
82
|
-
- existing message-type behavior for conversation, extended text, media, and context handling
|
|
13
|
+
This package is not a blind mirror of upstream. It intentionally keeps Neelegirl-specific runtime behavior and CommonJS packaging where that is required for compatibility with the local stack.
|
|
83
14
|
|
|
84
|
-
|
|
15
|
+
## What Was Explicitly Preserved
|
|
85
16
|
|
|
86
|
-
|
|
17
|
+
- QR code flow and terminal QR handling
|
|
18
|
+
- `NEELE` message-ID special handling
|
|
19
|
+
- Neelegirl-specific device and message labeling behavior
|
|
20
|
+
- Existing WhatsApp Web focused socket defaults and event flow
|
|
21
|
+
- Legacy auth helpers already shipped in this package:
|
|
22
|
+
`useMultiFileAuthState`, `useSingleFileAuthState`, `useMongoFileAuthState`
|
|
23
|
+
- Existing store helpers already shipped in this package:
|
|
24
|
+
`makeInMemoryStore`, `makeCacheManagerStore`
|
|
87
25
|
|
|
88
|
-
|
|
26
|
+
## What Was Updated Conservatively In 2.2.0
|
|
89
27
|
|
|
90
|
-
-
|
|
91
|
-
-
|
|
92
|
-
-
|
|
93
|
-
|
|
28
|
+
- Fixed WA Web version fetching so `fetchLatestWaWebVersion()` can parse `sw.js` correctly
|
|
29
|
+
- Preserved the `NEELE` message-ID path while correcting helper edge cases
|
|
30
|
+
- Forwarded alternative addressing fields more cleanly in decoded message keys:
|
|
31
|
+
`remoteJidAlt`, `participantAlt`, `addressingMode`
|
|
32
|
+
- Hardened LID migration calls so custom repositories do not fail noisily
|
|
33
|
+
- Cleaned publish metadata:
|
|
34
|
+
recursive `files`, explicit `exports`, corrected package description
|
|
35
|
+
- Rewrote the README to match the code that is actually present
|
|
94
36
|
|
|
95
|
-
|
|
37
|
+
## What Was Not Adopted From Upstream
|
|
96
38
|
|
|
97
|
-
-
|
|
98
|
-
-
|
|
99
|
-
-
|
|
100
|
-
|
|
101
|
-
## What was updated in 2.1.6
|
|
102
|
-
|
|
103
|
-
### Runtime compatibility
|
|
104
|
-
|
|
105
|
-
- fixed the mismatch between `socket.js` expectations and the local Signal repository implementation
|
|
106
|
-
- added the missing runtime LID mapping store
|
|
107
|
-
- aligned session helpers required by the current local socket logic:
|
|
108
|
-
- `lidMapping`
|
|
109
|
-
- `validateSession`
|
|
110
|
-
- `deleteSession`
|
|
111
|
-
- `migrateSession`
|
|
112
|
-
|
|
113
|
-
### History and identity handling
|
|
114
|
-
|
|
115
|
-
- history sync processing now collects `phoneNumberToLidMappings`
|
|
116
|
-
- inline bootstrap payloads are handled
|
|
117
|
-
- LID migration sync messages are processed conservatively
|
|
118
|
-
- session migration can now follow PN to LID transitions more cleanly
|
|
119
|
-
|
|
120
|
-
### JID and device helpers
|
|
121
|
-
|
|
122
|
-
- restored and exposed helpers needed by newer Baileys compatibility work:
|
|
123
|
-
- `WAJIDDomains`
|
|
124
|
-
- `getServerFromDomainType`
|
|
125
|
-
- `isPnUser`
|
|
126
|
-
- `isJidMetaAI`
|
|
127
|
-
- `transferDevice`
|
|
128
|
-
- added a compatibility `browser-utils` re-export for `Browsers` and `getPlatformId`
|
|
129
|
-
|
|
130
|
-
### Typings and docs
|
|
131
|
-
|
|
132
|
-
- refreshed multiple `.d.ts` files to match the actual current runtime more closely
|
|
133
|
-
- removed false README claims from older documentation
|
|
134
|
-
- replaced stale README imagery with the requested current project image
|
|
39
|
+
- No full ESM-only migration
|
|
40
|
+
- No Node 20 only engine jump
|
|
41
|
+
- No blind replacement of Neelegirl QR, ID, logging or device logic
|
|
42
|
+
- No forced adoption of every new upstream internal module
|
|
135
43
|
|
|
136
44
|
## Installation
|
|
137
45
|
|
|
138
|
-
Use npm:
|
|
139
|
-
|
|
140
46
|
```bash
|
|
141
47
|
npm install @neelegirl/baileys
|
|
142
48
|
```
|
|
143
49
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
```bash
|
|
147
|
-
yarn add @neelegirl/baileys
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
Runtime requirement:
|
|
151
|
-
|
|
152
|
-
```text
|
|
153
|
-
Node.js >= 20
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
## Imports
|
|
157
|
-
|
|
158
|
-
CommonJS:
|
|
159
|
-
|
|
160
|
-
```js
|
|
161
|
-
const makeWASocket = require('@neelegirl/baileys').default
|
|
162
|
-
const {
|
|
163
|
-
Browsers,
|
|
164
|
-
DisconnectReason,
|
|
165
|
-
fetchLatestBaileysVersion,
|
|
166
|
-
useMultiFileAuthState
|
|
167
|
-
} = require('@neelegirl/baileys')
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
ESM:
|
|
171
|
-
|
|
172
|
-
```js
|
|
173
|
-
import makeWASocket, {
|
|
174
|
-
Browsers,
|
|
175
|
-
DisconnectReason,
|
|
176
|
-
fetchLatestBaileysVersion,
|
|
177
|
-
useMultiFileAuthState
|
|
178
|
-
} from '@neelegirl/baileys'
|
|
179
|
-
```
|
|
180
|
-
|
|
181
|
-
## Quickstart
|
|
182
|
-
|
|
183
|
-
### Start with QR
|
|
50
|
+
## Quick Start
|
|
184
51
|
|
|
185
52
|
```js
|
|
186
|
-
const makeWASocket = require('@neelegirl/baileys').default
|
|
187
53
|
const {
|
|
54
|
+
default: makeWASocket,
|
|
188
55
|
Browsers,
|
|
189
56
|
DisconnectReason,
|
|
190
57
|
fetchLatestBaileysVersion,
|
|
191
58
|
useMultiFileAuthState
|
|
192
59
|
} = require('@neelegirl/baileys')
|
|
60
|
+
const { Boom } = require('@hapi/boom')
|
|
193
61
|
|
|
194
62
|
async function start() {
|
|
195
63
|
const { state, saveCreds } = await useMultiFileAuthState('./auth_info')
|
|
@@ -198,35 +66,27 @@ async function start() {
|
|
|
198
66
|
const sock = makeWASocket({
|
|
199
67
|
version,
|
|
200
68
|
auth: state,
|
|
201
|
-
|
|
202
|
-
|
|
69
|
+
printQRInTerminal: true,
|
|
70
|
+
browser: Browsers.ubuntu('Chrome')
|
|
203
71
|
})
|
|
204
72
|
|
|
205
73
|
sock.ev.on('creds.update', saveCreds)
|
|
206
74
|
|
|
207
75
|
sock.ev.on('connection.update', ({ connection, lastDisconnect }) => {
|
|
208
|
-
if (connection === 'open') {
|
|
209
|
-
console.log('connected')
|
|
210
|
-
}
|
|
211
|
-
|
|
212
76
|
if (connection === 'close') {
|
|
213
|
-
const
|
|
214
|
-
|
|
77
|
+
const shouldReconnect =
|
|
78
|
+
(lastDisconnect?.error instanceof Boom
|
|
79
|
+
? lastDisconnect.error.output?.statusCode
|
|
80
|
+
: undefined) !== DisconnectReason.loggedOut
|
|
81
|
+
|
|
215
82
|
if (shouldReconnect) {
|
|
216
|
-
start()
|
|
83
|
+
start().catch(console.error)
|
|
217
84
|
}
|
|
85
|
+
return
|
|
218
86
|
}
|
|
219
|
-
})
|
|
220
87
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
const text =
|
|
224
|
-
msg?.message?.conversation ||
|
|
225
|
-
msg?.message?.extendedTextMessage?.text ||
|
|
226
|
-
''
|
|
227
|
-
|
|
228
|
-
if (text.toLowerCase() === 'ping') {
|
|
229
|
-
await sock.sendMessage(msg.key.remoteJid, { text: 'pong' })
|
|
88
|
+
if (connection === 'open') {
|
|
89
|
+
console.log('WhatsApp Web connection opened')
|
|
230
90
|
}
|
|
231
91
|
})
|
|
232
92
|
}
|
|
@@ -234,1425 +94,54 @@ async function start() {
|
|
|
234
94
|
start().catch(console.error)
|
|
235
95
|
```
|
|
236
96
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
```js
|
|
240
|
-
const makeWASocket = require('@neelegirl/baileys').default
|
|
241
|
-
const {
|
|
242
|
-
Browsers,
|
|
243
|
-
fetchLatestBaileysVersion,
|
|
244
|
-
useMultiFileAuthState
|
|
245
|
-
} = require('@neelegirl/baileys')
|
|
246
|
-
|
|
247
|
-
async function startPairing() {
|
|
248
|
-
const { state, saveCreds } = await useMultiFileAuthState('./auth_pairing')
|
|
249
|
-
const { version } = await fetchLatestBaileysVersion()
|
|
250
|
-
|
|
251
|
-
const sock = makeWASocket({
|
|
252
|
-
version,
|
|
253
|
-
auth: state,
|
|
254
|
-
browser: Browsers.windows('Neelegirl'),
|
|
255
|
-
printQRInTerminal: false
|
|
256
|
-
})
|
|
257
|
-
|
|
258
|
-
sock.ev.on('creds.update', saveCreds)
|
|
259
|
-
|
|
260
|
-
if (!sock.authState.creds.registered) {
|
|
261
|
-
const code = await sock.requestPairingCode('491234567890')
|
|
262
|
-
console.log('pairing code:', code)
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
startPairing().catch(console.error)
|
|
267
|
-
```
|
|
268
|
-
|
|
269
|
-
## Session storage
|
|
270
|
-
|
|
271
|
-
For development, `useMultiFileAuthState(...)` is the easiest storage helper:
|
|
272
|
-
|
|
273
|
-
```js
|
|
274
|
-
const { state, saveCreds } = await useMultiFileAuthState('./auth_info')
|
|
275
|
-
```
|
|
276
|
-
|
|
277
|
-
The package also exports:
|
|
278
|
-
|
|
279
|
-
- `useSingleFileAuthState`
|
|
280
|
-
- `useMongoFileAuthState`
|
|
281
|
-
- `makeInMemoryStore`
|
|
282
|
-
|
|
283
|
-
If you build a custom store, the critical rule is simple:
|
|
284
|
-
|
|
285
|
-
- credential updates must be persisted
|
|
286
|
-
- key updates must be persisted
|
|
287
|
-
- ignoring key-store updates will eventually break message delivery
|
|
288
|
-
|
|
289
|
-
## Socket configuration notes
|
|
290
|
-
|
|
291
|
-
Useful socket options that remain especially relevant in this fork:
|
|
292
|
-
|
|
293
|
-
| Option | Why it matters |
|
|
294
|
-
|---|---|
|
|
295
|
-
| `auth` | required session state |
|
|
296
|
-
| `version` | WA Web version selection |
|
|
297
|
-
| `browser` | affects platform/device presentation |
|
|
298
|
-
| `printQRInTerminal` | keeps the existing QR path active |
|
|
299
|
-
| `markOnlineOnConnect` | controls online presence behavior |
|
|
300
|
-
| `syncFullHistory` | enables broader history sync requests |
|
|
301
|
-
| `getMessage` | improves retry and message recovery scenarios |
|
|
302
|
-
| `cachedGroupMetadata` | avoids repeated group fetches |
|
|
303
|
-
|
|
304
|
-
Example:
|
|
305
|
-
|
|
306
|
-
```js
|
|
307
|
-
const sock = makeWASocket({
|
|
308
|
-
version,
|
|
309
|
-
auth: state,
|
|
310
|
-
browser: Browsers.macOS('Desktop'),
|
|
311
|
-
printQRInTerminal: true,
|
|
312
|
-
markOnlineOnConnect: false,
|
|
313
|
-
syncFullHistory: true,
|
|
314
|
-
getMessage: async (key) => {
|
|
315
|
-
return store.loadMessage(key.remoteJid, key.id)
|
|
316
|
-
},
|
|
317
|
-
cachedGroupMetadata: async (jid) => groupCache.get(jid)
|
|
318
|
-
})
|
|
319
|
-
```
|
|
320
|
-
|
|
321
|
-
## Messages and media
|
|
322
|
-
|
|
323
|
-
### Send a text message
|
|
324
|
-
|
|
325
|
-
```js
|
|
326
|
-
await sock.sendMessage(jid, { text: 'hello' })
|
|
327
|
-
```
|
|
328
|
-
|
|
329
|
-
### Reply to a message
|
|
330
|
-
|
|
331
|
-
```js
|
|
332
|
-
await sock.sendMessage(
|
|
333
|
-
jid,
|
|
334
|
-
{ text: 'this is a reply' },
|
|
335
|
-
{ quoted: originalMessage }
|
|
336
|
-
)
|
|
337
|
-
```
|
|
338
|
-
|
|
339
|
-
### Send an image
|
|
340
|
-
|
|
341
|
-
```js
|
|
342
|
-
await sock.sendMessage(jid, {
|
|
343
|
-
image: { url: './image.jpg' },
|
|
344
|
-
caption: 'sample'
|
|
345
|
-
})
|
|
346
|
-
```
|
|
347
|
-
|
|
348
|
-
### Send a document
|
|
349
|
-
|
|
350
|
-
```js
|
|
351
|
-
await sock.sendMessage(jid, {
|
|
352
|
-
document: { url: './report.pdf' },
|
|
353
|
-
mimetype: 'application/pdf',
|
|
354
|
-
fileName: 'report.pdf'
|
|
355
|
-
})
|
|
356
|
-
```
|
|
357
|
-
|
|
358
|
-
### Send a reaction
|
|
359
|
-
|
|
360
|
-
```js
|
|
361
|
-
await sock.sendMessage(jid, {
|
|
362
|
-
react: {
|
|
363
|
-
text: '❤',
|
|
364
|
-
key: message.key
|
|
365
|
-
}
|
|
366
|
-
})
|
|
367
|
-
```
|
|
368
|
-
|
|
369
|
-
### Download received media
|
|
370
|
-
|
|
371
|
-
```js
|
|
372
|
-
const { downloadMediaMessage } = require('@neelegirl/baileys')
|
|
373
|
-
|
|
374
|
-
const buffer = await downloadMediaMessage(
|
|
375
|
-
message,
|
|
376
|
-
'buffer',
|
|
377
|
-
{},
|
|
378
|
-
{ logger: sock.logger, reuploadRequest: sock.updateMediaMessage }
|
|
379
|
-
)
|
|
380
|
-
```
|
|
381
|
-
|
|
382
|
-
## Device and LID notes
|
|
383
|
-
|
|
384
|
-
This fork intentionally does more than just plain PN handling.
|
|
385
|
-
|
|
386
|
-
### Relevant helper exports
|
|
387
|
-
|
|
388
|
-
- `jidDecode`
|
|
389
|
-
- `jidEncode`
|
|
390
|
-
- `jidNormalizedUser`
|
|
391
|
-
- `isPnUser`
|
|
392
|
-
- `isLidUser`
|
|
393
|
-
- `isHostedPnUser`
|
|
394
|
-
- `isHostedLidUser`
|
|
395
|
-
- `transferDevice`
|
|
396
|
-
- `WAJIDDomains`
|
|
397
|
-
|
|
398
|
-
### Example: inspect a JID
|
|
399
|
-
|
|
400
|
-
```js
|
|
401
|
-
const { jidDecode } = require('@neelegirl/baileys')
|
|
402
|
-
|
|
403
|
-
const decoded = jidDecode('491234567890@s.whatsapp.net')
|
|
404
|
-
console.log(decoded)
|
|
405
|
-
```
|
|
406
|
-
|
|
407
|
-
### Example: preserve device while switching identity space
|
|
408
|
-
|
|
409
|
-
```js
|
|
410
|
-
const { transferDevice } = require('@neelegirl/baileys')
|
|
411
|
-
|
|
412
|
-
const result = transferDevice(
|
|
413
|
-
'491234567890:5@s.whatsapp.net',
|
|
414
|
-
'1234567890@lid'
|
|
415
|
-
)
|
|
416
|
-
```
|
|
417
|
-
|
|
418
|
-
### Why this matters here
|
|
419
|
-
|
|
420
|
-
Neelegirl-specific code in this package already relies on richer identity handling around:
|
|
421
|
-
|
|
422
|
-
- `remoteJid`
|
|
423
|
-
- `remoteJidAlt`
|
|
424
|
-
- `participant`
|
|
425
|
-
- `participantAlt`
|
|
426
|
-
- sender normalization
|
|
427
|
-
- PN and LID mapping
|
|
428
|
-
- device labeling output
|
|
429
|
-
|
|
430
|
-
That is why the maintenance work kept those paths intact and only extended compatibility where necessary.
|
|
431
|
-
|
|
432
|
-
## Event notes
|
|
97
|
+
## Pairing And QR Notes
|
|
433
98
|
|
|
434
|
-
|
|
99
|
+
- `printQRInTerminal: true` keeps the QR flow active
|
|
100
|
+
- `requestPairingCode(phoneNumber, customCode?)` is available on the socket
|
|
101
|
+
- This package keeps the existing Neelegirl QR and pairing behavior instead of replacing it with upstream packaging changes
|
|
435
102
|
|
|
436
|
-
|
|
103
|
+
## Addressing And Device Notes
|
|
437
104
|
|
|
438
|
-
-
|
|
439
|
-
- `creds.update`
|
|
105
|
+
The package keeps Neelegirl-specific message and device handling and now forwards the additional addressing fields more consistently:
|
|
440
106
|
|
|
441
|
-
|
|
107
|
+
- `key.remoteJid`
|
|
108
|
+
- `key.remoteJidAlt`
|
|
109
|
+
- `key.participant`
|
|
110
|
+
- `key.participantAlt`
|
|
111
|
+
- `key.addressingMode`
|
|
442
112
|
|
|
443
|
-
-
|
|
444
|
-
- `messages.update`
|
|
445
|
-
- `messages.reaction`
|
|
446
|
-
- `message-receipt.update`
|
|
113
|
+
This is relevant for PN/LID mixed environments, Web-specific event handling and group/member tagging behavior.
|
|
447
114
|
|
|
448
|
-
|
|
115
|
+
## Exports Available In This Package
|
|
449
116
|
|
|
450
|
-
- `
|
|
451
|
-
- `
|
|
452
|
-
- `
|
|
453
|
-
- `chats.update`
|
|
117
|
+
- Root entry: `require('@neelegirl/baileys')`
|
|
118
|
+
- Compatibility root subpath: `require('@neelegirl/baileys/lib')`
|
|
119
|
+
- WAProto subpath: `require('@neelegirl/baileys/WAProto')`
|
|
454
120
|
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
- `groups.update`
|
|
458
|
-
- `group-participants.update`
|
|
459
|
-
- `group.join-request`
|
|
460
|
-
- `group.member-tag.update`
|
|
461
|
-
- `communities.update`
|
|
462
|
-
|
|
463
|
-
### Example
|
|
464
|
-
|
|
465
|
-
```js
|
|
466
|
-
sock.ev.on('messaging-history.set', ({ chats, contacts, messages, lidPnMappings }) => {
|
|
467
|
-
console.log({
|
|
468
|
-
chats: chats.length,
|
|
469
|
-
contacts: contacts.length,
|
|
470
|
-
messages: messages.length,
|
|
471
|
-
lidPnMappings: lidPnMappings?.length || 0
|
|
472
|
-
})
|
|
473
|
-
})
|
|
474
|
-
```
|
|
475
|
-
|
|
476
|
-
## Verified exports
|
|
477
|
-
|
|
478
|
-
The following items were verified in the currently prepared package before publish.
|
|
479
|
-
|
|
480
|
-
### Socket and auth
|
|
121
|
+
Primary runtime exports include:
|
|
481
122
|
|
|
482
123
|
- `makeWASocket`
|
|
124
|
+
- `proto`
|
|
125
|
+
- `Browsers`
|
|
126
|
+
- `fetchLatestBaileysVersion`
|
|
127
|
+
- `fetchLatestWaWebVersion`
|
|
483
128
|
- `useMultiFileAuthState`
|
|
484
129
|
- `useSingleFileAuthState`
|
|
485
130
|
- `useMongoFileAuthState`
|
|
486
131
|
- `makeInMemoryStore`
|
|
132
|
+
- `makeCacheManagerStore`
|
|
487
133
|
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
- `fetchLatestBaileysVersion`
|
|
491
|
-
- `fetchLatestWaWebVersion`
|
|
492
|
-
- `Browsers`
|
|
493
|
-
- `getPlatformId`
|
|
494
|
-
|
|
495
|
-
### JID and identity helpers
|
|
496
|
-
|
|
497
|
-
- `jidDecode`
|
|
498
|
-
- `jidEncode`
|
|
499
|
-
- `jidNormalizedUser`
|
|
500
|
-
- `isPnUser`
|
|
501
|
-
- `isLidUser`
|
|
502
|
-
- `isHostedPnUser`
|
|
503
|
-
- `isHostedLidUser`
|
|
504
|
-
- `isJidMetaAI`
|
|
505
|
-
- `transferDevice`
|
|
506
|
-
- `WAJIDDomains`
|
|
507
|
-
|
|
508
|
-
### Message and media helpers
|
|
509
|
-
|
|
510
|
-
- `downloadMediaMessage`
|
|
511
|
-
- `downloadAndProcessHistorySyncNotification`
|
|
512
|
-
- `processHistoryMessage`
|
|
513
|
-
- `getHistoryMsg`
|
|
514
|
-
- `getContentType`
|
|
515
|
-
- `normalizeMessageContent`
|
|
516
|
-
- `generateWAMessage`
|
|
517
|
-
- `generateWAMessageContent`
|
|
518
|
-
- `generateWAMessageFromContent`
|
|
519
|
-
|
|
520
|
-
### USync helpers
|
|
521
|
-
|
|
522
|
-
- `USyncQuery`
|
|
523
|
-
- `USyncUser`
|
|
524
|
-
- `USyncContactProtocol`
|
|
525
|
-
- `USyncLIDProtocol`
|
|
526
|
-
- `USyncDeviceProtocol`
|
|
527
|
-
- `USyncStatusProtocol`
|
|
528
|
-
|
|
529
|
-
## Known limits
|
|
530
|
-
|
|
531
|
-
- this package is not a direct one-to-one mirror of every newest upstream internal API
|
|
532
|
-
- no restrictive `exports` map was added because that would risk breaking existing CommonJS consumers
|
|
533
|
-
- some upstream files remain intentionally absent because the local Neelegirl fork structure differs by design
|
|
534
|
-
|
|
535
|
-
## Deep-dive: message handling
|
|
536
|
-
|
|
537
|
-
This fork pays extra attention to message handling because several Neelegirl-specific customizations already depend on richer metadata than a plain "text or media" abstraction.
|
|
538
|
-
|
|
539
|
-
### Why message handling is sensitive here
|
|
540
|
-
|
|
541
|
-
The package needs to preserve behavior around:
|
|
542
|
-
|
|
543
|
-
- `conversation`
|
|
544
|
-
- `extendedTextMessage`
|
|
545
|
-
- `imageMessage`
|
|
546
|
-
- `videoMessage`
|
|
547
|
-
- `documentMessage`
|
|
548
|
-
- `contextInfo`
|
|
549
|
-
- `participant`
|
|
550
|
-
- `participantAlt`
|
|
551
|
-
- `remoteJid`
|
|
552
|
-
- `remoteJidAlt`
|
|
553
|
-
- normalized sender values
|
|
554
|
-
- device and platform labels
|
|
555
|
-
|
|
556
|
-
That is why the maintenance pass intentionally avoided broad message-processing rewrites.
|
|
557
|
-
|
|
558
|
-
### Reading text safely
|
|
559
|
-
|
|
560
|
-
For many bots, the most robust quick read path is still:
|
|
561
|
-
|
|
562
|
-
```js
|
|
563
|
-
const text =
|
|
564
|
-
message?.message?.conversation ||
|
|
565
|
-
message?.message?.extendedTextMessage?.text ||
|
|
566
|
-
''
|
|
567
|
-
```
|
|
568
|
-
|
|
569
|
-
This stays valid because the fork intentionally keeps compatibility with the most common text cases.
|
|
570
|
-
|
|
571
|
-
### Example: normalize the sender view
|
|
572
|
-
|
|
573
|
-
```js
|
|
574
|
-
const {
|
|
575
|
-
jidDecode,
|
|
576
|
-
jidNormalizedUser,
|
|
577
|
-
isLidUser,
|
|
578
|
-
isPnUser
|
|
579
|
-
} = require('@neelegirl/baileys')
|
|
580
|
-
|
|
581
|
-
function inspectSender(msg) {
|
|
582
|
-
const raw =
|
|
583
|
-
msg?.key?.participant ||
|
|
584
|
-
msg?.participant ||
|
|
585
|
-
msg?.key?.remoteJid ||
|
|
586
|
-
''
|
|
587
|
-
|
|
588
|
-
const normalized = jidNormalizedUser(raw)
|
|
589
|
-
const decoded = jidDecode(raw)
|
|
590
|
-
|
|
591
|
-
return {
|
|
592
|
-
raw,
|
|
593
|
-
normalized,
|
|
594
|
-
decoded,
|
|
595
|
-
isPn: isPnUser(raw),
|
|
596
|
-
isLid: isLidUser(raw)
|
|
597
|
-
}
|
|
598
|
-
}
|
|
599
|
-
```
|
|
600
|
-
|
|
601
|
-
### Example: handle text, media, and fallback cleanly
|
|
602
|
-
|
|
603
|
-
```js
|
|
604
|
-
function getPrimaryContent(msg) {
|
|
605
|
-
const m = msg?.message || {}
|
|
606
|
-
|
|
607
|
-
if (m.conversation) {
|
|
608
|
-
return { type: 'conversation', text: m.conversation }
|
|
609
|
-
}
|
|
610
|
-
|
|
611
|
-
if (m.extendedTextMessage?.text) {
|
|
612
|
-
return { type: 'extendedTextMessage', text: m.extendedTextMessage.text }
|
|
613
|
-
}
|
|
614
|
-
|
|
615
|
-
if (m.imageMessage) {
|
|
616
|
-
return {
|
|
617
|
-
type: 'imageMessage',
|
|
618
|
-
caption: m.imageMessage.caption || ''
|
|
619
|
-
}
|
|
620
|
-
}
|
|
621
|
-
|
|
622
|
-
if (m.videoMessage) {
|
|
623
|
-
return {
|
|
624
|
-
type: 'videoMessage',
|
|
625
|
-
caption: m.videoMessage.caption || ''
|
|
626
|
-
}
|
|
627
|
-
}
|
|
628
|
-
|
|
629
|
-
if (m.documentMessage) {
|
|
630
|
-
return {
|
|
631
|
-
type: 'documentMessage',
|
|
632
|
-
fileName: m.documentMessage.fileName || ''
|
|
633
|
-
}
|
|
634
|
-
}
|
|
635
|
-
|
|
636
|
-
return { type: 'unknown' }
|
|
637
|
-
}
|
|
638
|
-
```
|
|
639
|
-
|
|
640
|
-
### Conversation vs extended text
|
|
641
|
-
|
|
642
|
-
The classic split is still important:
|
|
643
|
-
|
|
644
|
-
| Field | Typical use |
|
|
645
|
-
|---|---|
|
|
646
|
-
| `conversation` | direct simple text |
|
|
647
|
-
| `extendedTextMessage.text` | richer text message with more surrounding metadata |
|
|
648
|
-
|
|
649
|
-
Bots that only read one of the two will still miss messages in practice.
|
|
650
|
-
|
|
651
|
-
### Media notes
|
|
652
|
-
|
|
653
|
-
Current helpers still support common media workflows:
|
|
654
|
-
|
|
655
|
-
- send image
|
|
656
|
-
- send video
|
|
657
|
-
- send audio
|
|
658
|
-
- send sticker
|
|
659
|
-
- send document
|
|
660
|
-
- download received media
|
|
661
|
-
- request media re-upload when needed
|
|
662
|
-
|
|
663
|
-
### Downloading media carefully
|
|
664
|
-
|
|
665
|
-
```js
|
|
666
|
-
const {
|
|
667
|
-
downloadMediaMessage,
|
|
668
|
-
getContentType
|
|
669
|
-
} = require('@neelegirl/baileys')
|
|
670
|
-
|
|
671
|
-
sock.ev.on('messages.upsert', async ({ messages }) => {
|
|
672
|
-
const msg = messages[0]
|
|
673
|
-
if (!msg?.message) {
|
|
674
|
-
return
|
|
675
|
-
}
|
|
676
|
-
|
|
677
|
-
const type = getContentType(msg.message)
|
|
678
|
-
if (type === 'imageMessage') {
|
|
679
|
-
const buffer = await downloadMediaMessage(
|
|
680
|
-
msg,
|
|
681
|
-
'buffer',
|
|
682
|
-
{},
|
|
683
|
-
{
|
|
684
|
-
logger: sock.logger,
|
|
685
|
-
reuploadRequest: sock.updateMediaMessage
|
|
686
|
-
}
|
|
687
|
-
)
|
|
688
|
-
|
|
689
|
-
console.log('downloaded image bytes:', buffer.length)
|
|
690
|
-
}
|
|
691
|
-
})
|
|
692
|
-
```
|
|
693
|
-
|
|
694
|
-
### Polls, reactions, edits
|
|
695
|
-
|
|
696
|
-
The runtime still supports event flows around:
|
|
697
|
-
|
|
698
|
-
- reactions
|
|
699
|
-
- poll updates
|
|
700
|
-
- message edits
|
|
701
|
-
|
|
702
|
-
This is another reason the current `process-message` path was updated only where necessary.
|
|
703
|
-
|
|
704
|
-
## Deep-dive: device and browser behavior
|
|
705
|
-
|
|
706
|
-
Device identity matters more than many wrappers admit. In this fork it is especially relevant because the project already uses browser and device strings in a more opinionated way.
|
|
707
|
-
|
|
708
|
-
### Browser helper examples
|
|
709
|
-
|
|
710
|
-
```js
|
|
711
|
-
const { Browsers } = require('@neelegirl/baileys')
|
|
712
|
-
|
|
713
|
-
const webProfile = Browsers.ubuntu('Neelegirl')
|
|
714
|
-
const desktopProfile = Browsers.macOS('Desktop')
|
|
715
|
-
const mobileStyleProfile = Browsers.iOS('Neelegirl iOS')
|
|
716
|
-
```
|
|
717
|
-
|
|
718
|
-
### `getPlatformId`
|
|
719
|
-
|
|
720
|
-
The compatibility export `getPlatformId` exists so consumers do not have to guess how platform names map into the pairing flow.
|
|
721
|
-
|
|
722
|
-
```js
|
|
723
|
-
const { getPlatformId } = require('@neelegirl/baileys')
|
|
724
|
-
|
|
725
|
-
console.log(getPlatformId('Chrome'))
|
|
726
|
-
console.log(getPlatformId('Desktop'))
|
|
727
|
-
```
|
|
728
|
-
|
|
729
|
-
### Why not flatten device logic
|
|
730
|
-
|
|
731
|
-
During maintenance, device logic was not "simplified" because doing that would risk losing:
|
|
732
|
-
|
|
733
|
-
- Web labels
|
|
734
|
-
- Desktop labels
|
|
735
|
-
- iOS labels
|
|
736
|
-
- Android labels
|
|
737
|
-
- hosted PN and hosted LID distinctions
|
|
738
|
-
|
|
739
|
-
### Device-aware identity helpers
|
|
740
|
-
|
|
741
|
-
```js
|
|
742
|
-
const {
|
|
743
|
-
jidDecode,
|
|
744
|
-
transferDevice
|
|
745
|
-
} = require('@neelegirl/baileys')
|
|
746
|
-
|
|
747
|
-
const from = '491234567890:5@s.whatsapp.net'
|
|
748
|
-
const to = '1234567890@lid'
|
|
749
|
-
|
|
750
|
-
console.log(jidDecode(from))
|
|
751
|
-
console.log(transferDevice(from, to))
|
|
752
|
-
```
|
|
753
|
-
|
|
754
|
-
### Practical device matrix
|
|
755
|
-
|
|
756
|
-
| Concern | Why it matters |
|
|
757
|
-
|---|---|
|
|
758
|
-
| browser string | affects how the client is presented |
|
|
759
|
-
| platform id | used in pairing-related flows |
|
|
760
|
-
| desktop-like browser | can influence history sync behavior |
|
|
761
|
-
| hosted device space | matters for some LID and hosted identity transitions |
|
|
762
|
-
|
|
763
|
-
## Deep-dive: JID and LID handling
|
|
764
|
-
|
|
765
|
-
One of the biggest reasons to maintain this fork carefully is identity handling.
|
|
766
|
-
|
|
767
|
-
### Common identity spaces
|
|
768
|
-
|
|
769
|
-
| Space | Example |
|
|
770
|
-
|---|---|
|
|
771
|
-
| PN user | `491234567890@s.whatsapp.net` |
|
|
772
|
-
| LID user | `1234567890@lid` |
|
|
773
|
-
| hosted PN | `491234567890:99@hosted` |
|
|
774
|
-
| hosted LID | `1234567890:99@hosted.lid` |
|
|
775
|
-
|
|
776
|
-
### Helpers exposed by the current package
|
|
777
|
-
|
|
778
|
-
- `jidDecode`
|
|
779
|
-
- `jidEncode`
|
|
780
|
-
- `jidNormalizedUser`
|
|
781
|
-
- `isPnUser`
|
|
782
|
-
- `isLidUser`
|
|
783
|
-
- `isHostedPnUser`
|
|
784
|
-
- `isHostedLidUser`
|
|
785
|
-
- `getServerFromDomainType`
|
|
786
|
-
- `transferDevice`
|
|
787
|
-
- `WAJIDDomains`
|
|
788
|
-
|
|
789
|
-
### Example: decode and route by identity type
|
|
790
|
-
|
|
791
|
-
```js
|
|
792
|
-
const {
|
|
793
|
-
jidDecode,
|
|
794
|
-
isPnUser,
|
|
795
|
-
isLidUser,
|
|
796
|
-
isHostedPnUser,
|
|
797
|
-
isHostedLidUser
|
|
798
|
-
} = require('@neelegirl/baileys')
|
|
799
|
-
|
|
800
|
-
function classify(jid) {
|
|
801
|
-
return {
|
|
802
|
-
jid,
|
|
803
|
-
decoded: jidDecode(jid),
|
|
804
|
-
pn: !!isPnUser(jid),
|
|
805
|
-
lid: !!isLidUser(jid),
|
|
806
|
-
hostedPn: !!isHostedPnUser(jid),
|
|
807
|
-
hostedLid: !!isHostedLidUser(jid)
|
|
808
|
-
}
|
|
809
|
-
}
|
|
810
|
-
```
|
|
811
|
-
|
|
812
|
-
### Example: server from domain type
|
|
813
|
-
|
|
814
|
-
```js
|
|
815
|
-
const {
|
|
816
|
-
WAJIDDomains,
|
|
817
|
-
getServerFromDomainType
|
|
818
|
-
} = require('@neelegirl/baileys')
|
|
819
|
-
|
|
820
|
-
console.log(getServerFromDomainType('s.whatsapp.net', WAJIDDomains.WHATSAPP))
|
|
821
|
-
console.log(getServerFromDomainType('s.whatsapp.net', WAJIDDomains.LID))
|
|
822
|
-
console.log(getServerFromDomainType('s.whatsapp.net', WAJIDDomains.HOSTED))
|
|
823
|
-
console.log(getServerFromDomainType('s.whatsapp.net', WAJIDDomains.HOSTED_LID))
|
|
824
|
-
```
|
|
825
|
-
|
|
826
|
-
### Why this matters to bots
|
|
827
|
-
|
|
828
|
-
If your bot logs sender ids, checks participants, stores device metadata, or combines phone-number and LID records, identity mismatches will show up quickly unless the JID layer is handled carefully.
|
|
829
|
-
|
|
830
|
-
That is exactly why:
|
|
831
|
-
|
|
832
|
-
- the local `jid-utils` was extended
|
|
833
|
-
- history sync now collects LID-to-PN mapping data
|
|
834
|
-
- session migration helpers now exist in the signal repository
|
|
835
|
-
|
|
836
|
-
## Deep-dive: history sync behavior
|
|
837
|
-
|
|
838
|
-
The current local package now handles history sync more consistently with the existing socket expectations.
|
|
839
|
-
|
|
840
|
-
### What is processed
|
|
841
|
-
|
|
842
|
-
- conversations
|
|
843
|
-
- contacts
|
|
844
|
-
- messages
|
|
845
|
-
- `phoneNumberToLidMappings`
|
|
846
|
-
- inline bootstrap payloads when present
|
|
847
|
-
|
|
848
|
-
### What gets emitted
|
|
849
|
-
|
|
850
|
-
The important event remains:
|
|
851
|
-
|
|
852
|
-
```js
|
|
853
|
-
sock.ev.on('messaging-history.set', (data) => {
|
|
854
|
-
console.log(data)
|
|
855
|
-
})
|
|
856
|
-
```
|
|
857
|
-
|
|
858
|
-
### Example: inspect incoming history batches
|
|
859
|
-
|
|
860
|
-
```js
|
|
861
|
-
sock.ev.on('messaging-history.set', ({ chats, contacts, messages, lidPnMappings, isLatest }) => {
|
|
862
|
-
console.log({
|
|
863
|
-
chats: chats.length,
|
|
864
|
-
contacts: contacts.length,
|
|
865
|
-
messages: messages.length,
|
|
866
|
-
lidPnMappings: lidPnMappings?.length || 0,
|
|
867
|
-
isLatest
|
|
868
|
-
})
|
|
869
|
-
})
|
|
870
|
-
```
|
|
871
|
-
|
|
872
|
-
### Why the mapping part matters
|
|
873
|
-
|
|
874
|
-
If you maintain your own sender normalization or account mapping layer, the `lidPnMappings` portion can help reconcile:
|
|
875
|
-
|
|
876
|
-
- phone-number identity space
|
|
877
|
-
- LID identity space
|
|
878
|
-
- device-level migration paths
|
|
879
|
-
|
|
880
|
-
## Cookbook: common tasks
|
|
881
|
-
|
|
882
|
-
### Send text
|
|
883
|
-
|
|
884
|
-
```js
|
|
885
|
-
await sock.sendMessage(jid, { text: 'hello' })
|
|
886
|
-
```
|
|
887
|
-
|
|
888
|
-
### Send image with caption
|
|
889
|
-
|
|
890
|
-
```js
|
|
891
|
-
await sock.sendMessage(jid, {
|
|
892
|
-
image: { url: './image.jpg' },
|
|
893
|
-
caption: 'caption'
|
|
894
|
-
})
|
|
895
|
-
```
|
|
896
|
-
|
|
897
|
-
### Send video
|
|
898
|
-
|
|
899
|
-
```js
|
|
900
|
-
await sock.sendMessage(jid, {
|
|
901
|
-
video: { url: './video.mp4' },
|
|
902
|
-
caption: 'video'
|
|
903
|
-
})
|
|
904
|
-
```
|
|
905
|
-
|
|
906
|
-
### Send document
|
|
907
|
-
|
|
908
|
-
```js
|
|
909
|
-
await sock.sendMessage(jid, {
|
|
910
|
-
document: { url: './report.pdf' },
|
|
911
|
-
mimetype: 'application/pdf',
|
|
912
|
-
fileName: 'report.pdf'
|
|
913
|
-
})
|
|
914
|
-
```
|
|
915
|
-
|
|
916
|
-
### Send sticker
|
|
917
|
-
|
|
918
|
-
```js
|
|
919
|
-
await sock.sendMessage(jid, {
|
|
920
|
-
sticker: { url: './sticker.webp' }
|
|
921
|
-
})
|
|
922
|
-
```
|
|
923
|
-
|
|
924
|
-
### Send location
|
|
925
|
-
|
|
926
|
-
```js
|
|
927
|
-
await sock.sendMessage(jid, {
|
|
928
|
-
location: {
|
|
929
|
-
degreesLatitude: 52.52,
|
|
930
|
-
degreesLongitude: 13.405
|
|
931
|
-
}
|
|
932
|
-
})
|
|
933
|
-
```
|
|
934
|
-
|
|
935
|
-
### Send contact
|
|
936
|
-
|
|
937
|
-
```js
|
|
938
|
-
const vcard = [
|
|
939
|
-
'BEGIN:VCARD',
|
|
940
|
-
'VERSION:3.0',
|
|
941
|
-
'FN:Example Contact',
|
|
942
|
-
'TEL;type=CELL;type=VOICE;waid=491234567890:+49 123 4567890',
|
|
943
|
-
'END:VCARD'
|
|
944
|
-
].join('\n')
|
|
945
|
-
|
|
946
|
-
await sock.sendMessage(jid, {
|
|
947
|
-
contacts: {
|
|
948
|
-
displayName: 'Example Contact',
|
|
949
|
-
contacts: [{ vcard }]
|
|
950
|
-
}
|
|
951
|
-
})
|
|
952
|
-
```
|
|
953
|
-
|
|
954
|
-
### Send reaction
|
|
955
|
-
|
|
956
|
-
```js
|
|
957
|
-
await sock.sendMessage(jid, {
|
|
958
|
-
react: {
|
|
959
|
-
text: '❤',
|
|
960
|
-
key: message.key
|
|
961
|
-
}
|
|
962
|
-
})
|
|
963
|
-
```
|
|
964
|
-
|
|
965
|
-
### Remove reaction
|
|
966
|
-
|
|
967
|
-
```js
|
|
968
|
-
await sock.sendMessage(jid, {
|
|
969
|
-
react: {
|
|
970
|
-
text: '',
|
|
971
|
-
key: message.key
|
|
972
|
-
}
|
|
973
|
-
})
|
|
974
|
-
```
|
|
975
|
-
|
|
976
|
-
### Edit a message
|
|
977
|
-
|
|
978
|
-
```js
|
|
979
|
-
const sent = await sock.sendMessage(jid, { text: 'draft' })
|
|
980
|
-
|
|
981
|
-
await sock.sendMessage(jid, {
|
|
982
|
-
text: 'final text',
|
|
983
|
-
edit: sent.key
|
|
984
|
-
})
|
|
985
|
-
```
|
|
986
|
-
|
|
987
|
-
### Delete for everyone
|
|
988
|
-
|
|
989
|
-
```js
|
|
990
|
-
await sock.sendMessage(jid, {
|
|
991
|
-
delete: message.key
|
|
992
|
-
})
|
|
993
|
-
```
|
|
994
|
-
|
|
995
|
-
### Mention a user
|
|
996
|
-
|
|
997
|
-
```js
|
|
998
|
-
await sock.sendMessage(jid, {
|
|
999
|
-
text: '@491234567890 hello',
|
|
1000
|
-
mentions: ['491234567890@s.whatsapp.net']
|
|
1001
|
-
})
|
|
1002
|
-
```
|
|
1003
|
-
|
|
1004
|
-
### Forward a message
|
|
1005
|
-
|
|
1006
|
-
```js
|
|
1007
|
-
await sock.sendMessage(jid, {
|
|
1008
|
-
forward: originalMessage
|
|
1009
|
-
})
|
|
1010
|
-
```
|
|
1011
|
-
|
|
1012
|
-
### Send poll
|
|
1013
|
-
|
|
1014
|
-
```js
|
|
1015
|
-
await sock.sendMessage(jid, {
|
|
1016
|
-
poll: {
|
|
1017
|
-
name: 'Choose one',
|
|
1018
|
-
values: ['A', 'B', 'C'],
|
|
1019
|
-
selectableCount: 1
|
|
1020
|
-
}
|
|
1021
|
-
})
|
|
1022
|
-
```
|
|
1023
|
-
|
|
1024
|
-
## Group and community notes
|
|
1025
|
-
|
|
1026
|
-
The current fork still exposes the usual group-oriented socket methods, and the event layer keeps its extended handling for participant and community metadata.
|
|
1027
|
-
|
|
1028
|
-
### Example: create a group
|
|
1029
|
-
|
|
1030
|
-
```js
|
|
1031
|
-
const group = await sock.groupCreate('Example Group', [
|
|
1032
|
-
'491111111111@s.whatsapp.net',
|
|
1033
|
-
'492222222222@s.whatsapp.net'
|
|
1034
|
-
])
|
|
1035
|
-
|
|
1036
|
-
console.log(group.id)
|
|
1037
|
-
```
|
|
1038
|
-
|
|
1039
|
-
### Example: add participants
|
|
1040
|
-
|
|
1041
|
-
```js
|
|
1042
|
-
await sock.groupParticipantsUpdate(
|
|
1043
|
-
group.id,
|
|
1044
|
-
['493333333333@s.whatsapp.net'],
|
|
1045
|
-
'add'
|
|
1046
|
-
)
|
|
1047
|
-
```
|
|
1048
|
-
|
|
1049
|
-
### Example: change subject
|
|
1050
|
-
|
|
1051
|
-
```js
|
|
1052
|
-
await sock.groupUpdateSubject(group.id, 'New Subject')
|
|
1053
|
-
```
|
|
1054
|
-
|
|
1055
|
-
### Example: change description
|
|
1056
|
-
|
|
1057
|
-
```js
|
|
1058
|
-
await sock.groupUpdateDescription(group.id, 'New Description')
|
|
1059
|
-
```
|
|
1060
|
-
|
|
1061
|
-
### Example: fetch metadata
|
|
1062
|
-
|
|
1063
|
-
```js
|
|
1064
|
-
const metadata = await sock.groupMetadata(group.id)
|
|
1065
|
-
console.log(metadata.subject)
|
|
1066
|
-
```
|
|
1067
|
-
|
|
1068
|
-
### Event surfaces that matter here
|
|
1069
|
-
|
|
1070
|
-
- `groups.update`
|
|
1071
|
-
- `group-participants.update`
|
|
1072
|
-
- `group.join-request`
|
|
1073
|
-
- `group.member-tag.update`
|
|
1074
|
-
- `communities.update`
|
|
1075
|
-
|
|
1076
|
-
### Why the fork keeps custom group handling
|
|
1077
|
-
|
|
1078
|
-
The local project already has richer handling around:
|
|
1079
|
-
|
|
1080
|
-
- group author info
|
|
1081
|
-
- participant alternatives
|
|
1082
|
-
- community-specific stubs
|
|
1083
|
-
- label changes
|
|
1084
|
-
|
|
1085
|
-
That is why those paths were preserved instead of normalized down to a simpler generic structure.
|
|
1086
|
-
|
|
1087
|
-
## Event reference
|
|
1088
|
-
|
|
1089
|
-
The package uses the event-emitter style surface exposed through `sock.ev`.
|
|
1090
|
-
|
|
1091
|
-
### High-value events
|
|
1092
|
-
|
|
1093
|
-
| Event | Typical use |
|
|
1094
|
-
|---|---|
|
|
1095
|
-
| `connection.update` | login, reconnect, QR lifecycle |
|
|
1096
|
-
| `creds.update` | persist auth state |
|
|
1097
|
-
| `messages.upsert` | incoming messages |
|
|
1098
|
-
| `messages.update` | edits, receipts, state changes |
|
|
1099
|
-
| `messages.reaction` | reaction handling |
|
|
1100
|
-
| `messaging-history.set` | first sync and history batches |
|
|
1101
|
-
| `contacts.update` | contact refresh |
|
|
1102
|
-
| `chats.update` | chat state changes |
|
|
1103
|
-
| `groups.update` | group metadata changes |
|
|
1104
|
-
| `group-participants.update` | participant changes |
|
|
1105
|
-
|
|
1106
|
-
### Example: connection update
|
|
1107
|
-
|
|
1108
|
-
```js
|
|
1109
|
-
sock.ev.on('connection.update', (update) => {
|
|
1110
|
-
const { connection, qr, isNewLogin, lastDisconnect } = update
|
|
1111
|
-
|
|
1112
|
-
if (qr) {
|
|
1113
|
-
console.log('qr available')
|
|
1114
|
-
}
|
|
1115
|
-
|
|
1116
|
-
if (isNewLogin) {
|
|
1117
|
-
console.log('new login established')
|
|
1118
|
-
}
|
|
1119
|
-
|
|
1120
|
-
if (connection === 'close') {
|
|
1121
|
-
console.log(lastDisconnect?.error)
|
|
1122
|
-
}
|
|
1123
|
-
})
|
|
1124
|
-
```
|
|
1125
|
-
|
|
1126
|
-
### Example: messages upsert
|
|
1127
|
-
|
|
1128
|
-
```js
|
|
1129
|
-
sock.ev.on('messages.upsert', ({ messages, type }) => {
|
|
1130
|
-
console.log(type, messages.length)
|
|
1131
|
-
})
|
|
1132
|
-
```
|
|
1133
|
-
|
|
1134
|
-
### Example: group participants update
|
|
1135
|
-
|
|
1136
|
-
```js
|
|
1137
|
-
sock.ev.on('group-participants.update', (event) => {
|
|
1138
|
-
console.log({
|
|
1139
|
-
id: event.id,
|
|
1140
|
-
author: event.author,
|
|
1141
|
-
action: event.action,
|
|
1142
|
-
participants: event.participants
|
|
1143
|
-
})
|
|
1144
|
-
})
|
|
1145
|
-
```
|
|
1146
|
-
|
|
1147
|
-
### Example: group join requests
|
|
1148
|
-
|
|
1149
|
-
```js
|
|
1150
|
-
sock.ev.on('group.join-request', (event) => {
|
|
1151
|
-
console.log(event)
|
|
1152
|
-
})
|
|
1153
|
-
```
|
|
1154
|
-
|
|
1155
|
-
### Example: reactions
|
|
1156
|
-
|
|
1157
|
-
```js
|
|
1158
|
-
sock.ev.on('messages.reaction', (items) => {
|
|
1159
|
-
for (const item of items) {
|
|
1160
|
-
console.log(item.reaction)
|
|
1161
|
-
}
|
|
1162
|
-
})
|
|
1163
|
-
```
|
|
1164
|
-
|
|
1165
|
-
## Logging notes
|
|
1166
|
-
|
|
1167
|
-
The package continues to work with a `pino`-style logger object. In practice:
|
|
1168
|
-
|
|
1169
|
-
- quiet logs are appropriate for production wrappers
|
|
1170
|
-
- `debug` is helpful when exploring socket flow
|
|
1171
|
-
- `trace` is useful when inspecting binary-node behavior and protocol details
|
|
1172
|
-
|
|
1173
|
-
### Example
|
|
1174
|
-
|
|
1175
|
-
```js
|
|
1176
|
-
const pino = require('pino')
|
|
1177
|
-
|
|
1178
|
-
const sock = makeWASocket({
|
|
1179
|
-
version,
|
|
1180
|
-
auth: state,
|
|
1181
|
-
logger: pino({ level: 'info' }),
|
|
1182
|
-
browser: Browsers.ubuntu('Neelegirl'),
|
|
1183
|
-
printQRInTerminal: true
|
|
1184
|
-
})
|
|
1185
|
-
```
|
|
1186
|
-
|
|
1187
|
-
### Why logs were preserved
|
|
1188
|
-
|
|
1189
|
-
Neelegirl-specific logging output and watch behavior were explicitly treated as protected. The goal was not to "prettify" logs at the cost of losing operational context.
|
|
1190
|
-
|
|
1191
|
-
## Update notice
|
|
1192
|
-
|
|
1193
|
-
This package already contains a runtime npm-version check in the current Neelegirl fork.
|
|
1194
|
-
|
|
1195
|
-
### What it really does
|
|
1196
|
-
|
|
1197
|
-
- it checks the npm registry
|
|
1198
|
-
- it does not self-update
|
|
1199
|
-
- it prints a hint only
|
|
1200
|
-
- it is intentionally lightweight
|
|
1201
|
-
|
|
1202
|
-
### When it appears
|
|
1203
|
-
|
|
1204
|
-
In the current local fork, the update notice is tied to the existing connection and QR-related flow, and it is designed to run once per process.
|
|
1205
|
-
|
|
1206
|
-
### Realistic expectation
|
|
1207
|
-
|
|
1208
|
-
If a newer version exists, you still update manually:
|
|
1209
|
-
|
|
1210
|
-
```bash
|
|
1211
|
-
npm install @neelegirl/baileys@latest
|
|
1212
|
-
```
|
|
1213
|
-
|
|
1214
|
-
This is the realistic behavior. The package does not automatically replace files in your project.
|
|
1215
|
-
|
|
1216
|
-
## Troubleshooting
|
|
1217
|
-
|
|
1218
|
-
### QR is not appearing
|
|
1219
|
-
|
|
1220
|
-
Check:
|
|
1221
|
-
|
|
1222
|
-
- `printQRInTerminal: true`
|
|
1223
|
-
- your auth folder is not already fully logged in
|
|
1224
|
-
- the socket is actually being started
|
|
1225
|
-
- your terminal is not swallowing QR output
|
|
1226
|
-
|
|
1227
|
-
### Pairing code does not return
|
|
1228
|
-
|
|
1229
|
-
Check:
|
|
1230
|
-
|
|
1231
|
-
- `printQRInTerminal` is disabled for pairing flow
|
|
1232
|
-
- the phone number is passed without `+`
|
|
1233
|
-
- the session is not already registered
|
|
1234
|
-
|
|
1235
|
-
### Messages are not sending after reconnect
|
|
1236
|
-
|
|
1237
|
-
Check:
|
|
1238
|
-
|
|
1239
|
-
- auth state persistence
|
|
1240
|
-
- key-store persistence
|
|
1241
|
-
- `creds.update` listener
|
|
1242
|
-
- whether your custom store is actually writing signal keys back
|
|
1243
|
-
|
|
1244
|
-
### Sender ids look inconsistent
|
|
1245
|
-
|
|
1246
|
-
Check whether you are mixing:
|
|
1247
|
-
|
|
1248
|
-
- PN ids
|
|
1249
|
-
- LID ids
|
|
1250
|
-
- hosted PN ids
|
|
1251
|
-
- hosted LID ids
|
|
1252
|
-
|
|
1253
|
-
Normalize before storing or comparing.
|
|
1254
|
-
|
|
1255
|
-
### History sync looks incomplete
|
|
1256
|
-
|
|
1257
|
-
Check:
|
|
1258
|
-
|
|
1259
|
-
- `syncFullHistory`
|
|
1260
|
-
- browser profile choice
|
|
1261
|
-
- first-login behavior versus reconnect behavior
|
|
1262
|
-
- whether you are handling `messaging-history.set`
|
|
1263
|
-
|
|
1264
|
-
## FAQ
|
|
1265
|
-
|
|
1266
|
-
### Is this the official Baileys package?
|
|
1267
|
-
|
|
1268
|
-
No. It is a Neelegirl-maintained fork.
|
|
1269
|
-
|
|
1270
|
-
### Is it based on public WhiskeySockets/Baileys?
|
|
1271
|
-
|
|
1272
|
-
Yes, but selectively and conservatively.
|
|
1273
|
-
|
|
1274
|
-
### Does it preserve the custom QR flow?
|
|
1275
|
-
|
|
1276
|
-
Yes.
|
|
1277
|
-
|
|
1278
|
-
### Does it preserve `NEELE` message IDs?
|
|
1279
|
-
|
|
1280
|
-
Yes.
|
|
1281
|
-
|
|
1282
|
-
### Does it mirror every upstream internal file?
|
|
1283
|
-
|
|
1284
|
-
No.
|
|
1285
|
-
|
|
1286
|
-
### Does it include a CLI?
|
|
1287
|
-
|
|
1288
|
-
No.
|
|
1289
|
-
|
|
1290
|
-
### Does it auto-update itself?
|
|
1291
|
-
|
|
1292
|
-
No. It can show an update hint, but updating remains manual.
|
|
1293
|
-
|
|
1294
|
-
### Should I use this instead of upstream for Neelegirl projects?
|
|
1295
|
-
|
|
1296
|
-
If your project depends on the current Neelegirl-specific runtime behavior, yes.
|
|
1297
|
-
|
|
1298
|
-
### Can I still access lower-level helpers?
|
|
1299
|
-
|
|
1300
|
-
Yes. The package exports a broad set of utilities and socket-related helpers.
|
|
1301
|
-
|
|
1302
|
-
### Why not just overwrite everything with upstream?
|
|
1303
|
-
|
|
1304
|
-
Because that would risk breaking project-specific runtime behavior that already exists locally.
|
|
1305
|
-
|
|
1306
|
-
### Why are LID helpers emphasized so much?
|
|
1307
|
-
|
|
1308
|
-
Because identity handling is one of the areas most likely to cause subtle regressions in message processing, logging, and sender tracking.
|
|
1309
|
-
|
|
1310
|
-
## Configuration patterns
|
|
1311
|
-
|
|
1312
|
-
This section is intentionally verbose because configuration details are where many WhatsApp Web client issues begin.
|
|
1313
|
-
|
|
1314
|
-
### Minimal practical config
|
|
1315
|
-
|
|
1316
|
-
```js
|
|
1317
|
-
const sock = makeWASocket({
|
|
1318
|
-
version,
|
|
1319
|
-
auth: state,
|
|
1320
|
-
browser: Browsers.ubuntu('Neelegirl'),
|
|
1321
|
-
printQRInTerminal: true
|
|
1322
|
-
})
|
|
1323
|
-
```
|
|
1324
|
-
|
|
1325
|
-
### Quiet production-oriented config
|
|
1326
|
-
|
|
1327
|
-
```js
|
|
1328
|
-
const pino = require('pino')
|
|
1329
|
-
|
|
1330
|
-
const sock = makeWASocket({
|
|
1331
|
-
version,
|
|
1332
|
-
auth: state,
|
|
1333
|
-
browser: Browsers.windows('Neelegirl Bot'),
|
|
1334
|
-
printQRInTerminal: false,
|
|
1335
|
-
logger: pino({ level: 'silent' }),
|
|
1336
|
-
markOnlineOnConnect: false,
|
|
1337
|
-
syncFullHistory: false
|
|
1338
|
-
})
|
|
1339
|
-
```
|
|
1340
|
-
|
|
1341
|
-
### Store-aware config
|
|
1342
|
-
|
|
1343
|
-
```js
|
|
1344
|
-
const sock = makeWASocket({
|
|
1345
|
-
version,
|
|
1346
|
-
auth: state,
|
|
1347
|
-
browser: Browsers.macOS('Desktop'),
|
|
1348
|
-
printQRInTerminal: true,
|
|
1349
|
-
getMessage: async (key) => {
|
|
1350
|
-
return store.loadMessage(key.remoteJid, key.id)
|
|
1351
|
-
},
|
|
1352
|
-
cachedGroupMetadata: async (jid) => {
|
|
1353
|
-
return groupCache.get(jid)
|
|
1354
|
-
}
|
|
1355
|
-
})
|
|
1356
|
-
```
|
|
1357
|
-
|
|
1358
|
-
### Config checklist
|
|
1359
|
-
|
|
1360
|
-
| Question | Why to check it |
|
|
1361
|
-
|---|---|
|
|
1362
|
-
| did you pass `auth` | required for login state |
|
|
1363
|
-
| did you persist `creds.update` | prevents key drift |
|
|
1364
|
-
| did you choose an appropriate `browser` | affects presentation and sometimes sync behavior |
|
|
1365
|
-
| did you define `getMessage` if needed | helps retry and recovery flows |
|
|
1366
|
-
| did you define `cachedGroupMetadata` if group-heavy | reduces repeated metadata fetches |
|
|
1367
|
-
|
|
1368
|
-
## Auth and persistence patterns
|
|
1369
|
-
|
|
1370
|
-
### Multi-file auth state
|
|
1371
|
-
|
|
1372
|
-
This is usually the easiest place to start:
|
|
1373
|
-
|
|
1374
|
-
```js
|
|
1375
|
-
const { state, saveCreds } = await useMultiFileAuthState('./auth_info')
|
|
1376
|
-
|
|
1377
|
-
const sock = makeWASocket({
|
|
1378
|
-
version,
|
|
1379
|
-
auth: state,
|
|
1380
|
-
browser: Browsers.ubuntu('Neelegirl'),
|
|
1381
|
-
printQRInTerminal: true
|
|
1382
|
-
})
|
|
1383
|
-
|
|
1384
|
-
sock.ev.on('creds.update', saveCreds)
|
|
1385
|
-
```
|
|
1386
|
-
|
|
1387
|
-
### Single-file auth state
|
|
1388
|
-
|
|
1389
|
-
```js
|
|
1390
|
-
const { state, saveCreds } = await useSingleFileAuthState('./auth.json')
|
|
1391
|
-
|
|
1392
|
-
const sock = makeWASocket({
|
|
1393
|
-
version,
|
|
1394
|
-
auth: state,
|
|
1395
|
-
browser: Browsers.ubuntu('Neelegirl'),
|
|
1396
|
-
printQRInTerminal: true
|
|
1397
|
-
})
|
|
1398
|
-
|
|
1399
|
-
sock.ev.on('creds.update', saveCreds)
|
|
1400
|
-
```
|
|
1401
|
-
|
|
1402
|
-
### Mongo-style helper
|
|
1403
|
-
|
|
1404
|
-
If your project uses the local helper for mongo-backed auth state:
|
|
1405
|
-
|
|
1406
|
-
```js
|
|
1407
|
-
const { state, saveCreds } = await useMongoFileAuthState(mongoCollection)
|
|
1408
|
-
```
|
|
1409
|
-
|
|
1410
|
-
### Custom persistence rules
|
|
1411
|
-
|
|
1412
|
-
If you write your own auth store:
|
|
1413
|
-
|
|
1414
|
-
- persist credentials
|
|
1415
|
-
- persist signal keys
|
|
1416
|
-
- persist updates promptly
|
|
1417
|
-
- do not drop `creds.update`
|
|
1418
|
-
- do not ignore key mutations
|
|
1419
|
-
|
|
1420
|
-
## Store usage
|
|
1421
|
-
|
|
1422
|
-
The package still exports `makeInMemoryStore` for simple local state handling.
|
|
1423
|
-
|
|
1424
|
-
### Example
|
|
1425
|
-
|
|
1426
|
-
```js
|
|
1427
|
-
const pino = require('pino')
|
|
1428
|
-
const { makeInMemoryStore } = require('@neelegirl/baileys')
|
|
1429
|
-
|
|
1430
|
-
const store = makeInMemoryStore({
|
|
1431
|
-
logger: pino({ level: 'silent' })
|
|
1432
|
-
})
|
|
1433
|
-
|
|
1434
|
-
store.bind(sock.ev)
|
|
1435
|
-
```
|
|
1436
|
-
|
|
1437
|
-
### Typical uses
|
|
1438
|
-
|
|
1439
|
-
- quick development persistence
|
|
1440
|
-
- message lookup for retry helpers
|
|
1441
|
-
- chat cache
|
|
1442
|
-
- contact cache
|
|
1443
|
-
|
|
1444
|
-
### Caveat
|
|
1445
|
-
|
|
1446
|
-
For serious production systems, build a proper persistent store instead of keeping too much history only in memory.
|
|
1447
|
-
|
|
1448
|
-
## More cookbook examples
|
|
1449
|
-
|
|
1450
|
-
### Mark messages as read
|
|
1451
|
-
|
|
1452
|
-
```js
|
|
1453
|
-
await sock.readMessages([message.key])
|
|
1454
|
-
```
|
|
1455
|
-
|
|
1456
|
-
### Update presence
|
|
1457
|
-
|
|
1458
|
-
```js
|
|
1459
|
-
await sock.sendPresenceUpdate('available', jid)
|
|
1460
|
-
await sock.sendPresenceUpdate('unavailable', jid)
|
|
1461
|
-
```
|
|
1462
|
-
|
|
1463
|
-
### Subscribe to another user's presence
|
|
1464
|
-
|
|
1465
|
-
```js
|
|
1466
|
-
await sock.presenceSubscribe(jid)
|
|
1467
|
-
```
|
|
1468
|
-
|
|
1469
|
-
### Fetch profile picture
|
|
1470
|
-
|
|
1471
|
-
```js
|
|
1472
|
-
const url = await sock.profilePictureUrl(jid, 'image')
|
|
1473
|
-
console.log(url)
|
|
1474
|
-
```
|
|
1475
|
-
|
|
1476
|
-
### Fetch status
|
|
1477
|
-
|
|
1478
|
-
```js
|
|
1479
|
-
const status = await sock.fetchStatus(jid)
|
|
1480
|
-
console.log(status)
|
|
1481
|
-
```
|
|
1482
|
-
|
|
1483
|
-
### Check if a number is on WhatsApp
|
|
1484
|
-
|
|
1485
|
-
```js
|
|
1486
|
-
const [result] = await sock.onWhatsApp('491234567890@s.whatsapp.net')
|
|
1487
|
-
console.log(result)
|
|
1488
|
-
```
|
|
1489
|
-
|
|
1490
|
-
### Run a USync query
|
|
1491
|
-
|
|
1492
|
-
```js
|
|
1493
|
-
const {
|
|
1494
|
-
USyncQuery,
|
|
1495
|
-
USyncUser
|
|
1496
|
-
} = require('@neelegirl/baileys')
|
|
1497
|
-
|
|
1498
|
-
const query = new USyncQuery()
|
|
1499
|
-
.withContactProtocol()
|
|
1500
|
-
.withUser(new USyncUser().withPhone('+491234567890'))
|
|
1501
|
-
|
|
1502
|
-
const result = await sock.executeUSyncQuery(query)
|
|
1503
|
-
console.log(result)
|
|
1504
|
-
```
|
|
1505
|
-
|
|
1506
|
-
### Fetch group invite code
|
|
1507
|
-
|
|
1508
|
-
```js
|
|
1509
|
-
const code = await sock.groupInviteCode(groupId)
|
|
1510
|
-
console.log(code)
|
|
1511
|
-
```
|
|
1512
|
-
|
|
1513
|
-
### Accept invite
|
|
1514
|
-
|
|
1515
|
-
```js
|
|
1516
|
-
const joined = await sock.groupAcceptInvite(code)
|
|
1517
|
-
console.log(joined)
|
|
1518
|
-
```
|
|
1519
|
-
|
|
1520
|
-
### Update profile status
|
|
1521
|
-
|
|
1522
|
-
```js
|
|
1523
|
-
await sock.updateProfileStatus('hello from neelegirl')
|
|
1524
|
-
```
|
|
1525
|
-
|
|
1526
|
-
### Update profile name
|
|
1527
|
-
|
|
1528
|
-
```js
|
|
1529
|
-
await sock.updateProfileName('Neelegirl Bot')
|
|
1530
|
-
```
|
|
1531
|
-
|
|
1532
|
-
## Architecture notes
|
|
1533
|
-
|
|
1534
|
-
This local package can be thought of in layers:
|
|
1535
|
-
|
|
1536
|
-
| Layer | Responsibility |
|
|
1537
|
-
|---|---|
|
|
1538
|
-
| socket layer | connection, noise, login, QR, pairing |
|
|
1539
|
-
| utils layer | message building, media handling, parsing, helpers |
|
|
1540
|
-
| binary layer | JID parsing and node encoding/decoding |
|
|
1541
|
-
| signal layer | session crypto, sender keys, LID mapping |
|
|
1542
|
-
| store layer | optional in-memory cache and helpers |
|
|
1543
|
-
|
|
1544
|
-
### Why the signal layer mattered in this maintenance pass
|
|
1545
|
-
|
|
1546
|
-
The socket already expected LID-aware signal helpers, but the older local `libsignal.js` did not fully provide them. That mismatch was one of the most important actual runtime corrections in the recent update.
|
|
1547
|
-
|
|
1548
|
-
## Automatic update note
|
|
1549
|
-
|
|
1550
|
-
This package can show an update hint, but it does not auto-patch your installation.
|
|
1551
|
-
|
|
1552
|
-
### Realistic behavior summary
|
|
1553
|
-
|
|
1554
|
-
| Behavior | Status |
|
|
1555
|
-
|---|---|
|
|
1556
|
-
| check registry | yes |
|
|
1557
|
-
| run once per process | yes |
|
|
1558
|
-
| self-update code | no |
|
|
1559
|
-
| replace files automatically | no |
|
|
1560
|
-
| tell you what to run | yes |
|
|
1561
|
-
|
|
1562
|
-
### Manual update commands
|
|
1563
|
-
|
|
1564
|
-
```bash
|
|
1565
|
-
npm install @neelegirl/baileys@latest
|
|
1566
|
-
```
|
|
1567
|
-
|
|
1568
|
-
```bash
|
|
1569
|
-
yarn add @neelegirl/baileys@latest
|
|
1570
|
-
```
|
|
1571
|
-
|
|
1572
|
-
### Why not self-update
|
|
1573
|
-
|
|
1574
|
-
Auto-replacing package files inside an active bot environment would be risky and surprising. A hint is realistic. Silent mutation of dependencies is not.
|
|
1575
|
-
|
|
1576
|
-
## Glossary
|
|
1577
|
-
|
|
1578
|
-
### PN
|
|
1579
|
-
|
|
1580
|
-
Phone-number identity space, typically `@s.whatsapp.net`.
|
|
1581
|
-
|
|
1582
|
-
### LID
|
|
1583
|
-
|
|
1584
|
-
Linked identity space, typically `@lid`.
|
|
1585
|
-
|
|
1586
|
-
### hosted PN
|
|
1587
|
-
|
|
1588
|
-
Hosted phone-number identity space, often seen with device-specific hosted forms.
|
|
1589
|
-
|
|
1590
|
-
### hosted LID
|
|
1591
|
-
|
|
1592
|
-
Hosted LID identity space, often seen when identity and hosted-device concerns intersect.
|
|
1593
|
-
|
|
1594
|
-
### `participantAlt`
|
|
1595
|
-
|
|
1596
|
-
Project-specific alternate participant metadata preserved in the local fork.
|
|
1597
|
-
|
|
1598
|
-
### `remoteJidAlt`
|
|
1599
|
-
|
|
1600
|
-
Project-specific alternate remote jid metadata preserved in the local fork.
|
|
1601
|
-
|
|
1602
|
-
### `senderNormalized`
|
|
1603
|
-
|
|
1604
|
-
A generic phrase used in many bot projects to refer to the stable sender representation after identity reconciliation.
|
|
1605
|
-
|
|
1606
|
-
## Project policy
|
|
1607
|
-
|
|
1608
|
-
This fork intentionally prioritizes:
|
|
1609
|
-
|
|
1610
|
-
- stable behavior for existing Neelegirl consumers
|
|
1611
|
-
- conservative compatibility updates
|
|
1612
|
-
- readable maintenance over flashy churn
|
|
1613
|
-
- truthful documentation over exaggerated claims
|
|
1614
|
-
|
|
1615
|
-
It intentionally avoids:
|
|
1616
|
-
|
|
1617
|
-
- blind upstream overwrite
|
|
1618
|
-
- destructive export-map tightening
|
|
1619
|
-
- rewriting protected project logic just to look more "modern"
|
|
1620
|
-
|
|
1621
|
-
## Documentation philosophy
|
|
1622
|
-
|
|
1623
|
-
This README is intentionally longer than a minimal package page because users of this fork usually need:
|
|
1624
|
-
|
|
1625
|
-
- a clear explanation of why the fork exists
|
|
1626
|
-
- reassurance about what custom logic is protected
|
|
1627
|
-
- a practical guide for auth, QR, pairing, and message handling
|
|
1628
|
-
- a realistic statement of what is and is not updated automatically
|
|
1629
|
-
|
|
1630
|
-
## Release notes
|
|
1631
|
-
|
|
1632
|
-
### 2.1.8
|
|
1633
|
-
|
|
1634
|
-
- runtime hotfix release for CommonJS `lru-cache` compatibility in the current Neelegirl environment
|
|
1635
|
-
- fixed constructor resolution used by LID mapping and retry cache initialization
|
|
1636
|
-
- dependency range aligned to `@neelegirl/libsignal@^1.0.12`
|
|
1637
|
-
|
|
1638
|
-
### 2.1.7
|
|
1639
|
-
|
|
1640
|
-
- documentation expansion release
|
|
1641
|
-
- Baileys README now includes deep operational guidance and realistic update behavior notes
|
|
1642
|
-
- dependency range aligned to `@neelegirl/libsignal@^1.0.11`
|
|
1643
|
-
|
|
1644
|
-
### 2.1.6
|
|
134
|
+
## Requirements
|
|
1645
135
|
|
|
1646
|
-
-
|
|
1647
|
-
-
|
|
1648
|
-
- improved history sync processing for LID and PN mapping capture
|
|
1649
|
-
- added current JID helper compatibility exports
|
|
1650
|
-
- refreshed typings and README without touching protected QR and `NEELE` logic
|
|
136
|
+
- Node.js `>=16.0.0`
|
|
137
|
+
- A WhatsApp account that is allowed to link a Web client
|
|
1651
138
|
|
|
1652
|
-
|
|
139
|
+
## Limits And Honesty Notes
|
|
1653
140
|
|
|
1654
|
-
-
|
|
141
|
+
- This package does not claim to be a 1:1 upstream 7.x layout
|
|
142
|
+
- This package does not bundle every new upstream internal module
|
|
143
|
+
- This README does not claim unsupported helpers such as `createSmartMessageQueue()`
|
|
1655
144
|
|
|
1656
|
-
##
|
|
145
|
+
## License
|
|
1657
146
|
|
|
1658
|
-
|
|
147
|
+
MIT
|