wuzapi 1.2.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +244 -46
- package/dist/index.js +87 -1
- package/dist/index.js.map +1 -1
- package/dist/types/events.d.ts +72 -0
- package/dist/types/webhook.d.ts +36 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -301,11 +301,128 @@ console.log("Subscribed events:", webhookConfig.subscribe);
|
|
|
301
301
|
|
|
302
302
|
WuzAPI sends real-time events to your webhook endpoint. Here's how to handle different types of events:
|
|
303
303
|
|
|
304
|
+
## Webhook Payload Structure
|
|
305
|
+
|
|
306
|
+
When S3 is enabled, webhook payloads will include S3 information based on the `media_delivery` setting configured in your WuzAPI instance.
|
|
307
|
+
|
|
308
|
+
### Standard Event Payload
|
|
309
|
+
|
|
310
|
+
```json
|
|
311
|
+
{
|
|
312
|
+
"event": {
|
|
313
|
+
"Info": {
|
|
314
|
+
"ID": "3EB06F9067F80BAB89FF",
|
|
315
|
+
"Type": "text",
|
|
316
|
+
"PushName": "John Doe",
|
|
317
|
+
"Timestamp": "2024-12-25T10:30:00Z",
|
|
318
|
+
"Source": {
|
|
319
|
+
"Chat": "5491155553934@s.whatsapp.net",
|
|
320
|
+
"Sender": "5491155553934@s.whatsapp.net",
|
|
321
|
+
"IsFromMe": false,
|
|
322
|
+
"IsGroup": false
|
|
323
|
+
}
|
|
324
|
+
},
|
|
325
|
+
"Message": {
|
|
326
|
+
"conversation": "Hello, this is a test message!"
|
|
327
|
+
},
|
|
328
|
+
"IsEphemeral": false,
|
|
329
|
+
"IsViewOnce": false,
|
|
330
|
+
"IsDocumentWithCaption": false,
|
|
331
|
+
"IsEdit": false
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
### S3 Only (`media_delivery: "s3"`)
|
|
337
|
+
|
|
338
|
+
```json
|
|
339
|
+
{
|
|
340
|
+
"event": {
|
|
341
|
+
"Info": {
|
|
342
|
+
"ID": "3EB06F9067F80BAB89FF",
|
|
343
|
+
"Type": "image",
|
|
344
|
+
"PushName": "John Doe",
|
|
345
|
+
"Timestamp": "2024-12-25T10:30:00Z",
|
|
346
|
+
"Source": {
|
|
347
|
+
"Chat": "5491155553934@s.whatsapp.net",
|
|
348
|
+
"Sender": "5491155553934@s.whatsapp.net",
|
|
349
|
+
"IsFromMe": false,
|
|
350
|
+
"IsGroup": false
|
|
351
|
+
}
|
|
352
|
+
},
|
|
353
|
+
"Message": {
|
|
354
|
+
"imageMessage": {
|
|
355
|
+
"caption": "Check out this photo!",
|
|
356
|
+
"mimetype": "image/jpeg",
|
|
357
|
+
"width": 1920,
|
|
358
|
+
"height": 1080,
|
|
359
|
+
"fileLength": 245632
|
|
360
|
+
}
|
|
361
|
+
},
|
|
362
|
+
"IsEphemeral": false,
|
|
363
|
+
"IsViewOnce": false
|
|
364
|
+
},
|
|
365
|
+
"s3": {
|
|
366
|
+
"url": "https://my-bucket.s3.us-east-1.amazonaws.com/users/abc123/inbox/5491155553934/2024/12/25/images/3EB06F9067F80BAB89FF.jpg",
|
|
367
|
+
"key": "users/abc123/inbox/5491155553934/2024/12/25/images/3EB06F9067F80BAB89FF.jpg",
|
|
368
|
+
"bucket": "my-bucket",
|
|
369
|
+
"size": 245632,
|
|
370
|
+
"mimeType": "image/jpeg",
|
|
371
|
+
"fileName": "3EB06F9067F80BAB89FF.jpg"
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
### Both S3 and Base64 (`media_delivery: "both"`)
|
|
377
|
+
|
|
378
|
+
```json
|
|
379
|
+
{
|
|
380
|
+
"event": {
|
|
381
|
+
"Info": { "..." },
|
|
382
|
+
"Message": {
|
|
383
|
+
"imageMessage": {
|
|
384
|
+
"caption": "Check out this photo!",
|
|
385
|
+
"mimetype": "image/jpeg",
|
|
386
|
+
"width": 1920,
|
|
387
|
+
"height": 1080
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
},
|
|
391
|
+
"base64": "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQYGBcUFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj/2wBDAQcHBwoIChMKChMoGhYaKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCj/wAARCAABAAEDASIAAhEBAxEB/8QAFQABAQAAAAAAAAAAAAAAAAAAAAv/xAAUEAEAAAAAAAAAAAAAAAAAAAAA/8QAFQEBAQAAAAAAAAAAAAAAAAAAAAX/xAAUEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwCdABmX/9k=",
|
|
392
|
+
"mimeType": "image/jpeg",
|
|
393
|
+
"fileName": "3EB06F9067F80BAB89FF.jpg",
|
|
394
|
+
"s3": {
|
|
395
|
+
"url": "https://my-bucket.s3.us-east-1.amazonaws.com/users/abc123/inbox/5491155553934/2024/12/25/images/3EB06F9067F80BAB89FF.jpg",
|
|
396
|
+
"key": "users/abc123/inbox/5491155553934/2024/12/25/images/3EB06F9067F80BAB89FF.jpg",
|
|
397
|
+
"bucket": "my-bucket",
|
|
398
|
+
"size": 245632,
|
|
399
|
+
"mimeType": "image/jpeg",
|
|
400
|
+
"fileName": "3EB06F9067F80BAB89FF.jpg"
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
### Base64 Only (`media_delivery: "base64"`)
|
|
406
|
+
|
|
407
|
+
```json
|
|
408
|
+
{
|
|
409
|
+
"event": { "..." },
|
|
410
|
+
"base64": "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQYGBcUFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj/2wBDAQcHBwoIChMKChMoGhYaKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCj/wAARCAABAAEDASIAAhEBAxEB/8QAFQABAQAAAAAAAAAAAAAAAAAAAAv/xAAUEAEAAAAAAAAAAAAAAAAAAAAA/8QAFQEBAQAAAAAAAAAAAAAAAAAAAAX/xAAUEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwCdABmX/9k=",
|
|
411
|
+
"mimeType": "image/jpeg",
|
|
412
|
+
"fileName": "3EB06F9067F80BAB89FF.jpg"
|
|
413
|
+
}
|
|
414
|
+
```
|
|
415
|
+
|
|
304
416
|
### Basic Webhook Setup
|
|
305
417
|
|
|
306
418
|
```typescript
|
|
307
419
|
import express from "express";
|
|
308
|
-
import WuzapiClient
|
|
420
|
+
import WuzapiClient, {
|
|
421
|
+
EventType,
|
|
422
|
+
hasS3Media,
|
|
423
|
+
hasBase64Media,
|
|
424
|
+
WebhookPayload,
|
|
425
|
+
} from "wuzapi";
|
|
309
426
|
|
|
310
427
|
const app = express();
|
|
311
428
|
app.use(express.json());
|
|
@@ -315,18 +432,43 @@ const client = new WuzapiClient({
|
|
|
315
432
|
token: "your-token",
|
|
316
433
|
});
|
|
317
434
|
|
|
318
|
-
// Webhook endpoint
|
|
435
|
+
// Webhook endpoint with S3 media support
|
|
319
436
|
app.post("/webhook", async (req, res) => {
|
|
320
437
|
try {
|
|
321
|
-
const
|
|
322
|
-
|
|
323
|
-
// Handle
|
|
324
|
-
if (
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
438
|
+
const webhookPayload: WebhookPayload = req.body;
|
|
439
|
+
|
|
440
|
+
// Handle S3 media information if present
|
|
441
|
+
if (hasS3Media(webhookPayload)) {
|
|
442
|
+
console.log("☁️ S3 Media:", {
|
|
443
|
+
url: webhookPayload.s3.url,
|
|
444
|
+
bucket: webhookPayload.s3.bucket,
|
|
445
|
+
size: webhookPayload.s3.size,
|
|
446
|
+
type: webhookPayload.s3.mimeType,
|
|
447
|
+
});
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
if (hasBase64Media(webhookPayload)) {
|
|
451
|
+
console.log("📦 Base64 media included");
|
|
452
|
+
// Process base64 media: webhookPayload.base64
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
// Extract the actual event data
|
|
456
|
+
const event = webhookPayload.event || webhookPayload;
|
|
457
|
+
const eventType = detectEventType(event);
|
|
458
|
+
|
|
459
|
+
// Handle different event types using EventType enum
|
|
460
|
+
switch (eventType) {
|
|
461
|
+
case EventType.MESSAGE:
|
|
462
|
+
await handleMessage(event);
|
|
463
|
+
break;
|
|
464
|
+
case EventType.RECEIPT:
|
|
465
|
+
await handleReceipt(event);
|
|
466
|
+
break;
|
|
467
|
+
case EventType.PRESENCE:
|
|
468
|
+
await handlePresence(event);
|
|
469
|
+
break;
|
|
470
|
+
default:
|
|
471
|
+
console.log(`Unhandled event type: ${eventType}`);
|
|
330
472
|
}
|
|
331
473
|
|
|
332
474
|
res.status(200).json({ success: true });
|
|
@@ -336,6 +478,18 @@ app.post("/webhook", async (req, res) => {
|
|
|
336
478
|
}
|
|
337
479
|
});
|
|
338
480
|
|
|
481
|
+
// Helper function to detect event type
|
|
482
|
+
function detectEventType(event: any): EventType | string {
|
|
483
|
+
if (event.Message && event.Info) return EventType.MESSAGE;
|
|
484
|
+
if (event.MessageIDs && event.Type) return EventType.RECEIPT;
|
|
485
|
+
if (event.From && typeof event.Unavailable !== "undefined")
|
|
486
|
+
return EventType.PRESENCE;
|
|
487
|
+
if (event.State && event.MessageSource) return EventType.CHAT_PRESENCE;
|
|
488
|
+
if (event.Codes) return EventType.QR;
|
|
489
|
+
// Add more detection logic as needed
|
|
490
|
+
return "Unknown";
|
|
491
|
+
}
|
|
492
|
+
|
|
339
493
|
app.listen(3000, () => {
|
|
340
494
|
console.log("Webhook server running on port 3000");
|
|
341
495
|
});
|
|
@@ -823,23 +977,23 @@ app.get("/health", (req, res) => {
|
|
|
823
977
|
// Initialize
|
|
824
978
|
async function initialize() {
|
|
825
979
|
try {
|
|
826
|
-
// Connect to WhatsApp with all events
|
|
980
|
+
// Connect to WhatsApp with all events using EventType enum
|
|
827
981
|
await client.session.connect({
|
|
828
982
|
Subscribe: [
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
983
|
+
EventType.MESSAGE,
|
|
984
|
+
EventType.RECEIPT,
|
|
985
|
+
EventType.PRESENCE,
|
|
986
|
+
EventType.CHAT_PRESENCE,
|
|
987
|
+
EventType.GROUP_INFO,
|
|
988
|
+
EventType.CONTACT,
|
|
989
|
+
EventType.PUSH_NAME,
|
|
990
|
+
EventType.PICTURE,
|
|
991
|
+
EventType.QR,
|
|
992
|
+
EventType.CONNECTED,
|
|
993
|
+
EventType.DISCONNECTED,
|
|
994
|
+
EventType.LOGGED_OUT,
|
|
995
|
+
EventType.UNDECRYPTABLE_MESSAGE,
|
|
996
|
+
EventType.STREAM_ERROR,
|
|
843
997
|
],
|
|
844
998
|
Immediate: false,
|
|
845
999
|
});
|
|
@@ -868,6 +1022,9 @@ All webhook events are fully typed. Import the specific event types you need:
|
|
|
868
1022
|
|
|
869
1023
|
```typescript
|
|
870
1024
|
import {
|
|
1025
|
+
// Event type enum for all possible events
|
|
1026
|
+
EventType,
|
|
1027
|
+
|
|
871
1028
|
// Core message types
|
|
872
1029
|
Message,
|
|
873
1030
|
MessageEvent,
|
|
@@ -887,6 +1044,16 @@ import {
|
|
|
887
1044
|
PollCreationMessage,
|
|
888
1045
|
ReactionMessage,
|
|
889
1046
|
|
|
1047
|
+
// Webhook payload types
|
|
1048
|
+
WebhookPayload,
|
|
1049
|
+
S3MediaInfo,
|
|
1050
|
+
S3OnlyWebhookPayload,
|
|
1051
|
+
Base64OnlyWebhookPayload,
|
|
1052
|
+
BothMediaWebhookPayload,
|
|
1053
|
+
hasS3Media,
|
|
1054
|
+
hasBase64Media,
|
|
1055
|
+
hasBothMedia,
|
|
1056
|
+
|
|
890
1057
|
// Event types
|
|
891
1058
|
Receipt,
|
|
892
1059
|
Presence,
|
|
@@ -904,33 +1071,64 @@ import {
|
|
|
904
1071
|
WhatsAppEvent,
|
|
905
1072
|
} from "wuzapi";
|
|
906
1073
|
|
|
907
|
-
// Type-safe event handling with
|
|
908
|
-
async function
|
|
909
|
-
const
|
|
1074
|
+
// Type-safe event handling with EventType enum
|
|
1075
|
+
async function handleTypedWebhook(webhookPayload: WebhookPayload) {
|
|
1076
|
+
const event = webhookPayload.event;
|
|
910
1077
|
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
const imageMsg: ImageMessage = messageContent.content;
|
|
914
|
-
console.log(`Image dimensions: ${imageMsg.width}x${imageMsg.height}`);
|
|
915
|
-
console.log(`File size: ${imageMsg.fileLength} bytes`);
|
|
1078
|
+
// Type-safe event detection using EventType enum
|
|
1079
|
+
const eventType = detectEventType(event);
|
|
916
1080
|
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
}
|
|
1081
|
+
switch (eventType) {
|
|
1082
|
+
case EventType.MESSAGE:
|
|
1083
|
+
const messageEvent = event as MessageEvent;
|
|
1084
|
+
const messageContent = getMessageContent(messageEvent.Message);
|
|
922
1085
|
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
1086
|
+
if (messageContent?.type === "image") {
|
|
1087
|
+
// TypeScript knows this is an ImageMessage
|
|
1088
|
+
const imageMsg: ImageMessage = messageContent.content;
|
|
1089
|
+
console.log(`Image dimensions: ${imageMsg.width}x${imageMsg.height}`);
|
|
927
1090
|
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
1091
|
+
// Handle S3 media if available
|
|
1092
|
+
if (hasS3Media(webhookPayload)) {
|
|
1093
|
+
console.log(`S3 URL: ${webhookPayload.s3.url}`);
|
|
1094
|
+
// Download from S3 or process as needed
|
|
1095
|
+
}
|
|
1096
|
+
|
|
1097
|
+
// Handle Base64 media if available
|
|
1098
|
+
if (hasBase64Media(webhookPayload)) {
|
|
1099
|
+
console.log("Processing base64 image data");
|
|
1100
|
+
// Process base64 data: webhookPayload.base64
|
|
1101
|
+
}
|
|
1102
|
+
}
|
|
1103
|
+
break;
|
|
1104
|
+
|
|
1105
|
+
case EventType.RECEIPT:
|
|
1106
|
+
const receiptEvent = event as Receipt;
|
|
1107
|
+
console.log(`Receipt type: ${receiptEvent.Type}`);
|
|
1108
|
+
break;
|
|
1109
|
+
|
|
1110
|
+
case EventType.PRESENCE:
|
|
1111
|
+
const presenceEvent = event as Presence;
|
|
1112
|
+
console.log(`User ${presenceEvent.From.User} presence update`);
|
|
1113
|
+
break;
|
|
1114
|
+
|
|
1115
|
+
default:
|
|
1116
|
+
console.log(`Unhandled event: ${eventType}`);
|
|
931
1117
|
}
|
|
932
1118
|
}
|
|
933
1119
|
|
|
1120
|
+
// Complete webhook server with S3 support
|
|
1121
|
+
app.post("/webhook", async (req, res) => {
|
|
1122
|
+
try {
|
|
1123
|
+
const payload: WebhookPayload = req.body;
|
|
1124
|
+
await handleTypedWebhook(payload);
|
|
1125
|
+
res.status(200).json({ success: true });
|
|
1126
|
+
} catch (error) {
|
|
1127
|
+
console.error("Webhook error:", error);
|
|
1128
|
+
res.status(500).json({ error: error.message });
|
|
1129
|
+
}
|
|
1130
|
+
});
|
|
1131
|
+
|
|
934
1132
|
// Helper function to handle all message types generically
|
|
935
1133
|
function processMessageContent(content: MessageContent) {
|
|
936
1134
|
switch (content.type) {
|
package/dist/index.js
CHANGED
|
@@ -378,6 +378,15 @@ class WuzapiClient {
|
|
|
378
378
|
}
|
|
379
379
|
}
|
|
380
380
|
}
|
|
381
|
+
function hasS3Media(payload) {
|
|
382
|
+
return !!payload.s3;
|
|
383
|
+
}
|
|
384
|
+
function hasBase64Media(payload) {
|
|
385
|
+
return !!payload.base64;
|
|
386
|
+
}
|
|
387
|
+
function hasBothMedia(payload) {
|
|
388
|
+
return hasS3Media(payload) && hasBase64Media(payload);
|
|
389
|
+
}
|
|
381
390
|
var DisappearingModeInitiator = /* @__PURE__ */ ((DisappearingModeInitiator2) => {
|
|
382
391
|
DisappearingModeInitiator2[DisappearingModeInitiator2["CHANGED_IN_CHAT"] = 0] = "CHANGED_IN_CHAT";
|
|
383
392
|
DisappearingModeInitiator2[DisappearingModeInitiator2["INITIATED_BY_ME"] = 1] = "INITIATED_BY_ME";
|
|
@@ -601,6 +610,79 @@ function getMessageContent(message) {
|
|
|
601
610
|
}
|
|
602
611
|
return null;
|
|
603
612
|
}
|
|
613
|
+
var EventType = /* @__PURE__ */ ((EventType2) => {
|
|
614
|
+
EventType2["MESSAGE"] = "Message";
|
|
615
|
+
EventType2["RECEIPT"] = "Receipt";
|
|
616
|
+
EventType2["PRESENCE"] = "Presence";
|
|
617
|
+
EventType2["CHAT_PRESENCE"] = "ChatPresence";
|
|
618
|
+
EventType2["CONNECTED"] = "Connected";
|
|
619
|
+
EventType2["DISCONNECTED"] = "Disconnected";
|
|
620
|
+
EventType2["LOGGED_OUT"] = "LoggedOut";
|
|
621
|
+
EventType2["QR"] = "QR";
|
|
622
|
+
EventType2["QR_SCANNED_WITHOUT_MULTIDEVICE"] = "QRScannedWithoutMultidevice";
|
|
623
|
+
EventType2["PAIR_SUCCESS"] = "PairSuccess";
|
|
624
|
+
EventType2["PAIR_ERROR"] = "PairError";
|
|
625
|
+
EventType2["MANUAL_LOGIN_RECONNECT"] = "ManualLoginReconnect";
|
|
626
|
+
EventType2["KEEP_ALIVE_RESTORED"] = "KeepAliveRestored";
|
|
627
|
+
EventType2["KEEP_ALIVE_TIMEOUT"] = "KeepAliveTimeout";
|
|
628
|
+
EventType2["GROUP_INFO"] = "GroupInfo";
|
|
629
|
+
EventType2["JOINED_GROUP"] = "JoinedGroup";
|
|
630
|
+
EventType2["CONTACT"] = "Contact";
|
|
631
|
+
EventType2["PUSH_NAME"] = "PushName";
|
|
632
|
+
EventType2["PUSH_NAME_SETTING"] = "PushNameSetting";
|
|
633
|
+
EventType2["PICTURE"] = "Picture";
|
|
634
|
+
EventType2["USER_ABOUT"] = "UserAbout";
|
|
635
|
+
EventType2["USER_STATUS_MUTE"] = "UserStatusMute";
|
|
636
|
+
EventType2["PRIVACY_SETTINGS"] = "PrivacySettings";
|
|
637
|
+
EventType2["APP_STATE"] = "AppState";
|
|
638
|
+
EventType2["APP_STATE_SYNC_COMPLETE"] = "AppStateSyncComplete";
|
|
639
|
+
EventType2["HISTORY_SYNC"] = "HistorySync";
|
|
640
|
+
EventType2["OFFLINE_SYNC_COMPLETED"] = "OfflineSyncCompleted";
|
|
641
|
+
EventType2["OFFLINE_SYNC_PREVIEW"] = "OfflineSyncPreview";
|
|
642
|
+
EventType2["IDENTITY_CHANGE"] = "IdentityChange";
|
|
643
|
+
EventType2["ARCHIVE"] = "Archive";
|
|
644
|
+
EventType2["UNARCHIVE_CHATS_SETTING"] = "UnarchiveChatsSetting";
|
|
645
|
+
EventType2["CLEAR_CHAT"] = "ClearChat";
|
|
646
|
+
EventType2["DELETE_CHAT"] = "DeleteChat";
|
|
647
|
+
EventType2["DELETE_FOR_ME"] = "DeleteForMe";
|
|
648
|
+
EventType2["MARK_CHAT_AS_READ"] = "MarkChatAsRead";
|
|
649
|
+
EventType2["MUTE"] = "Mute";
|
|
650
|
+
EventType2["PIN"] = "Pin";
|
|
651
|
+
EventType2["STAR"] = "Star";
|
|
652
|
+
EventType2["LABEL_ASSOCIATION_CHAT"] = "LabelAssociationChat";
|
|
653
|
+
EventType2["LABEL_ASSOCIATION_MESSAGE"] = "LabelAssociationMessage";
|
|
654
|
+
EventType2["LABEL_EDIT"] = "LabelEdit";
|
|
655
|
+
EventType2["MEDIA_RETRY"] = "MediaRetry";
|
|
656
|
+
EventType2["MEDIA_RETRY_ERROR"] = "MediaRetryError";
|
|
657
|
+
EventType2["NEWSLETTER_JOIN"] = "NewsletterJoin";
|
|
658
|
+
EventType2["NEWSLETTER_LEAVE"] = "NewsletterLeave";
|
|
659
|
+
EventType2["NEWSLETTER_LIVE_UPDATE"] = "NewsletterLiveUpdate";
|
|
660
|
+
EventType2["NEWSLETTER_MESSAGE_META"] = "NewsletterMessageMeta";
|
|
661
|
+
EventType2["NEWSLETTER_MUTE_CHANGE"] = "NewsletterMuteChange";
|
|
662
|
+
EventType2["UNDECRYPTABLE_MESSAGE"] = "UndecryptableMessage";
|
|
663
|
+
EventType2["STREAM_ERROR"] = "StreamError";
|
|
664
|
+
EventType2["STREAM_REPLACED"] = "StreamReplaced";
|
|
665
|
+
EventType2["CONNECT_FAILURE"] = "ConnectFailure";
|
|
666
|
+
EventType2["CLIENT_OUTDATED"] = "ClientOutdated";
|
|
667
|
+
EventType2["TEMPORARY_BAN"] = "TemporaryBan";
|
|
668
|
+
EventType2["CAT_REFRESH_ERROR"] = "CATRefreshError";
|
|
669
|
+
EventType2["PERMANENT_DISCONNECT"] = "PermanentDisconnect";
|
|
670
|
+
EventType2["BLOCKLIST"] = "Blocklist";
|
|
671
|
+
EventType2["BLOCKLIST_ACTION"] = "BlocklistAction";
|
|
672
|
+
EventType2["BLOCKLIST_CHANGE"] = "BlocklistChange";
|
|
673
|
+
EventType2["BUSINESS_NAME"] = "BusinessName";
|
|
674
|
+
EventType2["CALL_ACCEPT"] = "CallAccept";
|
|
675
|
+
EventType2["CALL_OFFER"] = "CallOffer";
|
|
676
|
+
EventType2["CALL_OFFER_NOTICE"] = "CallOfferNotice";
|
|
677
|
+
EventType2["CALL_PRE_ACCEPT"] = "CallPreAccept";
|
|
678
|
+
EventType2["CALL_REJECT"] = "CallReject";
|
|
679
|
+
EventType2["CALL_RELAY_LATENCY"] = "CallRelayLatency";
|
|
680
|
+
EventType2["CALL_TERMINATE"] = "CallTerminate";
|
|
681
|
+
EventType2["CALL_TRANSPORT"] = "CallTransport";
|
|
682
|
+
EventType2["UNKNOWN_CALL_EVENT"] = "UnknownCallEvent";
|
|
683
|
+
EventType2["FB_MESSAGE"] = "FBMessage";
|
|
684
|
+
return EventType2;
|
|
685
|
+
})(EventType || {});
|
|
604
686
|
var MessageStatus = /* @__PURE__ */ ((MessageStatus2) => {
|
|
605
687
|
MessageStatus2["ERROR"] = "ERROR";
|
|
606
688
|
MessageStatus2["PENDING"] = "PENDING";
|
|
@@ -669,6 +751,7 @@ export {
|
|
|
669
751
|
DecryptFailMode,
|
|
670
752
|
DisappearingModeInitiator,
|
|
671
753
|
DisappearingModeTrigger,
|
|
754
|
+
EventType,
|
|
672
755
|
ExtendedTextMessageFontType,
|
|
673
756
|
ExtendedTextMessageInviteLinkGroupType,
|
|
674
757
|
ExtendedTextMessagePreviewType,
|
|
@@ -694,6 +777,9 @@ export {
|
|
|
694
777
|
WuzapiClient,
|
|
695
778
|
WuzapiError,
|
|
696
779
|
WuzapiClient as default,
|
|
697
|
-
getMessageContent
|
|
780
|
+
getMessageContent,
|
|
781
|
+
hasBase64Media,
|
|
782
|
+
hasBothMedia,
|
|
783
|
+
hasS3Media
|
|
698
784
|
};
|
|
699
785
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +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","../src/types/message.ts","../src/types/events.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","// WhatsApp Message types based on whatsmeow protobuf definitions\n// Reference: https://pkg.go.dev/go.mau.fi/whatsmeow@v0.0.0-20250829123043-72d2ed58e998/proto/waE2E#Message\n\n// Base message context and metadata types\nexport interface ContextInfo {\n stanzaId?: string;\n participant?: string;\n quotedMessage?: Message;\n remoteJid?: string;\n mentionedJid?: string[];\n conversionSource?: string;\n conversionData?: string;\n conversionDelaySeconds?: number;\n forwardingScore?: number;\n isForwarded?: boolean;\n quotedAd?: AdReplyInfo;\n placeholderKey?: MessageKey;\n expiration?: number;\n ephemeralSettingTimestamp?: number;\n ephemeralSharedSecret?: string;\n externalAdReply?: ExternalAdReplyInfo;\n entryPointConversionSource?: string;\n entryPointConversionApp?: string;\n entryPointConversionDelaySeconds?: number;\n disappearingMode?: DisappearingMode;\n actionLink?: ActionLink;\n groupSubject?: string;\n parentGroupJid?: string;\n trustBannerType?: string;\n trustBannerAction?: number;\n isSampled?: boolean;\n utm?: UTMInfo;\n}\n\nexport interface MessageKey {\n remoteJid?: string;\n fromMe?: boolean;\n id?: string;\n participant?: string;\n}\n\nexport interface DisappearingMode {\n initiator?: DisappearingModeInitiator;\n trigger?: DisappearingModeTrigger;\n initiatorDeviceJid?: string;\n}\n\nexport enum DisappearingModeInitiator {\n CHANGED_IN_CHAT = 0,\n INITIATED_BY_ME = 1,\n INITIATED_BY_OTHER = 2,\n}\n\nexport enum DisappearingModeTrigger {\n UNKNOWN = 0,\n CHAT_SETTING = 1,\n ACCOUNT_SETTING = 2,\n BULK_CHANGE = 3,\n}\n\nexport interface AdReplyInfo {\n advertiserName?: string;\n mediaType?: MediaType;\n jpegThumbnail?: Uint8Array;\n caption?: string;\n}\n\nexport interface ExternalAdReplyInfo {\n title?: string;\n body?: string;\n mediaType?: MediaType;\n thumbnailUrl?: string;\n mediaUrl?: string;\n thumbnail?: Uint8Array;\n sourceType?: string;\n sourceId?: string;\n sourceUrl?: string;\n containsAutoReply?: boolean;\n renderLargerThumbnail?: boolean;\n showAdAttribution?: boolean;\n ctwaClid?: string;\n ref?: string;\n}\n\nexport interface ActionLink {\n url?: string;\n buttonTitle?: string;\n}\n\nexport interface UTMInfo {\n utmSource?: string;\n utmCampaign?: string;\n}\n\nexport enum MediaType {\n UNKNOWN = 0,\n IMAGE = 1,\n VIDEO = 2,\n AUDIO = 3,\n DOCUMENT = 4,\n STICKER = 5,\n}\n\n// Interactive elements\nexport interface InteractiveAnnotation {\n polygonVertices?: Point[];\n location?: Location;\n}\n\nexport interface Point {\n xDeprecated?: number;\n yDeprecated?: number;\n x?: number;\n y?: number;\n}\n\n// Location types\nexport interface LocationMessage {\n degreesLatitude?: number;\n degreesLongitude?: number;\n name?: string;\n address?: string;\n url?: string;\n isLiveLocation?: boolean;\n accuracyInMeters?: number;\n speedInMps?: number;\n degreesClockwiseFromMagneticNorth?: number;\n comment?: string;\n jpegThumbnail?: Uint8Array;\n contextInfo?: ContextInfo;\n}\n\nexport interface LiveLocationMessage {\n degreesLatitude?: number;\n degreesLongitude?: number;\n accuracyInMeters?: number;\n speedInMps?: number;\n degreesClockwiseFromMagneticNorth?: number;\n caption?: string;\n sequenceNumber?: number;\n timeOffset?: number;\n jpegThumbnail?: Uint8Array;\n contextInfo?: ContextInfo;\n}\n\nexport interface Location {\n degreesLatitude?: number;\n degreesLongitude?: number;\n name?: string;\n}\n\n// Media message types\nexport interface ImageMessage {\n url?: string;\n mimetype?: string;\n caption?: string;\n fileSha256?: Uint8Array;\n fileLength?: number;\n height?: number;\n width?: number;\n mediaKey?: Uint8Array;\n fileEncSha256?: Uint8Array;\n interactiveAnnotations?: InteractiveAnnotation[];\n directPath?: string;\n mediaKeyTimestamp?: number;\n jpegThumbnail?: Uint8Array;\n contextInfo?: ContextInfo;\n firstScanSidecar?: Uint8Array;\n firstScanLength?: number;\n experimentGroupId?: number;\n scansSidecar?: Uint8Array;\n scanLengths?: number[];\n midQualityFileSha256?: Uint8Array;\n midQualityFileEncSha256?: Uint8Array;\n viewOnce?: boolean;\n thumbnailDirectPath?: string;\n thumbnailSha256?: Uint8Array;\n thumbnailEncSha256?: Uint8Array;\n staticUrl?: string;\n annotations?: InteractiveAnnotation[];\n originalFileName?: string;\n}\n\nexport interface VideoMessage {\n url?: string;\n mimetype?: string;\n fileSha256?: Uint8Array;\n fileLength?: number;\n seconds?: number;\n mediaKey?: Uint8Array;\n caption?: string;\n gifPlayback?: boolean;\n height?: number;\n width?: number;\n fileEncSha256?: Uint8Array;\n interactiveAnnotations?: InteractiveAnnotation[];\n directPath?: string;\n mediaKeyTimestamp?: number;\n jpegThumbnail?: Uint8Array;\n contextInfo?: ContextInfo;\n streamingSidecar?: Uint8Array;\n gifAttribution?: VideoAttribution;\n viewOnce?: boolean;\n thumbnailDirectPath?: string;\n thumbnailSha256?: Uint8Array;\n thumbnailEncSha256?: Uint8Array;\n staticUrl?: string;\n annotations?: InteractiveAnnotation[];\n accessibilityLabel?: string;\n processedVideos?: ProcessedVideo[];\n externalShareFullVideoDurationInSeconds?: number;\n motionPhotoPresentationOffsetMS?: number;\n metadataUrl?: string;\n videoSourceType?: VideoSourceType;\n}\n\nexport enum VideoAttribution {\n NONE = 0,\n GIPHY = 1,\n TENOR = 2,\n KLIPY = 3,\n}\n\nexport enum VideoSourceType {\n USER_VIDEO = 0,\n AI_GENERATED = 1,\n}\n\nexport interface ProcessedVideo {\n url?: string;\n fileLength?: number;\n fileSha256?: Uint8Array;\n fileEncSha256?: Uint8Array;\n}\n\nexport interface AudioMessage {\n url?: string;\n mimetype?: string;\n fileSha256?: Uint8Array;\n fileLength?: number;\n seconds?: number;\n ptt?: boolean;\n mediaKey?: Uint8Array;\n fileEncSha256?: Uint8Array;\n directPath?: string;\n mediaKeyTimestamp?: number;\n contextInfo?: ContextInfo;\n streamingSidecar?: Uint8Array;\n waveform?: Uint8Array;\n backgroundArgb?: number;\n viewOnce?: boolean;\n}\n\nexport interface DocumentMessage {\n url?: string;\n mimetype?: string;\n title?: string;\n fileSha256?: Uint8Array;\n fileLength?: number;\n pageCount?: number;\n mediaKey?: Uint8Array;\n fileName?: string;\n fileEncSha256?: Uint8Array;\n directPath?: string;\n mediaKeyTimestamp?: number;\n contactVcard?: boolean;\n thumbnailDirectPath?: string;\n thumbnailSha256?: Uint8Array;\n thumbnailEncSha256?: Uint8Array;\n jpegThumbnail?: Uint8Array;\n contextInfo?: ContextInfo;\n thumbnailHeight?: number;\n thumbnailWidth?: number;\n caption?: string;\n}\n\nexport interface StickerMessage {\n url?: string;\n fileSha256?: Uint8Array;\n fileEncSha256?: Uint8Array;\n mediaKey?: Uint8Array;\n mimetype?: string;\n height?: number;\n width?: number;\n directPath?: string;\n fileLength?: number;\n mediaKeyTimestamp?: number;\n firstFrameLength?: number;\n firstFrameSidecar?: Uint8Array;\n isAnimated?: boolean;\n pngThumbnail?: Uint8Array;\n contextInfo?: ContextInfo;\n stickerSentTs?: number;\n isAvatar?: boolean;\n isAiSticker?: boolean;\n isLottie?: boolean;\n}\n\n// Contact message types\nexport interface ContactMessage {\n displayName?: string;\n vcard?: string;\n contextInfo?: ContextInfo;\n}\n\nexport interface ContactsArrayMessage {\n displayName?: string;\n contacts?: ContactMessage[];\n contextInfo?: ContextInfo;\n}\n\n// Text and extended text messages\nexport interface ExtendedTextMessage {\n text?: string;\n matchedText?: string;\n canonicalUrl?: string;\n description?: string;\n title?: string;\n textArgb?: number;\n backgroundArgb?: number;\n font?: ExtendedTextMessageFontType;\n previewType?: ExtendedTextMessagePreviewType;\n jpegThumbnail?: Uint8Array;\n contextInfo?: ContextInfo;\n doNotPlayInline?: boolean;\n thumbnailDirectPath?: string;\n thumbnailSha256?: Uint8Array;\n thumbnailEncSha256?: Uint8Array;\n mediaKey?: Uint8Array;\n mediaKeyTimestamp?: number;\n thumbnailHeight?: number;\n thumbnailWidth?: number;\n inviteLinkGroupType?: ExtendedTextMessageInviteLinkGroupType;\n inviteLinkParentGroupSubject?: string;\n inviteLinkParentGroupThumbnailJpeg?: Uint8Array;\n inviteLinkGroupTypeV2?: InviteLinkGroupType;\n viewOnce?: boolean;\n}\n\nexport enum ExtendedTextMessageFontType {\n SANS_SERIF = 0,\n SERIF = 1,\n NORICAN_REGULAR = 2,\n BRYNDAN_WRITE = 3,\n BEBASNEUE_REGULAR = 4,\n OSWALD_HEAVY = 5,\n}\n\nexport enum ExtendedTextMessagePreviewType {\n NONE = 0,\n VIDEO = 1,\n PLACEHOLDER = 4,\n IMAGE = 5,\n}\n\nexport enum ExtendedTextMessageInviteLinkGroupType {\n DEFAULT = 0,\n PARENT = 1,\n SUB = 2,\n DEFAULT_SUB = 3,\n}\n\nexport enum InviteLinkGroupType {\n DEFAULT = 0,\n PARENT = 1,\n SUB = 2,\n DEFAULT_SUB = 3,\n}\n\n// Interactive messages\nexport interface ButtonsMessage {\n contentText?: string;\n footerText?: string;\n contextInfo?: ContextInfo;\n buttons?: Button[];\n headerType?: ButtonsMessageHeaderType;\n text?: string;\n documentMessage?: DocumentMessage;\n imageMessage?: ImageMessage;\n videoMessage?: VideoMessage;\n locationMessage?: LocationMessage;\n}\n\nexport interface Button {\n buttonId?: string;\n buttonText?: ButtonText;\n type?: ButtonType;\n nativeFlowInfo?: NativeFlowInfo;\n}\n\nexport interface ButtonText {\n displayText?: string;\n}\n\nexport enum ButtonType {\n UNKNOWN = 0,\n RESPONSE = 1,\n NATIVE_FLOW = 2,\n}\n\nexport interface NativeFlowInfo {\n name?: string;\n paramsJson?: string;\n}\n\nexport enum ButtonsMessageHeaderType {\n UNKNOWN = 0,\n EMPTY = 1,\n TEXT = 2,\n DOCUMENT = 3,\n IMAGE = 4,\n VIDEO = 5,\n LOCATION = 6,\n}\n\nexport interface ListMessage {\n title?: string;\n description?: string;\n buttonText?: string;\n listType?: ListMessageListType;\n sections?: Section[];\n productListInfo?: ProductListInfo;\n footerText?: string;\n contextInfo?: ContextInfo;\n}\n\nexport interface Section {\n title?: string;\n rows?: Row[];\n}\n\nexport interface Row {\n title?: string;\n description?: string;\n rowId?: string;\n}\n\nexport interface ProductListInfo {\n productSections?: ProductSection[];\n headerImage?: ImageMessage;\n businessOwnerJid?: string;\n}\n\nexport interface ProductSection {\n title?: string;\n products?: ProductListItem[];\n}\n\nexport interface ProductListItem {\n productId?: string;\n}\n\nexport enum ListMessageListType {\n UNKNOWN = 0,\n SINGLE_SELECT = 1,\n PRODUCT_LIST = 2,\n}\n\n// Template and interactive response messages\nexport interface TemplateMessage {\n contextInfo?: ContextInfo;\n hydratedTemplate?: HydratedFourRowTemplate;\n templateId?: string;\n documentMessage?: DocumentMessage;\n imageMessage?: ImageMessage;\n videoMessage?: VideoMessage;\n locationMessage?: LocationMessage;\n}\n\nexport interface HydratedFourRowTemplate {\n documentMessage?: DocumentMessage;\n imageMessage?: ImageMessage;\n videoMessage?: VideoMessage;\n locationMessage?: LocationMessage;\n title?: string;\n hydratedContentText?: string;\n hydratedFooterText?: string;\n hydratedButtons?: HydratedTemplateButton[];\n templateId?: string;\n mask?: string;\n}\n\nexport interface HydratedTemplateButton {\n index?: number;\n quickReplyButton?: HydratedQuickReplyButton;\n urlButton?: HydratedURLButton;\n callButton?: HydratedCallButton;\n}\n\nexport interface HydratedQuickReplyButton {\n displayText?: string;\n id?: string;\n}\n\nexport interface HydratedURLButton {\n displayText?: string;\n url?: string;\n}\n\nexport interface HydratedCallButton {\n displayText?: string;\n phoneNumber?: string;\n}\n\n// Response messages\nexport interface ButtonsResponseMessage {\n selectedButtonId?: string;\n contextInfo?: ContextInfo;\n type?: ButtonsResponseMessageType;\n selectedDisplayText?: string;\n}\n\nexport enum ButtonsResponseMessageType {\n UNKNOWN = 0,\n DISPLAY_TEXT = 1,\n}\n\nexport interface ListResponseMessage {\n title?: string;\n listType?: ListResponseMessageListType;\n singleSelectReply?: SingleSelectReply;\n contextInfo?: ContextInfo;\n description?: string;\n}\n\nexport interface SingleSelectReply {\n selectedRowId?: string;\n}\n\nexport enum ListResponseMessageListType {\n UNKNOWN = 0,\n SINGLE_SELECT = 1,\n}\n\n// Payment and order messages\nexport interface SendPaymentMessage {\n noteMessage?: Message;\n requestMessageKey?: MessageKey;\n background?: PaymentBackground;\n}\n\nexport interface PaymentBackground {\n id?: string;\n fileEncSha256?: Uint8Array;\n directPath?: string;\n mediaKey?: Uint8Array;\n type?: PaymentBackgroundType;\n mediaKeyTimestamp?: number;\n}\n\nexport enum PaymentBackgroundType {\n UNKNOWN = 0,\n DEFAULT = 1,\n}\n\nexport interface RequestPaymentMessage {\n noteMessage?: Message;\n currencyCodeIso4217?: string;\n amount1000?: number;\n requestFrom?: string;\n expiryTimestamp?: number;\n background?: PaymentBackground;\n}\n\nexport interface DeclinePaymentRequestMessage {\n key?: MessageKey;\n}\n\nexport interface CancelPaymentRequestMessage {\n key?: MessageKey;\n}\n\n// Group invite message\nexport interface GroupInviteMessage {\n groupJid?: string;\n inviteCode?: string;\n inviteExpiration?: number;\n groupName?: string;\n jpegThumbnail?: Uint8Array;\n caption?: string;\n contextInfo?: ContextInfo;\n}\n\n// Poll message\nexport interface PollCreationMessage {\n name?: string;\n options?: PollOption[];\n selectableOptionsCount?: number;\n contextInfo?: ContextInfo;\n}\n\nexport interface PollOption {\n optionName?: string;\n}\n\nexport interface PollUpdateMessage {\n pollCreationMessageKey?: MessageKey;\n vote?: PollEncValue;\n metadata?: PollUpdateMetadata;\n senderTimestampMs?: number;\n}\n\nexport interface PollEncValue {\n encPayload?: Uint8Array;\n encIv?: Uint8Array;\n}\n\nexport interface PollUpdateMetadata {\n // Metadata about the poll update\n}\n\n// Chat and conversation messages\nexport interface Chat {\n displayName?: string;\n id?: string;\n}\n\nexport interface Call {\n callKey?: Uint8Array;\n conversionSource?: string;\n conversionData?: Uint8Array;\n conversionDelaySeconds?: number;\n}\n\n// Main Message union type\nexport interface Message {\n // Text messages\n conversation?: string;\n extendedTextMessage?: ExtendedTextMessage;\n\n // Media messages\n imageMessage?: ImageMessage;\n videoMessage?: VideoMessage;\n audioMessage?: AudioMessage;\n documentMessage?: DocumentMessage;\n stickerMessage?: StickerMessage;\n\n // Location messages\n locationMessage?: LocationMessage;\n liveLocationMessage?: LiveLocationMessage;\n\n // Contact messages\n contactMessage?: ContactMessage;\n contactsArrayMessage?: ContactsArrayMessage;\n\n // Interactive messages\n buttonsMessage?: ButtonsMessage;\n listMessage?: ListMessage;\n templateMessage?: TemplateMessage;\n\n // Response messages\n buttonsResponseMessage?: ButtonsResponseMessage;\n listResponseMessage?: ListResponseMessage;\n\n // Payment messages\n sendPaymentMessage?: SendPaymentMessage;\n requestPaymentMessage?: RequestPaymentMessage;\n declinePaymentRequestMessage?: DeclinePaymentRequestMessage;\n cancelPaymentRequestMessage?: CancelPaymentRequestMessage;\n\n // Group messages\n groupInviteMessage?: GroupInviteMessage;\n\n // Poll messages\n pollCreationMessage?: PollCreationMessage;\n pollUpdateMessage?: PollUpdateMessage;\n\n // System messages\n protocolMessage?: ProtocolMessage;\n ephemeralMessage?: EphemeralMessage;\n viewOnceMessage?: ViewOnceMessage;\n reactionMessage?: ReactionMessage;\n stickerSyncRmrMessage?: StickerSyncRmrMessage;\n\n // Call messages\n call?: Call;\n chat?: Chat;\n\n // MessageContextInfo\n messageContextInfo?: MessageContextInfo;\n}\n\n// System and protocol messages\nexport interface ProtocolMessage {\n key?: MessageKey;\n type?: ProtocolMessageType;\n ephemeralExpiration?: number;\n ephemeralSettingTimestamp?: number;\n historySyncNotification?: HistorySyncNotification;\n appStateSyncKeyShare?: AppStateSyncKeyShare;\n appStateSyncKeyRequest?: AppStateSyncKeyRequest;\n initialSecurityNotificationSettingSync?: InitialSecurityNotificationSettingSync;\n appStateFatalExceptionNotification?: AppStateFatalExceptionNotification;\n disappearingMode?: DisappearingMode;\n editedMessage?: Message;\n timestampMs?: number;\n peerDataOperationRequestMessage?: PeerDataOperationRequestMessage;\n peerDataOperationRequestResponseMessage?: PeerDataOperationRequestResponseMessage;\n}\n\nexport enum ProtocolMessageType {\n REVOKE = 0,\n EPHEMERAL_SETTING = 3,\n EPHEMERAL_SYNC_RESPONSE = 4,\n HISTORY_SYNC_NOTIFICATION = 5,\n APP_STATE_SYNC_KEY_SHARE = 6,\n APP_STATE_SYNC_KEY_REQUEST = 7,\n MSG_FANOUT_BACKFILL_REQUEST = 8,\n INITIAL_SECURITY_NOTIFICATION_SETTING_SYNC = 9,\n APP_STATE_FATAL_EXCEPTION_NOTIFICATION = 10,\n SHARE_PHONE_NUMBER = 11,\n MESSAGE_EDIT = 14,\n PEER_DATA_OPERATION_REQUEST_MESSAGE = 16,\n PEER_DATA_OPERATION_REQUEST_RESPONSE_MESSAGE = 17,\n}\n\nexport interface EphemeralMessage {\n message?: Message;\n}\n\nexport interface ViewOnceMessage {\n message?: Message;\n}\n\nexport interface ReactionMessage {\n key?: MessageKey;\n text?: string;\n groupingKey?: string;\n senderTimestampMs?: number;\n unread?: boolean;\n}\n\nexport interface StickerSyncRmrMessage {\n filehash?: string[];\n rmrSource?: string;\n requestTimestamp?: number;\n}\n\nexport interface MessageContextInfo {\n deviceListMetadata?: DeviceListMetadata;\n deviceListMetadataVersion?: number;\n messageSecret?: Uint8Array;\n paddingBytes?: Uint8Array;\n messageAddOnDurationInSecs?: number;\n botMessageInvoker?: BotMessageInvoker;\n botResponseCorrelationId?: string;\n botPluginType?: BotPluginType;\n botPluginReferenceIndex?: number;\n botPluginSearchProvider?: BotPluginSearchProvider;\n botPluginSearchUrl?: string;\n botPluginMaybeParentPluginType?: BotPluginType;\n botReelPluginThumbnailCdnUrl?: string;\n expiredBotResponseCorrelationId?: string;\n}\n\nexport interface DeviceListMetadata {\n senderKeyHash?: Uint8Array;\n senderTimestamp?: number;\n senderKeyIndexes?: number[];\n recipientKeyHash?: Uint8Array;\n recipientTimestamp?: number;\n recipientKeyIndexes?: number[];\n}\n\nexport interface BotMessageInvoker {\n // Bot message invoker details\n}\n\nexport enum BotPluginType {\n REELS = 0,\n SEARCH = 1,\n}\n\nexport enum BotPluginSearchProvider {\n BING = 0,\n GOOGLE = 1,\n}\n\n// Additional system notification types\nexport interface HistorySyncNotification {\n fileSha256?: Uint8Array;\n fileLength?: number;\n mediaKey?: Uint8Array;\n fileEncSha256?: Uint8Array;\n directPath?: string;\n syncType?: HistorySyncNotificationHistorySyncType;\n chunkOrder?: number;\n originalMessageId?: string;\n progress?: number;\n oldestMsgInChunkTimestampSec?: number;\n initialHistBootstrapInlinePayload?: Uint8Array;\n peerDataRequestSessionId?: string;\n}\n\nexport enum HistorySyncNotificationHistorySyncType {\n INITIAL_BOOTSTRAP = 0,\n INITIAL_STATUS_V3 = 1,\n FULL = 2,\n RECENT = 3,\n PUSH_NAME = 4,\n NON_BLOCKING_DATA = 5,\n ON_DEMAND = 6,\n}\n\nexport interface AppStateSyncKeyShare {\n keys?: AppStateSyncKey[];\n}\n\nexport interface AppStateSyncKey {\n keyId?: AppStateSyncKeyId;\n keyData?: AppStateSyncKeyData;\n}\n\nexport interface AppStateSyncKeyId {\n keyId?: Uint8Array;\n}\n\nexport interface AppStateSyncKeyData {\n keyData?: Uint8Array;\n fingerprint?: AppStateSyncKeyFingerprint;\n timestamp?: number;\n}\n\nexport interface AppStateSyncKeyFingerprint {\n rawId?: number;\n currentIndex?: number;\n deviceIndexes?: number[];\n}\n\nexport interface AppStateSyncKeyRequest {\n keyIds?: AppStateSyncKeyId[];\n}\n\nexport interface InitialSecurityNotificationSettingSync {\n securityNotificationEnabled?: boolean;\n}\n\nexport interface AppStateFatalExceptionNotification {\n collectionNames?: string[];\n timestamp?: number;\n}\n\nexport interface PeerDataOperationRequestMessage {\n peerDataOperationRequestType?: PeerDataOperationRequestType;\n requestId?: string;\n}\n\nexport interface PeerDataOperationRequestResponseMessage {\n peerDataOperationResult?: PeerDataOperationRequestResponseMessagePeerDataOperationResult;\n stanzaId?: string;\n}\n\nexport enum PeerDataOperationRequestType {\n UPLOAD_STICKER = 0,\n SEND_RECENT_STICKER_BOOTSTRAP = 1,\n GENERATE_LINK_PREVIEW = 2,\n}\n\nexport enum PeerDataOperationRequestResponseMessagePeerDataOperationResult {\n SUCCESS = 0,\n NOT_AUTHORIZED = 1,\n NOT_FOUND = 2,\n THROTTLED = 3,\n UNKNOWN_ERROR = 4,\n}\n\n// Helper type to get the active message type\nexport type MessageContent =\n | { type: \"text\"; content: string }\n | { type: \"extendedText\"; content: ExtendedTextMessage }\n | { type: \"image\"; content: ImageMessage }\n | { type: \"video\"; content: VideoMessage }\n | { type: \"audio\"; content: AudioMessage }\n | { type: \"document\"; content: DocumentMessage }\n | { type: \"sticker\"; content: StickerMessage }\n | { type: \"location\"; content: LocationMessage }\n | { type: \"liveLocation\"; content: LiveLocationMessage }\n | { type: \"contact\"; content: ContactMessage }\n | { type: \"contactsArray\"; content: ContactsArrayMessage }\n | { type: \"buttons\"; content: ButtonsMessage }\n | { type: \"list\"; content: ListMessage }\n | { type: \"template\"; content: TemplateMessage }\n | { type: \"buttonsResponse\"; content: ButtonsResponseMessage }\n | { type: \"listResponse\"; content: ListResponseMessage }\n | { type: \"groupInvite\"; content: GroupInviteMessage }\n | { type: \"poll\"; content: PollCreationMessage }\n | { type: \"pollUpdate\"; content: PollUpdateMessage }\n | { type: \"reaction\"; content: ReactionMessage }\n | { type: \"protocol\"; content: ProtocolMessage }\n | { type: \"ephemeral\"; content: EphemeralMessage }\n | { type: \"viewOnce\"; content: ViewOnceMessage };\n\n// Utility function to extract message content and type\nexport function getMessageContent(message: Message): MessageContent | null {\n if (message.conversation) {\n return { type: \"text\", content: message.conversation };\n }\n if (message.extendedTextMessage) {\n return { type: \"extendedText\", content: message.extendedTextMessage };\n }\n if (message.imageMessage) {\n return { type: \"image\", content: message.imageMessage };\n }\n if (message.videoMessage) {\n return { type: \"video\", content: message.videoMessage };\n }\n if (message.audioMessage) {\n return { type: \"audio\", content: message.audioMessage };\n }\n if (message.documentMessage) {\n return { type: \"document\", content: message.documentMessage };\n }\n if (message.stickerMessage) {\n return { type: \"sticker\", content: message.stickerMessage };\n }\n if (message.locationMessage) {\n return { type: \"location\", content: message.locationMessage };\n }\n if (message.liveLocationMessage) {\n return { type: \"liveLocation\", content: message.liveLocationMessage };\n }\n if (message.contactMessage) {\n return { type: \"contact\", content: message.contactMessage };\n }\n if (message.contactsArrayMessage) {\n return { type: \"contactsArray\", content: message.contactsArrayMessage };\n }\n if (message.buttonsMessage) {\n return { type: \"buttons\", content: message.buttonsMessage };\n }\n if (message.listMessage) {\n return { type: \"list\", content: message.listMessage };\n }\n if (message.templateMessage) {\n return { type: \"template\", content: message.templateMessage };\n }\n if (message.buttonsResponseMessage) {\n return { type: \"buttonsResponse\", content: message.buttonsResponseMessage };\n }\n if (message.listResponseMessage) {\n return { type: \"listResponse\", content: message.listResponseMessage };\n }\n if (message.groupInviteMessage) {\n return { type: \"groupInvite\", content: message.groupInviteMessage };\n }\n if (message.pollCreationMessage) {\n return { type: \"poll\", content: message.pollCreationMessage };\n }\n if (message.pollUpdateMessage) {\n return { type: \"pollUpdate\", content: message.pollUpdateMessage };\n }\n if (message.reactionMessage) {\n return { type: \"reaction\", content: message.reactionMessage };\n }\n if (message.protocolMessage) {\n return { type: \"protocol\", content: message.protocolMessage };\n }\n if (message.ephemeralMessage) {\n return { type: \"ephemeral\", content: message.ephemeralMessage };\n }\n if (message.viewOnceMessage) {\n return { type: \"viewOnce\", content: message.viewOnceMessage };\n }\n\n return null;\n}\n","// WhatsApp events types based on whatsmeow package\n// Reference: https://pkg.go.dev/go.mau.fi/whatsmeow@v0.0.0-20250829123043-72d2ed58e998/types/events\n\nimport { Message } from \"./message.js\";\n\n// Additional specific types from whatsmeow\nexport interface WaBinaryNode {\n Tag: string;\n Attrs: Record<string, string>;\n Content: unknown;\n}\n\nexport interface SyncAction {\n timestamp: Date;\n action: unknown;\n}\n\nexport interface StarAction extends SyncAction {\n starred: boolean;\n}\n\nexport interface ArchiveAction extends SyncAction {\n archived: boolean;\n}\n\nexport interface ClearChatAction extends SyncAction {\n messageRange?: {\n lastMessageTimestamp?: Date;\n lastSystemMessageTimestamp?: Date;\n };\n}\n\nexport interface DeleteChatAction extends SyncAction {}\n\nexport interface DeleteMessageForMeAction extends SyncAction {}\n\nexport interface MarkChatAsReadAction extends SyncAction {\n read: boolean;\n messageRange?: {\n lastMessageTimestamp?: Date;\n lastSystemMessageTimestamp?: Date;\n };\n}\n\nexport interface MuteAction extends SyncAction {\n muted: boolean;\n muteEndTimestamp?: Date;\n}\n\nexport interface PinAction extends SyncAction {\n pinned: boolean;\n}\n\nexport interface PushNameSettingAction extends SyncAction {\n name: string;\n}\n\nexport interface UnarchiveChatsSettingAction extends SyncAction {\n unarchiveChats: boolean;\n}\n\nexport interface LabelAssociationAction extends SyncAction {\n labeled: boolean;\n}\n\nexport interface LabelEditAction extends SyncAction {\n name: string;\n color: number;\n predefinedId?: string;\n deleted: boolean;\n}\n\nexport interface BusinessNameAction extends SyncAction {\n businessName: string;\n verified: number;\n}\n\nexport interface UserStatusMuteAction extends SyncAction {\n muted: boolean;\n}\n\nexport interface Armadillo {\n payload?: unknown;\n}\n\nexport interface ConsumerApplication {\n metadata?: unknown;\n}\n\nexport interface BasicCallMeta {\n from: JID;\n timestamp: Date;\n callId: string;\n callCreator: JID;\n}\n\nexport interface CallRemoteMeta {\n remoteJid: JID;\n fromMe: boolean;\n}\n\nexport interface EventGroupParticipant {\n JID: JID;\n IsAdmin: boolean;\n IsSuperAdmin: boolean;\n}\n\nexport interface HistorySyncData {\n conversations?: unknown[];\n messages?: unknown[];\n}\n\n// Common types used in events\nexport interface JID {\n User: string;\n Agent: number;\n Device: number;\n Integrator: number;\n Server: string;\n AD: boolean;\n}\n\nexport interface MessageInfo {\n ID: string;\n Type: string;\n PushName: string;\n Timestamp: Date;\n Source: MessageSource;\n DeviceSentMeta?: DeviceSentMeta;\n ServerID?: number;\n Status?: MessageStatus;\n}\n\nexport interface MessageSource {\n Chat: JID;\n Sender: JID;\n IsFromMe: boolean;\n IsGroup: boolean;\n BroadcastListOwner?: JID;\n}\n\nexport interface DeviceSentMeta {\n DestinationJID: string;\n Phash: string;\n}\n\nexport enum MessageStatus {\n ERROR = \"ERROR\",\n PENDING = \"PENDING\",\n SERVER_ACK = \"SERVER_ACK\",\n DELIVERY_ACK = \"DELIVERY_ACK\",\n READ = \"READ\",\n PLAYED = \"PLAYED\",\n}\n\nexport enum ReceiptType {\n UNKNOWN = \"\",\n DELIVERY = \"delivery\",\n READ = \"read\",\n READ_SELF = \"read-self\",\n PLAYED = \"played\",\n SENDER = \"sender\",\n INACTIVE = \"inactive\",\n PEER_MSG = \"peer_msg\",\n}\n\nexport enum DecryptFailMode {\n UNAVAILABLE = \"unavailable\",\n DECRYPT_FAIL = \"decrypt_fail\",\n}\n\nexport enum UnavailableType {\n UNKNOWN = \"\",\n VIEW_ONCE = \"view_once\",\n}\n\nexport enum ConnectFailureReason {\n SOCKET_OPEN_TIMEOUT = 4001,\n SOCKET_PING_TIMEOUT = 4002,\n SOCKET_PONG_TIMEOUT = 4003,\n UNKNOWN_LOGOUT = 4004,\n BAD_MAC = 4005,\n INIT_TIMEOUT = 4006,\n MULTI_DEVICE_MISMATCH = 4007,\n MULTI_DEVICE_DISABLED = 4008,\n TEMP_BANNED = 4009,\n CLIENT_OUTDATED = 4010,\n STREAM_ERROR = 4011,\n DEVICE_GONE = 4012,\n IDENTITY_MISSING = 4013,\n RATE_LIMIT_HIT = 4014,\n MAIN_DEVICE_GONE = 4015,\n}\n\nexport enum TempBanReason {\n SENT_TO_TOO_MANY_PEOPLE = 101,\n BLOCKED_BY_USERS = 102,\n CREATED_TOO_MANY_GROUPS = 103,\n SENT_TOO_MANY_SAME_MESSAGE = 104,\n BROADCAST_LIST = 106,\n}\n\n// Event types\nexport interface AppState {\n name: string;\n version: number;\n hash: string[];\n}\n\nexport interface AppStateSyncComplete {\n name: string;\n}\n\nexport interface Archive {\n JID: JID;\n Timestamp: Date;\n Action: ArchiveAction;\n FromFullSync: boolean;\n}\n\nexport interface Blocklist {\n JID: JID;\n action: string;\n dhash: string;\n}\n\nexport interface BlocklistAction {\n action: string;\n}\n\nexport interface BlocklistChange {\n JID: JID;\n action: BlocklistChangeAction;\n}\n\nexport interface BlocklistChangeAction {\n action: string;\n}\n\nexport interface BusinessName {\n BusinessJID: JID;\n PushName: string;\n VerifiedName: string;\n VerifiedLevel: string;\n Action: BusinessNameAction;\n FromFullSync: boolean;\n}\n\nexport interface CATRefreshError {\n code: string;\n text: string;\n}\n\nexport interface CallAccept {\n BasicCallMeta: BasicCallMeta;\n}\n\nexport interface CallOffer {\n BasicCallMeta: BasicCallMeta;\n CallRemoteMeta: CallRemoteMeta;\n Data: string;\n}\n\nexport interface CallOfferNotice {\n BasicCallMeta: BasicCallMeta;\n Media: string;\n Type: string;\n Data: string;\n}\n\nexport interface CallPreAccept {\n BasicCallMeta: BasicCallMeta;\n CallRemoteMeta: CallRemoteMeta;\n}\n\nexport interface CallReject {\n BasicCallMeta: BasicCallMeta;\n}\n\nexport interface CallRelayLatency {\n BasicCallMeta: BasicCallMeta;\n Latency: number;\n}\n\nexport interface CallTerminate {\n BasicCallMeta: BasicCallMeta;\n Reason: string;\n}\n\nexport interface CallTransport {\n BasicCallMeta: BasicCallMeta;\n}\n\nexport interface ChatPresence {\n MessageSource: MessageSource;\n State: string;\n Media: string;\n}\n\nexport interface ClearChat {\n ChatJID: JID;\n Timestamp: Date;\n Action: ClearChatAction;\n FromFullSync: boolean;\n}\n\nexport interface ClientOutdated {\n // Event indicating the client version is outdated\n}\n\nexport interface ConnectFailure {\n Reason: ConnectFailureReason;\n Raw: WaBinaryNode;\n}\n\nexport interface Connected {\n // Event indicating successful connection\n}\n\nexport interface EventContact {\n JID: JID;\n Found: boolean;\n FirstName: string;\n FullName: string;\n PushName: string;\n BusinessName: string;\n}\n\nexport interface DeleteChat {\n ChatJID: JID;\n Timestamp: Date;\n Action: DeleteChatAction;\n FromFullSync: boolean;\n}\n\nexport interface DeleteForMe {\n ChatJID: JID;\n SenderJID: JID;\n IsFromMe: boolean;\n MessageID: string;\n Timestamp: Date;\n Action: DeleteMessageForMeAction;\n FromFullSync: boolean;\n}\n\nexport interface Disconnected {\n // Event indicating disconnection\n}\n\nexport interface FBMessage {\n Info: MessageInfo;\n IsEphemeral: boolean;\n IsViewOnce: boolean;\n IsDocumentWithCaption: boolean;\n IsEdit: boolean;\n Message: Armadillo;\n}\n\nexport interface EventGroupInfo {\n JID: JID;\n GroupName: string;\n GroupTopic: string;\n GroupLocked: boolean;\n GroupAnnounce: boolean;\n GroupEphemeral: boolean;\n GroupParent?: JID;\n GroupLinkedParent?: JID;\n GroupIsDefaultSub: boolean;\n GroupCreated: Date;\n ParticipantVersionID: string;\n Participants: EventGroupParticipant[];\n PendingParticipants: EventGroupParticipant[];\n JoinedAt: Date;\n CreateKey: string;\n Sender: JID;\n Timestamp: Date;\n}\n\nexport interface HistorySync {\n Data: HistorySyncData;\n}\n\nexport interface IdentityChange {\n JID: JID;\n Timestamp: Date;\n Implicit: boolean;\n}\n\nexport interface JoinedGroup {\n Reason: string;\n Type: string;\n CreateKey: string;\n Participants: EventGroupParticipant[];\n}\n\nexport interface KeepAliveRestored {\n // Event indicating keep-alive connection restored\n}\n\nexport interface KeepAliveTimeout {\n // Event indicating keep-alive timeout\n}\n\nexport interface LabelAssociationChat {\n ChatJID: JID;\n LabelID: string;\n Labeled: boolean;\n Timestamp: Date;\n Action: LabelAssociationAction;\n FromFullSync: boolean;\n}\n\nexport interface LabelAssociationMessage {\n ChatJID: JID;\n SenderJID: JID;\n IsFromMe: boolean;\n MessageID: string;\n LabelID: string;\n Labeled: boolean;\n Timestamp: Date;\n Action: LabelAssociationAction;\n FromFullSync: boolean;\n}\n\nexport interface LabelEdit {\n ID: string;\n Name: string;\n Color: number;\n Deleted: boolean;\n Timestamp: Date;\n Action: LabelEditAction;\n FromFullSync: boolean;\n}\n\nexport interface LoggedOut {\n OnConnect: boolean;\n Reason: string;\n}\n\nexport interface ManualLoginReconnect {\n // Event indicating manual login reconnection required\n}\n\nexport interface MarkChatAsRead {\n ChatJID: JID;\n Timestamp: Date;\n Action: MarkChatAsReadAction;\n FromFullSync: boolean;\n}\n\nexport interface MediaRetry {\n MessageID: string;\n ChatJID: JID;\n SenderJID: JID;\n IsFromMe: boolean;\n Timestamp: Date;\n}\n\nexport interface MediaRetryError {\n MessageID: string;\n ChatJID: JID;\n SenderJID: JID;\n IsFromMe: boolean;\n Timestamp: Date;\n Error: string;\n}\n\nexport interface MessageEvent {\n Info: MessageInfo;\n Message: Message;\n IsEphemeral: boolean;\n IsViewOnce: boolean;\n IsDocumentWithCaption: boolean;\n IsEdit: boolean;\n RawMessage: WaBinaryNode;\n}\n\nexport interface Mute {\n ChatJID: JID;\n Timestamp: Date;\n Action: MuteAction;\n FromFullSync: boolean;\n}\n\nexport interface NewsletterJoin {\n ID: JID;\n NewsletterMeta: {\n name: string;\n description?: string;\n invite?: string;\n creationTime?: Date;\n };\n}\n\nexport interface NewsletterLeave {\n ID: JID;\n}\n\nexport interface NewsletterLiveUpdate {\n ID: JID;\n Time: Date;\n Messages: unknown[];\n}\n\nexport interface NewsletterMessageMeta {\n ID: JID;\n MessageServerID: number;\n MessageID: string;\n ReactionCounts: Record<string, number>;\n Views: number;\n}\n\nexport interface NewsletterMuteChange {\n ID: JID;\n Mute: string;\n}\n\nexport interface OfflineSyncCompleted {\n Count: number;\n}\n\nexport interface OfflineSyncPreview {\n Messages: unknown[];\n IsLatest: boolean;\n}\n\nexport interface PairError {\n ID: string;\n Error: string;\n}\n\nexport interface PairSuccess {\n ID: string;\n BusinessName: string;\n Platform: string;\n}\n\nexport interface PermanentDisconnect {\n // Event indicating permanent disconnection\n}\n\nexport interface Picture {\n JID: JID;\n Author: JID;\n Timestamp: Date;\n Remove: boolean;\n NewPicture?: {\n id: string;\n type: string;\n directPath: string;\n };\n OldPicture?: {\n id: string;\n type: string;\n directPath: string;\n };\n}\n\nexport interface Pin {\n ChatJID: JID;\n SenderJID: JID;\n IsFromMe: boolean;\n MessageID: string;\n Timestamp: Date;\n Action: PinAction;\n FromFullSync: boolean;\n}\n\nexport interface Presence {\n From: JID;\n Unavailable: boolean;\n LastSeen: Date;\n}\n\nexport interface PrivacySettings {\n GroupAddChanged: boolean;\n LastSeenChanged: boolean;\n StatusChanged: boolean;\n ProfileChanged: boolean;\n ReadReceiptsChanged: boolean;\n OnlineChanged: boolean;\n CallAddChanged: boolean;\n}\n\nexport interface PushName {\n JID: JID;\n Message: MessageInfo;\n OldPushName: string;\n NewPushName: string;\n}\n\nexport interface PushNameSetting {\n Timestamp: Date;\n Action: PushNameSettingAction;\n FromFullSync: boolean;\n}\n\nexport interface QR {\n Codes: string[];\n}\n\nexport interface QRScannedWithoutMultidevice {\n // Event indicating QR was scanned but multidevice not enabled\n}\n\nexport interface Receipt {\n MessageSource: MessageSource;\n MessageIDs: string[];\n Timestamp: Date;\n Type: ReceiptType;\n MessageSender: JID;\n}\n\nexport interface Star {\n ChatJID: JID;\n SenderJID: JID;\n IsFromMe: boolean;\n MessageID: string;\n Timestamp: Date;\n Action: StarAction;\n FromFullSync: boolean;\n}\n\nexport interface StreamError {\n Code: string;\n Raw: WaBinaryNode;\n}\n\nexport interface StreamReplaced {\n // Event indicating stream was replaced by another connection\n}\n\nexport interface TemporaryBan {\n Code: TempBanReason;\n Expire: number; // Duration in seconds\n}\n\nexport interface UnarchiveChatsSetting {\n Timestamp: Date;\n Action: UnarchiveChatsSettingAction;\n FromFullSync: boolean;\n}\n\nexport interface UndecryptableMessage {\n Info: MessageInfo;\n IsUnavailable: boolean;\n UnavailableType: UnavailableType;\n DecryptFailMode: DecryptFailMode;\n}\n\nexport interface UnknownCallEvent {\n Node: WaBinaryNode;\n}\n\nexport interface UserAbout {\n JID: JID;\n Status: string;\n Timestamp: Date;\n}\n\nexport interface UserStatusMute {\n JID: JID;\n Timestamp: Date;\n Action: UserStatusMuteAction;\n FromFullSync: boolean;\n}\n\n// Union type for all possible events\nexport type WhatsAppEvent =\n | AppState\n | AppStateSyncComplete\n | Archive\n | Blocklist\n | BlocklistAction\n | BlocklistChange\n | BusinessName\n | CATRefreshError\n | CallAccept\n | CallOffer\n | CallOfferNotice\n | CallPreAccept\n | CallReject\n | CallRelayLatency\n | CallTerminate\n | CallTransport\n | ChatPresence\n | ClearChat\n | ClientOutdated\n | ConnectFailure\n | Connected\n | EventContact\n | DeleteChat\n | DeleteForMe\n | Disconnected\n | FBMessage\n | EventGroupInfo\n | HistorySync\n | IdentityChange\n | JoinedGroup\n | KeepAliveRestored\n | KeepAliveTimeout\n | LabelAssociationChat\n | LabelAssociationMessage\n | LabelEdit\n | LoggedOut\n | ManualLoginReconnect\n | MarkChatAsRead\n | MediaRetry\n | MediaRetryError\n | MessageEvent\n | Mute\n | NewsletterJoin\n | NewsletterLeave\n | NewsletterLiveUpdate\n | NewsletterMessageMeta\n | NewsletterMuteChange\n | OfflineSyncCompleted\n | OfflineSyncPreview\n | PairError\n | PairSuccess\n | PermanentDisconnect\n | Picture\n | Pin\n | Presence\n | PrivacySettings\n | PushName\n | PushNameSetting\n | QR\n | QRScannedWithoutMultidevice\n | Receipt\n | Star\n | StreamError\n | StreamReplaced\n | TemporaryBan\n | UnarchiveChatsSetting\n | UndecryptableMessage\n | UnknownCallEvent\n | UserAbout\n | UserStatusMute;\n\n// Event handler type\nexport type EventHandler<T extends WhatsAppEvent = WhatsAppEvent> = (\n event: T\n) => void | Promise<void>;\n\n// Event emitter interface\nexport interface EventEmitter {\n on<T extends WhatsAppEvent>(\n eventType: string,\n handler: EventHandler<T>\n ): void;\n off<T extends WhatsAppEvent>(\n eventType: string,\n handler: EventHandler<T>\n ): void;\n emit<T extends WhatsAppEvent>(eventType: string, event: T): void;\n}\n"],"names":["DisappearingModeInitiator","DisappearingModeTrigger","MediaType","VideoAttribution","VideoSourceType","ExtendedTextMessageFontType","ExtendedTextMessagePreviewType","ExtendedTextMessageInviteLinkGroupType","InviteLinkGroupType","ButtonType","ButtonsMessageHeaderType","ListMessageListType","ButtonsResponseMessageType","ListResponseMessageListType","PaymentBackgroundType","ProtocolMessageType","BotPluginType","BotPluginSearchProvider","HistorySyncNotificationHistorySyncType","PeerDataOperationRequestType","PeerDataOperationRequestResponseMessagePeerDataOperationResult","MessageStatus","ReceiptType","DecryptFailMode","UnavailableType","ConnectFailureReason","TempBanReason"],"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,UACA,MACY;AACZ,UAAM,WAAW,MAAM,KAAK,MAAM,QAA2B;AAAA,MAC3D;AAAA,MACA,KAAK;AAAA,MACL;AAAA,IAAA,CACD;AAED,QAAI,CAAC,SAAS,KAAK,SAAS;AAC1B,YAAM,IAAI;AAAA,QACR,SAAS,KAAK;AAAA,QACd;AAAA,QACA,SAAS;AAAA,MAAA;AAAA,IAEb;AAEA,WAAO,SAAS,KA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A,CAAA,CAAA;"}
|
|
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","../src/types/webhook.ts","../src/types/message.ts","../src/types/events.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","// Webhook endpoints types\n\nexport interface SetWebhookRequest {\n webhookURL: string;\n}\n\nexport interface SetWebhookResponse {\n webhook: string;\n}\n\nexport interface GetWebhookResponse {\n subscribe: string[];\n webhook: string;\n}\n\n// Webhook payload types (what your webhook endpoint receives)\n\nexport interface S3MediaInfo {\n url: string;\n key: string;\n bucket: string;\n size: number;\n mimeType: string;\n fileName: string;\n}\n\nexport interface WebhookPayload<T = unknown> {\n event: T;\n s3?: S3MediaInfo;\n base64?: string;\n mimeType?: string;\n fileName?: string;\n}\n\n// Specific webhook payload types for different media delivery modes\n\n// S3 only delivery\nexport interface S3OnlyWebhookPayload<T = unknown> {\n event: T;\n s3: S3MediaInfo;\n}\n\n// Base64 only delivery\nexport interface Base64OnlyWebhookPayload<T = unknown> {\n event: T;\n base64: string;\n mimeType: string;\n fileName: string;\n}\n\n// Both S3 and Base64 delivery\nexport interface BothMediaWebhookPayload<T = unknown> {\n event: T;\n s3: S3MediaInfo;\n base64: string;\n mimeType: string;\n fileName: string;\n}\n\n// Union type for all possible webhook payloads\nexport type AnyWebhookPayload<T = unknown> =\n | WebhookPayload<T>\n | S3OnlyWebhookPayload<T>\n | Base64OnlyWebhookPayload<T>\n | BothMediaWebhookPayload<T>;\n\n// Helper type guards\nexport function hasS3Media(\n payload: WebhookPayload\n): payload is S3OnlyWebhookPayload | BothMediaWebhookPayload {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return !!(payload as any).s3;\n}\n\nexport function hasBase64Media(\n payload: WebhookPayload\n): payload is Base64OnlyWebhookPayload | BothMediaWebhookPayload {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return !!(payload as any).base64;\n}\n\nexport function hasBothMedia(\n payload: WebhookPayload\n): payload is BothMediaWebhookPayload {\n return hasS3Media(payload) && hasBase64Media(payload);\n}\n","// WhatsApp Message types based on whatsmeow protobuf definitions\n// Reference: https://pkg.go.dev/go.mau.fi/whatsmeow@v0.0.0-20250829123043-72d2ed58e998/proto/waE2E#Message\n\n// Base message context and metadata types\nexport interface ContextInfo {\n stanzaId?: string;\n participant?: string;\n quotedMessage?: Message;\n remoteJid?: string;\n mentionedJid?: string[];\n conversionSource?: string;\n conversionData?: string;\n conversionDelaySeconds?: number;\n forwardingScore?: number;\n isForwarded?: boolean;\n quotedAd?: AdReplyInfo;\n placeholderKey?: MessageKey;\n expiration?: number;\n ephemeralSettingTimestamp?: number;\n ephemeralSharedSecret?: string;\n externalAdReply?: ExternalAdReplyInfo;\n entryPointConversionSource?: string;\n entryPointConversionApp?: string;\n entryPointConversionDelaySeconds?: number;\n disappearingMode?: DisappearingMode;\n actionLink?: ActionLink;\n groupSubject?: string;\n parentGroupJid?: string;\n trustBannerType?: string;\n trustBannerAction?: number;\n isSampled?: boolean;\n utm?: UTMInfo;\n}\n\nexport interface MessageKey {\n remoteJid?: string;\n fromMe?: boolean;\n id?: string;\n participant?: string;\n}\n\nexport interface DisappearingMode {\n initiator?: DisappearingModeInitiator;\n trigger?: DisappearingModeTrigger;\n initiatorDeviceJid?: string;\n}\n\nexport enum DisappearingModeInitiator {\n CHANGED_IN_CHAT = 0,\n INITIATED_BY_ME = 1,\n INITIATED_BY_OTHER = 2,\n}\n\nexport enum DisappearingModeTrigger {\n UNKNOWN = 0,\n CHAT_SETTING = 1,\n ACCOUNT_SETTING = 2,\n BULK_CHANGE = 3,\n}\n\nexport interface AdReplyInfo {\n advertiserName?: string;\n mediaType?: MediaType;\n jpegThumbnail?: Uint8Array;\n caption?: string;\n}\n\nexport interface ExternalAdReplyInfo {\n title?: string;\n body?: string;\n mediaType?: MediaType;\n thumbnailUrl?: string;\n mediaUrl?: string;\n thumbnail?: Uint8Array;\n sourceType?: string;\n sourceId?: string;\n sourceUrl?: string;\n containsAutoReply?: boolean;\n renderLargerThumbnail?: boolean;\n showAdAttribution?: boolean;\n ctwaClid?: string;\n ref?: string;\n}\n\nexport interface ActionLink {\n url?: string;\n buttonTitle?: string;\n}\n\nexport interface UTMInfo {\n utmSource?: string;\n utmCampaign?: string;\n}\n\nexport enum MediaType {\n UNKNOWN = 0,\n IMAGE = 1,\n VIDEO = 2,\n AUDIO = 3,\n DOCUMENT = 4,\n STICKER = 5,\n}\n\n// Interactive elements\nexport interface InteractiveAnnotation {\n polygonVertices?: Point[];\n location?: Location;\n}\n\nexport interface Point {\n xDeprecated?: number;\n yDeprecated?: number;\n x?: number;\n y?: number;\n}\n\n// Location types\nexport interface LocationMessage {\n degreesLatitude?: number;\n degreesLongitude?: number;\n name?: string;\n address?: string;\n url?: string;\n isLiveLocation?: boolean;\n accuracyInMeters?: number;\n speedInMps?: number;\n degreesClockwiseFromMagneticNorth?: number;\n comment?: string;\n jpegThumbnail?: Uint8Array;\n contextInfo?: ContextInfo;\n}\n\nexport interface LiveLocationMessage {\n degreesLatitude?: number;\n degreesLongitude?: number;\n accuracyInMeters?: number;\n speedInMps?: number;\n degreesClockwiseFromMagneticNorth?: number;\n caption?: string;\n sequenceNumber?: number;\n timeOffset?: number;\n jpegThumbnail?: Uint8Array;\n contextInfo?: ContextInfo;\n}\n\nexport interface Location {\n degreesLatitude?: number;\n degreesLongitude?: number;\n name?: string;\n}\n\n// Media message types\nexport interface ImageMessage {\n url?: string;\n mimetype?: string;\n caption?: string;\n fileSha256?: Uint8Array;\n fileLength?: number;\n height?: number;\n width?: number;\n mediaKey?: Uint8Array;\n fileEncSha256?: Uint8Array;\n interactiveAnnotations?: InteractiveAnnotation[];\n directPath?: string;\n mediaKeyTimestamp?: number;\n jpegThumbnail?: Uint8Array;\n contextInfo?: ContextInfo;\n firstScanSidecar?: Uint8Array;\n firstScanLength?: number;\n experimentGroupId?: number;\n scansSidecar?: Uint8Array;\n scanLengths?: number[];\n midQualityFileSha256?: Uint8Array;\n midQualityFileEncSha256?: Uint8Array;\n viewOnce?: boolean;\n thumbnailDirectPath?: string;\n thumbnailSha256?: Uint8Array;\n thumbnailEncSha256?: Uint8Array;\n staticUrl?: string;\n annotations?: InteractiveAnnotation[];\n originalFileName?: string;\n}\n\nexport interface VideoMessage {\n url?: string;\n mimetype?: string;\n fileSha256?: Uint8Array;\n fileLength?: number;\n seconds?: number;\n mediaKey?: Uint8Array;\n caption?: string;\n gifPlayback?: boolean;\n height?: number;\n width?: number;\n fileEncSha256?: Uint8Array;\n interactiveAnnotations?: InteractiveAnnotation[];\n directPath?: string;\n mediaKeyTimestamp?: number;\n jpegThumbnail?: Uint8Array;\n contextInfo?: ContextInfo;\n streamingSidecar?: Uint8Array;\n gifAttribution?: VideoAttribution;\n viewOnce?: boolean;\n thumbnailDirectPath?: string;\n thumbnailSha256?: Uint8Array;\n thumbnailEncSha256?: Uint8Array;\n staticUrl?: string;\n annotations?: InteractiveAnnotation[];\n accessibilityLabel?: string;\n processedVideos?: ProcessedVideo[];\n externalShareFullVideoDurationInSeconds?: number;\n motionPhotoPresentationOffsetMS?: number;\n metadataUrl?: string;\n videoSourceType?: VideoSourceType;\n}\n\nexport enum VideoAttribution {\n NONE = 0,\n GIPHY = 1,\n TENOR = 2,\n KLIPY = 3,\n}\n\nexport enum VideoSourceType {\n USER_VIDEO = 0,\n AI_GENERATED = 1,\n}\n\nexport interface ProcessedVideo {\n url?: string;\n fileLength?: number;\n fileSha256?: Uint8Array;\n fileEncSha256?: Uint8Array;\n}\n\nexport interface AudioMessage {\n url?: string;\n mimetype?: string;\n fileSha256?: Uint8Array;\n fileLength?: number;\n seconds?: number;\n ptt?: boolean;\n mediaKey?: Uint8Array;\n fileEncSha256?: Uint8Array;\n directPath?: string;\n mediaKeyTimestamp?: number;\n contextInfo?: ContextInfo;\n streamingSidecar?: Uint8Array;\n waveform?: Uint8Array;\n backgroundArgb?: number;\n viewOnce?: boolean;\n}\n\nexport interface DocumentMessage {\n url?: string;\n mimetype?: string;\n title?: string;\n fileSha256?: Uint8Array;\n fileLength?: number;\n pageCount?: number;\n mediaKey?: Uint8Array;\n fileName?: string;\n fileEncSha256?: Uint8Array;\n directPath?: string;\n mediaKeyTimestamp?: number;\n contactVcard?: boolean;\n thumbnailDirectPath?: string;\n thumbnailSha256?: Uint8Array;\n thumbnailEncSha256?: Uint8Array;\n jpegThumbnail?: Uint8Array;\n contextInfo?: ContextInfo;\n thumbnailHeight?: number;\n thumbnailWidth?: number;\n caption?: string;\n}\n\nexport interface StickerMessage {\n url?: string;\n fileSha256?: Uint8Array;\n fileEncSha256?: Uint8Array;\n mediaKey?: Uint8Array;\n mimetype?: string;\n height?: number;\n width?: number;\n directPath?: string;\n fileLength?: number;\n mediaKeyTimestamp?: number;\n firstFrameLength?: number;\n firstFrameSidecar?: Uint8Array;\n isAnimated?: boolean;\n pngThumbnail?: Uint8Array;\n contextInfo?: ContextInfo;\n stickerSentTs?: number;\n isAvatar?: boolean;\n isAiSticker?: boolean;\n isLottie?: boolean;\n}\n\n// Contact message types\nexport interface ContactMessage {\n displayName?: string;\n vcard?: string;\n contextInfo?: ContextInfo;\n}\n\nexport interface ContactsArrayMessage {\n displayName?: string;\n contacts?: ContactMessage[];\n contextInfo?: ContextInfo;\n}\n\n// Text and extended text messages\nexport interface ExtendedTextMessage {\n text?: string;\n matchedText?: string;\n canonicalUrl?: string;\n description?: string;\n title?: string;\n textArgb?: number;\n backgroundArgb?: number;\n font?: ExtendedTextMessageFontType;\n previewType?: ExtendedTextMessagePreviewType;\n jpegThumbnail?: Uint8Array;\n contextInfo?: ContextInfo;\n doNotPlayInline?: boolean;\n thumbnailDirectPath?: string;\n thumbnailSha256?: Uint8Array;\n thumbnailEncSha256?: Uint8Array;\n mediaKey?: Uint8Array;\n mediaKeyTimestamp?: number;\n thumbnailHeight?: number;\n thumbnailWidth?: number;\n inviteLinkGroupType?: ExtendedTextMessageInviteLinkGroupType;\n inviteLinkParentGroupSubject?: string;\n inviteLinkParentGroupThumbnailJpeg?: Uint8Array;\n inviteLinkGroupTypeV2?: InviteLinkGroupType;\n viewOnce?: boolean;\n}\n\nexport enum ExtendedTextMessageFontType {\n SANS_SERIF = 0,\n SERIF = 1,\n NORICAN_REGULAR = 2,\n BRYNDAN_WRITE = 3,\n BEBASNEUE_REGULAR = 4,\n OSWALD_HEAVY = 5,\n}\n\nexport enum ExtendedTextMessagePreviewType {\n NONE = 0,\n VIDEO = 1,\n PLACEHOLDER = 4,\n IMAGE = 5,\n}\n\nexport enum ExtendedTextMessageInviteLinkGroupType {\n DEFAULT = 0,\n PARENT = 1,\n SUB = 2,\n DEFAULT_SUB = 3,\n}\n\nexport enum InviteLinkGroupType {\n DEFAULT = 0,\n PARENT = 1,\n SUB = 2,\n DEFAULT_SUB = 3,\n}\n\n// Interactive messages\nexport interface ButtonsMessage {\n contentText?: string;\n footerText?: string;\n contextInfo?: ContextInfo;\n buttons?: Button[];\n headerType?: ButtonsMessageHeaderType;\n text?: string;\n documentMessage?: DocumentMessage;\n imageMessage?: ImageMessage;\n videoMessage?: VideoMessage;\n locationMessage?: LocationMessage;\n}\n\nexport interface Button {\n buttonId?: string;\n buttonText?: ButtonText;\n type?: ButtonType;\n nativeFlowInfo?: NativeFlowInfo;\n}\n\nexport interface ButtonText {\n displayText?: string;\n}\n\nexport enum ButtonType {\n UNKNOWN = 0,\n RESPONSE = 1,\n NATIVE_FLOW = 2,\n}\n\nexport interface NativeFlowInfo {\n name?: string;\n paramsJson?: string;\n}\n\nexport enum ButtonsMessageHeaderType {\n UNKNOWN = 0,\n EMPTY = 1,\n TEXT = 2,\n DOCUMENT = 3,\n IMAGE = 4,\n VIDEO = 5,\n LOCATION = 6,\n}\n\nexport interface ListMessage {\n title?: string;\n description?: string;\n buttonText?: string;\n listType?: ListMessageListType;\n sections?: Section[];\n productListInfo?: ProductListInfo;\n footerText?: string;\n contextInfo?: ContextInfo;\n}\n\nexport interface Section {\n title?: string;\n rows?: Row[];\n}\n\nexport interface Row {\n title?: string;\n description?: string;\n rowId?: string;\n}\n\nexport interface ProductListInfo {\n productSections?: ProductSection[];\n headerImage?: ImageMessage;\n businessOwnerJid?: string;\n}\n\nexport interface ProductSection {\n title?: string;\n products?: ProductListItem[];\n}\n\nexport interface ProductListItem {\n productId?: string;\n}\n\nexport enum ListMessageListType {\n UNKNOWN = 0,\n SINGLE_SELECT = 1,\n PRODUCT_LIST = 2,\n}\n\n// Template and interactive response messages\nexport interface TemplateMessage {\n contextInfo?: ContextInfo;\n hydratedTemplate?: HydratedFourRowTemplate;\n templateId?: string;\n documentMessage?: DocumentMessage;\n imageMessage?: ImageMessage;\n videoMessage?: VideoMessage;\n locationMessage?: LocationMessage;\n}\n\nexport interface HydratedFourRowTemplate {\n documentMessage?: DocumentMessage;\n imageMessage?: ImageMessage;\n videoMessage?: VideoMessage;\n locationMessage?: LocationMessage;\n title?: string;\n hydratedContentText?: string;\n hydratedFooterText?: string;\n hydratedButtons?: HydratedTemplateButton[];\n templateId?: string;\n mask?: string;\n}\n\nexport interface HydratedTemplateButton {\n index?: number;\n quickReplyButton?: HydratedQuickReplyButton;\n urlButton?: HydratedURLButton;\n callButton?: HydratedCallButton;\n}\n\nexport interface HydratedQuickReplyButton {\n displayText?: string;\n id?: string;\n}\n\nexport interface HydratedURLButton {\n displayText?: string;\n url?: string;\n}\n\nexport interface HydratedCallButton {\n displayText?: string;\n phoneNumber?: string;\n}\n\n// Response messages\nexport interface ButtonsResponseMessage {\n selectedButtonId?: string;\n contextInfo?: ContextInfo;\n type?: ButtonsResponseMessageType;\n selectedDisplayText?: string;\n}\n\nexport enum ButtonsResponseMessageType {\n UNKNOWN = 0,\n DISPLAY_TEXT = 1,\n}\n\nexport interface ListResponseMessage {\n title?: string;\n listType?: ListResponseMessageListType;\n singleSelectReply?: SingleSelectReply;\n contextInfo?: ContextInfo;\n description?: string;\n}\n\nexport interface SingleSelectReply {\n selectedRowId?: string;\n}\n\nexport enum ListResponseMessageListType {\n UNKNOWN = 0,\n SINGLE_SELECT = 1,\n}\n\n// Payment and order messages\nexport interface SendPaymentMessage {\n noteMessage?: Message;\n requestMessageKey?: MessageKey;\n background?: PaymentBackground;\n}\n\nexport interface PaymentBackground {\n id?: string;\n fileEncSha256?: Uint8Array;\n directPath?: string;\n mediaKey?: Uint8Array;\n type?: PaymentBackgroundType;\n mediaKeyTimestamp?: number;\n}\n\nexport enum PaymentBackgroundType {\n UNKNOWN = 0,\n DEFAULT = 1,\n}\n\nexport interface RequestPaymentMessage {\n noteMessage?: Message;\n currencyCodeIso4217?: string;\n amount1000?: number;\n requestFrom?: string;\n expiryTimestamp?: number;\n background?: PaymentBackground;\n}\n\nexport interface DeclinePaymentRequestMessage {\n key?: MessageKey;\n}\n\nexport interface CancelPaymentRequestMessage {\n key?: MessageKey;\n}\n\n// Group invite message\nexport interface GroupInviteMessage {\n groupJid?: string;\n inviteCode?: string;\n inviteExpiration?: number;\n groupName?: string;\n jpegThumbnail?: Uint8Array;\n caption?: string;\n contextInfo?: ContextInfo;\n}\n\n// Poll message\nexport interface PollCreationMessage {\n name?: string;\n options?: PollOption[];\n selectableOptionsCount?: number;\n contextInfo?: ContextInfo;\n}\n\nexport interface PollOption {\n optionName?: string;\n}\n\nexport interface PollUpdateMessage {\n pollCreationMessageKey?: MessageKey;\n vote?: PollEncValue;\n metadata?: PollUpdateMetadata;\n senderTimestampMs?: number;\n}\n\nexport interface PollEncValue {\n encPayload?: Uint8Array;\n encIv?: Uint8Array;\n}\n\nexport interface PollUpdateMetadata {\n // Metadata about the poll update\n}\n\n// Chat and conversation messages\nexport interface Chat {\n displayName?: string;\n id?: string;\n}\n\nexport interface Call {\n callKey?: Uint8Array;\n conversionSource?: string;\n conversionData?: Uint8Array;\n conversionDelaySeconds?: number;\n}\n\n// Main Message union type\nexport interface Message {\n // Text messages\n conversation?: string;\n extendedTextMessage?: ExtendedTextMessage;\n\n // Media messages\n imageMessage?: ImageMessage;\n videoMessage?: VideoMessage;\n audioMessage?: AudioMessage;\n documentMessage?: DocumentMessage;\n stickerMessage?: StickerMessage;\n\n // Location messages\n locationMessage?: LocationMessage;\n liveLocationMessage?: LiveLocationMessage;\n\n // Contact messages\n contactMessage?: ContactMessage;\n contactsArrayMessage?: ContactsArrayMessage;\n\n // Interactive messages\n buttonsMessage?: ButtonsMessage;\n listMessage?: ListMessage;\n templateMessage?: TemplateMessage;\n\n // Response messages\n buttonsResponseMessage?: ButtonsResponseMessage;\n listResponseMessage?: ListResponseMessage;\n\n // Payment messages\n sendPaymentMessage?: SendPaymentMessage;\n requestPaymentMessage?: RequestPaymentMessage;\n declinePaymentRequestMessage?: DeclinePaymentRequestMessage;\n cancelPaymentRequestMessage?: CancelPaymentRequestMessage;\n\n // Group messages\n groupInviteMessage?: GroupInviteMessage;\n\n // Poll messages\n pollCreationMessage?: PollCreationMessage;\n pollUpdateMessage?: PollUpdateMessage;\n\n // System messages\n protocolMessage?: ProtocolMessage;\n ephemeralMessage?: EphemeralMessage;\n viewOnceMessage?: ViewOnceMessage;\n reactionMessage?: ReactionMessage;\n stickerSyncRmrMessage?: StickerSyncRmrMessage;\n\n // Call messages\n call?: Call;\n chat?: Chat;\n\n // MessageContextInfo\n messageContextInfo?: MessageContextInfo;\n}\n\n// System and protocol messages\nexport interface ProtocolMessage {\n key?: MessageKey;\n type?: ProtocolMessageType;\n ephemeralExpiration?: number;\n ephemeralSettingTimestamp?: number;\n historySyncNotification?: HistorySyncNotification;\n appStateSyncKeyShare?: AppStateSyncKeyShare;\n appStateSyncKeyRequest?: AppStateSyncKeyRequest;\n initialSecurityNotificationSettingSync?: InitialSecurityNotificationSettingSync;\n appStateFatalExceptionNotification?: AppStateFatalExceptionNotification;\n disappearingMode?: DisappearingMode;\n editedMessage?: Message;\n timestampMs?: number;\n peerDataOperationRequestMessage?: PeerDataOperationRequestMessage;\n peerDataOperationRequestResponseMessage?: PeerDataOperationRequestResponseMessage;\n}\n\nexport enum ProtocolMessageType {\n REVOKE = 0,\n EPHEMERAL_SETTING = 3,\n EPHEMERAL_SYNC_RESPONSE = 4,\n HISTORY_SYNC_NOTIFICATION = 5,\n APP_STATE_SYNC_KEY_SHARE = 6,\n APP_STATE_SYNC_KEY_REQUEST = 7,\n MSG_FANOUT_BACKFILL_REQUEST = 8,\n INITIAL_SECURITY_NOTIFICATION_SETTING_SYNC = 9,\n APP_STATE_FATAL_EXCEPTION_NOTIFICATION = 10,\n SHARE_PHONE_NUMBER = 11,\n MESSAGE_EDIT = 14,\n PEER_DATA_OPERATION_REQUEST_MESSAGE = 16,\n PEER_DATA_OPERATION_REQUEST_RESPONSE_MESSAGE = 17,\n}\n\nexport interface EphemeralMessage {\n message?: Message;\n}\n\nexport interface ViewOnceMessage {\n message?: Message;\n}\n\nexport interface ReactionMessage {\n key?: MessageKey;\n text?: string;\n groupingKey?: string;\n senderTimestampMs?: number;\n unread?: boolean;\n}\n\nexport interface StickerSyncRmrMessage {\n filehash?: string[];\n rmrSource?: string;\n requestTimestamp?: number;\n}\n\nexport interface MessageContextInfo {\n deviceListMetadata?: DeviceListMetadata;\n deviceListMetadataVersion?: number;\n messageSecret?: Uint8Array;\n paddingBytes?: Uint8Array;\n messageAddOnDurationInSecs?: number;\n botMessageInvoker?: BotMessageInvoker;\n botResponseCorrelationId?: string;\n botPluginType?: BotPluginType;\n botPluginReferenceIndex?: number;\n botPluginSearchProvider?: BotPluginSearchProvider;\n botPluginSearchUrl?: string;\n botPluginMaybeParentPluginType?: BotPluginType;\n botReelPluginThumbnailCdnUrl?: string;\n expiredBotResponseCorrelationId?: string;\n}\n\nexport interface DeviceListMetadata {\n senderKeyHash?: Uint8Array;\n senderTimestamp?: number;\n senderKeyIndexes?: number[];\n recipientKeyHash?: Uint8Array;\n recipientTimestamp?: number;\n recipientKeyIndexes?: number[];\n}\n\nexport interface BotMessageInvoker {\n // Bot message invoker details\n}\n\nexport enum BotPluginType {\n REELS = 0,\n SEARCH = 1,\n}\n\nexport enum BotPluginSearchProvider {\n BING = 0,\n GOOGLE = 1,\n}\n\n// Additional system notification types\nexport interface HistorySyncNotification {\n fileSha256?: Uint8Array;\n fileLength?: number;\n mediaKey?: Uint8Array;\n fileEncSha256?: Uint8Array;\n directPath?: string;\n syncType?: HistorySyncNotificationHistorySyncType;\n chunkOrder?: number;\n originalMessageId?: string;\n progress?: number;\n oldestMsgInChunkTimestampSec?: number;\n initialHistBootstrapInlinePayload?: Uint8Array;\n peerDataRequestSessionId?: string;\n}\n\nexport enum HistorySyncNotificationHistorySyncType {\n INITIAL_BOOTSTRAP = 0,\n INITIAL_STATUS_V3 = 1,\n FULL = 2,\n RECENT = 3,\n PUSH_NAME = 4,\n NON_BLOCKING_DATA = 5,\n ON_DEMAND = 6,\n}\n\nexport interface AppStateSyncKeyShare {\n keys?: AppStateSyncKey[];\n}\n\nexport interface AppStateSyncKey {\n keyId?: AppStateSyncKeyId;\n keyData?: AppStateSyncKeyData;\n}\n\nexport interface AppStateSyncKeyId {\n keyId?: Uint8Array;\n}\n\nexport interface AppStateSyncKeyData {\n keyData?: Uint8Array;\n fingerprint?: AppStateSyncKeyFingerprint;\n timestamp?: number;\n}\n\nexport interface AppStateSyncKeyFingerprint {\n rawId?: number;\n currentIndex?: number;\n deviceIndexes?: number[];\n}\n\nexport interface AppStateSyncKeyRequest {\n keyIds?: AppStateSyncKeyId[];\n}\n\nexport interface InitialSecurityNotificationSettingSync {\n securityNotificationEnabled?: boolean;\n}\n\nexport interface AppStateFatalExceptionNotification {\n collectionNames?: string[];\n timestamp?: number;\n}\n\nexport interface PeerDataOperationRequestMessage {\n peerDataOperationRequestType?: PeerDataOperationRequestType;\n requestId?: string;\n}\n\nexport interface PeerDataOperationRequestResponseMessage {\n peerDataOperationResult?: PeerDataOperationRequestResponseMessagePeerDataOperationResult;\n stanzaId?: string;\n}\n\nexport enum PeerDataOperationRequestType {\n UPLOAD_STICKER = 0,\n SEND_RECENT_STICKER_BOOTSTRAP = 1,\n GENERATE_LINK_PREVIEW = 2,\n}\n\nexport enum PeerDataOperationRequestResponseMessagePeerDataOperationResult {\n SUCCESS = 0,\n NOT_AUTHORIZED = 1,\n NOT_FOUND = 2,\n THROTTLED = 3,\n UNKNOWN_ERROR = 4,\n}\n\n// Helper type to get the active message type\nexport type MessageContent =\n | { type: \"text\"; content: string }\n | { type: \"extendedText\"; content: ExtendedTextMessage }\n | { type: \"image\"; content: ImageMessage }\n | { type: \"video\"; content: VideoMessage }\n | { type: \"audio\"; content: AudioMessage }\n | { type: \"document\"; content: DocumentMessage }\n | { type: \"sticker\"; content: StickerMessage }\n | { type: \"location\"; content: LocationMessage }\n | { type: \"liveLocation\"; content: LiveLocationMessage }\n | { type: \"contact\"; content: ContactMessage }\n | { type: \"contactsArray\"; content: ContactsArrayMessage }\n | { type: \"buttons\"; content: ButtonsMessage }\n | { type: \"list\"; content: ListMessage }\n | { type: \"template\"; content: TemplateMessage }\n | { type: \"buttonsResponse\"; content: ButtonsResponseMessage }\n | { type: \"listResponse\"; content: ListResponseMessage }\n | { type: \"groupInvite\"; content: GroupInviteMessage }\n | { type: \"poll\"; content: PollCreationMessage }\n | { type: \"pollUpdate\"; content: PollUpdateMessage }\n | { type: \"reaction\"; content: ReactionMessage }\n | { type: \"protocol\"; content: ProtocolMessage }\n | { type: \"ephemeral\"; content: EphemeralMessage }\n | { type: \"viewOnce\"; content: ViewOnceMessage };\n\n// Utility function to extract message content and type\nexport function getMessageContent(message: Message): MessageContent | null {\n if (message.conversation) {\n return { type: \"text\", content: message.conversation };\n }\n if (message.extendedTextMessage) {\n return { type: \"extendedText\", content: message.extendedTextMessage };\n }\n if (message.imageMessage) {\n return { type: \"image\", content: message.imageMessage };\n }\n if (message.videoMessage) {\n return { type: \"video\", content: message.videoMessage };\n }\n if (message.audioMessage) {\n return { type: \"audio\", content: message.audioMessage };\n }\n if (message.documentMessage) {\n return { type: \"document\", content: message.documentMessage };\n }\n if (message.stickerMessage) {\n return { type: \"sticker\", content: message.stickerMessage };\n }\n if (message.locationMessage) {\n return { type: \"location\", content: message.locationMessage };\n }\n if (message.liveLocationMessage) {\n return { type: \"liveLocation\", content: message.liveLocationMessage };\n }\n if (message.contactMessage) {\n return { type: \"contact\", content: message.contactMessage };\n }\n if (message.contactsArrayMessage) {\n return { type: \"contactsArray\", content: message.contactsArrayMessage };\n }\n if (message.buttonsMessage) {\n return { type: \"buttons\", content: message.buttonsMessage };\n }\n if (message.listMessage) {\n return { type: \"list\", content: message.listMessage };\n }\n if (message.templateMessage) {\n return { type: \"template\", content: message.templateMessage };\n }\n if (message.buttonsResponseMessage) {\n return { type: \"buttonsResponse\", content: message.buttonsResponseMessage };\n }\n if (message.listResponseMessage) {\n return { type: \"listResponse\", content: message.listResponseMessage };\n }\n if (message.groupInviteMessage) {\n return { type: \"groupInvite\", content: message.groupInviteMessage };\n }\n if (message.pollCreationMessage) {\n return { type: \"poll\", content: message.pollCreationMessage };\n }\n if (message.pollUpdateMessage) {\n return { type: \"pollUpdate\", content: message.pollUpdateMessage };\n }\n if (message.reactionMessage) {\n return { type: \"reaction\", content: message.reactionMessage };\n }\n if (message.protocolMessage) {\n return { type: \"protocol\", content: message.protocolMessage };\n }\n if (message.ephemeralMessage) {\n return { type: \"ephemeral\", content: message.ephemeralMessage };\n }\n if (message.viewOnceMessage) {\n return { type: \"viewOnce\", content: message.viewOnceMessage };\n }\n\n return null;\n}\n","// WhatsApp events types based on whatsmeow package\n// Reference: https://pkg.go.dev/go.mau.fi/whatsmeow@v0.0.0-20250829123043-72d2ed58e998/types/events\n\nimport { Message } from \"./message.js\";\n\n// Event types enum for all possible WhatsApp events\nexport enum EventType {\n // Core message and communication events\n MESSAGE = \"Message\",\n RECEIPT = \"Receipt\",\n PRESENCE = \"Presence\",\n CHAT_PRESENCE = \"ChatPresence\",\n\n // Connection and session events\n CONNECTED = \"Connected\",\n DISCONNECTED = \"Disconnected\",\n LOGGED_OUT = \"LoggedOut\",\n QR = \"QR\",\n QR_SCANNED_WITHOUT_MULTIDEVICE = \"QRScannedWithoutMultidevice\",\n PAIR_SUCCESS = \"PairSuccess\",\n PAIR_ERROR = \"PairError\",\n MANUAL_LOGIN_RECONNECT = \"ManualLoginReconnect\",\n KEEP_ALIVE_RESTORED = \"KeepAliveRestored\",\n KEEP_ALIVE_TIMEOUT = \"KeepAliveTimeout\",\n\n // Group events\n GROUP_INFO = \"GroupInfo\",\n JOINED_GROUP = \"JoinedGroup\",\n\n // Contact and user events\n CONTACT = \"Contact\",\n PUSH_NAME = \"PushName\",\n PUSH_NAME_SETTING = \"PushNameSetting\",\n PICTURE = \"Picture\",\n USER_ABOUT = \"UserAbout\",\n USER_STATUS_MUTE = \"UserStatusMute\",\n PRIVACY_SETTINGS = \"PrivacySettings\",\n\n // App state and sync events\n APP_STATE = \"AppState\",\n APP_STATE_SYNC_COMPLETE = \"AppStateSyncComplete\",\n HISTORY_SYNC = \"HistorySync\",\n OFFLINE_SYNC_COMPLETED = \"OfflineSyncCompleted\",\n OFFLINE_SYNC_PREVIEW = \"OfflineSyncPreview\",\n IDENTITY_CHANGE = \"IdentityChange\",\n\n // Chat management events\n ARCHIVE = \"Archive\",\n UNARCHIVE_CHATS_SETTING = \"UnarchiveChatsSetting\",\n CLEAR_CHAT = \"ClearChat\",\n DELETE_CHAT = \"DeleteChat\",\n DELETE_FOR_ME = \"DeleteForMe\",\n MARK_CHAT_AS_READ = \"MarkChatAsRead\",\n MUTE = \"Mute\",\n PIN = \"Pin\",\n STAR = \"Star\",\n\n // Label events\n LABEL_ASSOCIATION_CHAT = \"LabelAssociationChat\",\n LABEL_ASSOCIATION_MESSAGE = \"LabelAssociationMessage\",\n LABEL_EDIT = \"LabelEdit\",\n\n // Media events\n MEDIA_RETRY = \"MediaRetry\",\n MEDIA_RETRY_ERROR = \"MediaRetryError\",\n\n // Newsletter events\n NEWSLETTER_JOIN = \"NewsletterJoin\",\n NEWSLETTER_LEAVE = \"NewsletterLeave\",\n NEWSLETTER_LIVE_UPDATE = \"NewsletterLiveUpdate\",\n NEWSLETTER_MESSAGE_META = \"NewsletterMessageMeta\",\n NEWSLETTER_MUTE_CHANGE = \"NewsletterMuteChange\",\n\n // Error and system events\n UNDECRYPTABLE_MESSAGE = \"UndecryptableMessage\",\n STREAM_ERROR = \"StreamError\",\n STREAM_REPLACED = \"StreamReplaced\",\n CONNECT_FAILURE = \"ConnectFailure\",\n CLIENT_OUTDATED = \"ClientOutdated\",\n TEMPORARY_BAN = \"TemporaryBan\",\n CAT_REFRESH_ERROR = \"CATRefreshError\",\n PERMANENT_DISCONNECT = \"PermanentDisconnect\",\n\n // Blocklist events\n BLOCKLIST = \"Blocklist\",\n BLOCKLIST_ACTION = \"BlocklistAction\",\n BLOCKLIST_CHANGE = \"BlocklistChange\",\n\n // Business events\n BUSINESS_NAME = \"BusinessName\",\n\n // Call events\n CALL_ACCEPT = \"CallAccept\",\n CALL_OFFER = \"CallOffer\",\n CALL_OFFER_NOTICE = \"CallOfferNotice\",\n CALL_PRE_ACCEPT = \"CallPreAccept\",\n CALL_REJECT = \"CallReject\",\n CALL_RELAY_LATENCY = \"CallRelayLatency\",\n CALL_TERMINATE = \"CallTerminate\",\n CALL_TRANSPORT = \"CallTransport\",\n UNKNOWN_CALL_EVENT = \"UnknownCallEvent\",\n\n // FB/Meta specific events\n FB_MESSAGE = \"FBMessage\",\n}\n\n// Additional specific types from whatsmeow\nexport interface WaBinaryNode {\n Tag: string;\n Attrs: Record<string, string>;\n Content: unknown;\n}\n\nexport interface SyncAction {\n timestamp: Date;\n action: unknown;\n}\n\nexport interface StarAction extends SyncAction {\n starred: boolean;\n}\n\nexport interface ArchiveAction extends SyncAction {\n archived: boolean;\n}\n\nexport interface ClearChatAction extends SyncAction {\n messageRange?: {\n lastMessageTimestamp?: Date;\n lastSystemMessageTimestamp?: Date;\n };\n}\n\nexport interface DeleteChatAction extends SyncAction {}\n\nexport interface DeleteMessageForMeAction extends SyncAction {}\n\nexport interface MarkChatAsReadAction extends SyncAction {\n read: boolean;\n messageRange?: {\n lastMessageTimestamp?: Date;\n lastSystemMessageTimestamp?: Date;\n };\n}\n\nexport interface MuteAction extends SyncAction {\n muted: boolean;\n muteEndTimestamp?: Date;\n}\n\nexport interface PinAction extends SyncAction {\n pinned: boolean;\n}\n\nexport interface PushNameSettingAction extends SyncAction {\n name: string;\n}\n\nexport interface UnarchiveChatsSettingAction extends SyncAction {\n unarchiveChats: boolean;\n}\n\nexport interface LabelAssociationAction extends SyncAction {\n labeled: boolean;\n}\n\nexport interface LabelEditAction extends SyncAction {\n name: string;\n color: number;\n predefinedId?: string;\n deleted: boolean;\n}\n\nexport interface BusinessNameAction extends SyncAction {\n businessName: string;\n verified: number;\n}\n\nexport interface UserStatusMuteAction extends SyncAction {\n muted: boolean;\n}\n\nexport interface Armadillo {\n payload?: unknown;\n}\n\nexport interface ConsumerApplication {\n metadata?: unknown;\n}\n\nexport interface BasicCallMeta {\n from: JID;\n timestamp: Date;\n callId: string;\n callCreator: JID;\n}\n\nexport interface CallRemoteMeta {\n remoteJid: JID;\n fromMe: boolean;\n}\n\nexport interface EventGroupParticipant {\n JID: JID;\n IsAdmin: boolean;\n IsSuperAdmin: boolean;\n}\n\nexport interface HistorySyncData {\n conversations?: unknown[];\n messages?: unknown[];\n}\n\n// Common types used in events\nexport interface JID {\n User: string;\n Agent: number;\n Device: number;\n Integrator: number;\n Server: string;\n AD: boolean;\n}\n\nexport interface MessageInfo {\n ID: string;\n Type: string;\n PushName: string;\n Timestamp: Date;\n Source: MessageSource;\n DeviceSentMeta?: DeviceSentMeta;\n ServerID?: number;\n Status?: MessageStatus;\n}\n\nexport interface MessageSource {\n Chat: JID;\n Sender: JID;\n IsFromMe: boolean;\n IsGroup: boolean;\n BroadcastListOwner?: JID;\n}\n\nexport interface DeviceSentMeta {\n DestinationJID: string;\n Phash: string;\n}\n\nexport enum MessageStatus {\n ERROR = \"ERROR\",\n PENDING = \"PENDING\",\n SERVER_ACK = \"SERVER_ACK\",\n DELIVERY_ACK = \"DELIVERY_ACK\",\n READ = \"READ\",\n PLAYED = \"PLAYED\",\n}\n\nexport enum ReceiptType {\n UNKNOWN = \"\",\n DELIVERY = \"delivery\",\n READ = \"read\",\n READ_SELF = \"read-self\",\n PLAYED = \"played\",\n SENDER = \"sender\",\n INACTIVE = \"inactive\",\n PEER_MSG = \"peer_msg\",\n}\n\nexport enum DecryptFailMode {\n UNAVAILABLE = \"unavailable\",\n DECRYPT_FAIL = \"decrypt_fail\",\n}\n\nexport enum UnavailableType {\n UNKNOWN = \"\",\n VIEW_ONCE = \"view_once\",\n}\n\nexport enum ConnectFailureReason {\n SOCKET_OPEN_TIMEOUT = 4001,\n SOCKET_PING_TIMEOUT = 4002,\n SOCKET_PONG_TIMEOUT = 4003,\n UNKNOWN_LOGOUT = 4004,\n BAD_MAC = 4005,\n INIT_TIMEOUT = 4006,\n MULTI_DEVICE_MISMATCH = 4007,\n MULTI_DEVICE_DISABLED = 4008,\n TEMP_BANNED = 4009,\n CLIENT_OUTDATED = 4010,\n STREAM_ERROR = 4011,\n DEVICE_GONE = 4012,\n IDENTITY_MISSING = 4013,\n RATE_LIMIT_HIT = 4014,\n MAIN_DEVICE_GONE = 4015,\n}\n\nexport enum TempBanReason {\n SENT_TO_TOO_MANY_PEOPLE = 101,\n BLOCKED_BY_USERS = 102,\n CREATED_TOO_MANY_GROUPS = 103,\n SENT_TOO_MANY_SAME_MESSAGE = 104,\n BROADCAST_LIST = 106,\n}\n\n// Event types\nexport interface AppState {\n name: string;\n version: number;\n hash: string[];\n}\n\nexport interface AppStateSyncComplete {\n name: string;\n}\n\nexport interface Archive {\n JID: JID;\n Timestamp: Date;\n Action: ArchiveAction;\n FromFullSync: boolean;\n}\n\nexport interface Blocklist {\n JID: JID;\n action: string;\n dhash: string;\n}\n\nexport interface BlocklistAction {\n action: string;\n}\n\nexport interface BlocklistChange {\n JID: JID;\n action: BlocklistChangeAction;\n}\n\nexport interface BlocklistChangeAction {\n action: string;\n}\n\nexport interface BusinessName {\n BusinessJID: JID;\n PushName: string;\n VerifiedName: string;\n VerifiedLevel: string;\n Action: BusinessNameAction;\n FromFullSync: boolean;\n}\n\nexport interface CATRefreshError {\n code: string;\n text: string;\n}\n\nexport interface CallAccept {\n BasicCallMeta: BasicCallMeta;\n}\n\nexport interface CallOffer {\n BasicCallMeta: BasicCallMeta;\n CallRemoteMeta: CallRemoteMeta;\n Data: string;\n}\n\nexport interface CallOfferNotice {\n BasicCallMeta: BasicCallMeta;\n Media: string;\n Type: string;\n Data: string;\n}\n\nexport interface CallPreAccept {\n BasicCallMeta: BasicCallMeta;\n CallRemoteMeta: CallRemoteMeta;\n}\n\nexport interface CallReject {\n BasicCallMeta: BasicCallMeta;\n}\n\nexport interface CallRelayLatency {\n BasicCallMeta: BasicCallMeta;\n Latency: number;\n}\n\nexport interface CallTerminate {\n BasicCallMeta: BasicCallMeta;\n Reason: string;\n}\n\nexport interface CallTransport {\n BasicCallMeta: BasicCallMeta;\n}\n\nexport interface ChatPresence {\n MessageSource: MessageSource;\n State: string;\n Media: string;\n}\n\nexport interface ClearChat {\n ChatJID: JID;\n Timestamp: Date;\n Action: ClearChatAction;\n FromFullSync: boolean;\n}\n\nexport interface ClientOutdated {\n // Event indicating the client version is outdated\n}\n\nexport interface ConnectFailure {\n Reason: ConnectFailureReason;\n Raw: WaBinaryNode;\n}\n\nexport interface Connected {\n // Event indicating successful connection\n}\n\nexport interface EventContact {\n JID: JID;\n Found: boolean;\n FirstName: string;\n FullName: string;\n PushName: string;\n BusinessName: string;\n}\n\nexport interface DeleteChat {\n ChatJID: JID;\n Timestamp: Date;\n Action: DeleteChatAction;\n FromFullSync: boolean;\n}\n\nexport interface DeleteForMe {\n ChatJID: JID;\n SenderJID: JID;\n IsFromMe: boolean;\n MessageID: string;\n Timestamp: Date;\n Action: DeleteMessageForMeAction;\n FromFullSync: boolean;\n}\n\nexport interface Disconnected {\n // Event indicating disconnection\n}\n\nexport interface FBMessage {\n Info: MessageInfo;\n IsEphemeral: boolean;\n IsViewOnce: boolean;\n IsDocumentWithCaption: boolean;\n IsEdit: boolean;\n Message: Armadillo;\n}\n\nexport interface EventGroupInfo {\n JID: JID;\n GroupName: string;\n GroupTopic: string;\n GroupLocked: boolean;\n GroupAnnounce: boolean;\n GroupEphemeral: boolean;\n GroupParent?: JID;\n GroupLinkedParent?: JID;\n GroupIsDefaultSub: boolean;\n GroupCreated: Date;\n ParticipantVersionID: string;\n Participants: EventGroupParticipant[];\n PendingParticipants: EventGroupParticipant[];\n JoinedAt: Date;\n CreateKey: string;\n Sender: JID;\n Timestamp: Date;\n}\n\nexport interface HistorySync {\n Data: HistorySyncData;\n}\n\nexport interface IdentityChange {\n JID: JID;\n Timestamp: Date;\n Implicit: boolean;\n}\n\nexport interface JoinedGroup {\n Reason: string;\n Type: string;\n CreateKey: string;\n Participants: EventGroupParticipant[];\n}\n\nexport interface KeepAliveRestored {\n // Event indicating keep-alive connection restored\n}\n\nexport interface KeepAliveTimeout {\n // Event indicating keep-alive timeout\n}\n\nexport interface LabelAssociationChat {\n ChatJID: JID;\n LabelID: string;\n Labeled: boolean;\n Timestamp: Date;\n Action: LabelAssociationAction;\n FromFullSync: boolean;\n}\n\nexport interface LabelAssociationMessage {\n ChatJID: JID;\n SenderJID: JID;\n IsFromMe: boolean;\n MessageID: string;\n LabelID: string;\n Labeled: boolean;\n Timestamp: Date;\n Action: LabelAssociationAction;\n FromFullSync: boolean;\n}\n\nexport interface LabelEdit {\n ID: string;\n Name: string;\n Color: number;\n Deleted: boolean;\n Timestamp: Date;\n Action: LabelEditAction;\n FromFullSync: boolean;\n}\n\nexport interface LoggedOut {\n OnConnect: boolean;\n Reason: string;\n}\n\nexport interface ManualLoginReconnect {\n // Event indicating manual login reconnection required\n}\n\nexport interface MarkChatAsRead {\n ChatJID: JID;\n Timestamp: Date;\n Action: MarkChatAsReadAction;\n FromFullSync: boolean;\n}\n\nexport interface MediaRetry {\n MessageID: string;\n ChatJID: JID;\n SenderJID: JID;\n IsFromMe: boolean;\n Timestamp: Date;\n}\n\nexport interface MediaRetryError {\n MessageID: string;\n ChatJID: JID;\n SenderJID: JID;\n IsFromMe: boolean;\n Timestamp: Date;\n Error: string;\n}\n\nexport interface MessageEvent {\n Info: MessageInfo;\n Message: Message;\n IsEphemeral: boolean;\n IsViewOnce: boolean;\n IsDocumentWithCaption: boolean;\n IsEdit: boolean;\n RawMessage: WaBinaryNode;\n}\n\nexport interface Mute {\n ChatJID: JID;\n Timestamp: Date;\n Action: MuteAction;\n FromFullSync: boolean;\n}\n\nexport interface NewsletterJoin {\n ID: JID;\n NewsletterMeta: {\n name: string;\n description?: string;\n invite?: string;\n creationTime?: Date;\n };\n}\n\nexport interface NewsletterLeave {\n ID: JID;\n}\n\nexport interface NewsletterLiveUpdate {\n ID: JID;\n Time: Date;\n Messages: unknown[];\n}\n\nexport interface NewsletterMessageMeta {\n ID: JID;\n MessageServerID: number;\n MessageID: string;\n ReactionCounts: Record<string, number>;\n Views: number;\n}\n\nexport interface NewsletterMuteChange {\n ID: JID;\n Mute: string;\n}\n\nexport interface OfflineSyncCompleted {\n Count: number;\n}\n\nexport interface OfflineSyncPreview {\n Messages: unknown[];\n IsLatest: boolean;\n}\n\nexport interface PairError {\n ID: string;\n Error: string;\n}\n\nexport interface PairSuccess {\n ID: string;\n BusinessName: string;\n Platform: string;\n}\n\nexport interface PermanentDisconnect {\n // Event indicating permanent disconnection\n}\n\nexport interface Picture {\n JID: JID;\n Author: JID;\n Timestamp: Date;\n Remove: boolean;\n NewPicture?: {\n id: string;\n type: string;\n directPath: string;\n };\n OldPicture?: {\n id: string;\n type: string;\n directPath: string;\n };\n}\n\nexport interface Pin {\n ChatJID: JID;\n SenderJID: JID;\n IsFromMe: boolean;\n MessageID: string;\n Timestamp: Date;\n Action: PinAction;\n FromFullSync: boolean;\n}\n\nexport interface Presence {\n From: JID;\n Unavailable: boolean;\n LastSeen: Date;\n}\n\nexport interface PrivacySettings {\n GroupAddChanged: boolean;\n LastSeenChanged: boolean;\n StatusChanged: boolean;\n ProfileChanged: boolean;\n ReadReceiptsChanged: boolean;\n OnlineChanged: boolean;\n CallAddChanged: boolean;\n}\n\nexport interface PushName {\n JID: JID;\n Message: MessageInfo;\n OldPushName: string;\n NewPushName: string;\n}\n\nexport interface PushNameSetting {\n Timestamp: Date;\n Action: PushNameSettingAction;\n FromFullSync: boolean;\n}\n\nexport interface QR {\n Codes: string[];\n}\n\nexport interface QRScannedWithoutMultidevice {\n // Event indicating QR was scanned but multidevice not enabled\n}\n\nexport interface Receipt {\n MessageSource: MessageSource;\n MessageIDs: string[];\n Timestamp: Date;\n Type: ReceiptType;\n MessageSender: JID;\n}\n\nexport interface Star {\n ChatJID: JID;\n SenderJID: JID;\n IsFromMe: boolean;\n MessageID: string;\n Timestamp: Date;\n Action: StarAction;\n FromFullSync: boolean;\n}\n\nexport interface StreamError {\n Code: string;\n Raw: WaBinaryNode;\n}\n\nexport interface StreamReplaced {\n // Event indicating stream was replaced by another connection\n}\n\nexport interface TemporaryBan {\n Code: TempBanReason;\n Expire: number; // Duration in seconds\n}\n\nexport interface UnarchiveChatsSetting {\n Timestamp: Date;\n Action: UnarchiveChatsSettingAction;\n FromFullSync: boolean;\n}\n\nexport interface UndecryptableMessage {\n Info: MessageInfo;\n IsUnavailable: boolean;\n UnavailableType: UnavailableType;\n DecryptFailMode: DecryptFailMode;\n}\n\nexport interface UnknownCallEvent {\n Node: WaBinaryNode;\n}\n\nexport interface UserAbout {\n JID: JID;\n Status: string;\n Timestamp: Date;\n}\n\nexport interface UserStatusMute {\n JID: JID;\n Timestamp: Date;\n Action: UserStatusMuteAction;\n FromFullSync: boolean;\n}\n\n// Union type for all possible events\nexport type WhatsAppEvent =\n | AppState\n | AppStateSyncComplete\n | Archive\n | Blocklist\n | BlocklistAction\n | BlocklistChange\n | BusinessName\n | CATRefreshError\n | CallAccept\n | CallOffer\n | CallOfferNotice\n | CallPreAccept\n | CallReject\n | CallRelayLatency\n | CallTerminate\n | CallTransport\n | ChatPresence\n | ClearChat\n | ClientOutdated\n | ConnectFailure\n | Connected\n | EventContact\n | DeleteChat\n | DeleteForMe\n | Disconnected\n | FBMessage\n | EventGroupInfo\n | HistorySync\n | IdentityChange\n | JoinedGroup\n | KeepAliveRestored\n | KeepAliveTimeout\n | LabelAssociationChat\n | LabelAssociationMessage\n | LabelEdit\n | LoggedOut\n | ManualLoginReconnect\n | MarkChatAsRead\n | MediaRetry\n | MediaRetryError\n | MessageEvent\n | Mute\n | NewsletterJoin\n | NewsletterLeave\n | NewsletterLiveUpdate\n | NewsletterMessageMeta\n | NewsletterMuteChange\n | OfflineSyncCompleted\n | OfflineSyncPreview\n | PairError\n | PairSuccess\n | PermanentDisconnect\n | Picture\n | Pin\n | Presence\n | PrivacySettings\n | PushName\n | PushNameSetting\n | QR\n | QRScannedWithoutMultidevice\n | Receipt\n | Star\n | StreamError\n | StreamReplaced\n | TemporaryBan\n | UnarchiveChatsSetting\n | UndecryptableMessage\n | UnknownCallEvent\n | UserAbout\n | UserStatusMute;\n\n// Event handler type\nexport type EventHandler<T extends WhatsAppEvent = WhatsAppEvent> = (\n event: T\n) => void | Promise<void>;\n\n// Event emitter interface\nexport interface EventEmitter {\n on<T extends WhatsAppEvent>(\n eventType: string,\n handler: EventHandler<T>\n ): void;\n off<T extends WhatsAppEvent>(\n eventType: string,\n handler: EventHandler<T>\n ): void;\n emit<T extends WhatsAppEvent>(eventType: string, event: T): void;\n}\n"],"names":["DisappearingModeInitiator","DisappearingModeTrigger","MediaType","VideoAttribution","VideoSourceType","ExtendedTextMessageFontType","ExtendedTextMessagePreviewType","ExtendedTextMessageInviteLinkGroupType","InviteLinkGroupType","ButtonType","ButtonsMessageHeaderType","ListMessageListType","ButtonsResponseMessageType","ListResponseMessageListType","PaymentBackgroundType","ProtocolMessageType","BotPluginType","BotPluginSearchProvider","HistorySyncNotificationHistorySyncType","PeerDataOperationRequestType","PeerDataOperationRequestResponseMessagePeerDataOperationResult","EventType","MessageStatus","ReceiptType","DecryptFailMode","UnavailableType","ConnectFailureReason","TempBanReason"],"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,UACA,MACY;AACZ,UAAM,WAAW,MAAM,KAAK,MAAM,QAA2B;AA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|
|
4
|
+
RECEIPT = "Receipt",
|
|
5
|
+
PRESENCE = "Presence",
|
|
6
|
+
CHAT_PRESENCE = "ChatPresence",
|
|
7
|
+
CONNECTED = "Connected",
|
|
8
|
+
DISCONNECTED = "Disconnected",
|
|
9
|
+
LOGGED_OUT = "LoggedOut",
|
|
10
|
+
QR = "QR",
|
|
11
|
+
QR_SCANNED_WITHOUT_MULTIDEVICE = "QRScannedWithoutMultidevice",
|
|
12
|
+
PAIR_SUCCESS = "PairSuccess",
|
|
13
|
+
PAIR_ERROR = "PairError",
|
|
14
|
+
MANUAL_LOGIN_RECONNECT = "ManualLoginReconnect",
|
|
15
|
+
KEEP_ALIVE_RESTORED = "KeepAliveRestored",
|
|
16
|
+
KEEP_ALIVE_TIMEOUT = "KeepAliveTimeout",
|
|
17
|
+
GROUP_INFO = "GroupInfo",
|
|
18
|
+
JOINED_GROUP = "JoinedGroup",
|
|
19
|
+
CONTACT = "Contact",
|
|
20
|
+
PUSH_NAME = "PushName",
|
|
21
|
+
PUSH_NAME_SETTING = "PushNameSetting",
|
|
22
|
+
PICTURE = "Picture",
|
|
23
|
+
USER_ABOUT = "UserAbout",
|
|
24
|
+
USER_STATUS_MUTE = "UserStatusMute",
|
|
25
|
+
PRIVACY_SETTINGS = "PrivacySettings",
|
|
26
|
+
APP_STATE = "AppState",
|
|
27
|
+
APP_STATE_SYNC_COMPLETE = "AppStateSyncComplete",
|
|
28
|
+
HISTORY_SYNC = "HistorySync",
|
|
29
|
+
OFFLINE_SYNC_COMPLETED = "OfflineSyncCompleted",
|
|
30
|
+
OFFLINE_SYNC_PREVIEW = "OfflineSyncPreview",
|
|
31
|
+
IDENTITY_CHANGE = "IdentityChange",
|
|
32
|
+
ARCHIVE = "Archive",
|
|
33
|
+
UNARCHIVE_CHATS_SETTING = "UnarchiveChatsSetting",
|
|
34
|
+
CLEAR_CHAT = "ClearChat",
|
|
35
|
+
DELETE_CHAT = "DeleteChat",
|
|
36
|
+
DELETE_FOR_ME = "DeleteForMe",
|
|
37
|
+
MARK_CHAT_AS_READ = "MarkChatAsRead",
|
|
38
|
+
MUTE = "Mute",
|
|
39
|
+
PIN = "Pin",
|
|
40
|
+
STAR = "Star",
|
|
41
|
+
LABEL_ASSOCIATION_CHAT = "LabelAssociationChat",
|
|
42
|
+
LABEL_ASSOCIATION_MESSAGE = "LabelAssociationMessage",
|
|
43
|
+
LABEL_EDIT = "LabelEdit",
|
|
44
|
+
MEDIA_RETRY = "MediaRetry",
|
|
45
|
+
MEDIA_RETRY_ERROR = "MediaRetryError",
|
|
46
|
+
NEWSLETTER_JOIN = "NewsletterJoin",
|
|
47
|
+
NEWSLETTER_LEAVE = "NewsletterLeave",
|
|
48
|
+
NEWSLETTER_LIVE_UPDATE = "NewsletterLiveUpdate",
|
|
49
|
+
NEWSLETTER_MESSAGE_META = "NewsletterMessageMeta",
|
|
50
|
+
NEWSLETTER_MUTE_CHANGE = "NewsletterMuteChange",
|
|
51
|
+
UNDECRYPTABLE_MESSAGE = "UndecryptableMessage",
|
|
52
|
+
STREAM_ERROR = "StreamError",
|
|
53
|
+
STREAM_REPLACED = "StreamReplaced",
|
|
54
|
+
CONNECT_FAILURE = "ConnectFailure",
|
|
55
|
+
CLIENT_OUTDATED = "ClientOutdated",
|
|
56
|
+
TEMPORARY_BAN = "TemporaryBan",
|
|
57
|
+
CAT_REFRESH_ERROR = "CATRefreshError",
|
|
58
|
+
PERMANENT_DISCONNECT = "PermanentDisconnect",
|
|
59
|
+
BLOCKLIST = "Blocklist",
|
|
60
|
+
BLOCKLIST_ACTION = "BlocklistAction",
|
|
61
|
+
BLOCKLIST_CHANGE = "BlocklistChange",
|
|
62
|
+
BUSINESS_NAME = "BusinessName",
|
|
63
|
+
CALL_ACCEPT = "CallAccept",
|
|
64
|
+
CALL_OFFER = "CallOffer",
|
|
65
|
+
CALL_OFFER_NOTICE = "CallOfferNotice",
|
|
66
|
+
CALL_PRE_ACCEPT = "CallPreAccept",
|
|
67
|
+
CALL_REJECT = "CallReject",
|
|
68
|
+
CALL_RELAY_LATENCY = "CallRelayLatency",
|
|
69
|
+
CALL_TERMINATE = "CallTerminate",
|
|
70
|
+
CALL_TRANSPORT = "CallTransport",
|
|
71
|
+
UNKNOWN_CALL_EVENT = "UnknownCallEvent",
|
|
72
|
+
FB_MESSAGE = "FBMessage"
|
|
73
|
+
}
|
|
2
74
|
export interface WaBinaryNode {
|
|
3
75
|
Tag: string;
|
|
4
76
|
Attrs: Record<string, string>;
|
package/dist/types/webhook.d.ts
CHANGED
|
@@ -8,3 +8,39 @@ export interface GetWebhookResponse {
|
|
|
8
8
|
subscribe: string[];
|
|
9
9
|
webhook: string;
|
|
10
10
|
}
|
|
11
|
+
export interface S3MediaInfo {
|
|
12
|
+
url: string;
|
|
13
|
+
key: string;
|
|
14
|
+
bucket: string;
|
|
15
|
+
size: number;
|
|
16
|
+
mimeType: string;
|
|
17
|
+
fileName: string;
|
|
18
|
+
}
|
|
19
|
+
export interface WebhookPayload<T = unknown> {
|
|
20
|
+
event: T;
|
|
21
|
+
s3?: S3MediaInfo;
|
|
22
|
+
base64?: string;
|
|
23
|
+
mimeType?: string;
|
|
24
|
+
fileName?: string;
|
|
25
|
+
}
|
|
26
|
+
export interface S3OnlyWebhookPayload<T = unknown> {
|
|
27
|
+
event: T;
|
|
28
|
+
s3: S3MediaInfo;
|
|
29
|
+
}
|
|
30
|
+
export interface Base64OnlyWebhookPayload<T = unknown> {
|
|
31
|
+
event: T;
|
|
32
|
+
base64: string;
|
|
33
|
+
mimeType: string;
|
|
34
|
+
fileName: string;
|
|
35
|
+
}
|
|
36
|
+
export interface BothMediaWebhookPayload<T = unknown> {
|
|
37
|
+
event: T;
|
|
38
|
+
s3: S3MediaInfo;
|
|
39
|
+
base64: string;
|
|
40
|
+
mimeType: string;
|
|
41
|
+
fileName: string;
|
|
42
|
+
}
|
|
43
|
+
export type AnyWebhookPayload<T = unknown> = WebhookPayload<T> | S3OnlyWebhookPayload<T> | Base64OnlyWebhookPayload<T> | BothMediaWebhookPayload<T>;
|
|
44
|
+
export declare function hasS3Media(payload: WebhookPayload): payload is S3OnlyWebhookPayload | BothMediaWebhookPayload;
|
|
45
|
+
export declare function hasBase64Media(payload: WebhookPayload): payload is Base64OnlyWebhookPayload | BothMediaWebhookPayload;
|
|
46
|
+
export declare function hasBothMedia(payload: WebhookPayload): payload is BothMediaWebhookPayload;
|