wuzapi 1.5.0 → 1.5.2
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/dist/client.js +91 -0
- package/dist/client.js.map +1 -0
- package/dist/index.js +54 -1013
- package/dist/index.js.map +1 -1
- package/dist/modules/admin.js +37 -0
- package/dist/modules/admin.js.map +1 -0
- package/dist/modules/chat.js +173 -0
- package/dist/modules/chat.js.map +1 -0
- package/dist/modules/group.js +142 -0
- package/dist/modules/group.js.map +1 -0
- package/dist/modules/newsletter.js +13 -0
- package/dist/modules/newsletter.js.map +1 -0
- package/dist/modules/session.js +85 -0
- package/dist/modules/session.js.map +1 -0
- package/dist/modules/user.js +40 -0
- package/dist/modules/user.js.map +1 -0
- package/dist/modules/webhook.js +33 -0
- package/dist/modules/webhook.js.map +1 -0
- package/dist/types/index.js +396 -0
- package/dist/types/index.js.map +1 -0
- package/dist/wuzapi-client.js +45 -0
- package/dist/wuzapi-client.js.map +1 -0
- package/package.json +4 -4
- package/dist/vite-env.d.ts +0 -1
package/dist/index.js
CHANGED
|
@@ -1,1014 +1,55 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
async request(method, endpoint, data, options) {
|
|
56
|
-
const token = this.resolveToken(options);
|
|
57
|
-
const response = await this.axios.request({
|
|
58
|
-
method,
|
|
59
|
-
url: endpoint,
|
|
60
|
-
data,
|
|
61
|
-
headers: {
|
|
62
|
-
Authorization: token
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
if (!response.data.success) {
|
|
66
|
-
throw new WuzapiError(
|
|
67
|
-
response.data.code,
|
|
68
|
-
"API request failed",
|
|
69
|
-
response.data
|
|
70
|
-
);
|
|
71
|
-
}
|
|
72
|
-
return response.data.data;
|
|
73
|
-
}
|
|
74
|
-
async get(endpoint, options) {
|
|
75
|
-
return this.request("GET", endpoint, void 0, options);
|
|
76
|
-
}
|
|
77
|
-
async post(endpoint, data, options) {
|
|
78
|
-
return this.request("POST", endpoint, data, options);
|
|
79
|
-
}
|
|
80
|
-
async put(endpoint, data, options) {
|
|
81
|
-
return this.request("PUT", endpoint, data, options);
|
|
82
|
-
}
|
|
83
|
-
async delete(endpoint, options) {
|
|
84
|
-
return this.request("DELETE", endpoint, void 0, options);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
class AdminModule extends BaseClient {
|
|
88
|
-
/**
|
|
89
|
-
* List all users
|
|
90
|
-
*/
|
|
91
|
-
async listUsers(options) {
|
|
92
|
-
return this.get("/admin/users", options);
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Add a new user
|
|
96
|
-
*/
|
|
97
|
-
async addUser(user, options) {
|
|
98
|
-
return this.post("/admin/users", user, options);
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Get a specific user by ID
|
|
102
|
-
*/
|
|
103
|
-
async getUser(id, options) {
|
|
104
|
-
return this.get(`/admin/users/${id}`, options);
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Delete a user by ID
|
|
108
|
-
*/
|
|
109
|
-
async deleteUser(id, options) {
|
|
110
|
-
return this.delete(`/admin/users/${id}`, options);
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Delete a user completely (full deletion) by ID
|
|
114
|
-
*/
|
|
115
|
-
async deleteUserComplete(id, options) {
|
|
116
|
-
return this.delete(`/admin/users/${id}/full`, options);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
class SessionModule extends BaseClient {
|
|
120
|
-
/**
|
|
121
|
-
* Connect to WhatsApp servers
|
|
122
|
-
*/
|
|
123
|
-
async connect(request, options) {
|
|
124
|
-
return this.post("/session/connect", request, options);
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* Disconnect from WhatsApp servers
|
|
128
|
-
*/
|
|
129
|
-
async disconnect(options) {
|
|
130
|
-
return this.post(
|
|
131
|
-
"/session/disconnect",
|
|
132
|
-
void 0,
|
|
133
|
-
options
|
|
134
|
-
);
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* Logout and finish the session
|
|
138
|
-
*/
|
|
139
|
-
async logout(options) {
|
|
140
|
-
return this.post("/session/logout", void 0, options);
|
|
141
|
-
}
|
|
142
|
-
/**
|
|
143
|
-
* Get session status
|
|
144
|
-
*/
|
|
145
|
-
async getStatus(options) {
|
|
146
|
-
return this.get("/session/status", options);
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
* Get QR code for scanning
|
|
150
|
-
*/
|
|
151
|
-
async getQRCode(options) {
|
|
152
|
-
return this.get("/session/qr", options);
|
|
153
|
-
}
|
|
154
|
-
/**
|
|
155
|
-
* Configure S3 storage
|
|
156
|
-
*/
|
|
157
|
-
async configureS3(config, options) {
|
|
158
|
-
return this.post("/session/s3/config", config, options);
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* Get S3 configuration
|
|
162
|
-
*/
|
|
163
|
-
async getS3Config(options) {
|
|
164
|
-
return this.get("/session/s3/config", options);
|
|
165
|
-
}
|
|
166
|
-
/**
|
|
167
|
-
* Test S3 connection
|
|
168
|
-
*/
|
|
169
|
-
async testS3(options) {
|
|
170
|
-
return this.post("/session/s3/test", void 0, options);
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* Delete S3 configuration
|
|
174
|
-
*/
|
|
175
|
-
async deleteS3Config(options) {
|
|
176
|
-
return this.delete("/session/s3/config", options);
|
|
177
|
-
}
|
|
178
|
-
/**
|
|
179
|
-
* Pair phone using verification code
|
|
180
|
-
*/
|
|
181
|
-
async pairPhone(phone, code, options) {
|
|
182
|
-
const request = { Phone: phone, Code: code };
|
|
183
|
-
return this.post("/session/pairphone", request, options);
|
|
184
|
-
}
|
|
185
|
-
/**
|
|
186
|
-
* Request history sync from WhatsApp servers
|
|
187
|
-
*/
|
|
188
|
-
async requestHistory(options) {
|
|
189
|
-
return this.get("/session/history", options);
|
|
190
|
-
}
|
|
191
|
-
/**
|
|
192
|
-
* Set proxy configuration
|
|
193
|
-
*/
|
|
194
|
-
async setProxy(proxy, options) {
|
|
195
|
-
const request = { Proxy: proxy };
|
|
196
|
-
return this.post("/session/proxy", request, options);
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
class UserModule extends BaseClient {
|
|
200
|
-
/**
|
|
201
|
-
* Get user details for specified phone numbers
|
|
202
|
-
*/
|
|
203
|
-
async getInfo(phones, options) {
|
|
204
|
-
const request = { Phone: phones };
|
|
205
|
-
return this.post("/user/info", request, options);
|
|
206
|
-
}
|
|
207
|
-
/**
|
|
208
|
-
* Check if phone numbers are registered WhatsApp users
|
|
209
|
-
*/
|
|
210
|
-
async check(phones, options) {
|
|
211
|
-
const request = { Phone: phones };
|
|
212
|
-
return this.post("/user/check", request, options);
|
|
213
|
-
}
|
|
214
|
-
/**
|
|
215
|
-
* Get user avatar/profile picture
|
|
216
|
-
*/
|
|
217
|
-
async getAvatar(phone, preview = true, options) {
|
|
218
|
-
const request = { Phone: phone, Preview: preview };
|
|
219
|
-
return this.post("/user/avatar", request, options);
|
|
220
|
-
}
|
|
221
|
-
/**
|
|
222
|
-
* Get all contacts
|
|
223
|
-
*/
|
|
224
|
-
async getContacts(options) {
|
|
225
|
-
return this.get("/user/contacts", options);
|
|
226
|
-
}
|
|
227
|
-
/**
|
|
228
|
-
* Send user presence (available/unavailable status)
|
|
229
|
-
*/
|
|
230
|
-
async sendPresence(request, options) {
|
|
231
|
-
await this.post("/user/presence", request, options);
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
class ChatModule extends BaseClient {
|
|
235
|
-
/**
|
|
236
|
-
* Send a text message
|
|
237
|
-
*/
|
|
238
|
-
async sendText(request, options) {
|
|
239
|
-
return this.post("/chat/send/text", request, options);
|
|
240
|
-
}
|
|
241
|
-
/**
|
|
242
|
-
* Send a template message with buttons
|
|
243
|
-
*/
|
|
244
|
-
async sendTemplate(request, options) {
|
|
245
|
-
return this.post(
|
|
246
|
-
"/chat/send/template",
|
|
247
|
-
request,
|
|
248
|
-
options
|
|
249
|
-
);
|
|
250
|
-
}
|
|
251
|
-
/**
|
|
252
|
-
* Send an audio message
|
|
253
|
-
*/
|
|
254
|
-
async sendAudio(request, options) {
|
|
255
|
-
return this.post("/chat/send/audio", request, options);
|
|
256
|
-
}
|
|
257
|
-
/**
|
|
258
|
-
* Send an image message
|
|
259
|
-
*/
|
|
260
|
-
async sendImage(request, options) {
|
|
261
|
-
return this.post("/chat/send/image", request, options);
|
|
262
|
-
}
|
|
263
|
-
/**
|
|
264
|
-
* Send a document message
|
|
265
|
-
*/
|
|
266
|
-
async sendDocument(request, options) {
|
|
267
|
-
return this.post(
|
|
268
|
-
"/chat/send/document",
|
|
269
|
-
request,
|
|
270
|
-
options
|
|
271
|
-
);
|
|
272
|
-
}
|
|
273
|
-
/**
|
|
274
|
-
* Send a video message
|
|
275
|
-
*/
|
|
276
|
-
async sendVideo(request, options) {
|
|
277
|
-
return this.post("/chat/send/video", request, options);
|
|
278
|
-
}
|
|
279
|
-
/**
|
|
280
|
-
* Send a sticker message
|
|
281
|
-
*/
|
|
282
|
-
async sendSticker(request, options) {
|
|
283
|
-
return this.post(
|
|
284
|
-
"/chat/send/sticker",
|
|
285
|
-
request,
|
|
286
|
-
options
|
|
287
|
-
);
|
|
288
|
-
}
|
|
289
|
-
/**
|
|
290
|
-
* Send a location message
|
|
291
|
-
*/
|
|
292
|
-
async sendLocation(request, options) {
|
|
293
|
-
return this.post(
|
|
294
|
-
"/chat/send/location",
|
|
295
|
-
request,
|
|
296
|
-
options
|
|
297
|
-
);
|
|
298
|
-
}
|
|
299
|
-
/**
|
|
300
|
-
* Send a contact message
|
|
301
|
-
*/
|
|
302
|
-
async sendContact(request, options) {
|
|
303
|
-
return this.post(
|
|
304
|
-
"/chat/send/contact",
|
|
305
|
-
request,
|
|
306
|
-
options
|
|
307
|
-
);
|
|
308
|
-
}
|
|
309
|
-
/**
|
|
310
|
-
* Send chat presence indication (typing indicator)
|
|
311
|
-
*/
|
|
312
|
-
async sendPresence(request, options) {
|
|
313
|
-
await this.post("/chat/presence", request, options);
|
|
314
|
-
}
|
|
315
|
-
/**
|
|
316
|
-
* Mark messages as read
|
|
317
|
-
*/
|
|
318
|
-
async markRead(request, options) {
|
|
319
|
-
await this.post("/chat/markread", request, options);
|
|
320
|
-
}
|
|
321
|
-
/**
|
|
322
|
-
* React to a message
|
|
323
|
-
*/
|
|
324
|
-
async react(request, options) {
|
|
325
|
-
return this.post("/chat/react", request, options);
|
|
326
|
-
}
|
|
327
|
-
/**
|
|
328
|
-
* Download an image from a message
|
|
329
|
-
*/
|
|
330
|
-
async downloadImage(request, options) {
|
|
331
|
-
return this.post(
|
|
332
|
-
"/chat/downloadimage",
|
|
333
|
-
request,
|
|
334
|
-
options
|
|
335
|
-
);
|
|
336
|
-
}
|
|
337
|
-
/**
|
|
338
|
-
* Download a video from a message
|
|
339
|
-
*/
|
|
340
|
-
async downloadVideo(request, options) {
|
|
341
|
-
return this.post(
|
|
342
|
-
"/chat/downloadvideo",
|
|
343
|
-
request,
|
|
344
|
-
options
|
|
345
|
-
);
|
|
346
|
-
}
|
|
347
|
-
/**
|
|
348
|
-
* Download an audio from a message
|
|
349
|
-
*/
|
|
350
|
-
async downloadAudio(request, options) {
|
|
351
|
-
return this.post(
|
|
352
|
-
"/chat/downloadaudio",
|
|
353
|
-
request,
|
|
354
|
-
options
|
|
355
|
-
);
|
|
356
|
-
}
|
|
357
|
-
/**
|
|
358
|
-
* Download a document from a message
|
|
359
|
-
*/
|
|
360
|
-
async downloadDocument(request, options) {
|
|
361
|
-
return this.post(
|
|
362
|
-
"/chat/downloaddocument",
|
|
363
|
-
request,
|
|
364
|
-
options
|
|
365
|
-
);
|
|
366
|
-
}
|
|
367
|
-
/**
|
|
368
|
-
* Delete a message
|
|
369
|
-
*/
|
|
370
|
-
async deleteMessage(request, options) {
|
|
371
|
-
return this.post("/chat/delete", request, options);
|
|
372
|
-
}
|
|
373
|
-
/**
|
|
374
|
-
* Send interactive buttons message
|
|
375
|
-
*/
|
|
376
|
-
async sendButtons(request, options) {
|
|
377
|
-
return this.post(
|
|
378
|
-
"/chat/send/buttons",
|
|
379
|
-
request,
|
|
380
|
-
options
|
|
381
|
-
);
|
|
382
|
-
}
|
|
383
|
-
/**
|
|
384
|
-
* Send list message
|
|
385
|
-
*/
|
|
386
|
-
async sendList(request, options) {
|
|
387
|
-
return this.post("/chat/send/list", request, options);
|
|
388
|
-
}
|
|
389
|
-
/**
|
|
390
|
-
* Send poll message
|
|
391
|
-
*/
|
|
392
|
-
async sendPoll(request, options) {
|
|
393
|
-
return this.post("/chat/send/poll", request, options);
|
|
394
|
-
}
|
|
395
|
-
/**
|
|
396
|
-
* Edit a message
|
|
397
|
-
*/
|
|
398
|
-
async editMessage(request, options) {
|
|
399
|
-
return this.post("/chat/send/edit", request, options);
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
class GroupModule extends BaseClient {
|
|
403
|
-
/**
|
|
404
|
-
* List all subscribed groups
|
|
405
|
-
*/
|
|
406
|
-
async list(options) {
|
|
407
|
-
return this.get("/group/list", options);
|
|
408
|
-
}
|
|
409
|
-
/**
|
|
410
|
-
* Get group invite link
|
|
411
|
-
*/
|
|
412
|
-
async getInviteLink(groupJID, options) {
|
|
413
|
-
const request = { GroupJID: groupJID };
|
|
414
|
-
return this.post(
|
|
415
|
-
"/group/invitelink",
|
|
416
|
-
request,
|
|
417
|
-
options
|
|
418
|
-
);
|
|
419
|
-
}
|
|
420
|
-
/**
|
|
421
|
-
* Get group information
|
|
422
|
-
*/
|
|
423
|
-
async getInfo(groupJID, options) {
|
|
424
|
-
const request = { GroupJID: groupJID };
|
|
425
|
-
return this.post("/group/info", request, options);
|
|
426
|
-
}
|
|
427
|
-
/**
|
|
428
|
-
* Change group photo (JPEG only)
|
|
429
|
-
*/
|
|
430
|
-
async setPhoto(groupJID, image, options) {
|
|
431
|
-
const request = { GroupJID: groupJID, Image: image };
|
|
432
|
-
return this.post("/group/photo", request, options);
|
|
433
|
-
}
|
|
434
|
-
/**
|
|
435
|
-
* Change group name
|
|
436
|
-
*/
|
|
437
|
-
async setName(groupJID, name, options) {
|
|
438
|
-
const request = { GroupJID: groupJID, Name: name };
|
|
439
|
-
return this.post("/group/name", request, options);
|
|
440
|
-
}
|
|
441
|
-
/**
|
|
442
|
-
* Create a new group
|
|
443
|
-
*/
|
|
444
|
-
async create(name, participants, options) {
|
|
445
|
-
const request = { name, participants };
|
|
446
|
-
return this.post("/group/create", request, options);
|
|
447
|
-
}
|
|
448
|
-
/**
|
|
449
|
-
* Set group locked status
|
|
450
|
-
*/
|
|
451
|
-
async setLocked(groupJID, locked, options) {
|
|
452
|
-
const request = { groupjid: groupJID, locked };
|
|
453
|
-
return this.post("/group/locked", request, options);
|
|
454
|
-
}
|
|
455
|
-
/**
|
|
456
|
-
* Set disappearing messages timer
|
|
457
|
-
*/
|
|
458
|
-
async setEphemeral(groupJID, duration, options) {
|
|
459
|
-
const request = { groupjid: groupJID, duration };
|
|
460
|
-
return this.post(
|
|
461
|
-
"/group/ephemeral",
|
|
462
|
-
request,
|
|
463
|
-
options
|
|
464
|
-
);
|
|
465
|
-
}
|
|
466
|
-
/**
|
|
467
|
-
* Remove group photo
|
|
468
|
-
*/
|
|
469
|
-
async removePhoto(groupJID, options) {
|
|
470
|
-
const request = { groupjid: groupJID };
|
|
471
|
-
return this.post(
|
|
472
|
-
"/group/photo/remove",
|
|
473
|
-
request,
|
|
474
|
-
options
|
|
475
|
-
);
|
|
476
|
-
}
|
|
477
|
-
/**
|
|
478
|
-
* Leave a group
|
|
479
|
-
*/
|
|
480
|
-
async leave(groupJID, options) {
|
|
481
|
-
const request = { GroupJID: groupJID };
|
|
482
|
-
return this.post("/group/leave", request, options);
|
|
483
|
-
}
|
|
484
|
-
/**
|
|
485
|
-
* Set group topic/description
|
|
486
|
-
*/
|
|
487
|
-
async setTopic(groupJID, topic, options) {
|
|
488
|
-
const request = { GroupJID: groupJID, Topic: topic };
|
|
489
|
-
return this.post("/group/topic", request, options);
|
|
490
|
-
}
|
|
491
|
-
/**
|
|
492
|
-
* Set group announcement setting (only admins can send messages)
|
|
493
|
-
*/
|
|
494
|
-
async setAnnounce(groupJID, announce, options) {
|
|
495
|
-
const request = {
|
|
496
|
-
GroupJID: groupJID,
|
|
497
|
-
Announce: announce
|
|
498
|
-
};
|
|
499
|
-
return this.post(
|
|
500
|
-
"/group/announce",
|
|
501
|
-
request,
|
|
502
|
-
options
|
|
503
|
-
);
|
|
504
|
-
}
|
|
505
|
-
/**
|
|
506
|
-
* Join a group using invite link
|
|
507
|
-
*/
|
|
508
|
-
async join(inviteLink, options) {
|
|
509
|
-
const request = { InviteLink: inviteLink };
|
|
510
|
-
return this.post("/group/join", request, options);
|
|
511
|
-
}
|
|
512
|
-
/**
|
|
513
|
-
* Get group invite information
|
|
514
|
-
*/
|
|
515
|
-
async getInviteInfo(inviteLink, options) {
|
|
516
|
-
const request = { InviteLink: inviteLink };
|
|
517
|
-
return this.post(
|
|
518
|
-
"/group/inviteinfo",
|
|
519
|
-
request,
|
|
520
|
-
options
|
|
521
|
-
);
|
|
522
|
-
}
|
|
523
|
-
/**
|
|
524
|
-
* Update group participants (add/remove/promote/demote)
|
|
525
|
-
*/
|
|
526
|
-
async updateParticipants(groupJID, action, participants, options) {
|
|
527
|
-
const request = {
|
|
528
|
-
GroupJID: groupJID,
|
|
529
|
-
Action: action,
|
|
530
|
-
Participants: participants
|
|
531
|
-
};
|
|
532
|
-
return this.post(
|
|
533
|
-
"/group/updateparticipants",
|
|
534
|
-
request,
|
|
535
|
-
options
|
|
536
|
-
);
|
|
537
|
-
}
|
|
538
|
-
}
|
|
539
|
-
class WebhookModule extends BaseClient {
|
|
540
|
-
/**
|
|
541
|
-
* Set webhook URL and events to subscribe to
|
|
542
|
-
*/
|
|
543
|
-
async setWebhook(webhookURL, options) {
|
|
544
|
-
const request = { webhookURL };
|
|
545
|
-
return this.post("/webhook", request, options);
|
|
546
|
-
}
|
|
547
|
-
/**
|
|
548
|
-
* Get current webhook configuration
|
|
549
|
-
*/
|
|
550
|
-
async getWebhook(options) {
|
|
551
|
-
return this.get("/webhook", options);
|
|
552
|
-
}
|
|
553
|
-
/**
|
|
554
|
-
* Update webhook URL
|
|
555
|
-
*/
|
|
556
|
-
async updateWebhook(webhookURL, options) {
|
|
557
|
-
const request = { webhookURL };
|
|
558
|
-
return this.put("/webhook", request, options);
|
|
559
|
-
}
|
|
560
|
-
/**
|
|
561
|
-
* Delete webhook configuration
|
|
562
|
-
*/
|
|
563
|
-
async deleteWebhook(options) {
|
|
564
|
-
return this.delete("/webhook", options);
|
|
565
|
-
}
|
|
566
|
-
}
|
|
567
|
-
class NewsletterModule extends BaseClient {
|
|
568
|
-
/**
|
|
569
|
-
* List all subscribed newsletters
|
|
570
|
-
*/
|
|
571
|
-
async list(options) {
|
|
572
|
-
return this.get("/newsletter/list", options);
|
|
573
|
-
}
|
|
574
|
-
}
|
|
575
|
-
class WuzapiClient {
|
|
576
|
-
admin;
|
|
577
|
-
session;
|
|
578
|
-
user;
|
|
579
|
-
chat;
|
|
580
|
-
group;
|
|
581
|
-
webhook;
|
|
582
|
-
newsletter;
|
|
583
|
-
// Legacy aliases for convenience
|
|
584
|
-
users;
|
|
585
|
-
message;
|
|
586
|
-
constructor(config) {
|
|
587
|
-
this.admin = new AdminModule(config);
|
|
588
|
-
this.session = new SessionModule(config);
|
|
589
|
-
this.user = new UserModule(config);
|
|
590
|
-
this.chat = new ChatModule(config);
|
|
591
|
-
this.group = new GroupModule(config);
|
|
592
|
-
this.webhook = new WebhookModule(config);
|
|
593
|
-
this.newsletter = new NewsletterModule(config);
|
|
594
|
-
this.users = this.user;
|
|
595
|
-
this.message = this.chat;
|
|
596
|
-
}
|
|
597
|
-
/**
|
|
598
|
-
* Test connection to the API
|
|
599
|
-
*/
|
|
600
|
-
async ping(options) {
|
|
601
|
-
try {
|
|
602
|
-
await this.session.getStatus(options);
|
|
603
|
-
return true;
|
|
604
|
-
} catch {
|
|
605
|
-
return false;
|
|
606
|
-
}
|
|
607
|
-
}
|
|
608
|
-
}
|
|
609
|
-
function hasS3Media(payload) {
|
|
610
|
-
return !!payload.s3;
|
|
611
|
-
}
|
|
612
|
-
function hasBase64Media(payload) {
|
|
613
|
-
return !!payload.base64;
|
|
614
|
-
}
|
|
615
|
-
function hasBothMedia(payload) {
|
|
616
|
-
return hasS3Media(payload) && hasBase64Media(payload);
|
|
617
|
-
}
|
|
618
|
-
var DisappearingModeInitiator = /* @__PURE__ */ ((DisappearingModeInitiator2) => {
|
|
619
|
-
DisappearingModeInitiator2[DisappearingModeInitiator2["CHANGED_IN_CHAT"] = 0] = "CHANGED_IN_CHAT";
|
|
620
|
-
DisappearingModeInitiator2[DisappearingModeInitiator2["INITIATED_BY_ME"] = 1] = "INITIATED_BY_ME";
|
|
621
|
-
DisappearingModeInitiator2[DisappearingModeInitiator2["INITIATED_BY_OTHER"] = 2] = "INITIATED_BY_OTHER";
|
|
622
|
-
return DisappearingModeInitiator2;
|
|
623
|
-
})(DisappearingModeInitiator || {});
|
|
624
|
-
var DisappearingModeTrigger = /* @__PURE__ */ ((DisappearingModeTrigger2) => {
|
|
625
|
-
DisappearingModeTrigger2[DisappearingModeTrigger2["UNKNOWN"] = 0] = "UNKNOWN";
|
|
626
|
-
DisappearingModeTrigger2[DisappearingModeTrigger2["CHAT_SETTING"] = 1] = "CHAT_SETTING";
|
|
627
|
-
DisappearingModeTrigger2[DisappearingModeTrigger2["ACCOUNT_SETTING"] = 2] = "ACCOUNT_SETTING";
|
|
628
|
-
DisappearingModeTrigger2[DisappearingModeTrigger2["BULK_CHANGE"] = 3] = "BULK_CHANGE";
|
|
629
|
-
return DisappearingModeTrigger2;
|
|
630
|
-
})(DisappearingModeTrigger || {});
|
|
631
|
-
var MediaType = /* @__PURE__ */ ((MediaType2) => {
|
|
632
|
-
MediaType2[MediaType2["UNKNOWN"] = 0] = "UNKNOWN";
|
|
633
|
-
MediaType2[MediaType2["IMAGE"] = 1] = "IMAGE";
|
|
634
|
-
MediaType2[MediaType2["VIDEO"] = 2] = "VIDEO";
|
|
635
|
-
MediaType2[MediaType2["AUDIO"] = 3] = "AUDIO";
|
|
636
|
-
MediaType2[MediaType2["DOCUMENT"] = 4] = "DOCUMENT";
|
|
637
|
-
MediaType2[MediaType2["STICKER"] = 5] = "STICKER";
|
|
638
|
-
return MediaType2;
|
|
639
|
-
})(MediaType || {});
|
|
640
|
-
var VideoAttribution = /* @__PURE__ */ ((VideoAttribution2) => {
|
|
641
|
-
VideoAttribution2[VideoAttribution2["NONE"] = 0] = "NONE";
|
|
642
|
-
VideoAttribution2[VideoAttribution2["GIPHY"] = 1] = "GIPHY";
|
|
643
|
-
VideoAttribution2[VideoAttribution2["TENOR"] = 2] = "TENOR";
|
|
644
|
-
VideoAttribution2[VideoAttribution2["KLIPY"] = 3] = "KLIPY";
|
|
645
|
-
return VideoAttribution2;
|
|
646
|
-
})(VideoAttribution || {});
|
|
647
|
-
var VideoSourceType = /* @__PURE__ */ ((VideoSourceType2) => {
|
|
648
|
-
VideoSourceType2[VideoSourceType2["USER_VIDEO"] = 0] = "USER_VIDEO";
|
|
649
|
-
VideoSourceType2[VideoSourceType2["AI_GENERATED"] = 1] = "AI_GENERATED";
|
|
650
|
-
return VideoSourceType2;
|
|
651
|
-
})(VideoSourceType || {});
|
|
652
|
-
var ExtendedTextMessageFontType = /* @__PURE__ */ ((ExtendedTextMessageFontType2) => {
|
|
653
|
-
ExtendedTextMessageFontType2[ExtendedTextMessageFontType2["SANS_SERIF"] = 0] = "SANS_SERIF";
|
|
654
|
-
ExtendedTextMessageFontType2[ExtendedTextMessageFontType2["SERIF"] = 1] = "SERIF";
|
|
655
|
-
ExtendedTextMessageFontType2[ExtendedTextMessageFontType2["NORICAN_REGULAR"] = 2] = "NORICAN_REGULAR";
|
|
656
|
-
ExtendedTextMessageFontType2[ExtendedTextMessageFontType2["BRYNDAN_WRITE"] = 3] = "BRYNDAN_WRITE";
|
|
657
|
-
ExtendedTextMessageFontType2[ExtendedTextMessageFontType2["BEBASNEUE_REGULAR"] = 4] = "BEBASNEUE_REGULAR";
|
|
658
|
-
ExtendedTextMessageFontType2[ExtendedTextMessageFontType2["OSWALD_HEAVY"] = 5] = "OSWALD_HEAVY";
|
|
659
|
-
return ExtendedTextMessageFontType2;
|
|
660
|
-
})(ExtendedTextMessageFontType || {});
|
|
661
|
-
var ExtendedTextMessagePreviewType = /* @__PURE__ */ ((ExtendedTextMessagePreviewType2) => {
|
|
662
|
-
ExtendedTextMessagePreviewType2[ExtendedTextMessagePreviewType2["NONE"] = 0] = "NONE";
|
|
663
|
-
ExtendedTextMessagePreviewType2[ExtendedTextMessagePreviewType2["VIDEO"] = 1] = "VIDEO";
|
|
664
|
-
ExtendedTextMessagePreviewType2[ExtendedTextMessagePreviewType2["PLACEHOLDER"] = 4] = "PLACEHOLDER";
|
|
665
|
-
ExtendedTextMessagePreviewType2[ExtendedTextMessagePreviewType2["IMAGE"] = 5] = "IMAGE";
|
|
666
|
-
return ExtendedTextMessagePreviewType2;
|
|
667
|
-
})(ExtendedTextMessagePreviewType || {});
|
|
668
|
-
var ExtendedTextMessageInviteLinkGroupType = /* @__PURE__ */ ((ExtendedTextMessageInviteLinkGroupType2) => {
|
|
669
|
-
ExtendedTextMessageInviteLinkGroupType2[ExtendedTextMessageInviteLinkGroupType2["DEFAULT"] = 0] = "DEFAULT";
|
|
670
|
-
ExtendedTextMessageInviteLinkGroupType2[ExtendedTextMessageInviteLinkGroupType2["PARENT"] = 1] = "PARENT";
|
|
671
|
-
ExtendedTextMessageInviteLinkGroupType2[ExtendedTextMessageInviteLinkGroupType2["SUB"] = 2] = "SUB";
|
|
672
|
-
ExtendedTextMessageInviteLinkGroupType2[ExtendedTextMessageInviteLinkGroupType2["DEFAULT_SUB"] = 3] = "DEFAULT_SUB";
|
|
673
|
-
return ExtendedTextMessageInviteLinkGroupType2;
|
|
674
|
-
})(ExtendedTextMessageInviteLinkGroupType || {});
|
|
675
|
-
var InviteLinkGroupType = /* @__PURE__ */ ((InviteLinkGroupType2) => {
|
|
676
|
-
InviteLinkGroupType2[InviteLinkGroupType2["DEFAULT"] = 0] = "DEFAULT";
|
|
677
|
-
InviteLinkGroupType2[InviteLinkGroupType2["PARENT"] = 1] = "PARENT";
|
|
678
|
-
InviteLinkGroupType2[InviteLinkGroupType2["SUB"] = 2] = "SUB";
|
|
679
|
-
InviteLinkGroupType2[InviteLinkGroupType2["DEFAULT_SUB"] = 3] = "DEFAULT_SUB";
|
|
680
|
-
return InviteLinkGroupType2;
|
|
681
|
-
})(InviteLinkGroupType || {});
|
|
682
|
-
var ButtonType = /* @__PURE__ */ ((ButtonType2) => {
|
|
683
|
-
ButtonType2[ButtonType2["UNKNOWN"] = 0] = "UNKNOWN";
|
|
684
|
-
ButtonType2[ButtonType2["RESPONSE"] = 1] = "RESPONSE";
|
|
685
|
-
ButtonType2[ButtonType2["NATIVE_FLOW"] = 2] = "NATIVE_FLOW";
|
|
686
|
-
return ButtonType2;
|
|
687
|
-
})(ButtonType || {});
|
|
688
|
-
var ButtonsMessageHeaderType = /* @__PURE__ */ ((ButtonsMessageHeaderType2) => {
|
|
689
|
-
ButtonsMessageHeaderType2[ButtonsMessageHeaderType2["UNKNOWN"] = 0] = "UNKNOWN";
|
|
690
|
-
ButtonsMessageHeaderType2[ButtonsMessageHeaderType2["EMPTY"] = 1] = "EMPTY";
|
|
691
|
-
ButtonsMessageHeaderType2[ButtonsMessageHeaderType2["TEXT"] = 2] = "TEXT";
|
|
692
|
-
ButtonsMessageHeaderType2[ButtonsMessageHeaderType2["DOCUMENT"] = 3] = "DOCUMENT";
|
|
693
|
-
ButtonsMessageHeaderType2[ButtonsMessageHeaderType2["IMAGE"] = 4] = "IMAGE";
|
|
694
|
-
ButtonsMessageHeaderType2[ButtonsMessageHeaderType2["VIDEO"] = 5] = "VIDEO";
|
|
695
|
-
ButtonsMessageHeaderType2[ButtonsMessageHeaderType2["LOCATION"] = 6] = "LOCATION";
|
|
696
|
-
return ButtonsMessageHeaderType2;
|
|
697
|
-
})(ButtonsMessageHeaderType || {});
|
|
698
|
-
var ListMessageListType = /* @__PURE__ */ ((ListMessageListType2) => {
|
|
699
|
-
ListMessageListType2[ListMessageListType2["UNKNOWN"] = 0] = "UNKNOWN";
|
|
700
|
-
ListMessageListType2[ListMessageListType2["SINGLE_SELECT"] = 1] = "SINGLE_SELECT";
|
|
701
|
-
ListMessageListType2[ListMessageListType2["PRODUCT_LIST"] = 2] = "PRODUCT_LIST";
|
|
702
|
-
return ListMessageListType2;
|
|
703
|
-
})(ListMessageListType || {});
|
|
704
|
-
var ButtonsResponseMessageType = /* @__PURE__ */ ((ButtonsResponseMessageType2) => {
|
|
705
|
-
ButtonsResponseMessageType2[ButtonsResponseMessageType2["UNKNOWN"] = 0] = "UNKNOWN";
|
|
706
|
-
ButtonsResponseMessageType2[ButtonsResponseMessageType2["DISPLAY_TEXT"] = 1] = "DISPLAY_TEXT";
|
|
707
|
-
return ButtonsResponseMessageType2;
|
|
708
|
-
})(ButtonsResponseMessageType || {});
|
|
709
|
-
var ListResponseMessageListType = /* @__PURE__ */ ((ListResponseMessageListType2) => {
|
|
710
|
-
ListResponseMessageListType2[ListResponseMessageListType2["UNKNOWN"] = 0] = "UNKNOWN";
|
|
711
|
-
ListResponseMessageListType2[ListResponseMessageListType2["SINGLE_SELECT"] = 1] = "SINGLE_SELECT";
|
|
712
|
-
return ListResponseMessageListType2;
|
|
713
|
-
})(ListResponseMessageListType || {});
|
|
714
|
-
var PaymentBackgroundType = /* @__PURE__ */ ((PaymentBackgroundType2) => {
|
|
715
|
-
PaymentBackgroundType2[PaymentBackgroundType2["UNKNOWN"] = 0] = "UNKNOWN";
|
|
716
|
-
PaymentBackgroundType2[PaymentBackgroundType2["DEFAULT"] = 1] = "DEFAULT";
|
|
717
|
-
return PaymentBackgroundType2;
|
|
718
|
-
})(PaymentBackgroundType || {});
|
|
719
|
-
var ProtocolMessageType = /* @__PURE__ */ ((ProtocolMessageType2) => {
|
|
720
|
-
ProtocolMessageType2[ProtocolMessageType2["REVOKE"] = 0] = "REVOKE";
|
|
721
|
-
ProtocolMessageType2[ProtocolMessageType2["EPHEMERAL_SETTING"] = 3] = "EPHEMERAL_SETTING";
|
|
722
|
-
ProtocolMessageType2[ProtocolMessageType2["EPHEMERAL_SYNC_RESPONSE"] = 4] = "EPHEMERAL_SYNC_RESPONSE";
|
|
723
|
-
ProtocolMessageType2[ProtocolMessageType2["HISTORY_SYNC_NOTIFICATION"] = 5] = "HISTORY_SYNC_NOTIFICATION";
|
|
724
|
-
ProtocolMessageType2[ProtocolMessageType2["APP_STATE_SYNC_KEY_SHARE"] = 6] = "APP_STATE_SYNC_KEY_SHARE";
|
|
725
|
-
ProtocolMessageType2[ProtocolMessageType2["APP_STATE_SYNC_KEY_REQUEST"] = 7] = "APP_STATE_SYNC_KEY_REQUEST";
|
|
726
|
-
ProtocolMessageType2[ProtocolMessageType2["MSG_FANOUT_BACKFILL_REQUEST"] = 8] = "MSG_FANOUT_BACKFILL_REQUEST";
|
|
727
|
-
ProtocolMessageType2[ProtocolMessageType2["INITIAL_SECURITY_NOTIFICATION_SETTING_SYNC"] = 9] = "INITIAL_SECURITY_NOTIFICATION_SETTING_SYNC";
|
|
728
|
-
ProtocolMessageType2[ProtocolMessageType2["APP_STATE_FATAL_EXCEPTION_NOTIFICATION"] = 10] = "APP_STATE_FATAL_EXCEPTION_NOTIFICATION";
|
|
729
|
-
ProtocolMessageType2[ProtocolMessageType2["SHARE_PHONE_NUMBER"] = 11] = "SHARE_PHONE_NUMBER";
|
|
730
|
-
ProtocolMessageType2[ProtocolMessageType2["MESSAGE_EDIT"] = 14] = "MESSAGE_EDIT";
|
|
731
|
-
ProtocolMessageType2[ProtocolMessageType2["PEER_DATA_OPERATION_REQUEST_MESSAGE"] = 16] = "PEER_DATA_OPERATION_REQUEST_MESSAGE";
|
|
732
|
-
ProtocolMessageType2[ProtocolMessageType2["PEER_DATA_OPERATION_REQUEST_RESPONSE_MESSAGE"] = 17] = "PEER_DATA_OPERATION_REQUEST_RESPONSE_MESSAGE";
|
|
733
|
-
return ProtocolMessageType2;
|
|
734
|
-
})(ProtocolMessageType || {});
|
|
735
|
-
var BotPluginType = /* @__PURE__ */ ((BotPluginType2) => {
|
|
736
|
-
BotPluginType2[BotPluginType2["REELS"] = 0] = "REELS";
|
|
737
|
-
BotPluginType2[BotPluginType2["SEARCH"] = 1] = "SEARCH";
|
|
738
|
-
return BotPluginType2;
|
|
739
|
-
})(BotPluginType || {});
|
|
740
|
-
var BotPluginSearchProvider = /* @__PURE__ */ ((BotPluginSearchProvider2) => {
|
|
741
|
-
BotPluginSearchProvider2[BotPluginSearchProvider2["BING"] = 0] = "BING";
|
|
742
|
-
BotPluginSearchProvider2[BotPluginSearchProvider2["GOOGLE"] = 1] = "GOOGLE";
|
|
743
|
-
return BotPluginSearchProvider2;
|
|
744
|
-
})(BotPluginSearchProvider || {});
|
|
745
|
-
var HistorySyncNotificationHistorySyncType = /* @__PURE__ */ ((HistorySyncNotificationHistorySyncType2) => {
|
|
746
|
-
HistorySyncNotificationHistorySyncType2[HistorySyncNotificationHistorySyncType2["INITIAL_BOOTSTRAP"] = 0] = "INITIAL_BOOTSTRAP";
|
|
747
|
-
HistorySyncNotificationHistorySyncType2[HistorySyncNotificationHistorySyncType2["INITIAL_STATUS_V3"] = 1] = "INITIAL_STATUS_V3";
|
|
748
|
-
HistorySyncNotificationHistorySyncType2[HistorySyncNotificationHistorySyncType2["FULL"] = 2] = "FULL";
|
|
749
|
-
HistorySyncNotificationHistorySyncType2[HistorySyncNotificationHistorySyncType2["RECENT"] = 3] = "RECENT";
|
|
750
|
-
HistorySyncNotificationHistorySyncType2[HistorySyncNotificationHistorySyncType2["PUSH_NAME"] = 4] = "PUSH_NAME";
|
|
751
|
-
HistorySyncNotificationHistorySyncType2[HistorySyncNotificationHistorySyncType2["NON_BLOCKING_DATA"] = 5] = "NON_BLOCKING_DATA";
|
|
752
|
-
HistorySyncNotificationHistorySyncType2[HistorySyncNotificationHistorySyncType2["ON_DEMAND"] = 6] = "ON_DEMAND";
|
|
753
|
-
return HistorySyncNotificationHistorySyncType2;
|
|
754
|
-
})(HistorySyncNotificationHistorySyncType || {});
|
|
755
|
-
var PeerDataOperationRequestType = /* @__PURE__ */ ((PeerDataOperationRequestType2) => {
|
|
756
|
-
PeerDataOperationRequestType2[PeerDataOperationRequestType2["UPLOAD_STICKER"] = 0] = "UPLOAD_STICKER";
|
|
757
|
-
PeerDataOperationRequestType2[PeerDataOperationRequestType2["SEND_RECENT_STICKER_BOOTSTRAP"] = 1] = "SEND_RECENT_STICKER_BOOTSTRAP";
|
|
758
|
-
PeerDataOperationRequestType2[PeerDataOperationRequestType2["GENERATE_LINK_PREVIEW"] = 2] = "GENERATE_LINK_PREVIEW";
|
|
759
|
-
return PeerDataOperationRequestType2;
|
|
760
|
-
})(PeerDataOperationRequestType || {});
|
|
761
|
-
var PeerDataOperationRequestResponseMessagePeerDataOperationResult = /* @__PURE__ */ ((PeerDataOperationRequestResponseMessagePeerDataOperationResult2) => {
|
|
762
|
-
PeerDataOperationRequestResponseMessagePeerDataOperationResult2[PeerDataOperationRequestResponseMessagePeerDataOperationResult2["SUCCESS"] = 0] = "SUCCESS";
|
|
763
|
-
PeerDataOperationRequestResponseMessagePeerDataOperationResult2[PeerDataOperationRequestResponseMessagePeerDataOperationResult2["NOT_AUTHORIZED"] = 1] = "NOT_AUTHORIZED";
|
|
764
|
-
PeerDataOperationRequestResponseMessagePeerDataOperationResult2[PeerDataOperationRequestResponseMessagePeerDataOperationResult2["NOT_FOUND"] = 2] = "NOT_FOUND";
|
|
765
|
-
PeerDataOperationRequestResponseMessagePeerDataOperationResult2[PeerDataOperationRequestResponseMessagePeerDataOperationResult2["THROTTLED"] = 3] = "THROTTLED";
|
|
766
|
-
PeerDataOperationRequestResponseMessagePeerDataOperationResult2[PeerDataOperationRequestResponseMessagePeerDataOperationResult2["UNKNOWN_ERROR"] = 4] = "UNKNOWN_ERROR";
|
|
767
|
-
return PeerDataOperationRequestResponseMessagePeerDataOperationResult2;
|
|
768
|
-
})(PeerDataOperationRequestResponseMessagePeerDataOperationResult || {});
|
|
769
|
-
function getMessageContent(message) {
|
|
770
|
-
if (message.conversation) {
|
|
771
|
-
return { type: "text", content: message.conversation };
|
|
772
|
-
}
|
|
773
|
-
if (message.extendedTextMessage) {
|
|
774
|
-
return { type: "extendedText", content: message.extendedTextMessage };
|
|
775
|
-
}
|
|
776
|
-
if (message.imageMessage) {
|
|
777
|
-
return { type: "image", content: message.imageMessage };
|
|
778
|
-
}
|
|
779
|
-
if (message.videoMessage) {
|
|
780
|
-
return { type: "video", content: message.videoMessage };
|
|
781
|
-
}
|
|
782
|
-
if (message.audioMessage) {
|
|
783
|
-
return { type: "audio", content: message.audioMessage };
|
|
784
|
-
}
|
|
785
|
-
if (message.documentMessage) {
|
|
786
|
-
return { type: "document", content: message.documentMessage };
|
|
787
|
-
}
|
|
788
|
-
if (message.stickerMessage) {
|
|
789
|
-
return { type: "sticker", content: message.stickerMessage };
|
|
790
|
-
}
|
|
791
|
-
if (message.locationMessage) {
|
|
792
|
-
return { type: "location", content: message.locationMessage };
|
|
793
|
-
}
|
|
794
|
-
if (message.liveLocationMessage) {
|
|
795
|
-
return { type: "liveLocation", content: message.liveLocationMessage };
|
|
796
|
-
}
|
|
797
|
-
if (message.contactMessage) {
|
|
798
|
-
return { type: "contact", content: message.contactMessage };
|
|
799
|
-
}
|
|
800
|
-
if (message.contactsArrayMessage) {
|
|
801
|
-
return { type: "contactsArray", content: message.contactsArrayMessage };
|
|
802
|
-
}
|
|
803
|
-
if (message.buttonsMessage) {
|
|
804
|
-
return { type: "buttons", content: message.buttonsMessage };
|
|
805
|
-
}
|
|
806
|
-
if (message.listMessage) {
|
|
807
|
-
return { type: "list", content: message.listMessage };
|
|
808
|
-
}
|
|
809
|
-
if (message.templateMessage) {
|
|
810
|
-
return { type: "template", content: message.templateMessage };
|
|
811
|
-
}
|
|
812
|
-
if (message.buttonsResponseMessage) {
|
|
813
|
-
return { type: "buttonsResponse", content: message.buttonsResponseMessage };
|
|
814
|
-
}
|
|
815
|
-
if (message.listResponseMessage) {
|
|
816
|
-
return { type: "listResponse", content: message.listResponseMessage };
|
|
817
|
-
}
|
|
818
|
-
if (message.groupInviteMessage) {
|
|
819
|
-
return { type: "groupInvite", content: message.groupInviteMessage };
|
|
820
|
-
}
|
|
821
|
-
if (message.pollCreationMessage) {
|
|
822
|
-
return { type: "poll", content: message.pollCreationMessage };
|
|
823
|
-
}
|
|
824
|
-
if (message.pollUpdateMessage) {
|
|
825
|
-
return { type: "pollUpdate", content: message.pollUpdateMessage };
|
|
826
|
-
}
|
|
827
|
-
if (message.reactionMessage) {
|
|
828
|
-
return { type: "reaction", content: message.reactionMessage };
|
|
829
|
-
}
|
|
830
|
-
if (message.protocolMessage) {
|
|
831
|
-
return { type: "protocol", content: message.protocolMessage };
|
|
832
|
-
}
|
|
833
|
-
if (message.ephemeralMessage) {
|
|
834
|
-
return { type: "ephemeral", content: message.ephemeralMessage };
|
|
835
|
-
}
|
|
836
|
-
if (message.viewOnceMessage) {
|
|
837
|
-
return { type: "viewOnce", content: message.viewOnceMessage };
|
|
838
|
-
}
|
|
839
|
-
return null;
|
|
840
|
-
}
|
|
841
|
-
var EventType = /* @__PURE__ */ ((EventType2) => {
|
|
842
|
-
EventType2["MESSAGE"] = "Message";
|
|
843
|
-
EventType2["RECEIPT"] = "Receipt";
|
|
844
|
-
EventType2["PRESENCE"] = "Presence";
|
|
845
|
-
EventType2["CHAT_PRESENCE"] = "ChatPresence";
|
|
846
|
-
EventType2["CONNECTED"] = "Connected";
|
|
847
|
-
EventType2["DISCONNECTED"] = "Disconnected";
|
|
848
|
-
EventType2["LOGGED_OUT"] = "LoggedOut";
|
|
849
|
-
EventType2["QR"] = "QR";
|
|
850
|
-
EventType2["QR_SCANNED_WITHOUT_MULTIDEVICE"] = "QRScannedWithoutMultidevice";
|
|
851
|
-
EventType2["PAIR_SUCCESS"] = "PairSuccess";
|
|
852
|
-
EventType2["PAIR_ERROR"] = "PairError";
|
|
853
|
-
EventType2["MANUAL_LOGIN_RECONNECT"] = "ManualLoginReconnect";
|
|
854
|
-
EventType2["KEEP_ALIVE_RESTORED"] = "KeepAliveRestored";
|
|
855
|
-
EventType2["KEEP_ALIVE_TIMEOUT"] = "KeepAliveTimeout";
|
|
856
|
-
EventType2["GROUP_INFO"] = "GroupInfo";
|
|
857
|
-
EventType2["JOINED_GROUP"] = "JoinedGroup";
|
|
858
|
-
EventType2["CONTACT"] = "Contact";
|
|
859
|
-
EventType2["PUSH_NAME"] = "PushName";
|
|
860
|
-
EventType2["PUSH_NAME_SETTING"] = "PushNameSetting";
|
|
861
|
-
EventType2["PICTURE"] = "Picture";
|
|
862
|
-
EventType2["USER_ABOUT"] = "UserAbout";
|
|
863
|
-
EventType2["USER_STATUS_MUTE"] = "UserStatusMute";
|
|
864
|
-
EventType2["PRIVACY_SETTINGS"] = "PrivacySettings";
|
|
865
|
-
EventType2["APP_STATE"] = "AppState";
|
|
866
|
-
EventType2["APP_STATE_SYNC_COMPLETE"] = "AppStateSyncComplete";
|
|
867
|
-
EventType2["HISTORY_SYNC"] = "HistorySync";
|
|
868
|
-
EventType2["OFFLINE_SYNC_COMPLETED"] = "OfflineSyncCompleted";
|
|
869
|
-
EventType2["OFFLINE_SYNC_PREVIEW"] = "OfflineSyncPreview";
|
|
870
|
-
EventType2["IDENTITY_CHANGE"] = "IdentityChange";
|
|
871
|
-
EventType2["ARCHIVE"] = "Archive";
|
|
872
|
-
EventType2["UNARCHIVE_CHATS_SETTING"] = "UnarchiveChatsSetting";
|
|
873
|
-
EventType2["CLEAR_CHAT"] = "ClearChat";
|
|
874
|
-
EventType2["DELETE_CHAT"] = "DeleteChat";
|
|
875
|
-
EventType2["DELETE_FOR_ME"] = "DeleteForMe";
|
|
876
|
-
EventType2["MARK_CHAT_AS_READ"] = "MarkChatAsRead";
|
|
877
|
-
EventType2["MUTE"] = "Mute";
|
|
878
|
-
EventType2["PIN"] = "Pin";
|
|
879
|
-
EventType2["STAR"] = "Star";
|
|
880
|
-
EventType2["LABEL_ASSOCIATION_CHAT"] = "LabelAssociationChat";
|
|
881
|
-
EventType2["LABEL_ASSOCIATION_MESSAGE"] = "LabelAssociationMessage";
|
|
882
|
-
EventType2["LABEL_EDIT"] = "LabelEdit";
|
|
883
|
-
EventType2["MEDIA_RETRY"] = "MediaRetry";
|
|
884
|
-
EventType2["MEDIA_RETRY_ERROR"] = "MediaRetryError";
|
|
885
|
-
EventType2["NEWSLETTER_JOIN"] = "NewsletterJoin";
|
|
886
|
-
EventType2["NEWSLETTER_LEAVE"] = "NewsletterLeave";
|
|
887
|
-
EventType2["NEWSLETTER_LIVE_UPDATE"] = "NewsletterLiveUpdate";
|
|
888
|
-
EventType2["NEWSLETTER_MESSAGE_META"] = "NewsletterMessageMeta";
|
|
889
|
-
EventType2["NEWSLETTER_MUTE_CHANGE"] = "NewsletterMuteChange";
|
|
890
|
-
EventType2["UNDECRYPTABLE_MESSAGE"] = "UndecryptableMessage";
|
|
891
|
-
EventType2["STREAM_ERROR"] = "StreamError";
|
|
892
|
-
EventType2["STREAM_REPLACED"] = "StreamReplaced";
|
|
893
|
-
EventType2["CONNECT_FAILURE"] = "ConnectFailure";
|
|
894
|
-
EventType2["CLIENT_OUTDATED"] = "ClientOutdated";
|
|
895
|
-
EventType2["TEMPORARY_BAN"] = "TemporaryBan";
|
|
896
|
-
EventType2["CAT_REFRESH_ERROR"] = "CATRefreshError";
|
|
897
|
-
EventType2["PERMANENT_DISCONNECT"] = "PermanentDisconnect";
|
|
898
|
-
EventType2["BLOCKLIST"] = "Blocklist";
|
|
899
|
-
EventType2["BLOCKLIST_ACTION"] = "BlocklistAction";
|
|
900
|
-
EventType2["BLOCKLIST_CHANGE"] = "BlocklistChange";
|
|
901
|
-
EventType2["BUSINESS_NAME"] = "BusinessName";
|
|
902
|
-
EventType2["CALL_ACCEPT"] = "CallAccept";
|
|
903
|
-
EventType2["CALL_OFFER"] = "CallOffer";
|
|
904
|
-
EventType2["CALL_OFFER_NOTICE"] = "CallOfferNotice";
|
|
905
|
-
EventType2["CALL_PRE_ACCEPT"] = "CallPreAccept";
|
|
906
|
-
EventType2["CALL_REJECT"] = "CallReject";
|
|
907
|
-
EventType2["CALL_RELAY_LATENCY"] = "CallRelayLatency";
|
|
908
|
-
EventType2["CALL_TERMINATE"] = "CallTerminate";
|
|
909
|
-
EventType2["CALL_TRANSPORT"] = "CallTransport";
|
|
910
|
-
EventType2["UNKNOWN_CALL_EVENT"] = "UnknownCallEvent";
|
|
911
|
-
EventType2["FB_MESSAGE"] = "FBMessage";
|
|
912
|
-
return EventType2;
|
|
913
|
-
})(EventType || {});
|
|
914
|
-
var MessageStatus = /* @__PURE__ */ ((MessageStatus2) => {
|
|
915
|
-
MessageStatus2["ERROR"] = "ERROR";
|
|
916
|
-
MessageStatus2["PENDING"] = "PENDING";
|
|
917
|
-
MessageStatus2["SERVER_ACK"] = "SERVER_ACK";
|
|
918
|
-
MessageStatus2["DELIVERY_ACK"] = "DELIVERY_ACK";
|
|
919
|
-
MessageStatus2["READ"] = "READ";
|
|
920
|
-
MessageStatus2["PLAYED"] = "PLAYED";
|
|
921
|
-
return MessageStatus2;
|
|
922
|
-
})(MessageStatus || {});
|
|
923
|
-
var ReceiptType = /* @__PURE__ */ ((ReceiptType2) => {
|
|
924
|
-
ReceiptType2["UNKNOWN"] = "";
|
|
925
|
-
ReceiptType2["DELIVERY"] = "delivery";
|
|
926
|
-
ReceiptType2["READ"] = "read";
|
|
927
|
-
ReceiptType2["READ_SELF"] = "read-self";
|
|
928
|
-
ReceiptType2["PLAYED"] = "played";
|
|
929
|
-
ReceiptType2["SENDER"] = "sender";
|
|
930
|
-
ReceiptType2["INACTIVE"] = "inactive";
|
|
931
|
-
ReceiptType2["PEER_MSG"] = "peer_msg";
|
|
932
|
-
return ReceiptType2;
|
|
933
|
-
})(ReceiptType || {});
|
|
934
|
-
var DecryptFailMode = /* @__PURE__ */ ((DecryptFailMode2) => {
|
|
935
|
-
DecryptFailMode2["UNAVAILABLE"] = "unavailable";
|
|
936
|
-
DecryptFailMode2["DECRYPT_FAIL"] = "decrypt_fail";
|
|
937
|
-
return DecryptFailMode2;
|
|
938
|
-
})(DecryptFailMode || {});
|
|
939
|
-
var UnavailableType = /* @__PURE__ */ ((UnavailableType2) => {
|
|
940
|
-
UnavailableType2["UNKNOWN"] = "";
|
|
941
|
-
UnavailableType2["VIEW_ONCE"] = "view_once";
|
|
942
|
-
return UnavailableType2;
|
|
943
|
-
})(UnavailableType || {});
|
|
944
|
-
var ConnectFailureReason = /* @__PURE__ */ ((ConnectFailureReason2) => {
|
|
945
|
-
ConnectFailureReason2[ConnectFailureReason2["SOCKET_OPEN_TIMEOUT"] = 4001] = "SOCKET_OPEN_TIMEOUT";
|
|
946
|
-
ConnectFailureReason2[ConnectFailureReason2["SOCKET_PING_TIMEOUT"] = 4002] = "SOCKET_PING_TIMEOUT";
|
|
947
|
-
ConnectFailureReason2[ConnectFailureReason2["SOCKET_PONG_TIMEOUT"] = 4003] = "SOCKET_PONG_TIMEOUT";
|
|
948
|
-
ConnectFailureReason2[ConnectFailureReason2["UNKNOWN_LOGOUT"] = 4004] = "UNKNOWN_LOGOUT";
|
|
949
|
-
ConnectFailureReason2[ConnectFailureReason2["BAD_MAC"] = 4005] = "BAD_MAC";
|
|
950
|
-
ConnectFailureReason2[ConnectFailureReason2["INIT_TIMEOUT"] = 4006] = "INIT_TIMEOUT";
|
|
951
|
-
ConnectFailureReason2[ConnectFailureReason2["MULTI_DEVICE_MISMATCH"] = 4007] = "MULTI_DEVICE_MISMATCH";
|
|
952
|
-
ConnectFailureReason2[ConnectFailureReason2["MULTI_DEVICE_DISABLED"] = 4008] = "MULTI_DEVICE_DISABLED";
|
|
953
|
-
ConnectFailureReason2[ConnectFailureReason2["TEMP_BANNED"] = 4009] = "TEMP_BANNED";
|
|
954
|
-
ConnectFailureReason2[ConnectFailureReason2["CLIENT_OUTDATED"] = 4010] = "CLIENT_OUTDATED";
|
|
955
|
-
ConnectFailureReason2[ConnectFailureReason2["STREAM_ERROR"] = 4011] = "STREAM_ERROR";
|
|
956
|
-
ConnectFailureReason2[ConnectFailureReason2["DEVICE_GONE"] = 4012] = "DEVICE_GONE";
|
|
957
|
-
ConnectFailureReason2[ConnectFailureReason2["IDENTITY_MISSING"] = 4013] = "IDENTITY_MISSING";
|
|
958
|
-
ConnectFailureReason2[ConnectFailureReason2["RATE_LIMIT_HIT"] = 4014] = "RATE_LIMIT_HIT";
|
|
959
|
-
ConnectFailureReason2[ConnectFailureReason2["MAIN_DEVICE_GONE"] = 4015] = "MAIN_DEVICE_GONE";
|
|
960
|
-
return ConnectFailureReason2;
|
|
961
|
-
})(ConnectFailureReason || {});
|
|
962
|
-
var TempBanReason = /* @__PURE__ */ ((TempBanReason2) => {
|
|
963
|
-
TempBanReason2[TempBanReason2["SENT_TO_TOO_MANY_PEOPLE"] = 101] = "SENT_TO_TOO_MANY_PEOPLE";
|
|
964
|
-
TempBanReason2[TempBanReason2["BLOCKED_BY_USERS"] = 102] = "BLOCKED_BY_USERS";
|
|
965
|
-
TempBanReason2[TempBanReason2["CREATED_TOO_MANY_GROUPS"] = 103] = "CREATED_TOO_MANY_GROUPS";
|
|
966
|
-
TempBanReason2[TempBanReason2["SENT_TOO_MANY_SAME_MESSAGE"] = 104] = "SENT_TOO_MANY_SAME_MESSAGE";
|
|
967
|
-
TempBanReason2[TempBanReason2["BROADCAST_LIST"] = 106] = "BROADCAST_LIST";
|
|
968
|
-
return TempBanReason2;
|
|
969
|
-
})(TempBanReason || {});
|
|
970
|
-
export {
|
|
971
|
-
AdminModule,
|
|
972
|
-
BotPluginSearchProvider,
|
|
973
|
-
BotPluginType,
|
|
974
|
-
ButtonType,
|
|
975
|
-
ButtonsMessageHeaderType,
|
|
976
|
-
ButtonsResponseMessageType,
|
|
977
|
-
ChatModule,
|
|
978
|
-
ConnectFailureReason,
|
|
979
|
-
DecryptFailMode,
|
|
980
|
-
DisappearingModeInitiator,
|
|
981
|
-
DisappearingModeTrigger,
|
|
982
|
-
EventType,
|
|
983
|
-
ExtendedTextMessageFontType,
|
|
984
|
-
ExtendedTextMessageInviteLinkGroupType,
|
|
985
|
-
ExtendedTextMessagePreviewType,
|
|
986
|
-
GroupModule,
|
|
987
|
-
HistorySyncNotificationHistorySyncType,
|
|
988
|
-
InviteLinkGroupType,
|
|
989
|
-
ListMessageListType,
|
|
990
|
-
ListResponseMessageListType,
|
|
991
|
-
MediaType,
|
|
992
|
-
MessageStatus,
|
|
993
|
-
NewsletterModule,
|
|
994
|
-
PaymentBackgroundType,
|
|
995
|
-
PeerDataOperationRequestResponseMessagePeerDataOperationResult,
|
|
996
|
-
PeerDataOperationRequestType,
|
|
997
|
-
ProtocolMessageType,
|
|
998
|
-
ReceiptType,
|
|
999
|
-
SessionModule,
|
|
1000
|
-
TempBanReason,
|
|
1001
|
-
UnavailableType,
|
|
1002
|
-
UserModule,
|
|
1003
|
-
VideoAttribution,
|
|
1004
|
-
VideoSourceType,
|
|
1005
|
-
WebhookModule,
|
|
1006
|
-
WuzapiClient,
|
|
1007
|
-
WuzapiError,
|
|
1008
|
-
WuzapiClient as default,
|
|
1009
|
-
getMessageContent,
|
|
1010
|
-
hasBase64Media,
|
|
1011
|
-
hasBothMedia,
|
|
1012
|
-
hasS3Media
|
|
1013
|
-
};
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
const wuzapiClient = require("./wuzapi-client.js");
|
|
4
|
+
const client = require("./client.js");
|
|
5
|
+
const types_index = require("./types/index.js");
|
|
6
|
+
const modules_admin = require("./modules/admin.js");
|
|
7
|
+
const modules_session = require("./modules/session.js");
|
|
8
|
+
const modules_user = require("./modules/user.js");
|
|
9
|
+
const modules_chat = require("./modules/chat.js");
|
|
10
|
+
const modules_group = require("./modules/group.js");
|
|
11
|
+
const modules_webhook = require("./modules/webhook.js");
|
|
12
|
+
const modules_newsletter = require("./modules/newsletter.js");
|
|
13
|
+
exports.WuzapiClient = wuzapiClient.WuzapiClient;
|
|
14
|
+
exports.default = wuzapiClient.WuzapiClient;
|
|
15
|
+
exports.WuzapiError = client.WuzapiError;
|
|
16
|
+
exports.BotPluginSearchProvider = types_index.BotPluginSearchProvider;
|
|
17
|
+
exports.BotPluginType = types_index.BotPluginType;
|
|
18
|
+
exports.ButtonType = types_index.ButtonType;
|
|
19
|
+
exports.ButtonsMessageHeaderType = types_index.ButtonsMessageHeaderType;
|
|
20
|
+
exports.ButtonsResponseMessageType = types_index.ButtonsResponseMessageType;
|
|
21
|
+
exports.ConnectFailureReason = types_index.ConnectFailureReason;
|
|
22
|
+
exports.DecryptFailMode = types_index.DecryptFailMode;
|
|
23
|
+
exports.DisappearingModeInitiator = types_index.DisappearingModeInitiator;
|
|
24
|
+
exports.DisappearingModeTrigger = types_index.DisappearingModeTrigger;
|
|
25
|
+
exports.EventType = types_index.EventType;
|
|
26
|
+
exports.ExtendedTextMessageFontType = types_index.ExtendedTextMessageFontType;
|
|
27
|
+
exports.ExtendedTextMessageInviteLinkGroupType = types_index.ExtendedTextMessageInviteLinkGroupType;
|
|
28
|
+
exports.ExtendedTextMessagePreviewType = types_index.ExtendedTextMessagePreviewType;
|
|
29
|
+
exports.HistorySyncNotificationHistorySyncType = types_index.HistorySyncNotificationHistorySyncType;
|
|
30
|
+
exports.InviteLinkGroupType = types_index.InviteLinkGroupType;
|
|
31
|
+
exports.ListMessageListType = types_index.ListMessageListType;
|
|
32
|
+
exports.ListResponseMessageListType = types_index.ListResponseMessageListType;
|
|
33
|
+
exports.MediaType = types_index.MediaType;
|
|
34
|
+
exports.MessageStatus = types_index.MessageStatus;
|
|
35
|
+
exports.PaymentBackgroundType = types_index.PaymentBackgroundType;
|
|
36
|
+
exports.PeerDataOperationRequestResponseMessagePeerDataOperationResult = types_index.PeerDataOperationRequestResponseMessagePeerDataOperationResult;
|
|
37
|
+
exports.PeerDataOperationRequestType = types_index.PeerDataOperationRequestType;
|
|
38
|
+
exports.ProtocolMessageType = types_index.ProtocolMessageType;
|
|
39
|
+
exports.ReceiptType = types_index.ReceiptType;
|
|
40
|
+
exports.TempBanReason = types_index.TempBanReason;
|
|
41
|
+
exports.UnavailableType = types_index.UnavailableType;
|
|
42
|
+
exports.VideoAttribution = types_index.VideoAttribution;
|
|
43
|
+
exports.VideoSourceType = types_index.VideoSourceType;
|
|
44
|
+
exports.getMessageContent = types_index.getMessageContent;
|
|
45
|
+
exports.hasBase64Media = types_index.hasBase64Media;
|
|
46
|
+
exports.hasBothMedia = types_index.hasBothMedia;
|
|
47
|
+
exports.hasS3Media = types_index.hasS3Media;
|
|
48
|
+
exports.AdminModule = modules_admin.AdminModule;
|
|
49
|
+
exports.SessionModule = modules_session.SessionModule;
|
|
50
|
+
exports.UserModule = modules_user.UserModule;
|
|
51
|
+
exports.ChatModule = modules_chat.ChatModule;
|
|
52
|
+
exports.GroupModule = modules_group.GroupModule;
|
|
53
|
+
exports.WebhookModule = modules_webhook.WebhookModule;
|
|
54
|
+
exports.NewsletterModule = modules_newsletter.NewsletterModule;
|
|
1014
55
|
//# sourceMappingURL=index.js.map
|