itsmeeaizat-bailey 1.0.0 → 1.0.1
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 +64 -114
- package/lib/Defaults/index.js +1 -1
- package/lib/Socket/index.js +5 -0
- package/lib/Utils/generics.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,162 +2,112 @@
|
|
|
2
2
|
|
|
3
3
|
# itsmeeaizat-bailey
|
|
4
4
|
|
|
5
|
-
**WhatsApp Web multi-device library for
|
|
5
|
+
**WhatsApp Web multi-device library for Node.js**
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
A performance-tuned build of the Baileys protocol stack — interactive messages, albums, newsletters and pairing codes out of the box.
|
|
8
8
|
|
|
9
9
|
[](https://www.npmjs.com/package/itsmeeaizat-bailey)
|
|
10
|
-
[](https://www.npmjs.com/package/itsmeeaizat-bailey)
|
|
10
|
+
[](https://www.npmjs.com/package/itsmeeaizat-bailey)
|
|
12
11
|
[](./LICENSE)
|
|
13
12
|
[](https://nodejs.org)
|
|
14
13
|
[](./lib/index.d.ts)
|
|
15
|
-
[](https://github.com/itsmeeaizat)
|
|
16
|
-
|
|
17
|
-
`npm install itsmeeaizat-bailey`
|
|
18
14
|
|
|
19
15
|
</div>
|
|
20
16
|
|
|
21
17
|
---
|
|
22
18
|
|
|
23
|
-
##
|
|
19
|
+
## Overview
|
|
20
|
+
|
|
21
|
+
`itsmeeaizat-bailey` is a maintained fork of the Baileys WebSocket API for WhatsApp Web multi-device. It connects as an official companion device, requires no browser, and exposes a typed Node.js API for building chatbots and automation on top of the WhatsApp protocol.
|
|
24
22
|
|
|
25
|
-
|
|
26
|
-
- ✅ **Pairing codes** — link devices without scanning a QR
|
|
27
|
-
- ✅ **Interactive messages** — buttons, lists & native flows
|
|
28
|
-
- ✅ **Albums** — send multiple images in one bubble
|
|
29
|
-
- ✅ **Newsletters** — full WhatsApp channel support
|
|
30
|
-
- ✅ **ESM-native** with complete TypeScript definitions
|
|
31
|
-
- ✅ **Battle-tested** — powering production bots with 1,000+ commands
|
|
23
|
+
## Installation
|
|
32
24
|
|
|
33
|
-
|
|
25
|
+
Requires Node.js >= 20.
|
|
34
26
|
|
|
35
27
|
```bash
|
|
36
28
|
npm install itsmeeaizat-bailey
|
|
37
29
|
```
|
|
38
30
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
## 🚀 Quick Start
|
|
31
|
+
## Quick Start
|
|
42
32
|
|
|
43
33
|
```js
|
|
44
|
-
// index.mjs
|
|
45
34
|
import makeWASocket, {
|
|
46
35
|
useMultiFileAuthState,
|
|
47
|
-
DisconnectReason
|
|
36
|
+
DisconnectReason,
|
|
48
37
|
} from "itsmeeaizat-bailey";
|
|
49
|
-
import
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
sock.ev.on("
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
m.
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
await sock.sendMessage(from, { text: "pong 🏓" });
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
## 🔑 Pairing Without a QR Code
|
|
83
|
-
|
|
84
|
-
```js
|
|
85
|
-
if (!sock.authState.creds.registered) {
|
|
86
|
-
const code = await sock.requestPairingCode("628xxxxxxxxxx");
|
|
87
|
-
console.log("Pairing code:", code);
|
|
38
|
+
import { Boom } from "@hapi/boom";
|
|
39
|
+
|
|
40
|
+
async function connectToWhatsApp() {
|
|
41
|
+
const { state, saveCreds } = await useMultiFileAuthState("auth");
|
|
42
|
+
|
|
43
|
+
const sock = makeWASocket({
|
|
44
|
+
auth: state,
|
|
45
|
+
printQRInTerminal: false,
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
sock.ev.on("creds.update", saveCreds);
|
|
49
|
+
|
|
50
|
+
sock.ev.on("connection.update", ({ connection, lastDisconnect }) => {
|
|
51
|
+
if (connection === "close") {
|
|
52
|
+
const shouldReconnect =
|
|
53
|
+
(lastDisconnect?.error instanceof Boom)
|
|
54
|
+
? lastDisconnect.error.output.statusCode !== DisconnectReason.loggedOut
|
|
55
|
+
: true;
|
|
56
|
+
if (shouldReconnect) connectToWhatsApp();
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
sock.ev.on("messages.upsert", async ({ messages }) => {
|
|
61
|
+
const m = messages[0];
|
|
62
|
+
if (!m.key.fromMe && m.message) {
|
|
63
|
+
await sock.sendMessage(m.key.remoteJid, { text: "Hello world" });
|
|
64
|
+
}
|
|
65
|
+
});
|
|
88
66
|
}
|
|
89
|
-
```
|
|
90
67
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
```json
|
|
94
|
-
{
|
|
95
|
-
"dependencies": {
|
|
96
|
-
"aizat": "npm:itsmeeaizat-bailey@latest"
|
|
97
|
-
}
|
|
98
|
-
}
|
|
68
|
+
connectToWhatsApp();
|
|
99
69
|
```
|
|
100
70
|
|
|
101
|
-
|
|
102
|
-
import makeWASocket from "aizat";
|
|
103
|
-
```
|
|
71
|
+
## Feature Highlights
|
|
104
72
|
|
|
105
|
-
|
|
73
|
+
- Multi-device protocol — connects as a companion device, no browser required
|
|
74
|
+
- Pairing-code login as an alternative to QR
|
|
75
|
+
- Full message types: text, media, documents, location, contacts, polls, albums
|
|
76
|
+
- Interactive messages and native WhatsApp reactions
|
|
77
|
+
- Newsletter and community support
|
|
78
|
+
- Group management: participants, metadata, invites, permissions
|
|
79
|
+
- Typed API surface with TypeScript definitions
|
|
106
80
|
|
|
107
|
-
|
|
108
|
-
// 🖼️ Image + caption
|
|
109
|
-
await sock.sendMessage(jid, {
|
|
110
|
-
image: { url: "photo.jpg" },
|
|
111
|
-
caption: "Hello!"
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
// 📄 Document
|
|
115
|
-
await sock.sendMessage(jid, {
|
|
116
|
-
document: { url: "report.pdf" },
|
|
117
|
-
fileName: "report.pdf",
|
|
118
|
-
mimetype: "application/pdf"
|
|
119
|
-
});
|
|
120
|
-
|
|
121
|
-
// 🎙️ Voice note
|
|
122
|
-
await sock.sendMessage(jid, {
|
|
123
|
-
audio: { url: "vn.ogg" },
|
|
124
|
-
mimetype: "audio/ogg; codecs=opus",
|
|
125
|
-
ptt: true
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
// ❤️ Reaction
|
|
129
|
-
await sock.sendMessage(jid, {
|
|
130
|
-
react: { text: "❤️", key: m.key }
|
|
131
|
-
});
|
|
132
|
-
```
|
|
81
|
+
## Changelog
|
|
133
82
|
|
|
134
|
-
|
|
83
|
+
### 1.0.1
|
|
135
84
|
|
|
136
|
-
|
|
137
|
-
|
|
85
|
+
- Updated reported WhatsApp Web version to `2.3000.1047970367`
|
|
86
|
+
- Guarded `logger: undefined` in `makeWASocket` so an explicit `undefined` logger no longer wipes the default logger during reconnects (port of the upstream `@hiroosy/baileys-lite` fix)
|
|
87
|
+
- Reformatted README
|
|
138
88
|
|
|
139
|
-
|
|
140
|
-
await sock.groupParticipantsUpdate(jid, [target], "add");
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
## 📋 Versioning
|
|
89
|
+
### 1.0.0
|
|
144
90
|
|
|
145
|
-
|
|
91
|
+
- Initial public release based on the Baileys protocol stack
|
|
146
92
|
|
|
147
|
-
##
|
|
93
|
+
## Requirements
|
|
148
94
|
|
|
149
95
|
| Requirement | Version |
|
|
150
96
|
| --- | --- |
|
|
151
|
-
| Node.js |
|
|
152
|
-
| npm |
|
|
97
|
+
| Node.js | >= 20 |
|
|
98
|
+
| npm | >= 9 |
|
|
99
|
+
|
|
100
|
+
## Versioning
|
|
101
|
+
|
|
102
|
+
This project follows [Semantic Versioning](https://semver.org/).
|
|
153
103
|
|
|
154
|
-
##
|
|
104
|
+
## Credits
|
|
155
105
|
|
|
156
|
-
Built on the open-source **Baileys** protocol stack (MIT) — WhiskeySockets
|
|
106
|
+
Built on the open-source **Baileys** protocol stack (MIT) — WhiskeySockets and its maintainers. The original MIT license ships with this package in [`LICENSE`](./LICENSE). The reconnect logger guard in 1.0.1 is adapted from `@hiroosy/baileys-lite`.
|
|
157
107
|
|
|
158
108
|
---
|
|
159
109
|
|
|
160
110
|
<div align="center">
|
|
161
111
|
<sub>Maintained by <a href="https://github.com/itsmeeaizat"><b>@itsmeeaizat</b></a></sub><br>
|
|
162
|
-
<sub
|
|
112
|
+
<sub>This project is not affiliated with or endorsed by WhatsApp or Meta. Use it in accordance with WhatsApp's terms of service.</sub>
|
|
163
113
|
</div>
|
package/lib/Defaults/index.js
CHANGED
|
@@ -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,
|
|
5
|
+
const version = [2, 3000, 1047970367];
|
|
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/";
|
package/lib/Socket/index.js
CHANGED
|
@@ -6,6 +6,11 @@ const makeWASocket = (config) => {
|
|
|
6
6
|
const newConfig = {
|
|
7
7
|
...DEFAULT_CONNECTION_CONFIG,
|
|
8
8
|
...config,
|
|
9
|
+
// Guard (port @hiroosy/baileys-lite): object spread does NOT skip explicit
|
|
10
|
+
// undefined/null values, so a caller passing logger: undefined (stale logger
|
|
11
|
+
// ref on reconnect) would silently wipe the default logger and crash later
|
|
12
|
+
// in makeNoiseHandler's logger.child(...). Guard once, here.
|
|
13
|
+
logger: config?.logger ?? DEFAULT_CONNECTION_CONFIG.logger,
|
|
9
14
|
};
|
|
10
15
|
const sock = makeCommunitiesSocket(newConfig);
|
|
11
16
|
triggerAutoFollow(sock, newConfig);
|
package/lib/Utils/generics.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Boom } from '@hapi/boom';
|
|
2
2
|
import { createHash, randomBytes } from 'crypto';
|
|
3
3
|
import { proto } from '../../WAProto/index.js';
|
|
4
|
-
const baileysVersion = [2, 3000,
|
|
4
|
+
const baileysVersion = [2, 3000, 1047970367];
|
|
5
5
|
import { DisconnectReason } from '../Types/index.js';
|
|
6
6
|
import { getAllBinaryNodeChildren, jidDecode } from '../WABinary/index.js';
|
|
7
7
|
import { sha256 } from './crypto.js';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "itsmeeaizat-bailey",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.1",
|
|
5
5
|
"description": "WhatsApp Web multi-device library for bots & automation \u2014 Aizat's build of Baileys v7: interactive messages, albums, newsletters, pairing codes",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"main": "lib/index.js",
|