wuzapi 1.0.0
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/LICENSE +21 -0
- package/README.md +547 -0
- package/dist/index.js +392 -0
- package/dist/index.js.map +1 -0
- package/dist/vite.svg +1 -0
- package/package.json +58 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Gus
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,547 @@
|
|
|
1
|
+
# WuzAPI Client
|
|
2
|
+
|
|
3
|
+
A comprehensive TypeScript client library for the [WuzAPI WhatsApp API](https://github.com/asternic/wuzapi). This library provides a simple and intuitive interface to interact with WhatsApp through the WuzAPI service.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- 🔥 **Full TypeScript Support** - Complete type definitions for all API endpoints
|
|
8
|
+
- 🏗️ **Modular Architecture** - Organized by functionality (admin, session, chat, user, group, webhook)
|
|
9
|
+
- 🚀 **Promise-based** - Modern async/await support
|
|
10
|
+
- 🛡️ **Error Handling** - Comprehensive error handling with detailed error types
|
|
11
|
+
- 📦 **Tree Shakable** - Import only what you need
|
|
12
|
+
- 🔧 **Easy Configuration** - Simple setup with minimal configuration
|
|
13
|
+
- 📖 **Well Documented** - Extensive documentation and examples
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install wuzapi
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
or
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
yarn add wuzapi
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Quick Start
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
import WuzapiClient from "wuzapi";
|
|
31
|
+
|
|
32
|
+
const client = new WuzapiClient({
|
|
33
|
+
apiUrl: "http://localhost:8080",
|
|
34
|
+
token: "your-user-token",
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
// Connect to WhatsApp
|
|
38
|
+
await client.session.connect({
|
|
39
|
+
Subscribe: ["Message", "ReadReceipt"],
|
|
40
|
+
Immediate: false,
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
// Send a text message
|
|
44
|
+
await client.chat.sendText({
|
|
45
|
+
Phone: "5491155554444",
|
|
46
|
+
Body: "Hello from WuzAPI!",
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
// Get session status
|
|
50
|
+
const status = await client.session.getStatus();
|
|
51
|
+
console.log("Connected:", status.Connected);
|
|
52
|
+
console.log("Logged In:", status.LoggedIn);
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Configuration
|
|
56
|
+
|
|
57
|
+
The client requires a configuration object with the following properties:
|
|
58
|
+
|
|
59
|
+
```typescript
|
|
60
|
+
interface WuzapiConfig {
|
|
61
|
+
apiUrl: string; // The WuzAPI server URL
|
|
62
|
+
token: string; // Your user authentication token
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## API Modules
|
|
67
|
+
|
|
68
|
+
The client is organized into logical modules:
|
|
69
|
+
|
|
70
|
+
### Session Module
|
|
71
|
+
|
|
72
|
+
Manage WhatsApp connection and session state.
|
|
73
|
+
|
|
74
|
+
```typescript
|
|
75
|
+
// Connect to WhatsApp
|
|
76
|
+
await client.session.connect({
|
|
77
|
+
Subscribe: ["Message", "ReadReceipt", "HistorySync"],
|
|
78
|
+
Immediate: false,
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
// Get connection status
|
|
82
|
+
const status = await client.session.getStatus();
|
|
83
|
+
|
|
84
|
+
// Get QR code for initial setup
|
|
85
|
+
const qr = await client.session.getQRCode();
|
|
86
|
+
|
|
87
|
+
// Disconnect (keeps session)
|
|
88
|
+
await client.session.disconnect();
|
|
89
|
+
|
|
90
|
+
// Logout (destroys session)
|
|
91
|
+
await client.session.logout();
|
|
92
|
+
|
|
93
|
+
// Configure S3 storage
|
|
94
|
+
await client.session.configureS3({
|
|
95
|
+
enabled: true,
|
|
96
|
+
endpoint: "https://s3.amazonaws.com",
|
|
97
|
+
region: "us-east-1",
|
|
98
|
+
bucket: "my-bucket",
|
|
99
|
+
accessKey: "AKIAIOSFODNN7EXAMPLE",
|
|
100
|
+
secretKey: "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
|
|
101
|
+
pathStyle: false,
|
|
102
|
+
mediaDelivery: "both",
|
|
103
|
+
retentionDays: 30,
|
|
104
|
+
});
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Chat Module
|
|
108
|
+
|
|
109
|
+
Send messages and manage chat interactions.
|
|
110
|
+
|
|
111
|
+
```typescript
|
|
112
|
+
// Send text message
|
|
113
|
+
await client.chat.sendText({
|
|
114
|
+
Phone: "5491155554444",
|
|
115
|
+
Body: "Hello World!",
|
|
116
|
+
Id: "optional-message-id",
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
// Reply to a message
|
|
120
|
+
await client.chat.sendText({
|
|
121
|
+
Phone: "5491155554444",
|
|
122
|
+
Body: "This is a reply",
|
|
123
|
+
ContextInfo: {
|
|
124
|
+
StanzaId: "original-message-id",
|
|
125
|
+
Participant: "5491155553935@s.whatsapp.net",
|
|
126
|
+
},
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
// Send image
|
|
130
|
+
await client.chat.sendImage({
|
|
131
|
+
Phone: "5491155554444",
|
|
132
|
+
Image: "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQ...",
|
|
133
|
+
Caption: "Check this out!",
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
// Send template message with buttons
|
|
137
|
+
await client.chat.sendTemplate({
|
|
138
|
+
Phone: "5491155554444",
|
|
139
|
+
Content: "Choose an option:",
|
|
140
|
+
Footer: "Powered by WuzAPI",
|
|
141
|
+
Buttons: [
|
|
142
|
+
{ DisplayText: "Yes", Type: "quickreply" },
|
|
143
|
+
{ DisplayText: "No", Type: "quickreply" },
|
|
144
|
+
{ DisplayText: "Visit Site", Type: "url", Url: "https://example.com" },
|
|
145
|
+
{ DisplayText: "Call Us", Type: "call", PhoneNumber: "1155554444" },
|
|
146
|
+
],
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
// Send location
|
|
150
|
+
await client.chat.sendLocation({
|
|
151
|
+
Phone: "5491155554444",
|
|
152
|
+
Latitude: 48.85837,
|
|
153
|
+
Longitude: 2.294481,
|
|
154
|
+
Name: "Eiffel Tower, Paris",
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
// Send contact
|
|
158
|
+
await client.chat.sendContact({
|
|
159
|
+
Phone: "5491155554444",
|
|
160
|
+
Name: "John Doe",
|
|
161
|
+
Vcard:
|
|
162
|
+
"BEGIN:VCARD\nVERSION:3.0\nN:Doe;John;;;\nFN:John Doe\nTEL:+1234567890\nEND:VCARD",
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
// Mark messages as read
|
|
166
|
+
await client.chat.markRead({
|
|
167
|
+
Id: ["message-id-1", "message-id-2"],
|
|
168
|
+
Chat: "5491155553934@s.whatsapp.net",
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
// React to message
|
|
172
|
+
await client.chat.react({
|
|
173
|
+
Phone: "5491155554444",
|
|
174
|
+
Body: "❤️",
|
|
175
|
+
Id: "message-id-to-react-to",
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
// Download media
|
|
179
|
+
const media = await client.chat.downloadImage({
|
|
180
|
+
Url: "https://mmg.whatsapp.net/d/f/...",
|
|
181
|
+
MediaKey: "media-key...",
|
|
182
|
+
Mimetype: "image/jpeg",
|
|
183
|
+
FileSHA256: "file-hash...",
|
|
184
|
+
FileLength: 2039,
|
|
185
|
+
});
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### User Module
|
|
189
|
+
|
|
190
|
+
Get information about WhatsApp users.
|
|
191
|
+
|
|
192
|
+
```typescript
|
|
193
|
+
// Check if numbers are WhatsApp users
|
|
194
|
+
const check = await client.user.check(["5491155554444", "5491155554445"]);
|
|
195
|
+
|
|
196
|
+
// Get user information
|
|
197
|
+
const info = await client.user.getInfo(["5491155554444"]);
|
|
198
|
+
|
|
199
|
+
// Get user avatar
|
|
200
|
+
const avatar = await client.user.getAvatar("5491155554444", true); // true for preview
|
|
201
|
+
|
|
202
|
+
// Get all contacts
|
|
203
|
+
const contacts = await client.user.getContacts();
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### Group Module
|
|
207
|
+
|
|
208
|
+
Manage WhatsApp groups.
|
|
209
|
+
|
|
210
|
+
```typescript
|
|
211
|
+
// List all groups
|
|
212
|
+
const groups = await client.group.list();
|
|
213
|
+
|
|
214
|
+
// Create a group
|
|
215
|
+
const newGroup = await client.group.create("My New Group", [
|
|
216
|
+
"5491155553934",
|
|
217
|
+
"5491155553935",
|
|
218
|
+
]);
|
|
219
|
+
|
|
220
|
+
// Get group info
|
|
221
|
+
const groupInfo = await client.group.getInfo("120362023605733675@g.us");
|
|
222
|
+
|
|
223
|
+
// Set group name
|
|
224
|
+
await client.group.setName("120362023605733675@g.us", "New Group Name");
|
|
225
|
+
|
|
226
|
+
// Set group photo (JPEG only)
|
|
227
|
+
await client.group.setPhoto(
|
|
228
|
+
"120362023605733675@g.us",
|
|
229
|
+
"data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQ..."
|
|
230
|
+
);
|
|
231
|
+
|
|
232
|
+
// Get invite link
|
|
233
|
+
const invite = await client.group.getInviteLink("120362023605733675@g.us");
|
|
234
|
+
|
|
235
|
+
// Set group locked (only admins can modify info)
|
|
236
|
+
await client.group.setLocked("120362023605733675@g.us", true);
|
|
237
|
+
|
|
238
|
+
// Set disappearing messages
|
|
239
|
+
await client.group.setEphemeral("120362023605733675@g.us", "24h"); // '24h', '7d', '90d', or 'off'
|
|
240
|
+
|
|
241
|
+
// Remove group photo
|
|
242
|
+
await client.group.removePhoto("120362023605733675@g.us");
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
### Admin Module
|
|
246
|
+
|
|
247
|
+
Manage users (requires admin token).
|
|
248
|
+
|
|
249
|
+
```typescript
|
|
250
|
+
// Create admin client
|
|
251
|
+
const adminClient = new WuzapiClient({
|
|
252
|
+
apiUrl: "http://localhost:8080",
|
|
253
|
+
token: "your-admin-token",
|
|
254
|
+
});
|
|
255
|
+
|
|
256
|
+
// List all users
|
|
257
|
+
const users = await adminClient.admin.listUsers();
|
|
258
|
+
|
|
259
|
+
// Add new user
|
|
260
|
+
const newUser = await adminClient.admin.addUser({
|
|
261
|
+
name: "John Doe",
|
|
262
|
+
token: "user-token-123",
|
|
263
|
+
webhook: "https://example.com/webhook",
|
|
264
|
+
events: "Message,ReadReceipt",
|
|
265
|
+
proxyConfig: {
|
|
266
|
+
enabled: true,
|
|
267
|
+
proxyURL: "socks5://user:pass@proxy:port",
|
|
268
|
+
},
|
|
269
|
+
s3Config: {
|
|
270
|
+
enabled: true,
|
|
271
|
+
endpoint: "https://s3.amazonaws.com",
|
|
272
|
+
region: "us-east-1",
|
|
273
|
+
bucket: "user-media-bucket",
|
|
274
|
+
accessKey: "AKIA...",
|
|
275
|
+
secretKey: "secret...",
|
|
276
|
+
pathStyle: false,
|
|
277
|
+
mediaDelivery: "both",
|
|
278
|
+
retentionDays: 30,
|
|
279
|
+
},
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
// Delete user
|
|
283
|
+
await adminClient.admin.deleteUser(2);
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
### Webhook Module
|
|
287
|
+
|
|
288
|
+
Configure webhook settings.
|
|
289
|
+
|
|
290
|
+
```typescript
|
|
291
|
+
// Set webhook URL
|
|
292
|
+
await client.webhook.setWebhook("https://my-server.com/webhook");
|
|
293
|
+
|
|
294
|
+
// Get current webhook configuration
|
|
295
|
+
const webhookConfig = await client.webhook.getWebhook();
|
|
296
|
+
console.log("Webhook URL:", webhookConfig.webhook);
|
|
297
|
+
console.log("Subscribed events:", webhookConfig.subscribe);
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
## Error Handling
|
|
301
|
+
|
|
302
|
+
The library provides comprehensive error handling with detailed error information:
|
|
303
|
+
|
|
304
|
+
```typescript
|
|
305
|
+
import { WuzapiError } from "wuzapi";
|
|
306
|
+
|
|
307
|
+
try {
|
|
308
|
+
await client.chat.sendText({
|
|
309
|
+
Phone: "invalid-number",
|
|
310
|
+
Body: "This will fail",
|
|
311
|
+
});
|
|
312
|
+
} catch (error) {
|
|
313
|
+
if (error instanceof WuzapiError) {
|
|
314
|
+
console.error("WuzAPI Error:", {
|
|
315
|
+
code: error.code,
|
|
316
|
+
message: error.message,
|
|
317
|
+
details: error.details,
|
|
318
|
+
});
|
|
319
|
+
} else {
|
|
320
|
+
console.error("Unexpected error:", error);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
### Error Types
|
|
326
|
+
|
|
327
|
+
- **Network Errors**: Connection issues, timeouts
|
|
328
|
+
- **Authentication Errors**: Invalid tokens, permission denied
|
|
329
|
+
- **API Errors**: Invalid parameters, service unavailable
|
|
330
|
+
- **Validation Errors**: Missing required fields, invalid data formats
|
|
331
|
+
|
|
332
|
+
## TypeScript Support
|
|
333
|
+
|
|
334
|
+
The library is built with TypeScript and provides complete type definitions:
|
|
335
|
+
|
|
336
|
+
```typescript
|
|
337
|
+
import {
|
|
338
|
+
WuzapiClient,
|
|
339
|
+
SendTextRequest,
|
|
340
|
+
SendMessageResponse,
|
|
341
|
+
GroupInfo,
|
|
342
|
+
User,
|
|
343
|
+
} from "wuzapi";
|
|
344
|
+
|
|
345
|
+
// All API requests and responses are fully typed
|
|
346
|
+
const request: SendTextRequest = {
|
|
347
|
+
Phone: "5491155554444",
|
|
348
|
+
Body: "Typed message",
|
|
349
|
+
};
|
|
350
|
+
|
|
351
|
+
const response: SendMessageResponse = await client.chat.sendText(request);
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
## Legacy Aliases
|
|
355
|
+
|
|
356
|
+
For convenience, the library provides some legacy aliases:
|
|
357
|
+
|
|
358
|
+
```typescript
|
|
359
|
+
// These are equivalent:
|
|
360
|
+
await client.user.check(["5491155554444"]);
|
|
361
|
+
await client.users.check(["5491155554444"]); // Alias
|
|
362
|
+
|
|
363
|
+
await client.chat.sendText({ Phone: "123", Body: "Hi" });
|
|
364
|
+
await client.message.sendText({ Phone: "123", Body: "Hi" }); // Alias
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
## Advanced Usage
|
|
368
|
+
|
|
369
|
+
### Custom Axios Configuration
|
|
370
|
+
|
|
371
|
+
You can extend the base client for custom axios configuration:
|
|
372
|
+
|
|
373
|
+
```typescript
|
|
374
|
+
import { BaseClient } from "wuzapi";
|
|
375
|
+
|
|
376
|
+
class CustomClient extends BaseClient {
|
|
377
|
+
constructor(config: WuzapiConfig) {
|
|
378
|
+
super(config);
|
|
379
|
+
|
|
380
|
+
// Add custom interceptors
|
|
381
|
+
this.axios.interceptors.request.use((config) => {
|
|
382
|
+
console.log("Making request:", config.url);
|
|
383
|
+
return config;
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
### Ping Test
|
|
390
|
+
|
|
391
|
+
Test connectivity to the API:
|
|
392
|
+
|
|
393
|
+
```typescript
|
|
394
|
+
const isConnected = await client.ping();
|
|
395
|
+
if (isConnected) {
|
|
396
|
+
console.log("API is reachable");
|
|
397
|
+
} else {
|
|
398
|
+
console.log("API is not reachable");
|
|
399
|
+
}
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
## Examples
|
|
403
|
+
|
|
404
|
+
### Complete Chat Bot Example
|
|
405
|
+
|
|
406
|
+
```typescript
|
|
407
|
+
import WuzapiClient from "wuzapi";
|
|
408
|
+
|
|
409
|
+
const client = new WuzapiClient({
|
|
410
|
+
apiUrl: "http://localhost:8080",
|
|
411
|
+
token: "your-token",
|
|
412
|
+
});
|
|
413
|
+
|
|
414
|
+
async function startBot() {
|
|
415
|
+
// Connect to WhatsApp
|
|
416
|
+
await client.session.connect({
|
|
417
|
+
Subscribe: ["Message"],
|
|
418
|
+
Immediate: false,
|
|
419
|
+
});
|
|
420
|
+
|
|
421
|
+
// Wait for connection
|
|
422
|
+
let connected = false;
|
|
423
|
+
while (!connected) {
|
|
424
|
+
const status = await client.session.getStatus();
|
|
425
|
+
if (!status.LoggedIn) {
|
|
426
|
+
const qr = await client.session.getQRCode();
|
|
427
|
+
console.log("Scan this QR code:", qr.QRCode);
|
|
428
|
+
await new Promise((resolve) => setTimeout(resolve, 5000));
|
|
429
|
+
} else {
|
|
430
|
+
connected = true;
|
|
431
|
+
console.log("Bot connected and ready!");
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
// Set webhook for receiving messages
|
|
436
|
+
await client.webhook.setWebhook("https://your-server.com/webhook");
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
// Handle incoming messages in your webhook endpoint
|
|
440
|
+
function handleIncomingMessage(message: any) {
|
|
441
|
+
const phone = message.Info.RemoteJid.replace("@s.whatsapp.net", "");
|
|
442
|
+
const text = message.Message?.conversation || "";
|
|
443
|
+
|
|
444
|
+
if (text.toLowerCase() === "hello") {
|
|
445
|
+
client.chat.sendText({
|
|
446
|
+
Phone: phone,
|
|
447
|
+
Body: "Hello! How can I help you today?",
|
|
448
|
+
});
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
startBot().catch(console.error);
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
### Group Management Example
|
|
456
|
+
|
|
457
|
+
```typescript
|
|
458
|
+
async function manageGroup() {
|
|
459
|
+
// Create a new group
|
|
460
|
+
const group = await client.group.create("Project Team", [
|
|
461
|
+
"5491155553934",
|
|
462
|
+
"5491155553935",
|
|
463
|
+
]);
|
|
464
|
+
|
|
465
|
+
console.log("Created group:", group.JID);
|
|
466
|
+
|
|
467
|
+
// Set group photo
|
|
468
|
+
await client.group.setPhoto(group.JID, "data:image/jpeg;base64,...");
|
|
469
|
+
|
|
470
|
+
// Configure group settings
|
|
471
|
+
await client.group.setLocked(group.JID, true); // Only admins can modify
|
|
472
|
+
await client.group.setEphemeral(group.JID, "7d"); // Messages disappear after 7 days
|
|
473
|
+
|
|
474
|
+
// Get and share invite link
|
|
475
|
+
const invite = await client.group.getInviteLink(group.JID);
|
|
476
|
+
console.log("Invite link:", invite.InviteLink);
|
|
477
|
+
}
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
## API Reference
|
|
481
|
+
|
|
482
|
+
For detailed API documentation, refer to the [WuzAPI documentation](https://github.com/asternic/wuzapi/blob/main/API.md).
|
|
483
|
+
|
|
484
|
+
## Contributing
|
|
485
|
+
|
|
486
|
+
1. Fork the repository
|
|
487
|
+
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
|
|
488
|
+
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
|
|
489
|
+
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
490
|
+
5. Open a Pull Request
|
|
491
|
+
|
|
492
|
+
### Development Setup
|
|
493
|
+
|
|
494
|
+
```bash
|
|
495
|
+
# Clone the repository
|
|
496
|
+
git clone https://github.com/your-username/wuzapi.git
|
|
497
|
+
cd wuzapi
|
|
498
|
+
|
|
499
|
+
# Install dependencies
|
|
500
|
+
npm install
|
|
501
|
+
|
|
502
|
+
# Run linter
|
|
503
|
+
npm run lint
|
|
504
|
+
|
|
505
|
+
# Build the project
|
|
506
|
+
npm run build
|
|
507
|
+
|
|
508
|
+
# Run development server
|
|
509
|
+
npm run dev
|
|
510
|
+
```
|
|
511
|
+
|
|
512
|
+
### Code Style
|
|
513
|
+
|
|
514
|
+
This project uses ESLint and TypeScript. Please ensure your code passes all checks:
|
|
515
|
+
|
|
516
|
+
```bash
|
|
517
|
+
npm run lint
|
|
518
|
+
npm run lint:fix # Auto-fix issues
|
|
519
|
+
```
|
|
520
|
+
|
|
521
|
+
## License
|
|
522
|
+
|
|
523
|
+
MIT License - see the [LICENSE](LICENSE) file for details.
|
|
524
|
+
|
|
525
|
+
## Support
|
|
526
|
+
|
|
527
|
+
- 📚 [Documentation](https://github.com/asternic/wuzapi)
|
|
528
|
+
- 🐛 [Issue Tracker](https://github.com/your-username/wuzapi/issues)
|
|
529
|
+
- 💬 [Discussions](https://github.com/your-username/wuzapi/discussions)
|
|
530
|
+
|
|
531
|
+
## Changelog
|
|
532
|
+
|
|
533
|
+
### 1.0.0
|
|
534
|
+
|
|
535
|
+
- Initial release
|
|
536
|
+
- Full TypeScript support
|
|
537
|
+
- Complete API coverage
|
|
538
|
+
- Modular architecture
|
|
539
|
+
- Comprehensive error handling
|
|
540
|
+
- S3 storage integration support
|
|
541
|
+
- Admin user management
|
|
542
|
+
- Group management features
|
|
543
|
+
- Webhook configuration
|
|
544
|
+
|
|
545
|
+
---
|
|
546
|
+
|
|
547
|
+
Made with ❤️ for the WhatsApp automation community.
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
import axios from "axios";
|
|
2
|
+
class WuzapiError extends Error {
|
|
3
|
+
code;
|
|
4
|
+
details;
|
|
5
|
+
constructor(code, message, details) {
|
|
6
|
+
super(message);
|
|
7
|
+
this.name = "WuzapiError";
|
|
8
|
+
this.code = code;
|
|
9
|
+
this.details = details;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
class BaseClient {
|
|
13
|
+
axios;
|
|
14
|
+
config;
|
|
15
|
+
constructor(config) {
|
|
16
|
+
this.config = config;
|
|
17
|
+
this.axios = axios.create({
|
|
18
|
+
baseURL: config.apiUrl,
|
|
19
|
+
headers: {
|
|
20
|
+
"Content-Type": "application/json",
|
|
21
|
+
Authorization: config.token
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
this.axios.interceptors.response.use(
|
|
25
|
+
(response) => response,
|
|
26
|
+
(error) => {
|
|
27
|
+
if (error.response) {
|
|
28
|
+
const data = error.response.data;
|
|
29
|
+
throw new WuzapiError(
|
|
30
|
+
data.code || error.response.status,
|
|
31
|
+
data.message || error.message,
|
|
32
|
+
data
|
|
33
|
+
);
|
|
34
|
+
} else if (error.request) {
|
|
35
|
+
throw new WuzapiError(0, "Network error: No response from server");
|
|
36
|
+
} else {
|
|
37
|
+
throw new WuzapiError(0, error.message);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
async request(method, endpoint, data) {
|
|
43
|
+
const response = await this.axios.request({
|
|
44
|
+
method,
|
|
45
|
+
url: endpoint,
|
|
46
|
+
data
|
|
47
|
+
});
|
|
48
|
+
if (!response.data.success) {
|
|
49
|
+
throw new WuzapiError(
|
|
50
|
+
response.data.code,
|
|
51
|
+
"API request failed",
|
|
52
|
+
response.data
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
return response.data.data;
|
|
56
|
+
}
|
|
57
|
+
async get(endpoint) {
|
|
58
|
+
return this.request("GET", endpoint);
|
|
59
|
+
}
|
|
60
|
+
async post(endpoint, data) {
|
|
61
|
+
return this.request("POST", endpoint, data);
|
|
62
|
+
}
|
|
63
|
+
async delete(endpoint) {
|
|
64
|
+
return this.request("DELETE", endpoint);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
class AdminModule extends BaseClient {
|
|
68
|
+
/**
|
|
69
|
+
* List all users
|
|
70
|
+
*/
|
|
71
|
+
async listUsers() {
|
|
72
|
+
return this.get("/admin/users");
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Add a new user
|
|
76
|
+
*/
|
|
77
|
+
async addUser(user) {
|
|
78
|
+
return this.post("/admin/users", user);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Delete a user by ID
|
|
82
|
+
*/
|
|
83
|
+
async deleteUser(id) {
|
|
84
|
+
return this.delete(`/admin/users/${id}`);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
class SessionModule extends BaseClient {
|
|
88
|
+
/**
|
|
89
|
+
* Connect to WhatsApp servers
|
|
90
|
+
*/
|
|
91
|
+
async connect(options) {
|
|
92
|
+
return this.post("/session/connect", options);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Disconnect from WhatsApp servers
|
|
96
|
+
*/
|
|
97
|
+
async disconnect() {
|
|
98
|
+
return this.post("/session/disconnect");
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Logout and finish the session
|
|
102
|
+
*/
|
|
103
|
+
async logout() {
|
|
104
|
+
return this.post("/session/logout");
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Get session status
|
|
108
|
+
*/
|
|
109
|
+
async getStatus() {
|
|
110
|
+
return this.get("/session/status");
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Get QR code for scanning
|
|
114
|
+
*/
|
|
115
|
+
async getQRCode() {
|
|
116
|
+
return this.get("/session/qr");
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Configure S3 storage
|
|
120
|
+
*/
|
|
121
|
+
async configureS3(config) {
|
|
122
|
+
return this.post("/session/s3/config", config);
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Get S3 configuration
|
|
126
|
+
*/
|
|
127
|
+
async getS3Config() {
|
|
128
|
+
return this.get("/session/s3/config");
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Test S3 connection
|
|
132
|
+
*/
|
|
133
|
+
async testS3() {
|
|
134
|
+
return this.post("/session/s3/test");
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Delete S3 configuration
|
|
138
|
+
*/
|
|
139
|
+
async deleteS3Config() {
|
|
140
|
+
return this.delete("/session/s3/config");
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
class UserModule extends BaseClient {
|
|
144
|
+
/**
|
|
145
|
+
* Get user details for specified phone numbers
|
|
146
|
+
*/
|
|
147
|
+
async getInfo(phones) {
|
|
148
|
+
const request = { Phone: phones };
|
|
149
|
+
return this.post("/user/info", request);
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Check if phone numbers are registered WhatsApp users
|
|
153
|
+
*/
|
|
154
|
+
async check(phones) {
|
|
155
|
+
const request = { Phone: phones };
|
|
156
|
+
return this.post("/user/check", request);
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Get user avatar/profile picture
|
|
160
|
+
*/
|
|
161
|
+
async getAvatar(phone, preview = true) {
|
|
162
|
+
const request = { Phone: phone, Preview: preview };
|
|
163
|
+
return this.post("/user/avatar", request);
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Get all contacts
|
|
167
|
+
*/
|
|
168
|
+
async getContacts() {
|
|
169
|
+
return this.get("/user/contacts");
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
class ChatModule extends BaseClient {
|
|
173
|
+
/**
|
|
174
|
+
* Send a text message
|
|
175
|
+
*/
|
|
176
|
+
async sendText(request) {
|
|
177
|
+
return this.post("/chat/send/text", request);
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Send a template message with buttons
|
|
181
|
+
*/
|
|
182
|
+
async sendTemplate(request) {
|
|
183
|
+
return this.post("/chat/send/template", request);
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Send an audio message
|
|
187
|
+
*/
|
|
188
|
+
async sendAudio(request) {
|
|
189
|
+
return this.post("/chat/send/audio", request);
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Send an image message
|
|
193
|
+
*/
|
|
194
|
+
async sendImage(request) {
|
|
195
|
+
return this.post("/chat/send/image", request);
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Send a document message
|
|
199
|
+
*/
|
|
200
|
+
async sendDocument(request) {
|
|
201
|
+
return this.post("/chat/send/document", request);
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Send a video message
|
|
205
|
+
*/
|
|
206
|
+
async sendVideo(request) {
|
|
207
|
+
return this.post("/chat/send/video", request);
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Send a sticker message
|
|
211
|
+
*/
|
|
212
|
+
async sendSticker(request) {
|
|
213
|
+
return this.post("/chat/send/sticker", request);
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Send a location message
|
|
217
|
+
*/
|
|
218
|
+
async sendLocation(request) {
|
|
219
|
+
return this.post("/chat/send/location", request);
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Send a contact message
|
|
223
|
+
*/
|
|
224
|
+
async sendContact(request) {
|
|
225
|
+
return this.post("/chat/send/contact", request);
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Send chat presence indication (typing indicator)
|
|
229
|
+
*/
|
|
230
|
+
async sendPresence(request) {
|
|
231
|
+
await this.post("/chat/presence", request);
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Mark messages as read
|
|
235
|
+
*/
|
|
236
|
+
async markRead(request) {
|
|
237
|
+
await this.post("/chat/markread", request);
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* React to a message
|
|
241
|
+
*/
|
|
242
|
+
async react(request) {
|
|
243
|
+
return this.post("/chat/react", request);
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Download an image from a message
|
|
247
|
+
*/
|
|
248
|
+
async downloadImage(request) {
|
|
249
|
+
return this.post("/chat/downloadimage", request);
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Download a video from a message
|
|
253
|
+
*/
|
|
254
|
+
async downloadVideo(request) {
|
|
255
|
+
return this.post("/chat/downloadvideo", request);
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Download an audio from a message
|
|
259
|
+
*/
|
|
260
|
+
async downloadAudio(request) {
|
|
261
|
+
return this.post("/chat/downloadaudio", request);
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Download a document from a message
|
|
265
|
+
*/
|
|
266
|
+
async downloadDocument(request) {
|
|
267
|
+
return this.post("/chat/downloaddocument", request);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
class GroupModule extends BaseClient {
|
|
271
|
+
/**
|
|
272
|
+
* List all subscribed groups
|
|
273
|
+
*/
|
|
274
|
+
async list() {
|
|
275
|
+
return this.get("/group/list");
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Get group invite link
|
|
279
|
+
*/
|
|
280
|
+
async getInviteLink(groupJID) {
|
|
281
|
+
const request = { GroupJID: groupJID };
|
|
282
|
+
return this.post("/group/invitelink", request);
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Get group information
|
|
286
|
+
*/
|
|
287
|
+
async getInfo(groupJID) {
|
|
288
|
+
const request = { GroupJID: groupJID };
|
|
289
|
+
return this.post("/group/info", request);
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Change group photo (JPEG only)
|
|
293
|
+
*/
|
|
294
|
+
async setPhoto(groupJID, image) {
|
|
295
|
+
const request = { GroupJID: groupJID, Image: image };
|
|
296
|
+
return this.post("/group/photo", request);
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Change group name
|
|
300
|
+
*/
|
|
301
|
+
async setName(groupJID, name) {
|
|
302
|
+
const request = { GroupJID: groupJID, Name: name };
|
|
303
|
+
return this.post("/group/name", request);
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* Create a new group
|
|
307
|
+
*/
|
|
308
|
+
async create(name, participants) {
|
|
309
|
+
const request = { name, participants };
|
|
310
|
+
return this.post("/group/create", request);
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* Set group locked status
|
|
314
|
+
*/
|
|
315
|
+
async setLocked(groupJID, locked) {
|
|
316
|
+
const request = { groupjid: groupJID, locked };
|
|
317
|
+
return this.post("/group/locked", request);
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Set disappearing messages timer
|
|
321
|
+
*/
|
|
322
|
+
async setEphemeral(groupJID, duration) {
|
|
323
|
+
const request = { groupjid: groupJID, duration };
|
|
324
|
+
return this.post("/group/ephemeral", request);
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Remove group photo
|
|
328
|
+
*/
|
|
329
|
+
async removePhoto(groupJID) {
|
|
330
|
+
const request = { groupjid: groupJID };
|
|
331
|
+
return this.post("/group/photo/remove", request);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
class WebhookModule extends BaseClient {
|
|
335
|
+
/**
|
|
336
|
+
* Set webhook URL and events to subscribe to
|
|
337
|
+
*/
|
|
338
|
+
async setWebhook(webhookURL) {
|
|
339
|
+
const request = { webhookURL };
|
|
340
|
+
return this.post("/webhook", request);
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* Get current webhook configuration
|
|
344
|
+
*/
|
|
345
|
+
async getWebhook() {
|
|
346
|
+
return this.get("/webhook");
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
class WuzapiClient {
|
|
350
|
+
admin;
|
|
351
|
+
session;
|
|
352
|
+
user;
|
|
353
|
+
chat;
|
|
354
|
+
group;
|
|
355
|
+
webhook;
|
|
356
|
+
// Legacy aliases for convenience
|
|
357
|
+
users;
|
|
358
|
+
message;
|
|
359
|
+
constructor(config) {
|
|
360
|
+
this.admin = new AdminModule(config);
|
|
361
|
+
this.session = new SessionModule(config);
|
|
362
|
+
this.user = new UserModule(config);
|
|
363
|
+
this.chat = new ChatModule(config);
|
|
364
|
+
this.group = new GroupModule(config);
|
|
365
|
+
this.webhook = new WebhookModule(config);
|
|
366
|
+
this.users = this.user;
|
|
367
|
+
this.message = this.chat;
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* Test connection to the API
|
|
371
|
+
*/
|
|
372
|
+
async ping() {
|
|
373
|
+
try {
|
|
374
|
+
await this.session.getStatus();
|
|
375
|
+
return true;
|
|
376
|
+
} catch {
|
|
377
|
+
return false;
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
export {
|
|
382
|
+
AdminModule,
|
|
383
|
+
ChatModule,
|
|
384
|
+
GroupModule,
|
|
385
|
+
SessionModule,
|
|
386
|
+
UserModule,
|
|
387
|
+
WebhookModule,
|
|
388
|
+
WuzapiClient,
|
|
389
|
+
WuzapiError,
|
|
390
|
+
WuzapiClient as default
|
|
391
|
+
};
|
|
392
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/client.ts","../src/modules/admin.ts","../src/modules/session.ts","../src/modules/user.ts","../src/modules/chat.ts","../src/modules/group.ts","../src/modules/webhook.ts","../src/wuzapi-client.ts"],"sourcesContent":["import axios, { AxiosInstance, AxiosResponse } from \"axios\";\nimport { WuzapiConfig, WuzapiResponse } from \"./types/common.js\";\n\nexport class WuzapiError extends Error {\n public code: number;\n public details?: unknown;\n\n constructor(code: number, message: string, details?: unknown) {\n super(message);\n this.name = \"WuzapiError\";\n this.code = code;\n this.details = details;\n }\n}\n\nexport class BaseClient {\n protected axios: AxiosInstance;\n protected config: WuzapiConfig;\n\n constructor(config: WuzapiConfig) {\n this.config = config;\n this.axios = axios.create({\n baseURL: config.apiUrl,\n headers: {\n \"Content-Type\": \"application/json\",\n Authorization: config.token,\n },\n });\n\n // Add response interceptor for error handling\n this.axios.interceptors.response.use(\n (response: AxiosResponse) => response,\n (error) => {\n if (error.response) {\n // Server responded with error status\n const data = error.response.data;\n throw new WuzapiError(\n data.code || error.response.status,\n data.message || error.message,\n data\n );\n } else if (error.request) {\n // Request was made but no response received\n throw new WuzapiError(0, \"Network error: No response from server\");\n } else {\n // Something else happened\n throw new WuzapiError(0, error.message);\n }\n }\n );\n }\n\n protected async request<T>(\n method: \"GET\" | \"POST\" | \"DELETE\",\n endpoint: string,\n data?: unknown\n ): Promise<T> {\n const response = await this.axios.request<WuzapiResponse<T>>({\n method,\n url: endpoint,\n data,\n });\n\n if (!response.data.success) {\n throw new WuzapiError(\n response.data.code,\n \"API request failed\",\n response.data\n );\n }\n\n return response.data.data;\n }\n\n protected async get<T>(endpoint: string): Promise<T> {\n return this.request<T>(\"GET\", endpoint);\n }\n\n protected async post<T>(endpoint: string, data?: unknown): Promise<T> {\n return this.request<T>(\"POST\", endpoint, data);\n }\n\n protected async delete<T>(endpoint: string): Promise<T> {\n return this.request<T>(\"DELETE\", endpoint);\n }\n}\n","import { BaseClient } from \"../client.js\";\nimport {\n User,\n CreateUserRequest,\n CreateUserResponse,\n DeleteUserResponse,\n} from \"../types/admin.js\";\n\nexport class AdminModule extends BaseClient {\n /**\n * List all users\n */\n async listUsers(): Promise<User[]> {\n return this.get<User[]>(\"/admin/users\");\n }\n\n /**\n * Add a new user\n */\n async addUser(user: CreateUserRequest): Promise<CreateUserResponse> {\n return this.post<CreateUserResponse>(\"/admin/users\", user);\n }\n\n /**\n * Delete a user by ID\n */\n async deleteUser(id: number): Promise<DeleteUserResponse> {\n return this.delete<DeleteUserResponse>(`/admin/users/${id}`);\n }\n}\n","import { BaseClient } from \"../client.js\";\nimport {\n ConnectRequest,\n ConnectResponse,\n DisconnectResponse,\n LogoutResponse,\n StatusResponse,\n QRCodeResponse,\n S3ConfigResponse,\n S3TestResponse,\n} from \"../types/session.js\";\nimport { S3Config } from \"../types/common.js\";\n\nexport class SessionModule extends BaseClient {\n /**\n * Connect to WhatsApp servers\n */\n async connect(options: ConnectRequest): Promise<ConnectResponse> {\n return this.post<ConnectResponse>(\"/session/connect\", options);\n }\n\n /**\n * Disconnect from WhatsApp servers\n */\n async disconnect(): Promise<DisconnectResponse> {\n return this.post<DisconnectResponse>(\"/session/disconnect\");\n }\n\n /**\n * Logout and finish the session\n */\n async logout(): Promise<LogoutResponse> {\n return this.post<LogoutResponse>(\"/session/logout\");\n }\n\n /**\n * Get session status\n */\n async getStatus(): Promise<StatusResponse> {\n return this.get<StatusResponse>(\"/session/status\");\n }\n\n /**\n * Get QR code for scanning\n */\n async getQRCode(): Promise<QRCodeResponse> {\n return this.get<QRCodeResponse>(\"/session/qr\");\n }\n\n /**\n * Configure S3 storage\n */\n async configureS3(config: S3Config): Promise<S3ConfigResponse> {\n return this.post<S3ConfigResponse>(\"/session/s3/config\", config);\n }\n\n /**\n * Get S3 configuration\n */\n async getS3Config(): Promise<S3ConfigResponse> {\n return this.get<S3ConfigResponse>(\"/session/s3/config\");\n }\n\n /**\n * Test S3 connection\n */\n async testS3(): Promise<S3TestResponse> {\n return this.post<S3TestResponse>(\"/session/s3/test\");\n }\n\n /**\n * Delete S3 configuration\n */\n async deleteS3Config(): Promise<{ Details: string }> {\n return this.delete<{ Details: string }>(\"/session/s3/config\");\n }\n}\n","import { BaseClient } from \"../client.js\";\nimport {\n UserInfoRequest,\n UserInfoResponse,\n UserCheckRequest,\n UserCheckResponse,\n UserAvatarRequest,\n UserAvatarResponse,\n ContactsResponse,\n} from \"../types/user.js\";\n\nexport class UserModule extends BaseClient {\n /**\n * Get user details for specified phone numbers\n */\n async getInfo(phones: string[]): Promise<UserInfoResponse> {\n const request: UserInfoRequest = { Phone: phones };\n return this.post<UserInfoResponse>(\"/user/info\", request);\n }\n\n /**\n * Check if phone numbers are registered WhatsApp users\n */\n async check(phones: string[]): Promise<UserCheckResponse> {\n const request: UserCheckRequest = { Phone: phones };\n return this.post<UserCheckResponse>(\"/user/check\", request);\n }\n\n /**\n * Get user avatar/profile picture\n */\n async getAvatar(\n phone: string,\n preview: boolean = true\n ): Promise<UserAvatarResponse> {\n const request: UserAvatarRequest = { Phone: phone, Preview: preview };\n return this.post<UserAvatarResponse>(\"/user/avatar\", request);\n }\n\n /**\n * Get all contacts\n */\n async getContacts(): Promise<ContactsResponse> {\n return this.get<ContactsResponse>(\"/user/contacts\");\n }\n}\n","import { BaseClient } from \"../client.js\";\nimport {\n SendMessageResponse,\n SendTextRequest,\n SendTemplateRequest,\n SendAudioRequest,\n SendImageRequest,\n SendDocumentRequest,\n SendVideoRequest,\n SendStickerRequest,\n SendLocationRequest,\n SendContactRequest,\n ChatPresenceRequest,\n MarkReadRequest,\n ReactRequest,\n DownloadMediaRequest,\n DownloadMediaResponse,\n} from \"../types/chat.js\";\n\nexport class ChatModule extends BaseClient {\n /**\n * Send a text message\n */\n async sendText(request: SendTextRequest): Promise<SendMessageResponse> {\n return this.post<SendMessageResponse>(\"/chat/send/text\", request);\n }\n\n /**\n * Send a template message with buttons\n */\n async sendTemplate(\n request: SendTemplateRequest\n ): Promise<SendMessageResponse> {\n return this.post<SendMessageResponse>(\"/chat/send/template\", request);\n }\n\n /**\n * Send an audio message\n */\n async sendAudio(request: SendAudioRequest): Promise<SendMessageResponse> {\n return this.post<SendMessageResponse>(\"/chat/send/audio\", request);\n }\n\n /**\n * Send an image message\n */\n async sendImage(request: SendImageRequest): Promise<SendMessageResponse> {\n return this.post<SendMessageResponse>(\"/chat/send/image\", request);\n }\n\n /**\n * Send a document message\n */\n async sendDocument(\n request: SendDocumentRequest\n ): Promise<SendMessageResponse> {\n return this.post<SendMessageResponse>(\"/chat/send/document\", request);\n }\n\n /**\n * Send a video message\n */\n async sendVideo(request: SendVideoRequest): Promise<SendMessageResponse> {\n return this.post<SendMessageResponse>(\"/chat/send/video\", request);\n }\n\n /**\n * Send a sticker message\n */\n async sendSticker(request: SendStickerRequest): Promise<SendMessageResponse> {\n return this.post<SendMessageResponse>(\"/chat/send/sticker\", request);\n }\n\n /**\n * Send a location message\n */\n async sendLocation(\n request: SendLocationRequest\n ): Promise<SendMessageResponse> {\n return this.post<SendMessageResponse>(\"/chat/send/location\", request);\n }\n\n /**\n * Send a contact message\n */\n async sendContact(request: SendContactRequest): Promise<SendMessageResponse> {\n return this.post<SendMessageResponse>(\"/chat/send/contact\", request);\n }\n\n /**\n * Send chat presence indication (typing indicator)\n */\n async sendPresence(request: ChatPresenceRequest): Promise<void> {\n await this.post<void>(\"/chat/presence\", request);\n }\n\n /**\n * Mark messages as read\n */\n async markRead(request: MarkReadRequest): Promise<void> {\n await this.post<void>(\"/chat/markread\", request);\n }\n\n /**\n * React to a message\n */\n async react(request: ReactRequest): Promise<SendMessageResponse> {\n return this.post<SendMessageResponse>(\"/chat/react\", request);\n }\n\n /**\n * Download an image from a message\n */\n async downloadImage(\n request: DownloadMediaRequest\n ): Promise<DownloadMediaResponse> {\n return this.post<DownloadMediaResponse>(\"/chat/downloadimage\", request);\n }\n\n /**\n * Download a video from a message\n */\n async downloadVideo(\n request: DownloadMediaRequest\n ): Promise<DownloadMediaResponse> {\n return this.post<DownloadMediaResponse>(\"/chat/downloadvideo\", request);\n }\n\n /**\n * Download an audio from a message\n */\n async downloadAudio(\n request: DownloadMediaRequest\n ): Promise<DownloadMediaResponse> {\n return this.post<DownloadMediaResponse>(\"/chat/downloadaudio\", request);\n }\n\n /**\n * Download a document from a message\n */\n async downloadDocument(\n request: DownloadMediaRequest\n ): Promise<DownloadMediaResponse> {\n return this.post<DownloadMediaResponse>(\"/chat/downloaddocument\", request);\n }\n}\n","import { BaseClient } from \"../client.js\";\nimport {\n GroupListResponse,\n GroupInviteLinkRequest,\n GroupInviteLinkResponse,\n GroupInfoRequest,\n GroupInfo,\n GroupPhotoRequest,\n GroupPhotoResponse,\n GroupNameRequest,\n GroupNameResponse,\n GroupCreateRequest,\n GroupCreateResponse,\n GroupLockedRequest,\n GroupLockedResponse,\n GroupEphemeralRequest,\n GroupEphemeralResponse,\n GroupPhotoRemoveRequest,\n GroupPhotoRemoveResponse,\n} from \"../types/group.js\";\n\nexport class GroupModule extends BaseClient {\n /**\n * List all subscribed groups\n */\n async list(): Promise<GroupListResponse> {\n return this.get<GroupListResponse>(\"/group/list\");\n }\n\n /**\n * Get group invite link\n */\n async getInviteLink(groupJID: string): Promise<GroupInviteLinkResponse> {\n const request: GroupInviteLinkRequest = { GroupJID: groupJID };\n return this.post<GroupInviteLinkResponse>(\"/group/invitelink\", request);\n }\n\n /**\n * Get group information\n */\n async getInfo(groupJID: string): Promise<GroupInfo> {\n const request: GroupInfoRequest = { GroupJID: groupJID };\n return this.post<GroupInfo>(\"/group/info\", request);\n }\n\n /**\n * Change group photo (JPEG only)\n */\n async setPhoto(groupJID: string, image: string): Promise<GroupPhotoResponse> {\n const request: GroupPhotoRequest = { GroupJID: groupJID, Image: image };\n return this.post<GroupPhotoResponse>(\"/group/photo\", request);\n }\n\n /**\n * Change group name\n */\n async setName(groupJID: string, name: string): Promise<GroupNameResponse> {\n const request: GroupNameRequest = { GroupJID: groupJID, Name: name };\n return this.post<GroupNameResponse>(\"/group/name\", request);\n }\n\n /**\n * Create a new group\n */\n async create(\n name: string,\n participants: string[]\n ): Promise<GroupCreateResponse> {\n const request: GroupCreateRequest = { name, participants };\n return this.post<GroupCreateResponse>(\"/group/create\", request);\n }\n\n /**\n * Set group locked status\n */\n async setLocked(\n groupJID: string,\n locked: boolean\n ): Promise<GroupLockedResponse> {\n const request: GroupLockedRequest = { groupjid: groupJID, locked };\n return this.post<GroupLockedResponse>(\"/group/locked\", request);\n }\n\n /**\n * Set disappearing messages timer\n */\n async setEphemeral(\n groupJID: string,\n duration: \"24h\" | \"7d\" | \"90d\" | \"off\"\n ): Promise<GroupEphemeralResponse> {\n const request: GroupEphemeralRequest = { groupjid: groupJID, duration };\n return this.post<GroupEphemeralResponse>(\"/group/ephemeral\", request);\n }\n\n /**\n * Remove group photo\n */\n async removePhoto(groupJID: string): Promise<GroupPhotoRemoveResponse> {\n const request: GroupPhotoRemoveRequest = { groupjid: groupJID };\n return this.post<GroupPhotoRemoveResponse>(\"/group/photo/remove\", request);\n }\n}\n","import { BaseClient } from \"../client.js\";\nimport {\n SetWebhookRequest,\n SetWebhookResponse,\n GetWebhookResponse,\n} from \"../types/webhook.js\";\n\nexport class WebhookModule extends BaseClient {\n /**\n * Set webhook URL and events to subscribe to\n */\n async setWebhook(webhookURL: string): Promise<SetWebhookResponse> {\n const request: SetWebhookRequest = { webhookURL };\n return this.post<SetWebhookResponse>(\"/webhook\", request);\n }\n\n /**\n * Get current webhook configuration\n */\n async getWebhook(): Promise<GetWebhookResponse> {\n return this.get<GetWebhookResponse>(\"/webhook\");\n }\n}\n","import { WuzapiConfig } from \"./types/common.js\";\nimport { AdminModule } from \"./modules/admin.js\";\nimport { SessionModule } from \"./modules/session.js\";\nimport { UserModule } from \"./modules/user.js\";\nimport { ChatModule } from \"./modules/chat.js\";\nimport { GroupModule } from \"./modules/group.js\";\nimport { WebhookModule } from \"./modules/webhook.js\";\n\nexport class WuzapiClient {\n public readonly admin: AdminModule;\n public readonly session: SessionModule;\n public readonly user: UserModule;\n public readonly chat: ChatModule;\n public readonly group: GroupModule;\n public readonly webhook: WebhookModule;\n\n // Legacy aliases for convenience\n public readonly users: UserModule;\n public readonly message: ChatModule;\n\n constructor(config: WuzapiConfig) {\n // Initialize all modules with the same config\n this.admin = new AdminModule(config);\n this.session = new SessionModule(config);\n this.user = new UserModule(config);\n this.chat = new ChatModule(config);\n this.group = new GroupModule(config);\n this.webhook = new WebhookModule(config);\n\n // Legacy aliases\n this.users = this.user;\n this.message = this.chat;\n }\n\n /**\n * Test connection to the API\n */\n async ping(): Promise<boolean> {\n try {\n await this.session.getStatus();\n return true;\n } catch {\n return false;\n }\n }\n}\n"],"names":[],"mappings":";AAGO,MAAM,oBAAoB,MAAM;AAAA,EAC9B;AAAA,EACA;AAAA,EAEP,YAAY,MAAc,SAAiB,SAAmB;AAC5D,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,SAAK,OAAO;AACZ,SAAK,UAAU;AAAA,EACjB;AACF;AAEO,MAAM,WAAW;AAAA,EACZ;AAAA,EACA;AAAA,EAEV,YAAY,QAAsB;AAChC,SAAK,SAAS;AACd,SAAK,QAAQ,MAAM,OAAO;AAAA,MACxB,SAAS,OAAO;AAAA,MAChB,SAAS;AAAA,QACP,gBAAgB;AAAA,QAChB,eAAe,OAAO;AAAA,MAAA;AAAA,IACxB,CACD;AAGD,SAAK,MAAM,aAAa,SAAS;AAAA,MAC/B,CAAC,aAA4B;AAAA,MAC7B,CAAC,UAAU;AACT,YAAI,MAAM,UAAU;AAElB,gBAAM,OAAO,MAAM,SAAS;AAC5B,gBAAM,IAAI;AAAA,YACR,KAAK,QAAQ,MAAM,SAAS;AAAA,YAC5B,KAAK,WAAW,MAAM;AAAA,YACtB;AAAA,UAAA;AAAA,QAEJ,WAAW,MAAM,SAAS;AAExB,gBAAM,IAAI,YAAY,GAAG,wCAAwC;AAAA,QACnE,OAAO;AAEL,gBAAM,IAAI,YAAY,GAAG,MAAM,OAAO;AAAA,QACxC;AAAA,MACF;AAAA,IAAA;AAAA,EAEJ;AAAA,EAEA,MAAgB,QACd,QACA,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www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
package/package.json
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "wuzapi",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "TypeScript client library for WuzAPI WhatsApp API",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"types": "./dist/index.d.ts"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"dev": "vite",
|
|
20
|
+
"build": "tsc -p tsconfig.build.json && vite build",
|
|
21
|
+
"preview": "vite preview",
|
|
22
|
+
"lint": "eslint src --ext .ts,.tsx",
|
|
23
|
+
"lint:fix": "eslint src --ext .ts,.tsx --fix",
|
|
24
|
+
"type-check": "tsc --noEmit",
|
|
25
|
+
"clean": "rm -rf dist",
|
|
26
|
+
"prebuild": "npm run clean",
|
|
27
|
+
"prepublishOnly": "npm run lint && npm run type-check && npm run build",
|
|
28
|
+
"release:patch": "npm version patch && npm publish",
|
|
29
|
+
"release:minor": "npm version minor && npm publish",
|
|
30
|
+
"release:major": "npm version major && npm publish",
|
|
31
|
+
"release": "npm publish",
|
|
32
|
+
"test": "echo \"No tests specified\" && exit 0"
|
|
33
|
+
},
|
|
34
|
+
"keywords": [
|
|
35
|
+
"whatsapp",
|
|
36
|
+
"api",
|
|
37
|
+
"client",
|
|
38
|
+
"typescript",
|
|
39
|
+
"wuzapi"
|
|
40
|
+
],
|
|
41
|
+
"author": "Gus",
|
|
42
|
+
"license": "MIT",
|
|
43
|
+
"repository": {
|
|
44
|
+
"type": "git",
|
|
45
|
+
"url": "https://github.com/your-username/wuzapi.git"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@types/node": "^24.3.0",
|
|
49
|
+
"@typescript-eslint/eslint-plugin": "^8.41.0",
|
|
50
|
+
"@typescript-eslint/parser": "^8.41.0",
|
|
51
|
+
"eslint": "^9.34.0",
|
|
52
|
+
"typescript": "~5.8.3",
|
|
53
|
+
"vite": "^7.1.2"
|
|
54
|
+
},
|
|
55
|
+
"dependencies": {
|
|
56
|
+
"axios": "^1.11.0"
|
|
57
|
+
}
|
|
58
|
+
}
|