zaileys 1.1.29 β 1.1.31
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 +300 -125
- package/dist/index.d.mts +1709 -510
- package/dist/index.d.ts +1709 -510
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/examples/citation.ts +25 -0
- package/examples/limiter.ts +23 -0
- package/examples/llms.ts +37 -0
- package/examples/simple.ts +16 -0
- package/examples/speech.ts +38 -0
- package/examples/webhooks.ts +37 -0
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -1,64 +1,52 @@
|
|
|
1
|
-
<div align="center">
|
|
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">
|
|
3
|
-
</div>
|
|
4
|
-
|
|
5
1
|
<h1 align="center">Zaileys - Simplified WhatsApp Node.js API</h1>
|
|
6
2
|
|
|
7
3
|
<div align="center">
|
|
8
|
-
<
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
<a href="https://www.npmjs.com/package/zaileys">
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
<a href="https://github.com/zeative/zaileys">
|
|
15
|
-
|
|
16
|
-
</a>
|
|
17
|
-
<a href="https://github.com/zeative/zaileys">
|
|
18
|
-
<img src="https://img.shields.io/github/license/zeative/zaileys" alt="GitHub License">
|
|
19
|
-
</a>
|
|
20
|
-
<a href="https://github.com/zeative/zaileys">
|
|
21
|
-
<img src="https://img.shields.io/github/stars/zeative/zaileys" alt="GitHub Stars">
|
|
22
|
-
</a>
|
|
23
|
-
<a href="https://github.com/zeative/zaileys">
|
|
24
|
-
<img src="https://img.shields.io/github/forks/zeative/zaileys" alt="GitHub Forks">
|
|
25
|
-
</a>
|
|
4
|
+
<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>
|
|
26
12
|
</div>
|
|
27
13
|
|
|
28
|
-
|
|
29
|
-
|
|
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.
|
|
30
16
|
|
|
31
|
-
**
|
|
17
|
+
> **Note**: Stay updated and get support by joining our [WhatsApp Channel](https://whatsapp.com/channel/0029VazENbmInlqHIWzgn33h).
|
|
32
18
|
|
|
33
|
-
>
|
|
34
|
-
> Pairing code authentication is currently experiencing issues and is not supported. Use QR code authentication instead.
|
|
19
|
+
> **Warning**: Pairing code authentication is currently not supported due to issues. Use QR code authentication instead.
|
|
35
20
|
|
|
36
21
|
## π Table of Contents
|
|
37
22
|
|
|
38
|
-
1. [
|
|
39
|
-
2. [
|
|
40
|
-
3. [
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
-
|
|
54
|
-
-
|
|
55
|
-
-
|
|
56
|
-
-
|
|
57
|
-
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
23
|
+
1. [β¨ Features](#features)
|
|
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.
|
|
46
|
+
|
|
47
|
+
## π¦ Installation
|
|
48
|
+
|
|
49
|
+
Install Zaileys using your preferred package manager:
|
|
62
50
|
|
|
63
51
|
```bash
|
|
64
52
|
npm install zaileys
|
|
@@ -68,27 +56,39 @@ yarn add zaileys
|
|
|
68
56
|
pnpm add zaileys
|
|
69
57
|
```
|
|
70
58
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
59
|
+
**Requirements**:
|
|
60
|
+
|
|
61
|
+
- **Node.js**: Version 18 or higher.
|
|
62
|
+
- **Module System**: ESM or TypeScript only (no CommonJS).
|
|
63
|
+
- **Authentication**: QR code only (pairing code not supported).
|
|
64
|
+
- **Unsupported Runtimes**: Deno and Bun (due to `better-sqlite3` incompatibility).
|
|
65
|
+
|
|
66
|
+
## π Quick Start
|
|
67
|
+
|
|
68
|
+
Explore the `/examples` folder for practical use cases:
|
|
77
69
|
|
|
78
|
-
|
|
70
|
+
- [Simple Setup](https://github.com/zeative/zaileys/blob/main/examples/simple.ts): A minimal setup for quick prototyping.
|
|
71
|
+
- [Citation Example](https://github.com/zeative/zaileys/blob/main/examples/citation.ts): Demonstrates custom metadata with the citation mechanism.
|
|
72
|
+
- [Rate Limiting Example](https://github.com/zeative/zaileys/blob/main/examples/limiter.ts): Shows how to implement spam detection.
|
|
73
|
+
- [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
|
+
- [Voice Note with AI](https://github.com/zeative/zaileys/blob/main/examples/speech.ts): Interacts with AI using voice notes.
|
|
79
76
|
|
|
80
|
-
|
|
77
|
+
### Basic Example
|
|
81
78
|
|
|
82
79
|
```ts
|
|
83
80
|
import { Client } from "zaileys";
|
|
84
81
|
|
|
82
|
+
// default configuration
|
|
85
83
|
const wa = new Client({
|
|
86
|
-
prefix: "/",
|
|
87
|
-
ignoreMe: true,
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
84
|
+
prefix: "/",
|
|
85
|
+
ignoreMe: true,
|
|
86
|
+
showLogs: true,
|
|
87
|
+
autoRead: true,
|
|
88
|
+
autoOnline: true,
|
|
89
|
+
autoPresence: true,
|
|
90
|
+
autoRejectCall: true,
|
|
91
|
+
loadLLMSchemas: false,
|
|
92
92
|
database: {
|
|
93
93
|
type: "sqlite",
|
|
94
94
|
connection: { url: "./session/zaileys.db" },
|
|
@@ -100,31 +100,25 @@ wa.on("messages", async (ctx) => {
|
|
|
100
100
|
await wa.text("Hello!", { roomId: ctx.roomId });
|
|
101
101
|
}
|
|
102
102
|
});
|
|
103
|
-
|
|
104
|
-
wa.on("connection", (ctx) => {
|
|
105
|
-
console.log("Connection status:", ctx.status);
|
|
106
|
-
});
|
|
107
103
|
```
|
|
108
104
|
|
|
109
|
-
###
|
|
105
|
+
### Minimal Example
|
|
110
106
|
|
|
111
107
|
```ts
|
|
112
108
|
import { Client } from "zaileys";
|
|
113
109
|
|
|
114
|
-
const wa = new Client({
|
|
115
|
-
authType: "qr",
|
|
116
|
-
});
|
|
110
|
+
const wa = new Client({ authType: "qr" });
|
|
117
111
|
|
|
118
112
|
wa.on("messages", (ctx) => {
|
|
119
113
|
wa.text("Hello", { roomId: ctx.roomId });
|
|
120
114
|
});
|
|
121
115
|
```
|
|
122
116
|
|
|
123
|
-
##
|
|
117
|
+
## π Core Concepts
|
|
124
118
|
|
|
125
119
|
### Sessions & Authentication
|
|
126
120
|
|
|
127
|
-
Zaileys uses QR code authentication and stores
|
|
121
|
+
Zaileys uses QR code authentication and stores sessions in a database to avoid repeated QR scans.
|
|
128
122
|
|
|
129
123
|
```ts
|
|
130
124
|
import { Client } from "zaileys";
|
|
@@ -139,7 +133,7 @@ const wa = new Client({
|
|
|
139
133
|
|
|
140
134
|
### Citation Mechanism
|
|
141
135
|
|
|
142
|
-
Define custom metadata providers
|
|
136
|
+
Define custom metadata providers for dynamic boolean flags in `ctx.citation`. See [citation.ts](https://github.com/zeative/zaileys/blob/main/examples/citation.ts).
|
|
143
137
|
|
|
144
138
|
```ts
|
|
145
139
|
const wa = new Client({
|
|
@@ -156,117 +150,298 @@ wa.on("messages", (ctx) => {
|
|
|
156
150
|
});
|
|
157
151
|
```
|
|
158
152
|
|
|
159
|
-
|
|
153
|
+
### Rate Limiting
|
|
154
|
+
|
|
155
|
+
Detect and prevent spam with the built-in limiter. See [limiter.ts](https://github.com/zeative/zaileys/blob/main/examples/limiter.ts).
|
|
156
|
+
|
|
157
|
+
```ts
|
|
158
|
+
const wa = new Client({
|
|
159
|
+
authType: "qr",
|
|
160
|
+
|
|
161
|
+
// max 10 messages on 10 seconds
|
|
162
|
+
limiter: {
|
|
163
|
+
durationMs: 10000,
|
|
164
|
+
maxMessages: 5,
|
|
165
|
+
},
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
wa.on("messages", (ctx) => {
|
|
169
|
+
if (ctx.isSpam) {
|
|
170
|
+
wa.text("You're spamming!!", { roomId: ctx.roomId });
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
wa.text("Hello!", { roomId: ctx.roomId });
|
|
175
|
+
});
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Webhooks
|
|
179
|
+
|
|
180
|
+
Configure webhooks to handle external events. The URL is dynamically provided in the CLI upon running the app. See [webhooks.ts](https://github.com/zeative/zaileys/blob/main/examples/webhooks.ts).
|
|
181
|
+
|
|
182
|
+
```ts
|
|
183
|
+
const wa = new Client({
|
|
184
|
+
authType: "qr",
|
|
185
|
+
webhooks: {
|
|
186
|
+
url: "https://your-webhook-url.com",
|
|
187
|
+
},
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
wa.on("webhooks", (ctx) => {
|
|
191
|
+
console.log(ctx.data.query); // Query params
|
|
192
|
+
console.log(ctx.data.json); // JSON body
|
|
193
|
+
console.log(ctx.data.form); // Form data
|
|
194
|
+
console.log(ctx.data.raw); // Raw body
|
|
195
|
+
});
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
**Webhook Access**: Displayed in CLI on startup (e.g., `http://xxx.xxx.x.xxx:4135/webhooks`, Port: 4135, Methods: GET, POST).
|
|
199
|
+
|
|
200
|
+
## π‘ Event Handling
|
|
201
|
+
|
|
202
|
+
### Connection Events
|
|
203
|
+
|
|
204
|
+
Monitor connection status changes.
|
|
160
205
|
|
|
161
206
|
```ts
|
|
162
207
|
wa.on("connection", (ctx) => {
|
|
163
|
-
console.log(
|
|
208
|
+
console.log(`Connection: ${ctx.status}`);
|
|
164
209
|
});
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### Message Events
|
|
165
213
|
|
|
214
|
+
```ts
|
|
166
215
|
wa.on("messages", (ctx) => {
|
|
167
|
-
console.log(
|
|
216
|
+
console.log(ctx);
|
|
168
217
|
});
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
Schemas output of `ctx` type:
|
|
221
|
+
|
|
222
|
+
```json
|
|
223
|
+
{
|
|
224
|
+
"chatId": "string",
|
|
225
|
+
"channelId": "string",
|
|
226
|
+
"uniqueId": "string",
|
|
227
|
+
"receiverId": "string",
|
|
228
|
+
"receiverName": "string",
|
|
229
|
+
"roomId": "string",
|
|
230
|
+
"roomName": "string",
|
|
231
|
+
"senderId": "string",
|
|
232
|
+
"senderName": "string",
|
|
233
|
+
"senderDevice": "string",
|
|
234
|
+
"chatType": "string",
|
|
235
|
+
"timestamp": "number",
|
|
236
|
+
"mentions": "array",
|
|
237
|
+
"text": "string",
|
|
238
|
+
"links": "array",
|
|
239
|
+
"isPrefix": "boolean",
|
|
240
|
+
"isSpam": "boolean",
|
|
241
|
+
"isFromMe": "boolean",
|
|
242
|
+
"isTagMe": "boolean",
|
|
243
|
+
"isGroup": "boolean",
|
|
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.
|
|
169
268
|
|
|
269
|
+
```ts
|
|
170
270
|
wa.on("calls", (ctx) => {
|
|
171
|
-
|
|
271
|
+
console.log(ctx);
|
|
172
272
|
});
|
|
173
273
|
```
|
|
174
274
|
|
|
175
|
-
|
|
275
|
+
### Webhook Events
|
|
176
276
|
|
|
177
|
-
|
|
277
|
+
Handle external webhook requests.
|
|
278
|
+
|
|
279
|
+
```ts
|
|
280
|
+
wa.on("webhooks", (ctx) => {
|
|
281
|
+
console.log(ctx.data.query); // Query params
|
|
282
|
+
console.log(ctx.data.json); // JSON body
|
|
283
|
+
console.log(ctx.data.form); // Form data
|
|
284
|
+
console.log(ctx.data.raw); // Raw body
|
|
285
|
+
});
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
**Webhook Access**: Displayed in CLI on startup (e.g., `http://xxx.xxx.x.xxx:4135/webhooks`, Port: 4135, Methods: GET, POST).
|
|
289
|
+
|
|
290
|
+
## π© Sending Messages
|
|
291
|
+
|
|
292
|
+
### Basic Text Messages
|
|
293
|
+
|
|
294
|
+
Send simple or advanced text messages with options like replies or forwarding.
|
|
178
295
|
|
|
179
296
|
```ts
|
|
180
297
|
const roomId = ctx.roomId;
|
|
181
298
|
const message = ctx.message;
|
|
182
299
|
|
|
300
|
+
/* sending text */
|
|
183
301
|
wa.text("Hello", { roomId });
|
|
302
|
+
|
|
303
|
+
/* sending reply */
|
|
184
304
|
wa.text("Reply", { roomId, quoted: message });
|
|
305
|
+
|
|
306
|
+
/* sending forwarded */
|
|
185
307
|
wa.text("Forwarded", { roomId, asForwarded: true });
|
|
308
|
+
|
|
309
|
+
/* fake verified (just work on reply message only!) */
|
|
186
310
|
wa.text("Verified reply", { roomId, quoted: message, verifiedReply: "whatsapp" });
|
|
311
|
+
|
|
312
|
+
/* mark as ai (just work on private message only!) */
|
|
313
|
+
wa.text("Mark AI Message!", { roomId, asAI: true });
|
|
314
|
+
|
|
315
|
+
/* sending view once */
|
|
187
316
|
wa.text({ image: "https://example.com/image.png", text: "View once" }, { roomId, asViewOnce: true });
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
### Message Reactions, Edits, and Deletion
|
|
320
|
+
|
|
321
|
+
Add reactions, edit, or delete messages.
|
|
322
|
+
|
|
323
|
+
```ts
|
|
324
|
+
/* sending reaction */
|
|
188
325
|
wa.reaction("π", { message });
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
wa.
|
|
326
|
+
|
|
327
|
+
/* sending edit */
|
|
328
|
+
const original = await wa.text("Will edit", { roomId });
|
|
329
|
+
wa.edit("Edited", { message: original?.message });
|
|
330
|
+
|
|
331
|
+
/* sending delete */
|
|
332
|
+
const original = await wa.text("Will delete", { roomId });
|
|
333
|
+
wa.delete("Deleted", { message: original?.message });
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
### Polls
|
|
337
|
+
|
|
338
|
+
Create interactive polls.
|
|
339
|
+
|
|
340
|
+
```ts
|
|
341
|
+
/* sending polling */
|
|
193
342
|
wa.poll({ name: "Do you love me?", answers: ["Yes", "Maybe", "No"] }, { roomId });
|
|
194
343
|
```
|
|
195
344
|
|
|
196
|
-
###
|
|
345
|
+
### Contacts
|
|
346
|
+
|
|
347
|
+
Share contact information.
|
|
348
|
+
|
|
349
|
+
```ts
|
|
350
|
+
/* sending contact */
|
|
351
|
+
wa.contact({ fullname: "Kejaa", whatsAppNumber: 628123456789 }, { roomId });
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
### Location
|
|
197
355
|
|
|
198
|
-
|
|
356
|
+
Share geographic coordinates.
|
|
357
|
+
|
|
358
|
+
```ts
|
|
359
|
+
/* sending location */
|
|
360
|
+
wa.location({ latitude: 24.121231, longitude: 55.1121221 }, { roomId });
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
## πΌ Sending Media
|
|
364
|
+
|
|
365
|
+
### Images and Stickers
|
|
366
|
+
|
|
367
|
+
Send images or stickers from URLs or local files.
|
|
199
368
|
|
|
200
369
|
```ts
|
|
201
370
|
import fs from "fs";
|
|
202
371
|
|
|
203
|
-
|
|
204
|
-
wa.text({ image: "https://
|
|
372
|
+
/* sending by url */
|
|
373
|
+
wa.text({ image: "https://github.com/zeative.png", text: "Image" }, { roomId });
|
|
374
|
+
|
|
375
|
+
/* sending by file */
|
|
205
376
|
wa.text({ image: fs.readFileSync("example/image.png"), text: "Image" }, { roomId });
|
|
206
377
|
|
|
207
|
-
|
|
208
|
-
wa.text({ sticker: "https://
|
|
209
|
-
|
|
378
|
+
/* sending sticker */
|
|
379
|
+
wa.text({ sticker: "https://github.com/zeative.png" }, { roomId });
|
|
380
|
+
```
|
|
210
381
|
|
|
211
|
-
|
|
212
|
-
wa.text({ gif: "https://example.com/video.mp4" }, { roomId });
|
|
213
|
-
wa.text({ gif: fs.readFileSync("example/video.mp4") }, { roomId });
|
|
382
|
+
### Videos and GIFs
|
|
214
383
|
|
|
215
|
-
|
|
384
|
+
Send videos or GIFs with optional captions.
|
|
385
|
+
|
|
386
|
+
```ts
|
|
387
|
+
/* sending video */
|
|
216
388
|
wa.text({ video: "https://example.com/video.mp4", text: "Video" }, { roomId });
|
|
217
|
-
wa.text({ video: fs.readFileSync("example/video.mp4"), text: "Video" }, { roomId });
|
|
218
389
|
|
|
219
|
-
|
|
220
|
-
wa.text({
|
|
221
|
-
wa.text({ videoNote: fs.readFileSync("example/video.mp4") }, { roomId });
|
|
390
|
+
/* sending video as circle */
|
|
391
|
+
wa.text({ note: "https://example.com/video.mp4", text: "Video" }, { roomId });
|
|
222
392
|
|
|
223
|
-
|
|
393
|
+
/* sending gif */
|
|
394
|
+
wa.text({ gif: "https://example.com/video.mp4" }, { roomId });
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
### Audio and Voice Notes
|
|
398
|
+
|
|
399
|
+
Send audio files or voice notes (use `.ogg` for compatibility).
|
|
400
|
+
|
|
401
|
+
```ts
|
|
402
|
+
/* sending audio (recommended use .ogg format) */
|
|
224
403
|
wa.text({ audio: "https://example.com/audio.ogg" }, { roomId });
|
|
225
|
-
wa.text({ audio: fs.readFileSync("example/audio.ogg") }, { roomId });
|
|
226
404
|
|
|
227
|
-
|
|
228
|
-
wa.text({
|
|
229
|
-
wa.text({ audioNote: fs.readFileSync("example/audio.ogg") }, { roomId });
|
|
405
|
+
/* sending voice note (recommended use .ogg format) */
|
|
406
|
+
wa.text({ voice: "https://example.com/audio.ogg" }, { roomId });
|
|
230
407
|
```
|
|
231
408
|
|
|
232
|
-
|
|
409
|
+
## π§ Advanced Actions
|
|
410
|
+
|
|
411
|
+
### Presence Updates
|
|
412
|
+
|
|
413
|
+
Update the botβs presence status in a chat.
|
|
233
414
|
|
|
234
415
|
```ts
|
|
235
416
|
wa.presence("typing", { roomId }); // Options: typing, recording, online, offline, paused
|
|
236
417
|
```
|
|
237
418
|
|
|
238
|
-
###
|
|
419
|
+
### Profile Retrieval
|
|
420
|
+
|
|
421
|
+
Fetch user or group profiles.
|
|
239
422
|
|
|
240
423
|
```ts
|
|
241
424
|
wa.profile("628123456789@s.whatsapp.net"); // User profile
|
|
242
425
|
wa.profile("1209999@g.us"); // Group profile
|
|
243
426
|
```
|
|
244
427
|
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
```ts
|
|
248
|
-
wa.on("calls", (ctx) => {
|
|
249
|
-
wa.rejectCall({ callId: ctx.callId, callerId: ctx.callerId });
|
|
250
|
-
});
|
|
251
|
-
```
|
|
252
|
-
|
|
253
|
-
## π Issues & Feedback
|
|
428
|
+
## π Issues & Feedback
|
|
254
429
|
|
|
255
|
-
|
|
430
|
+
Encounter a bug or have a feature request? Submit it on our [GitHub Issues](https://github.com/zeative/zaileys/issues) page.
|
|
256
431
|
|
|
257
432
|
## β€οΈ Support
|
|
258
433
|
|
|
259
|
-
|
|
434
|
+
Show your support for Zaileys:
|
|
260
435
|
|
|
261
436
|
- [Buy me a coffee β](https://saweria.co/zaadevofc)
|
|
262
|
-
- β Star the
|
|
437
|
+
- β Star the repository on [GitHub](https://github.com/zeative/zaileys)
|
|
263
438
|
|
|
264
|
-
##
|
|
439
|
+
## π License
|
|
265
440
|
|
|
266
|
-
[MIT License](https://github.com/zeative/zaileys/blob/main/LICENSE).
|
|
441
|
+
Zaileys is licensed under the [MIT License](https://github.com/zeative/zaileys/blob/main/LICENSE).
|
|
267
442
|
|
|
268
|
-
##
|
|
443
|
+
## π Acknowledgements
|
|
269
444
|
|
|
270
|
-
|
|
445
|
+
Powered by [Baileys](https://github.com/WhiskeySockets/Baileys) from Whiskey Sockets.
|
|
271
446
|
|
|
272
|
-
|
|
447
|
+
Happy coding! π
|