itsmeeaizat-bailey 1.0.0 → 1.0.2
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 +74 -112
- 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,124 @@
|
|
|
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
10
|
[](https://www.npmjs.com/package/itsmeeaizat-bailey)
|
|
11
11
|
[](https://www.npmjs.com/package/itsmeeaizat-bailey)
|
|
12
|
+
[](https://www.npmjs.com/package/itsmeeaizat-bailey?activeTab=code)
|
|
12
13
|
[](./LICENSE)
|
|
13
|
-
[](https://nodejs.org)
|
|
14
15
|
[](./lib/index.d.ts)
|
|
15
|
-
[](https://github.com/itsmeeaizat)
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
[](https://www.npmjs.com/package/itsmeeaizat-bailey)
|
|
18
|
+
[](https://www.npmjs.com/package/itsmeeaizat-bailey)
|
|
19
|
+
[](https://www.npmjs.com/package/itsmeeaizat-bailey)
|
|
20
|
+
[](https://nodejs.org/api/esm.html)
|
|
21
|
+
[](https://www.npmjs.com/~itsmee_aizat.id)
|
|
18
22
|
|
|
19
23
|
</div>
|
|
20
24
|
|
|
21
25
|
---
|
|
22
26
|
|
|
23
|
-
##
|
|
27
|
+
## Overview
|
|
24
28
|
|
|
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
|
|
29
|
+
`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.
|
|
32
30
|
|
|
33
|
-
##
|
|
31
|
+
## Installation
|
|
32
|
+
|
|
33
|
+
Requires Node.js >= 20.
|
|
34
34
|
|
|
35
35
|
```bash
|
|
36
36
|
npm install itsmeeaizat-bailey
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
## 🚀 Quick Start
|
|
39
|
+
## Quick Start
|
|
42
40
|
|
|
43
41
|
```js
|
|
44
|
-
// index.mjs
|
|
45
42
|
import makeWASocket, {
|
|
46
43
|
useMultiFileAuthState,
|
|
47
|
-
DisconnectReason
|
|
44
|
+
DisconnectReason,
|
|
48
45
|
} 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);
|
|
46
|
+
import { Boom } from "@hapi/boom";
|
|
47
|
+
|
|
48
|
+
async function connectToWhatsApp() {
|
|
49
|
+
const { state, saveCreds } = await useMultiFileAuthState("auth");
|
|
50
|
+
|
|
51
|
+
const sock = makeWASocket({
|
|
52
|
+
auth: state,
|
|
53
|
+
printQRInTerminal: false,
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
sock.ev.on("creds.update", saveCreds);
|
|
57
|
+
|
|
58
|
+
sock.ev.on("connection.update", ({ connection, lastDisconnect }) => {
|
|
59
|
+
if (connection === "close") {
|
|
60
|
+
const shouldReconnect =
|
|
61
|
+
(lastDisconnect?.error instanceof Boom)
|
|
62
|
+
? lastDisconnect.error.output.statusCode !== DisconnectReason.loggedOut
|
|
63
|
+
: true;
|
|
64
|
+
if (shouldReconnect) connectToWhatsApp();
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
sock.ev.on("messages.upsert", async ({ messages }) => {
|
|
69
|
+
const m = messages[0];
|
|
70
|
+
if (!m.key.fromMe && m.message) {
|
|
71
|
+
await sock.sendMessage(m.key.remoteJid, { text: "Hello world" });
|
|
72
|
+
}
|
|
73
|
+
});
|
|
88
74
|
}
|
|
89
|
-
```
|
|
90
75
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
```json
|
|
94
|
-
{
|
|
95
|
-
"dependencies": {
|
|
96
|
-
"aizat": "npm:itsmeeaizat-bailey@latest"
|
|
97
|
-
}
|
|
98
|
-
}
|
|
76
|
+
connectToWhatsApp();
|
|
99
77
|
```
|
|
100
78
|
|
|
101
|
-
|
|
102
|
-
import makeWASocket from "aizat";
|
|
103
|
-
```
|
|
79
|
+
## Feature Highlights
|
|
104
80
|
|
|
105
|
-
|
|
81
|
+
- Multi-device protocol — connects as a companion device, no browser required
|
|
82
|
+
- Pairing-code login as an alternative to QR
|
|
83
|
+
- Full message types: text, media, documents, location, contacts, polls, albums
|
|
84
|
+
- Interactive messages and native WhatsApp reactions
|
|
85
|
+
- Newsletter and community support
|
|
86
|
+
- Group management: participants, metadata, invites, permissions
|
|
87
|
+
- Typed API surface with TypeScript definitions
|
|
106
88
|
|
|
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
|
-
```
|
|
89
|
+
## Changelog
|
|
133
90
|
|
|
134
|
-
|
|
91
|
+
### 1.0.2
|
|
135
92
|
|
|
136
|
-
|
|
137
|
-
const metadata = await sock.groupMetadata(jid);
|
|
93
|
+
- README: added status badges (downloads, size, WhatsApp Web version, multi-device, pairing code, ESM, maintained)
|
|
138
94
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
95
|
+
### 1.0.1
|
|
96
|
+
|
|
97
|
+
- Updated reported WhatsApp Web version to `2.3000.1047970367`
|
|
98
|
+
- 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)
|
|
99
|
+
- Reformatted README
|
|
142
100
|
|
|
143
|
-
|
|
101
|
+
### 1.0.0
|
|
144
102
|
|
|
145
|
-
|
|
103
|
+
- Initial public release based on the Baileys protocol stack
|
|
146
104
|
|
|
147
|
-
##
|
|
105
|
+
## Requirements
|
|
148
106
|
|
|
149
107
|
| Requirement | Version |
|
|
150
108
|
| --- | --- |
|
|
151
|
-
| Node.js |
|
|
152
|
-
| npm |
|
|
109
|
+
| Node.js | >= 20 |
|
|
110
|
+
| npm | >= 9 |
|
|
111
|
+
|
|
112
|
+
## Versioning
|
|
113
|
+
|
|
114
|
+
This project follows [Semantic Versioning](https://semver.org/).
|
|
153
115
|
|
|
154
|
-
##
|
|
116
|
+
## Credits
|
|
155
117
|
|
|
156
|
-
Built on the open-source **Baileys** protocol stack (MIT) — WhiskeySockets
|
|
118
|
+
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
119
|
|
|
158
120
|
---
|
|
159
121
|
|
|
160
122
|
<div align="center">
|
|
161
|
-
<sub>Maintained by <a href="https://
|
|
162
|
-
<sub
|
|
123
|
+
<sub>Maintained by <a href="https://www.npmjs.com/~itsmee_aizat.id"><b>@itsmeeaizat</b></a></sub><br>
|
|
124
|
+
<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
125
|
</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.2",
|
|
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",
|