zaileys 3.3.0 → 4.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 ADDED
@@ -0,0 +1,271 @@
1
+ <div align="center">
2
+
3
+ <img alt="Zaileys - Simplified WhatsApp Node.js TypeScript/JavaScript API" src="https://github.com/zeative/zeative/blob/main/libraries/zaileys/zaileys-clean.png?raw=true" width="140">
4
+
5
+ <h1 align="center">Zaileys — Simplified WhatsApp Node.js <br /> TypeScript/JavaScript API</h1>
6
+
7
+ <br>
8
+
9
+ <div align="center">
10
+ <a href="https://www.npmjs.com/package/zaileys"><img src="https://img.shields.io/npm/v/zaileys.svg" alt="NPM Version"></a>
11
+ <a href="https://www.npmjs.com/package/zaileys"><img src="https://img.shields.io/npm/dw/zaileys?label=npm&color=%23CB3837" alt="NPM Downloads"></a>
12
+ <a href="https://github.com/zeative/zaileys/releases"><img src="https://img.shields.io/npm/dt/zaileys" alt="NPM Downloads"></a>
13
+ <a href="https://github.com/zeative/zaileys"><img src="https://img.shields.io/badge/TypeScript-7%20native-blue?style=flat-square&logo=typescript" alt="TypeScript 7"></a>
14
+ </div>
15
+
16
+ <div align="center">
17
+ <a href="https://github.com/zeative/zaileys/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue" alt="License: MIT"></a>
18
+ <a href="https://discord.gg/KBHhTTVUc5"><img alt="Discord" src="https://img.shields.io/discord/1105833273415962654?logo=discord&label=discord&link=https%3A%2F%2Fgithub.com%2Fzeative%2Fzaileys"></a>
19
+ <a href="https://chat.whatsapp.com/GlQfvc83mSH3F6ov06vuCt"><img alt="WhatsApp" src="https://img.shields.io/badge/WhatsApp-Group-25D366?logo=whatsapp&logoColor=white"></a>
20
+ <a href="https://github.com/zeative/zaileys"><img src="https://img.shields.io/github/stars/zeative/zaileys" alt="GitHub Stars"></a>
21
+ <a href="https://github.com/zeative/zaileys"><img src="https://img.shields.io/github/forks/zeative/zaileys" alt="GitHub Forks"></a>
22
+ <a href="https://deepwiki.com/zeative/zaileys"><img src="https://deepwiki.com/badge.svg" alt="Ask DeepWiki"></a>
23
+ <a href="https://context7.com/zeative/zaileys"><img src="https://img.shields.io/badge/Context7-LLM%20Docs-4F46E5?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEoAAABLCAYAAADXjBHUAAAACXBIWXMAAAsTAAALEwEAmpwYAAABaWlDQ1BEaXNwbGF5IFAzAAB4nHWQvUvDUBTFT6tS0DqIDh0cMolD1NIKdnFoKxRFMFQFq1OafgltfCQpUnETVyn4H1jBWXCwiFRwcXAQRAcR3Zw6KbhoeN6XVNoi3sfl%2FTicc7lcwBtQGSv2AijplpFMxKS11Lrke4OHnlOqZrKooiwK%2Fv276%2FPR9d5PiFlNu3YQ2U9cl84ul3aeAlN%2F%2FV3Vn8maGv3f1EGNGRbgkYmVbYsJ3iUeMWgp4qrgvMvHgtMunzuelWSc%2BJZY0gpqhrhJLKc79HwHl4plrbWD2N6f1VeXxRzqUcxhEyYYilBRgQQF4X%2F8044%2Fji1yV2BQLo8CLMpESRETssTz0KFhEjJxCEHqkLhz634PrfvJbW3vFZhtcM4v2tpCAzidoZPV29p4BBgaAG7qTDVUR%2Bqh9uZywPsJMJgChu8os2HmwiF3e38M6Hvh%2FGMM8B0CdpXzryPO7RqFn4Er%2FQcXKWq8MSlPPgAABA5JREFUeAHtmzFME2EUgB%2BGQXCgGCSBpeiICRjERROKoYtG4kANC6kDasLCAgNLO%2BBcBxgYxIHiZhkgRJcahcgmJB1k1HaBBBLtomHTezXVu%2F%2Bu9N3de03Q9yUM%2FcPlb7%2F%2B79279%2F9tap4bfwdKXZqtv2FQ6nIOFBIqioiKIqKiiKgoIiqKiIoioqKIqCgiKoqIiiKioog0Q0hil3th%2BcEU%2BGX78z5M5pZ8XZObmIX%2B7ij4JbGagcJhEcIQWhTS034J%2FFIKcE2kpTXQXHhdWDT0iKgoIqFDr3BYguK3Y0dIlKzXK7tbp16H%2F%2BOX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ioqKIqCgiKoqIiiKiooioKCIqiojVPWi6DUpdfgE8wFukKedIwQAAAABJRU5ErkJggg%3D%3D" alt="Context7"></a>
24
+ </div>
25
+
26
+ <br>
27
+
28
+ <div align="center">
29
+ <p>
30
+ <b>Zaileys</b> is a type-safe wrapper around <a href="https://github.com/WhiskeySockets/Baileys">Baileys</a> that makes building WhatsApp bots feel effortless. Create a <code>Client</code>, listen for typed events, and send anything from plain text to interactive buttons and rich AI-style responses with a single chainable builder — authentication, reconnection, and storage are handled for you.
31
+ </p>
32
+ </div>
33
+
34
+ <div align="center">
35
+
36
+ [Quick start](#quick-start) &nbsp;•&nbsp;
37
+ [Why Zaileys](#why-zaileys) &nbsp;•&nbsp;
38
+ [Install](#install) &nbsp;•&nbsp;
39
+ [What you can build](#what-you-can-build) &nbsp;•&nbsp;
40
+ [Storage](#storage) &nbsp;•&nbsp;
41
+ [Runtimes](#runtime-support) &nbsp;•&nbsp;
42
+ [Docs](https://zeative.github.io/zaileys/)
43
+
44
+ </div>
45
+
46
+ </div>
47
+
48
+ <br>
49
+
50
+ > [!NOTE]
51
+ > This README is a **high-level overview**. The complete API reference, guides, and recipes live in the documentation site at **<https://zeative.github.io/zaileys/>**. Runnable code lives in [`examples/`](./examples).
52
+
53
+ ---
54
+
55
+ ## Quick start
56
+
57
+ There is no `await connect()` — the client connects on construction, so every handler you register synchronously is wired up before the first event arrives.
58
+
59
+ ```typescript
60
+ import { Client } from 'zaileys'
61
+
62
+ const client = new Client()
63
+
64
+ client.on('qr', ({ qrString }) => console.log('Scan this QR:', qrString))
65
+ client.on('connect', ({ me }) => console.log('Connected as', me.id))
66
+
67
+ client.on('text', async (msg) => {
68
+ await msg.reply(`You said: ${msg.text}`)
69
+ })
70
+ ```
71
+
72
+ That is the whole bot. Scan the printed QR via **WhatsApp → Linked Devices**, and every text message gets a reply.
73
+
74
+ Prefer a pairing code? Provide your number:
75
+
76
+ ```typescript
77
+ const client = new Client({ authType: 'pairing', phoneNumber: '6281234567890' })
78
+ ```
79
+
80
+ ## Build with AI
81
+
82
+ Zaileys ships an **official Agent Skill suite** so your AI assistant writes, reviews, and
83
+ debugs zaileys code with best practices — it knows the exact API, common pitfalls, and how
84
+ to fix errors. Install it straight from this repo:
85
+
86
+ ```bash
87
+ # Claude Code (native plugin — supports auto-update)
88
+ /plugin marketplace add zeative/zaileys
89
+ /plugin install zaileys-official@zeative
90
+
91
+ # npx skills (multi-agent: Claude Code, Codex, Cursor, OpenCode)
92
+ npx skills add zeative/zaileys # add -g for a global install
93
+ ```
94
+
95
+ The suite has an orchestrator that auto-routes plus three focused skills:
96
+
97
+ | Command (plugin) | Does |
98
+ | ---------------- | ---- |
99
+ | `/zaileys-official:assist` | Orchestrator — auto-detects intent (build / debug / review / explain) |
100
+ | `/zaileys-official:scaffold` | Generate a complete runnable bot from a short spec |
101
+ | `/zaileys-official:debug` | Diagnose a zaileys error/symptom → cause → fix |
102
+ | `/zaileys-official:review` | Audit code vs best practices + ban-safety |
103
+
104
+ Each skill also fetches the [live docs](https://zeative.github.io/zaileys/llms-full.txt) for the latest API. See [the skill guide](https://zeative.github.io/zaileys/skill/).
105
+
106
+ ## Why Zaileys
107
+
108
+ - **Typed events** — `on('text' | 'image' | 'reaction' | 'button-click' | 'group-update' | …)` with fully-typed payloads and IntelliSense. No raw Baileys decoding, no `any`.
109
+ - **One chainable builder** — `client.send(jid).text(…).reply(quoted).mentions([…])` resolves to the sent message key when awaited.
110
+ - **Rich & interactive out of the box** — native buttons, lists, carousels, and Meta-AI-style rich responses written as plain markdown.
111
+ - **Auto lifecycle** — QR or pairing-code login, auto-reconnect with backoff, clean logout, optional `ignoreMe`.
112
+ - **Pluggable storage** — independent `AuthStore` and `MessageStore` interfaces with `file`, `memory`, `sqlite`, `redis`, `postgres`, and `convex` adapters.
113
+ - **Batteries included** — command framework, broadcast with rate limiting, scheduled sends, and lazy media processing (image/video/audio/sticker).
114
+ - **Runs everywhere** — dual ESM/CJS with `.d.ts` + `.d.cts` types; verified on Node, Bun, Deno, and Termux.
115
+ - **Modern foundation** — Baileys `7.0.0-rc13` (includes the CVE-2026-48063 spoofing patch), built and type-checked with the native (Go) TypeScript 7 compiler.
116
+
117
+ ## Install
118
+
119
+ ```bash
120
+ npm i zaileys # or: pnpm add zaileys • yarn add zaileys • bun add zaileys
121
+ ```
122
+
123
+ Requires **Node.js v20+**. The `file` auth store is the zero-config default and needs nothing else.
124
+
125
+ Other storage backends are **optional peer dependencies** — install only the one you use:
126
+
127
+ ```bash
128
+ npm i better-sqlite3 # sqlite adapters
129
+ npm i redis # redis adapters
130
+ npm i pg # postgres adapters
131
+ npm i convex # convex adapters
132
+ ```
133
+
134
+ `sharp` is an optional accelerator for media/sticker processing; without it Zaileys falls back to a pure-JS path automatically.
135
+
136
+ ## What you can build
137
+
138
+ ### Send anything
139
+
140
+ ```typescript
141
+ await client.send(jid).text('Hello there')
142
+ await client.send(jid).image('https://example.com/photo.jpg', { caption: 'Nice shot' })
143
+ await client.send(jid).poll('Pick one', ['Red', 'Green', 'Blue'])
144
+ await client.send(jid).album([
145
+ { type: 'image', src: './a.jpg' },
146
+ { type: 'image', src: './b.jpg' },
147
+ ])
148
+ ```
149
+
150
+ ### Interactive messages
151
+
152
+ Reply, URL, copy, call, reminder, location, and address buttons — plus lists and carousels — rendered natively on personal accounts.
153
+
154
+ ```typescript
155
+ await client.send(jid).buttons(
156
+ [
157
+ { id: 'yes', text: 'Yes' },
158
+ { type: 'url', text: 'Open docs', url: 'https://github.com/zeative/zaileys' },
159
+ { type: 'copy', text: 'Copy code', code: 'ZAILEYS-2026' },
160
+ ],
161
+ { title: 'Pick one', text: 'Tap a button below' },
162
+ )
163
+
164
+ client.on('button-click', (ctx) => console.log('tapped:', ctx.buttonId))
165
+ ```
166
+
167
+ ### Rich responses, written as markdown
168
+
169
+ Toggle `{ rich: true }` and write ordinary markdown — fenced code (syntax-highlighted), tables, images, and `:::` directives for products, suggestions, and more.
170
+
171
+ ```typescript
172
+ await client.send(jid).text(
173
+ [
174
+ '*Daily brief* ☕',
175
+ '',
176
+ '```ts',
177
+ "const client = new Client()",
178
+ '```',
179
+ '',
180
+ ':::suggest',
181
+ 'See changelog | Upgrade guide',
182
+ ':::',
183
+ ].join('\n'),
184
+ { rich: true, title: '📰 zaileys' },
185
+ )
186
+ ```
187
+
188
+ ### Commands, broadcast & schedule
189
+
190
+ ```typescript
191
+ const client = new Client({ commandPrefix: ['/', '!'] })
192
+ client.command('ping', (ctx) => ctx.reply('pong 🏓'))
193
+
194
+ await client.broadcast(jids, (b) => b.text('Announcement'), { rateLimitPerSec: 5 })
195
+ await client.scheduleAt(new Date(Date.now() + 60_000), (b) => b.text('Sends in 1 minute'))
196
+ ```
197
+
198
+ ### Mutate messages
199
+
200
+ ```typescript
201
+ const key = await client.send(jid).text('Original')
202
+ await client.edit(key).text('Edited')
203
+ await client.react(key, '👍')
204
+ await client.delete(key, { forEveryone: true })
205
+ await client.forward(key, otherJid)
206
+ ```
207
+
208
+ ## Storage
209
+
210
+ Auth state and message history use two independent interfaces, so you can mix and match — e.g. auth in SQLite, messages in Redis.
211
+
212
+ ```typescript
213
+ import { Client, SqliteAuthStore, RedisMessageStore } from 'zaileys'
214
+
215
+ const client = new Client({
216
+ auth: new SqliteAuthStore({ database: './auth.db' }),
217
+ store: new RedisMessageStore({ url: 'redis://localhost:6379' }),
218
+ })
219
+ ```
220
+
221
+ | Adapter | Auth store | Message store | Peer dependency |
222
+ | ---------- | ------------------- | ---------------------- | ---------------- |
223
+ | `file` | `FileAuthStore` ⭐ | — | none |
224
+ | `memory` | `MemoryAuthStore` | `MemoryMessageStore` | none |
225
+ | `sqlite` | `SqliteAuthStore` | `SqliteMessageStore` | `better-sqlite3` |
226
+ | `redis` | `RedisAuthStore` | `RedisMessageStore` | `redis` |
227
+ | `postgres` | `PostgresAuthStore` | `PostgresMessageStore` | `pg` |
228
+ | `convex` | `ConvexAuthStore` | `ConvexMessageStore` | `convex` |
229
+
230
+ > ⭐ default. Convex requires deploying the helper functions in [`examples/convex/`](./examples/convex) — see that folder's README.
231
+
232
+ ## Runtime support
233
+
234
+ Zaileys ships dual ESM/CJS entry points with type declarations for both module systems, and is verified to load on:
235
+
236
+ | Runtime | ESM | CJS |
237
+ | ------- | --- | --- |
238
+ | Node.js `>=20` | ✅ | ✅ |
239
+ | Bun | ✅ | ✅ |
240
+ | Deno (`--node-modules-dir`) | ✅ | ✅ |
241
+ | Termux (Android) | ✅ | ✅ |
242
+
243
+ Package managers: **npm**, **pnpm**, **yarn**, and **bun** are all supported.
244
+
245
+ ## Documentation
246
+
247
+ - 🌐 [**zeative.github.io/zaileys**](https://zeative.github.io/zaileys/) — full documentation site: guides, API reference, recipes
248
+ - 🤖 [**AI Skill**](https://zeative.github.io/zaileys/skill/) — official Claude Code / `npx skills` skill
249
+ - 📦 [**examples/**](./examples) — runnable bots: quickstart, interactive buttons, AIRich, storage adapters, broadcast
250
+ - 🔀 [**MIGRATION.md**](./MIGRATION.md) — upgrading from v3.x to v4.0.0 (breaking changes, side-by-side snippets)
251
+ - 🤝 [**CONTRIBUTING.md**](./CONTRIBUTING.md) — dev setup, tests, commit convention, release flow
252
+ - 🔒 [**SECURITY.md**](./SECURITY.md) — vulnerability disclosure and supported versions
253
+ - 📝 [**CHANGELOG.md**](./CHANGELOG.md) — release history
254
+
255
+ ## Issues & feedback
256
+
257
+ Hit a problem or have a feature request? Open an [issue](https://github.com/zeative/zaileys/issues).
258
+
259
+ - [Buy me a coffee ☕](https://saweria.co/zaadevofc) • [Ko-Fi](https://ko-fi.com/zaadevofc) • [Trakteer](https://trakteer.id/zaadevofc)
260
+ - ⭐ Star the repo on GitHub
261
+
262
+ ## License
263
+
264
+ Distributed under the **MIT License**. See [`LICENSE`](https://github.com/zeative/zaileys/blob/main/LICENSE) for details.
265
+
266
+ <div align="left">
267
+ <p>
268
+ <img alt="Zaileys" src="https://github.com/zeative/zeative/blob/main/libraries/zaileys/zaileys-clean.png?raw=true" width="28" align="center">
269
+ Copyright © 2026 zaadevofc. All rights reserved.
270
+ </p>
271
+ </div>