@lekzsync/baileys 0.0.0-stage → 1.0.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.
Potentially problematic release.
This version of @lekzsync/baileys might be problematic. Click here for more details.
- package/README.md +577 -2
- package/WAProto/GenerateStatics.sh +3 -0
- package/WAProto/WAProto.proto +7014 -0
- package/WAProto/fix-imports.js +85 -0
- package/WAProto/index.d.ts +79257 -0
- package/WAProto/index.js +242946 -0
- package/engine-requirements.js +10 -0
- package/lib/Defaults/index.js +131 -0
- package/lib/Signal/Group/ciphertext-message.js +12 -0
- package/lib/Signal/Group/group-session-builder.js +30 -0
- package/lib/Signal/Group/group_cipher.js +82 -0
- package/lib/Signal/Group/index.js +12 -0
- package/lib/Signal/Group/keyhelper.js +18 -0
- package/lib/Signal/Group/sender-chain-key.js +26 -0
- package/lib/Signal/Group/sender-key-distribution-message.js +63 -0
- package/lib/Signal/Group/sender-key-message.js +66 -0
- package/lib/Signal/Group/sender-key-name.js +48 -0
- package/lib/Signal/Group/sender-key-record.js +41 -0
- package/lib/Signal/Group/sender-key-state.js +84 -0
- package/lib/Signal/Group/sender-message-key.js +26 -0
- package/lib/Signal/libsignal.js +431 -0
- package/lib/Signal/lid-mapping.js +277 -0
- package/lib/Socket/Client/index.js +3 -0
- package/lib/Socket/Client/types.js +11 -0
- package/lib/Socket/Client/websocket.js +54 -0
- package/lib/Socket/MessageBuilder.js +3729 -0
- package/lib/Socket/business.js +379 -0
- package/lib/Socket/chats.js +1198 -0
- package/lib/Socket/communities.js +431 -0
- package/lib/Socket/graphql.js +716 -0
- package/lib/Socket/groups.js +374 -0
- package/lib/Socket/index.js +29 -0
- package/lib/Socket/interop.js +463 -0
- package/lib/Socket/luxu.js +387 -0
- package/lib/Socket/message-builder.js +556 -0
- package/lib/Socket/messages-recv.js +1916 -0
- package/lib/Socket/messages-send.js +1516 -0
- package/lib/Socket/mex.js +54 -0
- package/lib/Socket/newsletter.js +641 -0
- package/lib/Socket/privacy.js +318 -0
- package/lib/Socket/socket.js +1115 -0
- package/lib/Socket/username.js +236 -0
- package/lib/Store/index.js +10 -0
- package/lib/Store/keyed-db.js +108 -0
- package/lib/Store/make-cache-manager-store.js +85 -0
- package/lib/Store/make-in-memory-store.js +244 -0
- package/lib/Store/make-ordered-dictionary.js +75 -0
- package/lib/Store/object-repository.js +32 -0
- package/lib/Types/Auth.js +2 -0
- package/lib/Types/Bussines.js +2 -0
- package/lib/Types/Call.js +2 -0
- package/lib/Types/Chat.js +8 -0
- package/lib/Types/Contact.js +2 -0
- package/lib/Types/Events.js +2 -0
- package/lib/Types/GroupMetadata.js +2 -0
- package/lib/Types/Label.js +25 -0
- package/lib/Types/LabelAssociation.js +7 -0
- package/lib/Types/Message.js +11 -0
- package/lib/Types/Mex.js +111 -0
- package/lib/Types/Product.js +2 -0
- package/lib/Types/Signal.js +2 -0
- package/lib/Types/Socket.js +3 -0
- package/lib/Types/State.js +56 -0
- package/lib/Types/USync.js +2 -0
- package/lib/Types/index.js +26 -0
- package/lib/Utils/auth-utils.js +302 -0
- package/lib/Utils/browser-utils.js +48 -0
- package/lib/Utils/business.js +231 -0
- package/lib/Utils/chat-utils.js +872 -0
- package/lib/Utils/companion-reg-client-utils.js +35 -0
- package/lib/Utils/crypto.js +118 -0
- package/lib/Utils/decode-wa-message.js +350 -0
- package/lib/Utils/event-buffer.js +622 -0
- package/lib/Utils/generics.js +403 -0
- package/lib/Utils/history.js +134 -0
- package/lib/Utils/identity-change-handler.js +50 -0
- package/lib/Utils/index.js +25 -0
- package/lib/Utils/link-preview.js +85 -0
- package/lib/Utils/logger.js +3 -0
- package/lib/Utils/lt-hash.js +8 -0
- package/lib/Utils/make-mutex.js +33 -0
- package/lib/Utils/message-composer.js +273 -0
- package/lib/Utils/message-retry-manager.js +265 -0
- package/lib/Utils/messages-media.js +870 -0
- package/lib/Utils/messages.js +1394 -0
- package/lib/Utils/noise-handler.js +201 -0
- package/lib/Utils/offline-node-processor.js +40 -0
- package/lib/Utils/pre-key-manager.js +106 -0
- package/lib/Utils/process-message.js +630 -0
- package/lib/Utils/reporting-utils.js +258 -0
- package/lib/Utils/sPR.js +529 -0
- package/lib/Utils/signal.js +201 -0
- package/lib/Utils/stanza-ack.js +38 -0
- package/lib/Utils/sticker.js +133 -0
- package/lib/Utils/sync-action-utils.js +49 -0
- package/lib/Utils/tc-token-utils.js +163 -0
- package/lib/Utils/use-multi-file-auth-state.js +121 -0
- package/lib/Utils/use-sqlite-auth-state.js +162 -0
- package/lib/Utils/validate-connection.js +203 -0
- package/lib/WABinary/constants.js +1301 -0
- package/lib/WABinary/decode.js +262 -0
- package/lib/WABinary/encode.js +220 -0
- package/lib/WABinary/generic-utils.js +204 -0
- package/lib/WABinary/index.js +6 -0
- package/lib/WABinary/jid-utils.js +98 -0
- package/lib/WABinary/types.js +2 -0
- package/lib/WAM/BinaryInfo.js +10 -0
- package/lib/WAM/constants.js +22853 -0
- package/lib/WAM/encode.js +150 -0
- package/lib/WAM/index.js +4 -0
- package/lib/WAUSync/Protocols/USyncBotProfileProtocol.js +53 -0
- package/lib/WAUSync/Protocols/USyncBusinessProtocol.js +43 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +54 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +57 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +30 -0
- package/lib/WAUSync/Protocols/USyncFeatureProtocol.js +58 -0
- package/lib/WAUSync/Protocols/USyncLIDProtocol.js +30 -0
- package/lib/WAUSync/Protocols/USyncPictureProtocol.js +32 -0
- package/lib/WAUSync/Protocols/USyncSidelistProtocol.js +28 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +39 -0
- package/lib/WAUSync/Protocols/USyncTextStatusProtocol.js +38 -0
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.js +27 -0
- package/lib/WAUSync/Protocols/index.js +12 -0
- package/lib/WAUSync/USyncQuery.js +151 -0
- package/lib/WAUSync/USyncUser.js +56 -0
- package/lib/WAUSync/index.js +3 -0
- package/lib/index.js +43 -0
- package/package.json +136 -5
package/README.md
CHANGED
|
@@ -1,3 +1,578 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
# 🚀 Lekzo — Advanced WhatsApp Web API
|
|
4
|
+
|
|
5
|
+
<!-- TYPING ANIMATION -->
|
|
6
|
+
<p>
|
|
7
|
+
<img src="https://readme-typing-svg.demolab.com/?font=Fira+Code&weight=600&size=28&duration=3000&pause=1000&color=58A6FF¢er=true&vCenter=true&width=800&lines=Advanced+WhatsApp+Web+API;Native+AI+Rich+Response+%26+Interactive+Buttons;Built+with+TypeScript+%26+Baileys;Lightweight+%7C+Efficient+%7C+Stable" alt="Typing Animation" />
|
|
8
|
+
</p>
|
|
9
|
+
|
|
10
|
+
<!-- BADGES -->
|
|
11
|
+
<p>
|
|
12
|
+
<img src="https://img.shields.io/npm/dw/%40lekzox%2Fbaileys?label=NPM&color=%23CB3837" alt="NPM Downloads"/>
|
|
13
|
+
</p>
|
|
14
|
+
|
|
15
|
+
<!-- VISUAL SHOWCASE -->
|
|
16
|
+
### 📸 Project Showcase
|
|
17
|
+
|
|
18
|
+
<img src="https://b.top4top.io/p_3816tx02l1.jpg" alt="WhatsApp Interface" width="800" />
|
|
19
|
+
<br/>
|
|
20
|
+
<small><i>Native WhatsApp Experience integrated into your project</i></small>
|
|
21
|
+
|
|
22
|
+
<br/>
|
|
23
|
+
|
|
24
|
+
**Lekzo** (`lekzsync/Baileys`) is a powerful, lightweight, and efficient library for interacting with the **WhatsApp Web multi-device API** — no Selenium, no Chromium, no headless browser. It connects over a raw WebSocket, speaks WhatsApp's native binary + protobuf protocol, and exposes a fully typed, event-driven JavaScript/TypeScript API.
|
|
25
|
+
|
|
26
|
+
</div>
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## ⚠️ Disclaimer & Liability
|
|
31
|
+
|
|
32
|
+
This library is a community-driven project and is **in no way affiliated with, endorsed by, or sponsored by WhatsApp Inc. or Meta**. It is an unofficial, reverse-engineered API. Use at your own discretion.
|
|
33
|
+
|
|
34
|
+
**Important Guidelines:**
|
|
35
|
+
|
|
36
|
+
- Do **not** use this library for spamming, bulk messaging, stalkerware, or any activity that violates WhatsApp's [Terms of Service](https://www.whatsapp.com/legal/terms-of-service).
|
|
37
|
+
- The developers are **not liable** for any misuse of this software, including account bans. Please refer to the [MIT License](LICENSE) for details.
|
|
38
|
+
- Users are fully responsible for ensuring their usage complies with applicable laws and WhatsApp's policies.
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Table of Contents
|
|
43
|
+
|
|
44
|
+
- [Features](#features)
|
|
45
|
+
- [Requirements](#requirements)
|
|
46
|
+
- [Installation](#installation)
|
|
47
|
+
- [Import](#import)
|
|
48
|
+
- [Quick Start](#quick-start)
|
|
49
|
+
- [With QR Code](#with-qr-code)
|
|
50
|
+
- [With Pairing Code](#with-pairing-code)
|
|
51
|
+
- [Sending Message](#sending-message)
|
|
52
|
+
- [Generic Send / Relay](#generic-send--relay)
|
|
53
|
+
- [sPR](#spr)
|
|
54
|
+
- [Simple Senders](#simple-senders)
|
|
55
|
+
- [Ban Checker](#ban-checker)
|
|
56
|
+
- [Send Message with Participant](#send-message-with-participant)
|
|
57
|
+
- [Rich Menu](#rich-menu)
|
|
58
|
+
- [Message Builder](#message-builder)
|
|
59
|
+
- [Button](#button)
|
|
60
|
+
- [Quick Reply + URL + Copy](#quick-reply--url--copy)
|
|
61
|
+
- [ButtonV2](#buttonv2)
|
|
62
|
+
- [Carousel](#carousel)
|
|
63
|
+
- [Toolkit](#toolkit)
|
|
64
|
+
- [Why Choose Lekzo?](#why-choose-lekzo)
|
|
65
|
+
- [Contributing](#contributing)
|
|
66
|
+
- [License](#license)
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## Features
|
|
71
|
+
|
|
72
|
+
### 🧱 Core
|
|
73
|
+
|
|
74
|
+
| Feature | Description |
|
|
75
|
+
|---|---|
|
|
76
|
+
| ⚡ **Lightweight** | Direct WebSocket connection — no Selenium, no Chromium, no headless browser. |
|
|
77
|
+
| 🧠 **Efficient** | Drastically lower RAM usage compared to browser-based automation. |
|
|
78
|
+
| 📱 **Multi-Device** | Full support for WhatsApp Multi-Device (MD) protocols. |
|
|
79
|
+
| 🔒 **End-to-End Encrypted** | Complete Signal protocol implementation (1:1, groups, sender-key). |
|
|
80
|
+
| 🛡️ **Type-Safe** | Written in TypeScript with full IntelliSense / `index.d.ts` support. |
|
|
81
|
+
| 🔄 **Auto Reconnect** | Built-in reconnect and message retry logic. |
|
|
82
|
+
|
|
83
|
+
### 💬 Messaging
|
|
84
|
+
|
|
85
|
+
| Feature | Description |
|
|
86
|
+
|---|---|
|
|
87
|
+
| 🔁 **Generic Relay** | Send raw message objects with `relayMessage` or the standard `sendMessage`. |
|
|
88
|
+
| 📝 **Simple Senders** | One-line helpers for text, image, video, audio, location, poll, and quiz messages. |
|
|
89
|
+
| 📊 **Polls & Quizzes** | Create polls and quizzes with a single call. |
|
|
90
|
+
| 🔘 **Interactive UI** | Quick reply, URL, and copy buttons, classic button menus, and carousels. |
|
|
91
|
+
| 👥 **Participant Mode** | Send with `ptcp: true` for participant-aware delivery. |
|
|
92
|
+
|
|
93
|
+
### 🚀 Exclusive Enhancements
|
|
94
|
+
|
|
95
|
+
| Feature | Description |
|
|
96
|
+
|---|---|
|
|
97
|
+
| 📡 **sPR Helper** | Advanced send helper with include/exclude device targeting and configurable stanza options. |
|
|
98
|
+
| 🔎 **Ban Checker** | `checkBan` to query a phone number's status through an external API. |
|
|
99
|
+
| 🍽️ **Rich Menu** | `sendRich` for responses with a header image, action buttons, carousel cards, and a link footer. |
|
|
100
|
+
| 🤖 **Message Builder** | Integrated `MB` namespace (AIRich, Button, ButtonV2, Carousel, Toolkit) for rich, interactive responses. |
|
|
101
|
+
| 🧰 **Toolkit** | Helper utilities, including MP4 frame preview generation. |
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## Requirements
|
|
106
|
+
|
|
107
|
+
- Node.js **>= 20**
|
|
108
|
+
- Optional peer dependencies, depending on the features you use:
|
|
109
|
+
- `sharp` or `jimp` for image processing
|
|
110
|
+
- `link-preview-js` for link previews
|
|
111
|
+
- `audio-decode` for audio waveform handling
|
|
112
|
+
- `fluent-ffmpeg` for frame preview video (Toolkit `getMp4Preview`)
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
## Installation
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
npm install @whiskeysockets/baileys@github:lekzsync/Baileys
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Or add it to your `package.json`:
|
|
123
|
+
|
|
124
|
+
```json
|
|
125
|
+
{
|
|
126
|
+
"dependencies": {
|
|
127
|
+
"@whiskeysockets/baileys": "github:lekzsync/Baileys"
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## Import
|
|
135
|
+
|
|
136
|
+
```javascript
|
|
137
|
+
const {
|
|
138
|
+
default: makeWASocket,
|
|
139
|
+
// Other Options
|
|
140
|
+
} = require('@whiskeysockets/baileys');
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## Quick Start
|
|
146
|
+
|
|
147
|
+
### With QR Code
|
|
148
|
+
|
|
149
|
+
```javascript
|
|
150
|
+
const {
|
|
151
|
+
default: makeWASocket,
|
|
152
|
+
Browsers
|
|
153
|
+
// Other Options
|
|
154
|
+
} = require('@whiskeysockets/baileys');
|
|
155
|
+
|
|
156
|
+
const client = makeWASocket({
|
|
157
|
+
browser: Browsers.ubuntu('Chrome'),
|
|
158
|
+
printQRInTerminal: true
|
|
159
|
+
});
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### With Pairing Code
|
|
163
|
+
|
|
164
|
+
```javascript
|
|
165
|
+
const {
|
|
166
|
+
default: makeWASocket,
|
|
167
|
+
fetchLatestWAWebVersion,
|
|
168
|
+
Browsers
|
|
169
|
+
} = require('@whiskeysockets/baileys');
|
|
170
|
+
|
|
171
|
+
const client = makeWASocket({
|
|
172
|
+
browser: Browsers.ubuntu('Chrome'),
|
|
173
|
+
printQRInTerminal: false,
|
|
174
|
+
version: fetchLatestWAWebVersion(),
|
|
175
|
+
auth: state
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
const number = "628XXXXX";
|
|
179
|
+
const code = await client.requestPairingCode(number.trim()); // Use (number, "XXXXXXXX") for custom pairing
|
|
180
|
+
|
|
181
|
+
console.log("Your pairing code : " + code);
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
## Sending Message
|
|
187
|
+
|
|
188
|
+
### Generic Send / Relay
|
|
189
|
+
|
|
190
|
+
```javascript
|
|
191
|
+
// relayMessage — sends a raw message object
|
|
192
|
+
(async () => {
|
|
193
|
+
await client.relayMessage(m.chat, {
|
|
194
|
+
conversation: 'Lekzo'
|
|
195
|
+
});
|
|
196
|
+
})();
|
|
197
|
+
|
|
198
|
+
// sendMessage — the standard way to send a message
|
|
199
|
+
(async () => {
|
|
200
|
+
await client.sendMessage(m.chat, {
|
|
201
|
+
text: 'Lekzo'
|
|
202
|
+
});
|
|
203
|
+
})();
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### sPR
|
|
207
|
+
|
|
208
|
+
The `sPR` helper is included in this build. It is a named export and uses the library's internal utility modules.
|
|
209
|
+
|
|
210
|
+
#### Import
|
|
211
|
+
|
|
212
|
+
```javascript
|
|
213
|
+
const { sPR } = require('@whiskeysockets/baileys');
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
#### Basic usage
|
|
217
|
+
|
|
218
|
+
```javascript
|
|
219
|
+
const messageId = await sPR(
|
|
220
|
+
sock,
|
|
221
|
+
'6281234567890@s.whatsapp.net',
|
|
222
|
+
{ conversation: 'Hello from Lekzo' }
|
|
223
|
+
);
|
|
224
|
+
|
|
225
|
+
console.log('Message ID:', messageId);
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
#### Options
|
|
229
|
+
|
|
230
|
+
```javascript
|
|
231
|
+
await sPR(
|
|
232
|
+
client,
|
|
233
|
+
"120363000000000000@g.us",
|
|
234
|
+
{
|
|
235
|
+
conversation: "Hello, group!"
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
mode: "include",
|
|
239
|
+
target: [
|
|
240
|
+
"6281234567890@s.whatsapp.net",
|
|
241
|
+
"628000000000@s.whatsapp.net"
|
|
242
|
+
],
|
|
243
|
+
deviceMode: 'all'
|
|
244
|
+
}
|
|
245
|
+
);
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
Available options:
|
|
249
|
+
|
|
250
|
+
| Option | Type | Default | Description |
|
|
251
|
+
| --- | --- | --- | --- |
|
|
252
|
+
| `messageId` | `string` | Generated automatically | Custom message ID |
|
|
253
|
+
| `additionalAttributes` | `object` | `{}` | Extra message stanza attributes |
|
|
254
|
+
| `useUserDevicesCache` | `boolean` | `true` | Use the device cache during recipient resolution |
|
|
255
|
+
| `useCachedGroupMetadata` | `boolean` | `true` | Use cached group metadata when available |
|
|
256
|
+
| `statusJidList` | `string[]` | — | Additional status recipients |
|
|
257
|
+
| `additionalNodes` | `object[]` | — | Extra stanza nodes |
|
|
258
|
+
| `targetMe` | `boolean` | — | Override filtering for the sender's own devices |
|
|
259
|
+
| `mode` | `'include' \| 'exclude'` | `'exclude'` | Select matching or non-matching devices |
|
|
260
|
+
| `target` | `string[]` | `[]` | Recipient JIDs, optionally including a device ID |
|
|
261
|
+
| `hideDecryptFail` | `boolean` | `true` | Add the `decrypt-fail="hide"` attribute where applicable |
|
|
262
|
+
| `deviceMode` | `'all' \| 'primary' \| 'secondary'` | `'all'` | Filter by primary or secondary device ID |
|
|
263
|
+
|
|
264
|
+
#### Important compatibility notes
|
|
265
|
+
|
|
266
|
+
- `sPR` uses internal Baileys connection methods. Keep this helper aligned with the version of this build and retest it after updating the library.
|
|
267
|
+
- A returned message ID means the stanza was sent to the connection; it does not confirm that every intended recipient received or displayed it.
|
|
268
|
+
- Recipient and device filtering does not guarantee a particular visibility outcome. Test with accounts and devices you control, and use it transparently and responsibly.
|
|
269
|
+
- The helper supports text and message payloads that are compatible with the underlying Baileys encoders. Some message types or WhatsApp protocol changes may require further adaptation.
|
|
270
|
+
|
|
271
|
+
### Simple Senders
|
|
272
|
+
|
|
273
|
+
#### Send Text
|
|
274
|
+
|
|
275
|
+
```javascript
|
|
276
|
+
(async () => {
|
|
277
|
+
await client.sendText(m.chat, 'Hi!', {
|
|
278
|
+
contextInfo: {
|
|
279
|
+
mentionedJid: [jid]
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
})();
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
#### Send Image
|
|
286
|
+
|
|
287
|
+
```javascript
|
|
288
|
+
(async () => {
|
|
289
|
+
await client.sendImage(m.chat, { url: './photo.jpg' }, 'Lekzo');
|
|
290
|
+
})();
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
#### Send Video
|
|
294
|
+
|
|
295
|
+
```javascript
|
|
296
|
+
(async () => {
|
|
297
|
+
await client.sendVideo(m.chat, { url: './clip.mp4' }, 'Lekzo');
|
|
298
|
+
})();
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
#### Send Audio
|
|
302
|
+
|
|
303
|
+
```javascript
|
|
304
|
+
(async () => {
|
|
305
|
+
await client.sendAudio(m.chat, { url: './clip.mp3' });
|
|
306
|
+
})();
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
#### Send Location
|
|
310
|
+
|
|
311
|
+
```javascript
|
|
312
|
+
(async () => {
|
|
313
|
+
await client.sendLocation(m.chat, 'Lekzo', -6.2, 106.8, 'https://maps.example', '1234567890');
|
|
314
|
+
})();
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
#### Send Poll
|
|
318
|
+
|
|
319
|
+
```javascript
|
|
320
|
+
(async () => {
|
|
321
|
+
await client.sendPoll(m.chat, 'Pick one', ['Option 1', 'Option 2', 'Option 3'], true);
|
|
322
|
+
})();
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
#### Send Quiz
|
|
326
|
+
|
|
327
|
+
```javascript
|
|
328
|
+
(async () => {
|
|
329
|
+
await client.sendQuiz(m.chat, 'Correct answer?', ['1', '2', '3'], '2');
|
|
330
|
+
})();
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
### Ban Checker
|
|
334
|
+
|
|
335
|
+
`checkBan` allows you to check the WhatsApp ban status of a phone number using an external API.
|
|
336
|
+
|
|
337
|
+
#### Example
|
|
338
|
+
|
|
339
|
+
```javascript
|
|
340
|
+
(async () => {
|
|
341
|
+
try {
|
|
342
|
+
const number = '6281234567890';
|
|
343
|
+
const result = await checkBan(number);
|
|
344
|
+
|
|
345
|
+
await client.sendMessage(m.chat, {
|
|
346
|
+
text: JSON.stringify(result, null, 2)
|
|
347
|
+
});
|
|
348
|
+
} catch (error) {
|
|
349
|
+
console.error('Ban Checker Error:', error.message);
|
|
350
|
+
}
|
|
351
|
+
})();
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
#### Usage
|
|
355
|
+
|
|
356
|
+
- Replace `6281234567890` with the phone number you want to check.
|
|
357
|
+
- `checkBan` must already be defined in your bot's environment.
|
|
358
|
+
|
|
359
|
+
> [!NOTE]
|
|
360
|
+
> Ban Checker relies on an external API. Its availability and accuracy depend on the API provider. Results are not an official confirmation of a WhatsApp account's ban status.
|
|
361
|
+
|
|
362
|
+
### Send Message with Participant
|
|
363
|
+
|
|
364
|
+
`relayMessage`:
|
|
365
|
+
|
|
366
|
+
```javascript
|
|
367
|
+
(async () => {
|
|
368
|
+
await client.relayMessage(m.chat, {
|
|
369
|
+
extendedTextMessage: {
|
|
370
|
+
text: 'Lekzo'
|
|
371
|
+
}
|
|
372
|
+
}, {
|
|
373
|
+
ptcp: true
|
|
374
|
+
});
|
|
375
|
+
})();
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
`sendMessage`:
|
|
379
|
+
|
|
380
|
+
```javascript
|
|
381
|
+
(async () => {
|
|
382
|
+
await client.sendMessage(m.chat, {
|
|
383
|
+
text: 'Lekzo'
|
|
384
|
+
}, {
|
|
385
|
+
ptcp: true
|
|
386
|
+
});
|
|
387
|
+
})();
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
### Rich Menu
|
|
391
|
+
|
|
392
|
+
`sendRich` sends a rich response with an optional header image, action buttons, carousel cards, and an open-URL footer:
|
|
393
|
+
|
|
394
|
+
```javascript
|
|
395
|
+
await client.sendRich(m.chat, {
|
|
396
|
+
header: {
|
|
397
|
+
disclaimer: true,
|
|
398
|
+
disclaimerText: "github.com/lekzsync/Baileys",
|
|
399
|
+
title: "Lekzo"
|
|
400
|
+
},
|
|
401
|
+
body: {
|
|
402
|
+
title: "Select Option",
|
|
403
|
+
buttons: ["Menu 1", "Menu 2"]
|
|
404
|
+
},
|
|
405
|
+
footer: {
|
|
406
|
+
text: "WhatsApp Community",
|
|
407
|
+
url: "https://whatsapp.com/channel/0029Vb863rSLtOjDrDNHqq3o"
|
|
408
|
+
}
|
|
409
|
+
});
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
---
|
|
413
|
+
|
|
414
|
+
## Message Builder
|
|
415
|
+
|
|
416
|
+
MessageBuilder v4.7 is included directly in `lekzsync/Baileys`.
|
|
417
|
+
|
|
418
|
+
### Import
|
|
419
|
+
|
|
420
|
+
```javascript
|
|
421
|
+
const {
|
|
422
|
+
VERSION,
|
|
423
|
+
Button,
|
|
424
|
+
ButtonV2,
|
|
425
|
+
Carousel,
|
|
426
|
+
AIRich,
|
|
427
|
+
Toolkit,
|
|
428
|
+
bind,
|
|
429
|
+
MB
|
|
430
|
+
} = require('@whiskeysockets/baileys');
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
> [!NOTE]
|
|
434
|
+
> MessageBuilder is integrated. You don't need to install `baileys-mbuilder` separately.
|
|
435
|
+
|
|
436
|
+
### Example
|
|
437
|
+
|
|
438
|
+
```javascript
|
|
439
|
+
const { MB } = require('@whiskeysockets/baileys')
|
|
440
|
+
|
|
441
|
+
const rich = new MB.AIRich(sock)
|
|
442
|
+
.setTitle('Lekzo')
|
|
443
|
+
.setFooter('Made with AIRich')
|
|
444
|
+
.addText('Halo Lekzo!')
|
|
445
|
+
.addCode('javascript', `console.log('Halo Lekzo')`)
|
|
446
|
+
.addTable([
|
|
447
|
+
['Feature', 'Status'],
|
|
448
|
+
['Button', 'Available'],
|
|
449
|
+
['Carousel', 'Available'],
|
|
450
|
+
['AIRich', 'Experimental']
|
|
451
|
+
])
|
|
452
|
+
.addSuggest(['List Menu', 'Help', 'About Lekzo'])
|
|
453
|
+
|
|
454
|
+
await rich.send(jid)
|
|
455
|
+
```
|
|
456
|
+
|
|
457
|
+
---
|
|
458
|
+
|
|
459
|
+
## Button
|
|
460
|
+
|
|
461
|
+
The `Button` builder is used for native-flow interactive messages.
|
|
462
|
+
|
|
463
|
+
### Quick Reply + URL + Copy
|
|
464
|
+
|
|
465
|
+
```js
|
|
466
|
+
const { MB } = require('@whiskeysockets/baileys')
|
|
467
|
+
|
|
468
|
+
const msg = new MB.Button(client)
|
|
469
|
+
.setTitle('Select Menu')
|
|
470
|
+
.setBody('Choose one of the options below.')
|
|
471
|
+
.setFooter('github.com/lekzsync/Baileys')
|
|
472
|
+
.addReply('Ping', 'ping')
|
|
473
|
+
.addUrl('Open Website', 'https://example.com')
|
|
474
|
+
.addCopy('Copy Code', 'LEKZO')
|
|
475
|
+
|
|
476
|
+
await msg.send(m.chat)
|
|
477
|
+
```
|
|
478
|
+
|
|
479
|
+
---
|
|
480
|
+
|
|
481
|
+
## ButtonV2
|
|
482
|
+
|
|
483
|
+
`ButtonV2` provides a simpler classic button builder.
|
|
484
|
+
|
|
485
|
+
```javascript
|
|
486
|
+
const { MB } = require('@whiskeysockets/baileys')
|
|
487
|
+
|
|
488
|
+
const message = new MB.ButtonV2(client)
|
|
489
|
+
.setTitle('Lekzo')
|
|
490
|
+
.setSubtitle('WhatsApp Bot')
|
|
491
|
+
.setBody('Choose an action.')
|
|
492
|
+
.setFooter('Lekzo Baileys')
|
|
493
|
+
.setThumbnail('https://example.com/xxx.jpg')
|
|
494
|
+
.addButton('Menu', 'menu')
|
|
495
|
+
.addButton('Ping', 'ping')
|
|
496
|
+
|
|
497
|
+
await message.send(m.chat)
|
|
498
|
+
```
|
|
499
|
+
|
|
500
|
+
---
|
|
501
|
+
|
|
502
|
+
## Carousel
|
|
503
|
+
|
|
504
|
+
Carousel cards are created from `Button.toCard()` and then submitted to `Carousel`.
|
|
505
|
+
|
|
506
|
+
```javascript
|
|
507
|
+
const { MB } = require('@whiskeysockets/baileys')
|
|
508
|
+
|
|
509
|
+
const card1 = await new MB.Button(client)
|
|
510
|
+
.setImage('https://example.com/card1.jpg')
|
|
511
|
+
.setBody('First card')
|
|
512
|
+
.addReply('Select', 'card_1')
|
|
513
|
+
.toCard()
|
|
514
|
+
|
|
515
|
+
const card2 = await new MB.Button(client)
|
|
516
|
+
.setImage('https://example.com/card2.jpg')
|
|
517
|
+
.setBody('Second card')
|
|
518
|
+
.addUrl('Open', 'https://example.com')
|
|
519
|
+
.toCard()
|
|
520
|
+
|
|
521
|
+
const carousel = new MB.Carousel(client)
|
|
522
|
+
.setBody('Choose one of the cards below.')
|
|
523
|
+
.setFooter('Lekzo Carousel')
|
|
524
|
+
.addCard([card1, card2])
|
|
525
|
+
|
|
526
|
+
await carousel.send(jid)
|
|
527
|
+
```
|
|
528
|
+
|
|
529
|
+
> [!IMPORTANT]
|
|
530
|
+
> Each carousel card must have an image or video media attachment in its header.
|
|
531
|
+
|
|
532
|
+
---
|
|
533
|
+
|
|
534
|
+
## Toolkit
|
|
535
|
+
|
|
536
|
+
The `Toolkit` helpers are exported from the MessageBuilder namespace:
|
|
537
|
+
|
|
538
|
+
```javascript
|
|
539
|
+
const { MB, Toolkit } = require('@whiskeysockets/baileys')
|
|
540
|
+
```
|
|
541
|
+
|
|
542
|
+
> [!NOTE]
|
|
543
|
+
> `Toolkit.getMp4Preview` (frame preview video) requires `fluent-ffmpeg` to be installed.
|
|
544
|
+
|
|
545
|
+
---
|
|
546
|
+
|
|
547
|
+
## Why Choose Lekzo?
|
|
548
|
+
|
|
549
|
+
Lekzo is built for developers who need a lightweight, stable WhatsApp Web API without the overhead of a browser. It connects directly over WebSocket, keeps memory usage low, and ships with typed declarations and a focused set of messaging helpers, including rich responses, carousels, and a participant-aware send mode. It is a practical base for building reliable WhatsApp automation and integrations.
|
|
550
|
+
|
|
551
|
+
---
|
|
552
|
+
|
|
553
|
+
## Contributing
|
|
554
|
+
|
|
555
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
556
|
+
|
|
557
|
+
1. Fork the repository & create your branch (`git checkout -b feature/amazing-feature`)
|
|
558
|
+
2. Commit your changes (`git commit -m 'feat: add amazing feature'`)
|
|
559
|
+
3. Push to the branch (`git push origin feature/amazing-feature`)
|
|
560
|
+
4. Open a Pull Request
|
|
561
|
+
|
|
562
|
+
## License
|
|
563
|
+
|
|
564
|
+
MIT — Copyright (c) 2026 Lekzo. See [LICENSE](LICENSE) for details.
|
|
565
|
+
|
|
566
|
+
---
|
|
567
|
+
|
|
568
|
+
<div align="center">
|
|
569
|
+
|
|
570
|
+
**Lekzo** — Advanced WhatsApp Web API
|
|
571
|
+
|
|
572
|
+
[](https://www.npmjs.com/package/lekzsync/Baileys)
|
|
573
|
+
[](https://github.com/lekzsync/Baileys)
|
|
574
|
+
[](https://whatsapp.com/channel/0029Vb863rSLtOjDrDNHqq3o)
|
|
575
|
+
|
|
576
|
+
Made with by Lekzo
|
|
577
|
+
|
|
578
|
+
</div>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
yarn pbjs -t static-module --no-beautify -w es6 --no-bundle --no-delimited --no-verify --no-comments -o ./index.js ./WAProto.proto;
|
|
2
|
+
yarn pbjs -t static-module --no-beautify -w es6 --no-bundle --no-delimited --no-verify ./WAProto.proto | yarn pbts --no-comments -o ./index.d.ts -;
|
|
3
|
+
node ./fix-imports.js
|