zaileys 1.1.33 β 1.1.34
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/CHANGELOG.md +92 -0
- package/README.md +565 -294
- package/package.json +42 -35
- package/dist/index.d.mts +0 -2719
- package/dist/index.d.ts +0 -2719
- package/dist/index.js +0 -1
- package/dist/index.mjs +0 -1
package/README.md
CHANGED
|
@@ -1,52 +1,100 @@
|
|
|
1
|
-
<h1 align="center">Zaileys - Simplified WhatsApp Node.js API</h1>
|
|
2
|
-
|
|
3
1
|
<div align="center">
|
|
4
2
|
<img alt="Zaileys - Simplified WhatsApp Node.js API" src="https://socialify.git.ci/zeative/zaileys/image?description=1&descriptionEditable=Zaileys%20is%20a%20simplified%20version%20of%20the%20Baileys%20package%20%0Awhich%20is%20easier%20and%20faster.&font=KoHo&forks=1&issues=1&language=1&name=1&owner=1&pattern=Circuit%20Board&pulls=1&stargazers=1&theme=Auto">
|
|
5
|
-
<br>
|
|
6
|
-
<a href="https://www.npmjs.com/package/zaileys"><img src="https://img.shields.io/npm/v/zaileys.svg" alt="NPM Version"></a>
|
|
7
|
-
<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>
|
|
8
|
-
<a href="https://github.com/zeative/zaileys"><img src="https://img.shields.io/github/languages/code-size/zeative/zaileys" alt="GitHub Code Size"></a>
|
|
9
|
-
<a href="https://github.com/zeative/zaileys"><img src="https://img.shields.io/github/license/zeative/zaileys" alt="GitHub License"></a>
|
|
10
|
-
<a href="https://github.com/zeative/zaileys"><img src="https://img.shields.io/github/stars/zeative/zaileys" alt="GitHub Stars"></a>
|
|
11
|
-
<a href="https://github.com/zeative/zaileys"><img src="https://img.shields.io/github/forks/zeative/zaileys" alt="GitHub Forks"></a>
|
|
12
|
-
</div>
|
|
13
|
-
|
|
14
|
-
#
|
|
15
|
-
**Zaileys** is a lightweight, user-friendly wrapper around the [Baileys](https://github.com/WhiskeySockets/Baileys) library, designed to simplify building WhatsApp bots and integrations with TypeScript or ESM JavaScript. It offers a streamlined API, robust multi-device support, and seamless database integration for session management.
|
|
16
|
-
|
|
17
|
-
> **Note**: Stay updated and get support by joining our [WhatsApp Channel](https://whatsapp.com/channel/0029VazENbmInlqHIWzgn33h).
|
|
18
3
|
|
|
19
|
-
>
|
|
4
|
+
<h1 align="center">Zaileys - Simplified WhatsApp Node.js API</h1>
|
|
20
5
|
|
|
21
|
-
|
|
6
|
+
<a href="https://www.npmjs.com/package/zaileys"><img src="https://img.shields.io/npm/v/zaileys.svg" alt="NPM Version"></a>
|
|
7
|
+
<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>
|
|
8
|
+
<a href="https://github.com/zeative/zaileys"><img src="https://img.shields.io/github/languages/code-size/zeative/zaileys" alt="GitHub Code Size"></a>
|
|
9
|
+
<a href="https://github.com/zeative/zaileys"><img src="https://img.shields.io/github/license/zeative/zaileys" alt="GitHub License"></a>
|
|
10
|
+
<a href="https://github.com/zeative/zaileys"><img src="https://img.shields.io/github/stars/zeative/zaileys" alt="GitHub Stars"></a>
|
|
11
|
+
<a href="https://github.com/zeative/zaileys"><img src="https://img.shields.io/github/forks/zeative/zaileys" alt="GitHub Forks"></a>
|
|
22
12
|
|
|
23
|
-
|
|
24
|
-
2. [π¦ Installation](#installation)
|
|
25
|
-
3. [π Quick Start](#quick-start)
|
|
26
|
-
4. [π Core Concepts](#core-concepts)
|
|
27
|
-
5. [π‘ Event Handling](#event-handling)
|
|
28
|
-
6. [π© Sending Messages](#sending-messages)
|
|
29
|
-
7. [πΌ Sending Media](#sending-media)
|
|
30
|
-
8. [π§ Advanced Actions](#advanced-actions)
|
|
31
|
-
9. [π Issues & Feedback](#issues--feedback)
|
|
32
|
-
10. [β€οΈ Support](#support)
|
|
33
|
-
11. [π License](#license)
|
|
34
|
-
12. [π Acknowledgements](#acknowledgements)
|
|
35
|
-
|
|
36
|
-
## β¨ Features
|
|
37
|
-
|
|
38
|
-
- **Simplified API**: Minimal setup for rapid bot development.
|
|
39
|
-
- **Multi-Device Support**: Full compatibility with WhatsAppβs multi-device feature via Baileys.
|
|
40
|
-
- **Modular & Extensible**: Easily integrate middleware and custom storage solutions.
|
|
41
|
-
- **QR Code Authentication**: Hassle-free login with terminal-based QR codes.
|
|
42
|
-
- **TypeScript & ESM**: Full type safety and modern JavaScript support.
|
|
43
|
-
- **Database Integration**: Supports SQLite, PostgreSQL, or MySQL for session persistence.
|
|
44
|
-
- **Rate Limiting**: Built-in spam detection to prevent abuse.
|
|
45
|
-
- **Webhooks Support**: Handle external events with a dynamically provided URL during runtime.
|
|
13
|
+
</div>
|
|
46
14
|
|
|
47
|
-
|
|
15
|
+
**Zaileys** is a lightweight, user-friendly wrapper around the [Baileys](https://github.com/WhiskeySockets/Baileys) library, designed to simplify building WhatsApp bots and integrations with TypeScript or ESM JavaScript. It offers a streamlined API, robust multi-device support, and seamless database integration for session management.
|
|
48
16
|
|
|
49
|
-
|
|
17
|
+
> [!TIP]
|
|
18
|
+
> Stay updated and get support by joining our [WhatsApp Channel](https://whatsapp.com/channel/0029VazENbmInlqHIWzgn33h).
|
|
19
|
+
|
|
20
|
+
> [!IMPORTANT]
|
|
21
|
+
> There is no assurance that you wonβt get blocked when using this approach. WhatsApp does not permit bots or unofficial clients, so use it at your own risk.
|
|
22
|
+
|
|
23
|
+
### π Table of Contents
|
|
24
|
+
|
|
25
|
+
- [Features](#-features)
|
|
26
|
+
- [Installation](#-installation)
|
|
27
|
+
- [Example Projects](#-example-projects)
|
|
28
|
+
- [Connecting Methods](#-connecting-methods)
|
|
29
|
+
- [QR Code](#qr-code)
|
|
30
|
+
- [Pairing Code](#pairing-code)
|
|
31
|
+
- [Quick Start](#-quick-start)
|
|
32
|
+
- [Core Concepts](#-core-concepts)
|
|
33
|
+
- [Citation](#citation)
|
|
34
|
+
- [Limiter](#limiter)
|
|
35
|
+
- [Fake Reply](#fake-reply)
|
|
36
|
+
- [Event Handling](#-event-handling)
|
|
37
|
+
- [Relay Handling](#-relay-handling)
|
|
38
|
+
- [General](#general)
|
|
39
|
+
- [Text Message](#text-message)
|
|
40
|
+
- [Reply Message](#reply-message)
|
|
41
|
+
- [Forward Message](#forward-message)
|
|
42
|
+
- [Edit Message](#edit-message)
|
|
43
|
+
- [Delete Message](#delete-message)
|
|
44
|
+
- [Reaction Message](#reaction-message)
|
|
45
|
+
- [Presence](#presence)
|
|
46
|
+
- [Reject Call](#reject-call)
|
|
47
|
+
- [Media](#media)
|
|
48
|
+
- [Document Message](#document-message)
|
|
49
|
+
- [Image Message](#image-message)
|
|
50
|
+
- [Sticker Message](#sticker-message)
|
|
51
|
+
- [Video Message](#video-message)
|
|
52
|
+
- [Audio Message](#audio-message)
|
|
53
|
+
- [Voice Message](#voice-message)
|
|
54
|
+
- [View Once Message](#view-once-message)
|
|
55
|
+
- [Note Message](#note-message)
|
|
56
|
+
- [Gif Message](#gif-message)
|
|
57
|
+
- [Location Message](#location-message)
|
|
58
|
+
- [Contacts Message](#contacts-message)
|
|
59
|
+
- [Polling Message](#polling-message)
|
|
60
|
+
- [Button Message](#button-message)
|
|
61
|
+
- [Group Control](#group-control)
|
|
62
|
+
- [Group Create](#group-create)
|
|
63
|
+
- [Group Action](#group-action)
|
|
64
|
+
- [Group Invite](#group-invite)
|
|
65
|
+
- [Group Update](#group-update)
|
|
66
|
+
- [Group Settings](#group-settings)
|
|
67
|
+
- [Group Leave](#group-leave)
|
|
68
|
+
- [Group Links](#group-links)
|
|
69
|
+
- [Group Invite](#group-invite)
|
|
70
|
+
- [Group Metadata](#group-metadata)
|
|
71
|
+
- [Group Requests](#group-requests)
|
|
72
|
+
- [Privacy Control](#privacy-control)
|
|
73
|
+
- [Privacy Update](#privacy-update)
|
|
74
|
+
- [Privacy Fetch](#privacy-fetch)
|
|
75
|
+
- [Profile Control](#profile-control)
|
|
76
|
+
- [Profile Bio](#profile-bio)
|
|
77
|
+
- [Profile Avatar](#profile-avatar)
|
|
78
|
+
- [Profile Business](#profile-business)
|
|
79
|
+
- [Profile Update](#profile-update)
|
|
80
|
+
- [Profile Check](#profile-check)
|
|
81
|
+
- [Issues & Feedback](#-issues---feedback)
|
|
82
|
+
|
|
83
|
+
### π Features
|
|
84
|
+
|
|
85
|
+
- π― **Simplified API**: Minimal boilerplate get up and running in minutes.
|
|
86
|
+
- π **Secure Multi-Device**: Full multi-device support via Baileys.
|
|
87
|
+
- βοΈ **Modular & Extensible**: Plug-and-play middleware, transports, and storage layers.
|
|
88
|
+
- π **Multi Auth (QR and Pairing Code)**: Connect to whatsapp with QR code or Pairing Code.
|
|
89
|
+
- π οΈ **TypeScript First**: Full type definitions and zero-config TS support.
|
|
90
|
+
- ~~π **Built-in Logging**: Integrated with Pino for structured logs.~~
|
|
91
|
+
|
|
92
|
+
### π Installation
|
|
93
|
+
|
|
94
|
+
> [!WARNING]
|
|
95
|
+
> Ensure you are running [Node.js](https://nodejs.org/) **>= 20** as specified in `package.json`.
|
|
96
|
+
|
|
97
|
+
Install with your preferred package manager:
|
|
50
98
|
|
|
51
99
|
```bash
|
|
52
100
|
npm install zaileys
|
|
@@ -54,394 +102,617 @@ npm install zaileys
|
|
|
54
102
|
yarn add zaileys
|
|
55
103
|
# or
|
|
56
104
|
pnpm add zaileys
|
|
105
|
+
# or
|
|
106
|
+
bun add zaileys
|
|
107
|
+
deno add npm:zaileys
|
|
57
108
|
```
|
|
58
109
|
|
|
59
|
-
|
|
110
|
+
Then import your code using:
|
|
60
111
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
112
|
+
```js
|
|
113
|
+
import { Client } from "zaileys";
|
|
114
|
+
// or
|
|
115
|
+
const { Client } = require("zaileys");
|
|
116
|
+
```
|
|
65
117
|
|
|
66
|
-
|
|
118
|
+
### π Example Projects
|
|
67
119
|
|
|
68
|
-
Explore the
|
|
120
|
+
Explore the `examples` for practical use cases:
|
|
69
121
|
|
|
70
122
|
- [Simple Setup](https://github.com/zeative/zaileys/blob/main/examples/simple.ts): A minimal setup for quick prototyping.
|
|
71
123
|
- [Citation Example](https://github.com/zeative/zaileys/blob/main/examples/citation.ts): Demonstrates custom metadata with the citation mechanism.
|
|
72
124
|
- [Rate Limiting Example](https://github.com/zeative/zaileys/blob/main/examples/limiter.ts): Shows how to implement spam detection.
|
|
73
125
|
- [AI Integration with Groq](https://github.com/zeative/zaileys/blob/main/examples/llms.ts): Integrates AI capabilities using Groq.
|
|
74
|
-
- [Webhooks Integration](https://github.com/zeative/zaileys/blob/main/examples/webhooks.ts): Handles webhook-based interactions.
|
|
75
126
|
- [Voice Note with AI](https://github.com/zeative/zaileys/blob/main/examples/speech.ts): Interacts with AI using voice notes.
|
|
76
127
|
|
|
77
|
-
###
|
|
128
|
+
### π Connecting Methods
|
|
78
129
|
|
|
79
|
-
|
|
80
|
-
|
|
130
|
+
> [!TIP]
|
|
131
|
+
> You can connect to WhatsApp using either a QR code or a pairing code.
|
|
81
132
|
|
|
82
|
-
|
|
133
|
+
### `QR Code`
|
|
134
|
+
|
|
135
|
+
```js
|
|
83
136
|
const wa = new Client({
|
|
84
|
-
|
|
85
|
-
ignoreMe: true,
|
|
86
|
-
showLogs: true,
|
|
87
|
-
autoRead: true,
|
|
88
|
-
autoOnline: true,
|
|
89
|
-
autoPresence: true,
|
|
90
|
-
autoRejectCall: true,
|
|
91
|
-
loadLLMSchemas: false,
|
|
92
|
-
database: {
|
|
93
|
-
type: "sqlite",
|
|
94
|
-
connection: { url: "./session/zaileys.db" },
|
|
95
|
-
},
|
|
137
|
+
authType: "qr",
|
|
96
138
|
});
|
|
139
|
+
```
|
|
97
140
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
141
|
+
### `Pairing Code`
|
|
142
|
+
|
|
143
|
+
```js
|
|
144
|
+
const wa = new Client({
|
|
145
|
+
authType: "pairing",
|
|
146
|
+
phoneNumber: 628123456789,
|
|
102
147
|
});
|
|
103
148
|
```
|
|
104
149
|
|
|
105
|
-
###
|
|
150
|
+
### π Quick Start
|
|
106
151
|
|
|
107
|
-
|
|
108
|
-
import { Client } from "zaileys";
|
|
152
|
+
here is minimal example of how to run:
|
|
109
153
|
|
|
154
|
+
```js
|
|
110
155
|
const wa = new Client({ authType: "qr" });
|
|
111
156
|
|
|
112
157
|
wa.on("messages", (ctx) => {
|
|
113
|
-
|
|
158
|
+
if (ctx.text == "ping") {
|
|
159
|
+
wa.text("pong");
|
|
160
|
+
}
|
|
114
161
|
});
|
|
115
162
|
```
|
|
116
163
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
### Sessions & Authentication
|
|
120
|
-
|
|
121
|
-
Zaileys uses QR code authentication and stores sessions in a database to avoid repeated QR scans.
|
|
122
|
-
|
|
123
|
-
```ts
|
|
124
|
-
import { Client } from "zaileys";
|
|
125
|
-
|
|
126
|
-
const wa = new Client({
|
|
127
|
-
database: {
|
|
128
|
-
type: "sqlite",
|
|
129
|
-
connection: { url: "./session/zaileys.db" },
|
|
130
|
-
},
|
|
131
|
-
});
|
|
132
|
-
```
|
|
164
|
+
### π Core Concepts
|
|
133
165
|
|
|
134
|
-
### Citation
|
|
166
|
+
### `Citation`
|
|
135
167
|
|
|
136
|
-
Define custom metadata providers for dynamic boolean flags in `ctx.citation`. See
|
|
168
|
+
Define custom metadata providers for dynamic boolean flags in `ctx.citation`. See `citation.ts`.
|
|
137
169
|
|
|
138
|
-
```
|
|
170
|
+
```js
|
|
139
171
|
const wa = new Client({
|
|
172
|
+
...,
|
|
140
173
|
citation: {
|
|
141
|
-
admins:
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
});
|
|
174
|
+
admins: [628123456789]
|
|
175
|
+
}
|
|
176
|
+
})
|
|
145
177
|
|
|
146
178
|
wa.on("messages", (ctx) => {
|
|
179
|
+
// from 'admins' to 'isAdmins'
|
|
180
|
+
// from 'test' to 'isTest'
|
|
147
181
|
if (ctx.citation?.isAdmins) {
|
|
148
|
-
wa.text("Admin access granted"
|
|
182
|
+
wa.text("Admin access granted")
|
|
149
183
|
}
|
|
150
|
-
})
|
|
184
|
+
})
|
|
151
185
|
```
|
|
152
186
|
|
|
153
|
-
###
|
|
187
|
+
### `Limiter`
|
|
154
188
|
|
|
155
|
-
Detect and prevent spam with the built-in limiter. See
|
|
189
|
+
Detect and prevent spam with the built-in limiter. See limiter.ts.
|
|
156
190
|
|
|
157
|
-
```
|
|
191
|
+
```js
|
|
158
192
|
const wa = new Client({
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
// max 10 messages on 10 seconds
|
|
193
|
+
...,
|
|
194
|
+
// max 5 messages on 10 seconds
|
|
162
195
|
limiter: {
|
|
163
196
|
durationMs: 10000,
|
|
164
|
-
maxMessages: 5
|
|
165
|
-
}
|
|
166
|
-
})
|
|
197
|
+
maxMessages: 5
|
|
198
|
+
}
|
|
199
|
+
})
|
|
167
200
|
|
|
168
201
|
wa.on("messages", (ctx) => {
|
|
169
202
|
if (ctx.isSpam) {
|
|
170
|
-
wa.text("You're spamming!!"
|
|
171
|
-
return;
|
|
203
|
+
wa.text("You're spamming!!");
|
|
172
204
|
}
|
|
173
|
-
|
|
174
|
-
wa.text("Hello!", { roomId: ctx.roomId });
|
|
175
|
-
});
|
|
205
|
+
})
|
|
176
206
|
```
|
|
177
207
|
|
|
178
|
-
###
|
|
208
|
+
### `Fake Reply`
|
|
179
209
|
|
|
180
|
-
|
|
210
|
+
Make it look like the number verified by manipulation.
|
|
181
211
|
|
|
182
|
-
```
|
|
212
|
+
```js
|
|
183
213
|
const wa = new Client({
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
}
|
|
188
|
-
})
|
|
214
|
+
...,
|
|
215
|
+
fakeReply: {
|
|
216
|
+
provider: "whatsapp", // meta | chatgpt | copilot | instagram | tiktok
|
|
217
|
+
}
|
|
218
|
+
})
|
|
189
219
|
|
|
190
|
-
wa.on("
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
});
|
|
220
|
+
wa.on("messages", (ctx) => {
|
|
221
|
+
if (ctx.text == "test") {
|
|
222
|
+
wa.reply("Test reply...");
|
|
223
|
+
}
|
|
224
|
+
})
|
|
196
225
|
```
|
|
197
226
|
|
|
198
|
-
|
|
227
|
+
### π Event Handling
|
|
199
228
|
|
|
200
|
-
|
|
229
|
+
Types of events handled.
|
|
201
230
|
|
|
202
|
-
|
|
231
|
+
```js
|
|
232
|
+
/* Monitor connection status */
|
|
233
|
+
wa.on("connection", (ctx) => {});
|
|
203
234
|
|
|
204
|
-
|
|
235
|
+
/* Handle incoming messages */
|
|
236
|
+
wa.on("messages", (ctx) => {});
|
|
205
237
|
|
|
206
|
-
|
|
207
|
-
wa.on("
|
|
208
|
-
console.log(`Connection: ${ctx.status}`);
|
|
209
|
-
});
|
|
238
|
+
/* Handle incoming calls */
|
|
239
|
+
wa.on("calls", (ctx) => {});
|
|
210
240
|
```
|
|
211
241
|
|
|
212
|
-
###
|
|
242
|
+
### π Relay Handling
|
|
213
243
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
244
|
+
### `General`
|
|
245
|
+
|
|
246
|
+
#### *Text Message*
|
|
247
|
+
|
|
248
|
+
```js
|
|
249
|
+
wa.text("Hello World!")
|
|
250
|
+
// or
|
|
251
|
+
wa.text({ text: "Hello World!" })
|
|
252
|
+
|
|
253
|
+
/* custom roomId */
|
|
254
|
+
wa.text({ text: "Hello World!", roomId: "12345@xxx" })
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
auto mentions user/group (works for both):
|
|
258
|
+
|
|
259
|
+
```js
|
|
260
|
+
wa.text("Hello @628123456789 @0")
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
external ads preview (works for both):
|
|
264
|
+
|
|
265
|
+
```js
|
|
266
|
+
wa.text({
|
|
267
|
+
text: "Test ads text",
|
|
268
|
+
externalAdReply: {
|
|
269
|
+
title: "Test ads title",
|
|
270
|
+
body: "Test ads body",
|
|
271
|
+
thumbnailUrl: "https://github.com/zeative.png",
|
|
272
|
+
mediaUrl: "https://zpi.my.id",
|
|
273
|
+
}
|
|
274
|
+
})
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
#### *Reply Message*
|
|
278
|
+
|
|
279
|
+
```js
|
|
280
|
+
wa.reply("Test reply message...")
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
#### *Forward Message*
|
|
284
|
+
|
|
285
|
+
```js
|
|
286
|
+
wa.forward("Test forward message...")
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
#### *Edit Message*
|
|
290
|
+
|
|
291
|
+
```js
|
|
292
|
+
const msg = await wa.text("Test edit message...")
|
|
293
|
+
await wa.edit({ text: "Edit success!", message: msg.message })
|
|
218
294
|
```
|
|
219
295
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
```
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
"isStory": "boolean",
|
|
245
|
-
"isViewOnce": "boolean",
|
|
246
|
-
"isEdited": "boolean",
|
|
247
|
-
"isDeleted": "boolean",
|
|
248
|
-
"isPinned": "boolean",
|
|
249
|
-
"isUnPinned": "boolean",
|
|
250
|
-
"isChannel": "boolean",
|
|
251
|
-
"isBroadcast": "boolean",
|
|
252
|
-
"isEphemeral": "boolean",
|
|
253
|
-
"isForwarded": "boolean",
|
|
254
|
-
"citation": "object",
|
|
255
|
-
"media": {
|
|
256
|
-
...
|
|
257
|
-
"buffer": "function",
|
|
258
|
-
"stream": "function"
|
|
259
|
-
},
|
|
260
|
-
"replied": "object (same schema as ctx)",
|
|
261
|
-
"message": "function"
|
|
262
|
-
}
|
|
263
|
-
```
|
|
264
|
-
|
|
265
|
-
### Call Events
|
|
266
|
-
|
|
267
|
-
Handle incoming calls.
|
|
268
|
-
|
|
269
|
-
```ts
|
|
296
|
+
#### *Delete Message*
|
|
297
|
+
|
|
298
|
+
```js
|
|
299
|
+
const msg = await wa.text("Test delete message...")
|
|
300
|
+
await wa.delete({ message: msg.message })
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
#### *Reaction Message*
|
|
304
|
+
|
|
305
|
+
```js
|
|
306
|
+
wa.reaction("π―")
|
|
307
|
+
// or
|
|
308
|
+
wa.reaction({ emoticon: "π―" });
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
#### *Presence*
|
|
312
|
+
|
|
313
|
+
```js
|
|
314
|
+
wa.presence("typing") // online | offline | recording | paused
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
#### *Reject Call*
|
|
318
|
+
|
|
319
|
+
```js
|
|
270
320
|
wa.on("calls", (ctx) => {
|
|
271
|
-
|
|
272
|
-
|
|
321
|
+
wa.reject(ctx);
|
|
322
|
+
// or
|
|
323
|
+
wa.reject({ callId: ctx.callId, callerId: ctx.callerId });
|
|
324
|
+
})
|
|
273
325
|
```
|
|
274
326
|
|
|
275
|
-
###
|
|
327
|
+
### `Media`
|
|
276
328
|
|
|
277
|
-
|
|
329
|
+
#### *Document Message*
|
|
278
330
|
|
|
279
|
-
```
|
|
280
|
-
wa.
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
})
|
|
331
|
+
```js
|
|
332
|
+
wa.document("text", {
|
|
333
|
+
document: "https://github.com/zeative.png",
|
|
334
|
+
mimetype: "image/png",
|
|
335
|
+
fileName: "zaadevofc logo.png",
|
|
336
|
+
text: "Here your logo",
|
|
337
|
+
})
|
|
338
|
+
|
|
339
|
+
// others method: text | reply | forward
|
|
340
|
+
// example as reply
|
|
341
|
+
wa.document("reply" { ... })
|
|
286
342
|
```
|
|
287
343
|
|
|
288
|
-
|
|
344
|
+
#### *Image Message*
|
|
289
345
|
|
|
290
|
-
|
|
346
|
+
```js
|
|
347
|
+
wa.image("text", {
|
|
348
|
+
image: "https://github.com/zeative.png",
|
|
349
|
+
text: "Here your logo",
|
|
350
|
+
})
|
|
351
|
+
```
|
|
291
352
|
|
|
292
|
-
|
|
353
|
+
#### *Sticker Message*
|
|
293
354
|
|
|
294
|
-
|
|
355
|
+
```js
|
|
356
|
+
wa.sticker("text", {
|
|
357
|
+
sticker: "https://example.com/file.webp"
|
|
358
|
+
})
|
|
359
|
+
```
|
|
295
360
|
|
|
296
|
-
|
|
297
|
-
const roomId = ctx.roomId;
|
|
298
|
-
const message = ctx.message;
|
|
361
|
+
#### *Video Message*
|
|
299
362
|
|
|
300
|
-
|
|
301
|
-
wa.
|
|
363
|
+
```js
|
|
364
|
+
wa.video("text", {
|
|
365
|
+
video: "https://example.com/file.mp4",
|
|
366
|
+
text: "Here your logo",
|
|
367
|
+
})
|
|
368
|
+
```
|
|
302
369
|
|
|
303
|
-
|
|
304
|
-
wa.text("Reply", { roomId, quoted: message });
|
|
370
|
+
#### *Audio Message*
|
|
305
371
|
|
|
306
|
-
|
|
307
|
-
wa.
|
|
372
|
+
```js
|
|
373
|
+
wa.audio("text", {
|
|
374
|
+
audio: "https://example.com/file.mp3",
|
|
375
|
+
text: "Here your logo",
|
|
376
|
+
})
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
#### *Voice Message*
|
|
380
|
+
|
|
381
|
+
```js
|
|
382
|
+
wa.voice("text", {
|
|
383
|
+
audio: "https://example.com/file.ogg"
|
|
384
|
+
})
|
|
385
|
+
```
|
|
308
386
|
|
|
309
|
-
|
|
310
|
-
|
|
387
|
+
#### *View Once Message*
|
|
388
|
+
|
|
389
|
+
```js
|
|
390
|
+
wa.image("text", {
|
|
391
|
+
image: "https://github.com/zeative.png",
|
|
392
|
+
text: "Here your logo",
|
|
393
|
+
viewOnce: true
|
|
394
|
+
})
|
|
395
|
+
|
|
396
|
+
wa.video("text", {
|
|
397
|
+
...,
|
|
398
|
+
viewOnce: true
|
|
399
|
+
})
|
|
400
|
+
|
|
401
|
+
wa.voice("text", {
|
|
402
|
+
...,
|
|
403
|
+
viewOnce: true
|
|
404
|
+
})
|
|
405
|
+
```
|
|
311
406
|
|
|
312
|
-
|
|
313
|
-
wa.text("Mark AI Message!", { roomId, asAI: true });
|
|
407
|
+
#### *Note Message*
|
|
314
408
|
|
|
315
|
-
|
|
316
|
-
wa.
|
|
409
|
+
```js
|
|
410
|
+
wa.note("text", {
|
|
411
|
+
video: "https://example.com/file.mp4"
|
|
412
|
+
})
|
|
317
413
|
```
|
|
318
414
|
|
|
319
|
-
|
|
415
|
+
#### *Gif Message*
|
|
320
416
|
|
|
321
|
-
|
|
417
|
+
```js
|
|
418
|
+
wa.gif("text", {
|
|
419
|
+
video: "https://example.com/file.gif"
|
|
420
|
+
})
|
|
421
|
+
```
|
|
322
422
|
|
|
323
|
-
|
|
324
|
-
/* sending reaction */
|
|
325
|
-
wa.reaction("π", { message });
|
|
423
|
+
#### *Location Message*
|
|
326
424
|
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
425
|
+
```js
|
|
426
|
+
wa.location('text', {
|
|
427
|
+
latitude: 1115,
|
|
428
|
+
longitude: -2225,
|
|
429
|
+
title: "Test location title",
|
|
430
|
+
footer: "Test location footer",
|
|
431
|
+
})
|
|
432
|
+
```
|
|
330
433
|
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
434
|
+
#### *Contacts Message*
|
|
435
|
+
|
|
436
|
+
```js
|
|
437
|
+
wa.contacts('text', {
|
|
438
|
+
title: "Test contacts title",
|
|
439
|
+
contacts: [
|
|
440
|
+
{
|
|
441
|
+
fullname: "zaadevofc",
|
|
442
|
+
nickname: "kejaa",
|
|
443
|
+
phoneNumber: 628123456789,
|
|
444
|
+
website: "https://github.com/zaadevofc",
|
|
445
|
+
},
|
|
446
|
+
],
|
|
447
|
+
})
|
|
334
448
|
```
|
|
335
449
|
|
|
336
|
-
|
|
450
|
+
#### *Polling Message*
|
|
451
|
+
|
|
452
|
+
```js
|
|
453
|
+
wa.poll('text', {
|
|
454
|
+
action: "create",
|
|
455
|
+
name: "Test poll",
|
|
456
|
+
answers: [
|
|
457
|
+
"Option 1",
|
|
458
|
+
"Option 2",
|
|
459
|
+
],
|
|
460
|
+
})
|
|
461
|
+
```
|
|
337
462
|
|
|
338
|
-
|
|
463
|
+
#### *Button Message*
|
|
464
|
+
|
|
465
|
+
simple button schema:
|
|
466
|
+
|
|
467
|
+
```js
|
|
468
|
+
wa.button("text", {
|
|
469
|
+
type: "simple",
|
|
470
|
+
text: "Test button",
|
|
471
|
+
footer: "Test button footer",
|
|
472
|
+
buttons: [
|
|
473
|
+
{
|
|
474
|
+
id: "1",
|
|
475
|
+
text: "Test button 1",
|
|
476
|
+
},
|
|
477
|
+
{
|
|
478
|
+
id: "2",
|
|
479
|
+
text: "Test button 2",
|
|
480
|
+
}
|
|
481
|
+
]D
|
|
482
|
+
})
|
|
483
|
+
```
|
|
339
484
|
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
485
|
+
interactive button schema:
|
|
486
|
+
|
|
487
|
+
```js
|
|
488
|
+
wa.button("text", {
|
|
489
|
+
type: "interactive",
|
|
490
|
+
text: "Test button",
|
|
491
|
+
footer: "Test button footer",
|
|
492
|
+
buttons: [
|
|
493
|
+
{
|
|
494
|
+
id: "1",
|
|
495
|
+
type: "quick_reply",
|
|
496
|
+
text: "Reply button",
|
|
497
|
+
},
|
|
498
|
+
{
|
|
499
|
+
id: "2",
|
|
500
|
+
type: "cta_copy",
|
|
501
|
+
text: "Copy button",
|
|
502
|
+
copy: "this is form copy",
|
|
503
|
+
},
|
|
504
|
+
{
|
|
505
|
+
id: "3",
|
|
506
|
+
type: "cta_call",
|
|
507
|
+
text: "Test Call",
|
|
508
|
+
phoneNumber: "628123456789",
|
|
509
|
+
},
|
|
510
|
+
{
|
|
511
|
+
id: "4",
|
|
512
|
+
type: "cta_url",
|
|
513
|
+
text: "Visit Url",
|
|
514
|
+
url: "https://github.com/zeative",
|
|
515
|
+
}
|
|
516
|
+
]
|
|
517
|
+
})
|
|
343
518
|
```
|
|
344
519
|
|
|
345
|
-
###
|
|
520
|
+
### `Group Control`
|
|
346
521
|
|
|
347
|
-
|
|
522
|
+
#### *Group Create*
|
|
348
523
|
|
|
349
|
-
```
|
|
350
|
-
|
|
351
|
-
|
|
524
|
+
```js
|
|
525
|
+
wa.group().create({
|
|
526
|
+
title: "Test New Group",
|
|
527
|
+
members: ["628123456789@s.whatsapp.net"],
|
|
528
|
+
})
|
|
352
529
|
```
|
|
353
530
|
|
|
354
|
-
|
|
531
|
+
#### *Group Action*
|
|
355
532
|
|
|
356
|
-
|
|
533
|
+
add new member to group:
|
|
357
534
|
|
|
358
|
-
```
|
|
359
|
-
|
|
360
|
-
|
|
535
|
+
```js
|
|
536
|
+
wa.group().action({
|
|
537
|
+
action: "add",
|
|
538
|
+
roomId: "123456789@g.us",
|
|
539
|
+
members: ["628123456789@s.whatsapp.net"],
|
|
540
|
+
})
|
|
361
541
|
```
|
|
362
542
|
|
|
363
|
-
|
|
543
|
+
checkout others action: `add` | `kick` | `promote` | `demote`
|
|
364
544
|
|
|
365
|
-
|
|
545
|
+
#### *Group Update*
|
|
366
546
|
|
|
367
|
-
|
|
547
|
+
update group subject:
|
|
368
548
|
|
|
369
|
-
```
|
|
370
|
-
|
|
549
|
+
```js
|
|
550
|
+
wa.group().update({
|
|
551
|
+
action: "subject",
|
|
552
|
+
roomId: "123456789@g.us",
|
|
553
|
+
text: "Test New Group Title",
|
|
554
|
+
})
|
|
555
|
+
```
|
|
556
|
+
|
|
557
|
+
checkout others action: `subject` | `description`
|
|
371
558
|
|
|
372
|
-
|
|
373
|
-
wa.text({ image: "https://github.com/zeative.png", text: "Image" }, { roomId });
|
|
559
|
+
#### *Group Settings*
|
|
374
560
|
|
|
375
|
-
|
|
376
|
-
wa.text({ image: fs.readFileSync("example/image.png"), text: "Image" }, { roomId });
|
|
561
|
+
setting group only admin can send message:
|
|
377
562
|
|
|
378
|
-
|
|
379
|
-
wa.
|
|
563
|
+
```js
|
|
564
|
+
wa.group().settings({
|
|
565
|
+
action: "close",
|
|
566
|
+
roomId: "123456789@g.us"
|
|
567
|
+
})
|
|
380
568
|
```
|
|
381
569
|
|
|
382
|
-
|
|
570
|
+
checkout others action: `open` | `close` | `lock` | `unlock`
|
|
383
571
|
|
|
384
|
-
|
|
572
|
+
#### *Group Leave*
|
|
385
573
|
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
574
|
+
leave group:
|
|
575
|
+
|
|
576
|
+
```js
|
|
577
|
+
wa.group().leave({
|
|
578
|
+
roomId: "123456789@g.us"
|
|
579
|
+
})
|
|
580
|
+
```
|
|
389
581
|
|
|
390
|
-
|
|
391
|
-
wa.text({ note: "https://example.com/video.mp4", text: "Video" }, { roomId });
|
|
582
|
+
#### *Group Invite*
|
|
392
583
|
|
|
393
|
-
|
|
394
|
-
|
|
584
|
+
join group chat by url:
|
|
585
|
+
|
|
586
|
+
```js
|
|
587
|
+
wa.group().invite({
|
|
588
|
+
url: "https://chat.whatsapp.com/xxxxxx",
|
|
589
|
+
action: "join",
|
|
590
|
+
})
|
|
591
|
+
```
|
|
592
|
+
|
|
593
|
+
checkout others action: `join` | `info`
|
|
594
|
+
|
|
595
|
+
#### *Group Metadata*
|
|
596
|
+
|
|
597
|
+
get group metadata:
|
|
598
|
+
|
|
599
|
+
```js
|
|
600
|
+
wa.group().metadata({
|
|
601
|
+
roomId: "123456789@g.us",
|
|
602
|
+
})
|
|
603
|
+
```
|
|
604
|
+
|
|
605
|
+
#### *Group Requests*
|
|
606
|
+
|
|
607
|
+
get request join list:
|
|
608
|
+
|
|
609
|
+
```js
|
|
610
|
+
wa.group().requests.list({
|
|
611
|
+
roomId: "123456789@g.us",
|
|
612
|
+
})
|
|
395
613
|
```
|
|
396
614
|
|
|
397
|
-
|
|
615
|
+
approve request join:
|
|
398
616
|
|
|
399
|
-
|
|
617
|
+
```js
|
|
618
|
+
wa.group().requests.approve({
|
|
619
|
+
roomId: "123456789@g.us",
|
|
620
|
+
members: ["628123456789@s.whatsapp.net"],
|
|
621
|
+
})
|
|
622
|
+
```
|
|
400
623
|
|
|
401
|
-
|
|
402
|
-
/* sending audio (recommended use .ogg format) */
|
|
403
|
-
wa.text({ audio: "https://example.com/audio.ogg" }, { roomId });
|
|
624
|
+
reject request join:
|
|
404
625
|
|
|
405
|
-
|
|
406
|
-
wa.
|
|
626
|
+
```js
|
|
627
|
+
wa.group().requests.reject({
|
|
628
|
+
roomId: "123456789@g.us",
|
|
629
|
+
members: ["628123456789@s.whatsapp.net"],
|
|
630
|
+
})
|
|
407
631
|
```
|
|
408
632
|
|
|
409
|
-
|
|
633
|
+
### `Privacy Control`
|
|
410
634
|
|
|
411
|
-
|
|
635
|
+
#### *Privacy Update*
|
|
412
636
|
|
|
413
|
-
|
|
637
|
+
update profile picture privacy:
|
|
414
638
|
|
|
415
|
-
```
|
|
416
|
-
wa.
|
|
639
|
+
```js
|
|
640
|
+
wa.privacy().update({
|
|
641
|
+
action: "avatar",
|
|
642
|
+
type: "all"
|
|
643
|
+
})
|
|
417
644
|
```
|
|
418
645
|
|
|
419
|
-
|
|
646
|
+
checkout others type: `avatar` | `groupsAdd` | `lastSeen` | `online` | `read` | `story`
|
|
647
|
+
|
|
648
|
+
#### *Privacy Fetch*
|
|
420
649
|
|
|
421
|
-
|
|
650
|
+
get blocklists user:
|
|
422
651
|
|
|
423
|
-
```
|
|
424
|
-
wa.
|
|
425
|
-
wa.profile("1209999@g.us"); // Group profile
|
|
652
|
+
```js
|
|
653
|
+
wa.privacy().fetch.blocklists()
|
|
426
654
|
```
|
|
427
655
|
|
|
428
|
-
|
|
656
|
+
get my settings:
|
|
429
657
|
|
|
430
|
-
|
|
658
|
+
```js
|
|
659
|
+
wa.privacy().fetch.settings()
|
|
660
|
+
```
|
|
431
661
|
|
|
432
|
-
|
|
662
|
+
### `Profile Control`
|
|
433
663
|
|
|
434
|
-
|
|
664
|
+
#### *Profile Bio*
|
|
435
665
|
|
|
436
|
-
|
|
437
|
-
|
|
666
|
+
get user bio:
|
|
667
|
+
|
|
668
|
+
```js
|
|
669
|
+
wa.profile().bio({ senderId: ctx.senderId })
|
|
670
|
+
```
|
|
438
671
|
|
|
439
|
-
|
|
672
|
+
#### *Profile Avatar*
|
|
440
673
|
|
|
441
|
-
|
|
674
|
+
get user/group avatar:
|
|
442
675
|
|
|
443
|
-
|
|
676
|
+
```js
|
|
677
|
+
wa.profile().avatar({ senderId: ctx.senderId })
|
|
678
|
+
// or group
|
|
679
|
+
wa.profile().avatar({ senderId: ctx.roomId })
|
|
680
|
+
```
|
|
681
|
+
|
|
682
|
+
#### *Profile Business*
|
|
683
|
+
|
|
684
|
+
get user business:
|
|
685
|
+
|
|
686
|
+
```js
|
|
687
|
+
wa.profile().business({ senderId: ctx.senderId })
|
|
688
|
+
```
|
|
689
|
+
|
|
690
|
+
#### *Profile Update*
|
|
691
|
+
|
|
692
|
+
```js
|
|
693
|
+
wa.profile().update({
|
|
694
|
+
type: 'avatar',
|
|
695
|
+
avatar: 'https://github.com/zeative.png',
|
|
696
|
+
})
|
|
697
|
+
```
|
|
698
|
+
|
|
699
|
+
checkout others type: `avatar` | `bio` | `name`
|
|
700
|
+
|
|
701
|
+
#### *Profile Check*
|
|
702
|
+
|
|
703
|
+
```js
|
|
704
|
+
wa.profile().check({ senderId: ctx.senderId })
|
|
705
|
+
```
|
|
706
|
+
|
|
707
|
+
### π Issues & Feedback
|
|
708
|
+
|
|
709
|
+
**If you encounter any problems or have feature requests, please open an [issue](https://github.com/zeative/zaileys/issues)**
|
|
710
|
+
|
|
711
|
+
- [Buy me a coffee β](https://saweria.co/zaadevofc)
|
|
712
|
+
- [Ko-Fi](https://ko-fi.com/zaadevofc)
|
|
713
|
+
- [Trakteer](https://trakteer.id/zaadevofc)
|
|
714
|
+
- β Star the repo on GitHub
|
|
444
715
|
|
|
445
|
-
|
|
716
|
+
### π License
|
|
446
717
|
|
|
447
|
-
|
|
718
|
+
Distributed under the **MIT License**. See [`LICENSE`](https://github.com/zeative/zaileys/blob/main/LICENSE) for details.
|