@codexverified/baileys 2.7.5
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/LICENSE +21 -0
- package/README.md +233 -0
- package/WAProto/V +1 -0
- package/WAProto/WAProto.proto +8051 -0
- package/WAProto/index.js +289292 -0
- package/engine-requirements.js +13 -0
- package/lib/Defaults/index.js +158 -0
- package/lib/Signal/Group/ciphertext-message.js +11 -0
- package/lib/Signal/Group/group-session-builder.js +29 -0
- package/lib/Signal/Group/group_cipher.js +81 -0
- package/lib/Signal/Group/index.js +11 -0
- package/lib/Signal/Group/keyhelper.js +17 -0
- package/lib/Signal/Group/sender-chain-key.js +25 -0
- package/lib/Signal/Group/sender-key-distribution-message.js +62 -0
- package/lib/Signal/Group/sender-key-message.js +65 -0
- package/lib/Signal/Group/sender-key-name.js +47 -0
- package/lib/Signal/Group/sender-key-record.js +40 -0
- package/lib/Signal/Group/sender-key-state.js +83 -0
- package/lib/Signal/Group/sender-message-key.js +25 -0
- package/lib/Signal/libsignal.js +428 -0
- package/lib/Signal/lid-mapping.js +280 -0
- package/lib/Socket/Client/index.js +2 -0
- package/lib/Socket/Client/types.js +10 -0
- package/lib/Socket/Client/websocket.js +53 -0
- package/lib/Socket/aigroups.js +315 -0
- package/lib/Socket/business.js +407 -0
- package/lib/Socket/chats.js +1831 -0
- package/lib/Socket/communities.js +431 -0
- package/lib/Socket/graphql.js +899 -0
- package/lib/Socket/groups.js +549 -0
- package/lib/Socket/index.js +79 -0
- package/lib/Socket/interactive-handler.js +600 -0
- package/lib/Socket/interop.js +563 -0
- package/lib/Socket/managed-account.js +208 -0
- package/lib/Socket/messages-recv.js +2144 -0
- package/lib/Socket/messages-send.js +2030 -0
- package/lib/Socket/mex.js +41 -0
- package/lib/Socket/newsletter.js +226 -0
- package/lib/Socket/privacy.js +446 -0
- package/lib/Socket/registration.js +428 -0
- package/lib/Socket/socket.js +1017 -0
- package/lib/Socket/username.js +229 -0
- package/lib/Store/index.js +4 -0
- package/lib/Store/make-cache-manager-store.js +89 -0
- package/lib/Store/make-in-memory-store.js +420 -0
- package/lib/Store/make-ordered-dictionary.js +78 -0
- package/lib/Store/object-repository.js +23 -0
- package/lib/Types/Auth.js +1 -0
- package/lib/Types/Bussines.js +1 -0
- package/lib/Types/Call.js +1 -0
- package/lib/Types/Chat.js +7 -0
- package/lib/Types/Contact.js +1 -0
- package/lib/Types/Events.js +1 -0
- package/lib/Types/GroupMetadata.js +1 -0
- package/lib/Types/Label.js +24 -0
- package/lib/Types/LabelAssociation.js +6 -0
- package/lib/Types/Message.js +17 -0
- package/lib/Types/Mex.js +39 -0
- package/lib/Types/Product.js +1 -0
- package/lib/Types/RichType.js +22 -0
- package/lib/Types/Signal.js +1 -0
- package/lib/Types/Socket.js +2 -0
- package/lib/Types/State.js +48 -0
- package/lib/Types/USync.js +1 -0
- package/lib/Types/index.js +25 -0
- package/lib/Utils/auth-utils.js +301 -0
- package/lib/Utils/bot-planning-replay.js +169 -0
- package/lib/Utils/browser-utils.js +28 -0
- package/lib/Utils/business.js +230 -0
- package/lib/Utils/chat-utils.js +885 -0
- package/lib/Utils/companion-reg-client-utils.js +32 -0
- package/lib/Utils/consumer-application.js +102 -0
- package/lib/Utils/crypto.js +117 -0
- package/lib/Utils/decode-wa-message.js +484 -0
- package/lib/Utils/event-buffer.js +589 -0
- package/lib/Utils/generics.js +388 -0
- package/lib/Utils/group-history.js +56 -0
- package/lib/Utils/history.js +130 -0
- package/lib/Utils/identity-change-handler.js +48 -0
- package/lib/Utils/index.js +34 -0
- package/lib/Utils/jid-display-normalization.js +209 -0
- package/lib/Utils/link-preview.js +84 -0
- package/lib/Utils/logger.js +2 -0
- package/lib/Utils/lt-hash.js +7 -0
- package/lib/Utils/make-mutex.js +32 -0
- package/lib/Utils/message-composer.js +467 -0
- package/lib/Utils/message-inspect.js +67 -0
- package/lib/Utils/message-retry-manager.js +241 -0
- package/lib/Utils/messages-media.js +1006 -0
- package/lib/Utils/messages.js +1851 -0
- package/lib/Utils/meta-ai-msmsg.js +130 -0
- package/lib/Utils/meta-compositing.js +194 -0
- package/lib/Utils/noise-handler.js +200 -0
- package/lib/Utils/offline-node-processor.js +39 -0
- package/lib/Utils/pre-key-manager.js +105 -0
- package/lib/Utils/process-message.js +527 -0
- package/lib/Utils/reporting-utils.js +257 -0
- package/lib/Utils/rich-message-utils.js +439 -0
- package/lib/Utils/signal.js +200 -0
- package/lib/Utils/stanza-ack.js +37 -0
- package/lib/Utils/sync-action-utils.js +47 -0
- package/lib/Utils/tc-token-utils.js +162 -0
- package/lib/Utils/use-multi-file-auth-state.js +120 -0
- package/lib/Utils/use-single-file-auth-state.js +96 -0
- package/lib/Utils/use-sqlite-auth-state.js +108 -0
- package/lib/Utils/validate-connection.js +206 -0
- package/lib/Utils/voip-rekey.js +20 -0
- package/lib/Utils/welcome-flow.js +217 -0
- package/lib/WABinary/constants.js +1463 -0
- package/lib/WABinary/decode.js +261 -0
- package/lib/WABinary/encode.js +219 -0
- package/lib/WABinary/generic-utils.js +227 -0
- package/lib/WABinary/index.js +5 -0
- package/lib/WABinary/jid-utils.js +95 -0
- package/lib/WABinary/types.js +1 -0
- package/lib/WAM/BinaryInfo.js +9 -0
- package/lib/WAM/constants.js +22852 -0
- package/lib/WAM/encode.js +149 -0
- package/lib/WAM/index.js +3 -0
- package/lib/WAUSync/Protocols/USyncBusinessProtocol.js +96 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +56 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +53 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +26 -0
- package/lib/WAUSync/Protocols/USyncFeatureProtocol.js +70 -0
- package/lib/WAUSync/Protocols/USyncPictureProtocol.js +28 -0
- package/lib/WAUSync/Protocols/USyncSidelistProtocol.js +25 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +37 -0
- package/lib/WAUSync/Protocols/USyncTextStatusProtocol.js +34 -0
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.js +24 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +50 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +28 -0
- package/lib/WAUSync/Protocols/index.js +12 -0
- package/lib/WAUSync/USyncQuery.js +201 -0
- package/lib/WAUSync/USyncUser.js +54 -0
- package/lib/WAUSync/index.js +3 -0
- package/lib/antiban.cjs +4726 -0
- package/lib/index.d.ts +286 -0
- package/lib/index.js +18 -0
- package/package.json +121 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 dev codex
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
# @codexverified/baileys
|
|
2
|
+
|
|
3
|
+
> A premium Baileys package built and maintained by Codex.
|
|
4
|
+
|
|
5
|
+
`@codexverified/baileys` is a Node.js and TypeScript library for building WhatsApp integrations over the Baileys protocol. It provides a familiar socket-based API together with media handling, authentication helpers, newsletter operations, interactive messages, rich content utilities, and account-management features.
|
|
6
|
+
|
|
7
|
+
The project is developed and maintained by **Codex** with an emphasis on readable source code, explicit behavior, maintainable interfaces, and practical production use.
|
|
8
|
+
|
|
9
|
+
## Project Status
|
|
10
|
+
|
|
11
|
+
| Property | Value |
|
|
12
|
+
| --- | --- |
|
|
13
|
+
| Package | `@codexverified/baileys` |
|
|
14
|
+
| Version | `2.7.5` |
|
|
15
|
+
| Runtime | Node.js 20 or newer |
|
|
16
|
+
| Module format | ESM with CommonJS compatibility where supported |
|
|
17
|
+
| Type declarations | Included |
|
|
18
|
+
| License | MIT |
|
|
19
|
+
| Maintainer | Codex |
|
|
20
|
+
|
|
21
|
+
## Installation
|
|
22
|
+
|
|
23
|
+
Install the published package when it is available in the npm registry:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npm install @codexverified/baileys
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
To install the current local build from the provided archive, place `codex-baileys-2.7.5.tgz` in your project directory and run:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npm install ./codex-baileys-2.7.5.tgz
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
The local archive installs under the package name `@codexverified/baileys`, so application imports remain the same in both cases.
|
|
36
|
+
|
|
37
|
+
## Quick Start
|
|
38
|
+
|
|
39
|
+
The following example creates a socket, persists authentication credentials, and reconnects after an unexpected connection close.
|
|
40
|
+
|
|
41
|
+
```javascript
|
|
42
|
+
import {
|
|
43
|
+
makeWASocket,
|
|
44
|
+
useMultiFileAuthState,
|
|
45
|
+
DisconnectReason
|
|
46
|
+
} from '@codexverified/baileys'
|
|
47
|
+
import P from 'pino'
|
|
48
|
+
|
|
49
|
+
const start = async () => {
|
|
50
|
+
const { state, saveCreds } = await useMultiFileAuthState('./session')
|
|
51
|
+
|
|
52
|
+
const sock = makeWASocket({
|
|
53
|
+
auth: state,
|
|
54
|
+
logger: P({ level: 'silent' })
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
sock.ev.on('creds.update', saveCreds)
|
|
58
|
+
|
|
59
|
+
sock.ev.on('connection.update', ({ connection, lastDisconnect }) => {
|
|
60
|
+
if (connection === 'open') {
|
|
61
|
+
console.log('Connected using @codexverified/baileys')
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (connection === 'close') {
|
|
65
|
+
const statusCode = lastDisconnect?.error?.output?.statusCode
|
|
66
|
+
const shouldReconnect = statusCode !== DisconnectReason.loggedOut
|
|
67
|
+
|
|
68
|
+
if (shouldReconnect) {
|
|
69
|
+
start().catch(console.error)
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
sock.ev.on('messages.upsert', async ({ messages }) => {
|
|
75
|
+
for (const message of messages) {
|
|
76
|
+
if (!message.message || message.key.fromMe) continue
|
|
77
|
+
|
|
78
|
+
await sock.sendMessage(message.key.remoteJid, {
|
|
79
|
+
text: 'Hello from @codexverified/baileys'
|
|
80
|
+
})
|
|
81
|
+
}
|
|
82
|
+
})
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
start().catch(console.error)
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## CommonJS Usage
|
|
89
|
+
|
|
90
|
+
For supported Node.js versions, the package can also be loaded through CommonJS:
|
|
91
|
+
|
|
92
|
+
```javascript
|
|
93
|
+
const {
|
|
94
|
+
makeWASocket,
|
|
95
|
+
useMultiFileAuthState
|
|
96
|
+
} = require('@codexverified/baileys')
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Core Capabilities
|
|
100
|
+
|
|
101
|
+
The package includes the following major capabilities:
|
|
102
|
+
|
|
103
|
+
| Area | Included functionality |
|
|
104
|
+
| --- | --- |
|
|
105
|
+
| Connections | WebSocket connection handling, reconnect support, connection events, pairing codes, and browser identity configuration |
|
|
106
|
+
| Authentication | Multi-file, single-file, SQLite, and cache-manager authentication helpers |
|
|
107
|
+
| Messages | Text, mentions, reactions, edits, deletes, forwards, replies, polls, contacts, locations, events, and group invites |
|
|
108
|
+
| Media | Images, videos, audio, documents, stickers, albums, thumbnails, HD media processing, and GIF playback |
|
|
109
|
+
| Interactive content | Buttons, lists, native flows, carousels, templates, and other interactive message structures |
|
|
110
|
+
| Rich content | Code blocks, tables, inline entities, LaTeX content, link previews, and rich response utilities |
|
|
111
|
+
| Groups | Group creation, participant management, settings, metadata, invites, communities, and labels |
|
|
112
|
+
| Newsletters | Channel information, subscribers, following, unfollowing, posts, reactions, media, and polls |
|
|
113
|
+
| Account features | Profiles, business information, privacy controls, usernames, interoperation, and account layers |
|
|
114
|
+
| Storage | In-memory stores, ordered dictionaries, cache-manager stores, and persistent authentication storage |
|
|
115
|
+
|
|
116
|
+
## Sending Messages
|
|
117
|
+
|
|
118
|
+
A basic text message can be sent with `sendMessage`:
|
|
119
|
+
|
|
120
|
+
```javascript
|
|
121
|
+
await sock.sendMessage(jid, {
|
|
122
|
+
text: 'Your message text'
|
|
123
|
+
})
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
A media message can be sent from a local file, URL, or buffer depending on the upload configuration:
|
|
127
|
+
|
|
128
|
+
```javascript
|
|
129
|
+
await sock.sendMessage(jid, {
|
|
130
|
+
image: { url: './image.jpg' },
|
|
131
|
+
caption: 'A caption from Codex'
|
|
132
|
+
})
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
A video can be delivered with GIF playback enabled:
|
|
136
|
+
|
|
137
|
+
```javascript
|
|
138
|
+
await sock.sendMessage(jid, {
|
|
139
|
+
video: { url: './animation.mp4' },
|
|
140
|
+
gifPlayback: true,
|
|
141
|
+
caption: 'Animated media'
|
|
142
|
+
})
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Authentication
|
|
146
|
+
|
|
147
|
+
The recommended authentication helper is `useMultiFileAuthState`:
|
|
148
|
+
|
|
149
|
+
```javascript
|
|
150
|
+
import { useMultiFileAuthState } from '@codexverified/baileys'
|
|
151
|
+
|
|
152
|
+
const { state, saveCreds } = await useMultiFileAuthState('./session')
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Authentication data contains sensitive account credentials. Keep the session directory private, exclude it from version control, and do not upload it to public repositories.
|
|
156
|
+
|
|
157
|
+
## Explicit Newsletter Following
|
|
158
|
+
|
|
159
|
+
The package does not automatically follow trusted channels, subscribe to fallback channels, or inject a fallback channel identifier into media messages. Newsletter following is consumer-controlled and must be requested explicitly:
|
|
160
|
+
|
|
161
|
+
```javascript
|
|
162
|
+
await sock.sendMessage(jid, {
|
|
163
|
+
followMe: true,
|
|
164
|
+
channelId: '123456789@newsletter',
|
|
165
|
+
count: 'once'
|
|
166
|
+
})
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Applications should validate channel identifiers before sending requests and should only follow channels when the behavior is clearly intended by the application owner and its users.
|
|
170
|
+
|
|
171
|
+
## Media Attribution
|
|
172
|
+
|
|
173
|
+
Generated image and video messages do not receive an automatic newsletter annotation or channel pill. If an application intentionally needs message context, it should provide that context explicitly through the supported message options rather than relying on hidden defaults.
|
|
174
|
+
|
|
175
|
+
## CODEX Branding
|
|
176
|
+
|
|
177
|
+
The package displays the following startup identity when a socket is created:
|
|
178
|
+
|
|
179
|
+
```text
|
|
180
|
+
CODEX TECHNOLOGY
|
|
181
|
+
A premium Baileys developed and built by Dev Codex
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
Generated message identifiers use the `CODEX` marker. This branding is informational and does not change the WhatsApp protocol or the message transport format.
|
|
185
|
+
|
|
186
|
+
## Development
|
|
187
|
+
|
|
188
|
+
Clone or extract the source archive, then install the package dependencies in the project directory:
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
npm install --ignore-scripts
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
Run the package test command with:
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
npm test
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
Before submitting changes, check the following:
|
|
201
|
+
|
|
202
|
+
1. Preserve the public API unless a breaking change is intentional.
|
|
203
|
+
2. Keep runtime requirements and package metadata synchronized.
|
|
204
|
+
3. Keep authentication data and personal account information out of commits.
|
|
205
|
+
4. Validate ESM syntax and CommonJS compatibility where applicable.
|
|
206
|
+
5. Document user-visible behavior changes in this README.
|
|
207
|
+
|
|
208
|
+
## Package Layout
|
|
209
|
+
|
|
210
|
+
| Path | Purpose |
|
|
211
|
+
| --- | --- |
|
|
212
|
+
| `lib/` | Compiled JavaScript implementation and type declarations |
|
|
213
|
+
| `WAProto/` | WhatsApp protocol definitions and generated protocol helpers |
|
|
214
|
+
| `engine-requirements.js` | Runtime requirement checks used during installation |
|
|
215
|
+
| `package.json` | Package metadata, dependencies, scripts, and exports |
|
|
216
|
+
| `README.md` | Project documentation and usage reference |
|
|
217
|
+
|
|
218
|
+
## Security and Responsible Use
|
|
219
|
+
|
|
220
|
+
This library interacts with WhatsApp accounts and user communications. Use it only with accounts and data you are authorized to control. Protect authentication files, avoid unsolicited messaging, respect platform rules, and provide clear notice when an application performs automated actions.
|
|
221
|
+
|
|
222
|
+
Do not commit session files, access tokens, private keys, phone numbers, or other personal information to a public repository.
|
|
223
|
+
|
|
224
|
+
## License
|
|
225
|
+
|
|
226
|
+
This project is distributed under the MIT License. See the package license metadata for the applicable terms.
|
|
227
|
+
|
|
228
|
+
## Maintained by Codex
|
|
229
|
+
|
|
230
|
+
**@codexverified/baileys is built and maintained by Codex.** Contributions, bug reports, and carefully documented improvements are welcome through the project repository once it is published.
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
|
package/WAProto/V
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|