wuzapi 1.6.5 → 1.6.6
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 +96 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/types/index.js +3 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/webhook.d.ts +382 -2
- package/dist/webhook.js +40 -0
- package/dist/webhook.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -209,6 +209,7 @@ Check out the complete examples in the `examples/` directory:
|
|
|
209
209
|
- **[advanced-features.js](examples/advanced-features.js)** - Phone pairing, interactive messages, advanced group management
|
|
210
210
|
- **[chatbot-example.js](examples/chatbot-example.js)** - Complete bot with commands and auto-replies
|
|
211
211
|
- **[webhook-events-example.js](examples/webhook-events-example.js)** - Comprehensive webhook event handling
|
|
212
|
+
- **[webhook-types-example.js](examples/webhook-types-example.js)** - ⭐ **NEW!** Complete webhook types with message discovery utilities
|
|
212
213
|
|
|
213
214
|
### Run Examples
|
|
214
215
|
|
|
@@ -221,6 +222,9 @@ node examples/advanced-features.js
|
|
|
221
222
|
|
|
222
223
|
# Start chatbot
|
|
223
224
|
node examples/chatbot-example.js
|
|
225
|
+
|
|
226
|
+
# Webhook types example (with complete type safety)
|
|
227
|
+
node examples/webhook-types-example.js
|
|
224
228
|
```
|
|
225
229
|
|
|
226
230
|
## 🤖 Simple Bot Example
|
|
@@ -892,6 +896,98 @@ newsletters.Newsletters.forEach((newsletter) => {
|
|
|
892
896
|
|
|
893
897
|
WuzAPI sends real-time events to your webhook endpoint. Here's how to handle them:
|
|
894
898
|
|
|
899
|
+
### 🆕 Type-Safe Message Discovery
|
|
900
|
+
|
|
901
|
+
The library now includes comprehensive TypeScript types and utilities for handling webhook messages:
|
|
902
|
+
|
|
903
|
+
```typescript
|
|
904
|
+
import WuzapiClient, {
|
|
905
|
+
discoverMessageType,
|
|
906
|
+
MessageType,
|
|
907
|
+
hasS3Media,
|
|
908
|
+
hasBase64Media,
|
|
909
|
+
} from "wuzapi";
|
|
910
|
+
|
|
911
|
+
// Discover message type automatically
|
|
912
|
+
const messageType = discoverMessageType(webhookPayload.event.Message);
|
|
913
|
+
|
|
914
|
+
switch (messageType) {
|
|
915
|
+
case MessageType.TEXT:
|
|
916
|
+
console.log("Text:", webhookPayload.event.Message.conversation);
|
|
917
|
+
break;
|
|
918
|
+
|
|
919
|
+
case MessageType.EXTENDED_TEXT:
|
|
920
|
+
console.log("Text:", webhookPayload.event.Message.extendedTextMessage.text);
|
|
921
|
+
break;
|
|
922
|
+
|
|
923
|
+
case MessageType.IMAGE:
|
|
924
|
+
const imageMsg = webhookPayload.event.Message.imageMessage;
|
|
925
|
+
console.log("Image:", imageMsg.mimetype, imageMsg.fileLength);
|
|
926
|
+
break;
|
|
927
|
+
|
|
928
|
+
case MessageType.VIDEO:
|
|
929
|
+
const videoMsg = webhookPayload.event.Message.videoMessage;
|
|
930
|
+
console.log("Video:", `${videoMsg.seconds}s`, videoMsg.caption);
|
|
931
|
+
break;
|
|
932
|
+
|
|
933
|
+
case MessageType.AUDIO:
|
|
934
|
+
const audioMsg = webhookPayload.event.Message.audioMessage;
|
|
935
|
+
console.log(audioMsg.ptt ? "Voice message" : "Audio file");
|
|
936
|
+
break;
|
|
937
|
+
|
|
938
|
+
case MessageType.DOCUMENT:
|
|
939
|
+
const docMsg = webhookPayload.event.Message.documentMessage;
|
|
940
|
+
console.log("Document:", docMsg.fileName, `${docMsg.pageCount} pages`);
|
|
941
|
+
break;
|
|
942
|
+
|
|
943
|
+
case MessageType.CONTACT:
|
|
944
|
+
const contactMsg = webhookPayload.event.Message.contactMessage;
|
|
945
|
+
console.log("Contact:", contactMsg.displayName);
|
|
946
|
+
break;
|
|
947
|
+
|
|
948
|
+
case MessageType.LOCATION:
|
|
949
|
+
const locationMsg = webhookPayload.event.Message.locationMessage;
|
|
950
|
+
console.log(
|
|
951
|
+
"Location:",
|
|
952
|
+
locationMsg.degreesLatitude,
|
|
953
|
+
locationMsg.degreesLongitude
|
|
954
|
+
);
|
|
955
|
+
break;
|
|
956
|
+
|
|
957
|
+
case MessageType.POLL_CREATION:
|
|
958
|
+
const pollMsg = webhookPayload.event.Message.pollCreationMessageV3;
|
|
959
|
+
console.log("Poll:", pollMsg.name, `${pollMsg.options.length} options`);
|
|
960
|
+
break;
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
// Handle media intelligently
|
|
964
|
+
if (hasS3Media(webhookPayload)) {
|
|
965
|
+
console.log("S3 URL:", webhookPayload.s3.url);
|
|
966
|
+
} else if (hasBase64Media(webhookPayload)) {
|
|
967
|
+
console.log("Base64 media available");
|
|
968
|
+
}
|
|
969
|
+
```
|
|
970
|
+
|
|
971
|
+
### 🎯 Available Message Types
|
|
972
|
+
|
|
973
|
+
```typescript
|
|
974
|
+
enum MessageType {
|
|
975
|
+
TEXT = "conversation", // Simple text messages
|
|
976
|
+
EXTENDED_TEXT = "extendedTextMessage", // Rich text messages
|
|
977
|
+
IMAGE = "imageMessage", // Photos, screenshots
|
|
978
|
+
VIDEO = "videoMessage", // Video files
|
|
979
|
+
AUDIO = "audioMessage", // Audio files, voice messages
|
|
980
|
+
DOCUMENT = "documentMessage", // PDFs, Word docs, etc.
|
|
981
|
+
CONTACT = "contactMessage", // Shared contacts
|
|
982
|
+
LOCATION = "locationMessage", // Location pins
|
|
983
|
+
POLL_CREATION = "pollCreationMessageV3", // Polls (groups only)
|
|
984
|
+
EDITED = "editedMessage", // Edited messages
|
|
985
|
+
PROTOCOL = "protocolMessage", // System messages
|
|
986
|
+
DEVICE_SENT = "deviceSentMessage", // Multi-device messages
|
|
987
|
+
UNKNOWN = "unknown", // Unrecognized types
|
|
988
|
+
}
|
|
989
|
+
```
|
|
990
|
+
|
|
895
991
|
### Basic Webhook Setup
|
|
896
992
|
|
|
897
993
|
```typescript
|
package/dist/index.js
CHANGED
|
@@ -14,12 +14,15 @@ const modules_newsletter = require("./modules/newsletter.js");
|
|
|
14
14
|
exports.WuzapiClient = wuzapiClient.WuzapiClient;
|
|
15
15
|
exports.default = wuzapiClient.WuzapiClient;
|
|
16
16
|
exports.WuzapiError = client.WuzapiError;
|
|
17
|
+
exports.MessageType = webhook.MessageType;
|
|
17
18
|
exports.WEBHOOK_EVENTS = webhook.WEBHOOK_EVENTS;
|
|
18
19
|
exports.WebhookEventType = webhook.WebhookEventType;
|
|
20
|
+
exports.discoverMessageType = webhook.discoverMessageType;
|
|
19
21
|
exports.hasBase64Media = webhook.hasBase64Media;
|
|
20
22
|
exports.hasBothMedia = webhook.hasBothMedia;
|
|
21
23
|
exports.hasS3Media = webhook.hasS3Media;
|
|
22
24
|
exports.isValidWebhookPayload = webhook.isValidWebhookPayload;
|
|
25
|
+
exports.isWebhookEventType = webhook.isWebhookEventType;
|
|
23
26
|
exports.BotPluginSearchProvider = types_index.BotPluginSearchProvider;
|
|
24
27
|
exports.BotPluginType = types_index.BotPluginType;
|
|
25
28
|
exports.ButtonType = types_index.ButtonType;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/types/index.js
CHANGED
|
@@ -353,12 +353,15 @@ var TempBanReason = /* @__PURE__ */ ((TempBanReason2) => {
|
|
|
353
353
|
TempBanReason2[TempBanReason2["BROADCAST_LIST"] = 106] = "BROADCAST_LIST";
|
|
354
354
|
return TempBanReason2;
|
|
355
355
|
})(TempBanReason || {});
|
|
356
|
+
exports.MessageType = webhook.MessageType;
|
|
356
357
|
exports.WEBHOOK_EVENTS = webhook.WEBHOOK_EVENTS;
|
|
357
358
|
exports.WebhookEventType = webhook.WebhookEventType;
|
|
359
|
+
exports.discoverMessageType = webhook.discoverMessageType;
|
|
358
360
|
exports.hasBase64Media = webhook.hasBase64Media;
|
|
359
361
|
exports.hasBothMedia = webhook.hasBothMedia;
|
|
360
362
|
exports.hasS3Media = webhook.hasS3Media;
|
|
361
363
|
exports.isValidWebhookPayload = webhook.isValidWebhookPayload;
|
|
364
|
+
exports.isWebhookEventType = webhook.isWebhookEventType;
|
|
362
365
|
exports.BotPluginSearchProvider = BotPluginSearchProvider;
|
|
363
366
|
exports.BotPluginType = BotPluginType;
|
|
364
367
|
exports.ButtonType = ButtonType;
|
package/dist/types/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/types/message.ts","../../src/types/events.ts"],"sourcesContent":["// 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":";;;AA+CO,IAAK,8CAAAA,+BAAL;AACLA,6BAAAA,2BAAA,qBAAkB,CAAA,IAAlB;AACAA,6BAAAA,2BAAA,qBAAkB,CAAA,IAAlB;AACAA,6BAAAA,2BAAA,wBAAqB,CAAA,IAArB;AAHU,SAAAA;AAAA,GAAA,6BAAA,CAAA,CAAA;AAML,IAAK,4CAAAC,6BAAL;AACLA,2BAAAA,yBAAA,aAAU,CAAA,IAAV;AACAA,2BAAAA,yBAAA,kBAAe,CAAA,IAAf;AACAA,2BAAAA,yBAAA,qBAAkB,CAAA,IAAlB;AACAA,2BAAAA,yBAAA,iBAAc,CAAA,IAAd;AAJU,SAAAA;AAAA,GAAA,2BAAA,CAAA,CAAA;AAyCL,IAAK,8BAAAC,eAAL;AACLA,aAAAA,WAAA,aAAU,CAAA,IAAV;AACAA,aAAAA,WAAA,WAAQ,CAAA,IAAR;AACAA,aAAAA,WAAA,WAAQ,CAAA,IAAR;AACAA,aAAAA,WAAA,WAAQ,CAAA,IAAR;AACAA,aAAAA,WAAA,cAAW,CAAA,IAAX;AACAA,aAAAA,WAAA,aAAU,CAAA,IAAV;AANU,SAAAA;AAAA,GAAA,aAAA,CAAA,CAAA;AA0HL,IAAK,qCAAAC,sBAAL;AACLA,oBAAAA,kBAAA,UAAO,CAAA,IAAP;AACAA,oBAAAA,kBAAA,WAAQ,C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A,sBAAmB,GAAA,IAAnB;AACAA,iBAAAA,eAAA,6BAA0B,GAAA,IAA1B;AACAA,iBAAAA,eAAA,gCAA6B,GAAA,IAA7B;AACAA,iBAAAA,eAAA,oBAAiB,GAAA,IAAjB;AALU,SAAAA;AAAA,GAAA,iBAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/types/message.ts","../../src/types/events.ts"],"sourcesContent":["// 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":";;;AA+CO,IAAK,8CAAAA,+BAAL;AACLA,6BAAAA,2BAAA,qBAAkB,CAAA,IAAlB;AACAA,6BAAAA,2BAAA,qBAAkB,CAAA,IAAlB;AACAA,6BAAAA,2BAAA,wBAAqB,CAAA,IAArB;AAHU,SAAAA;AAAA,GAAA,6BAAA,CAAA,CAAA;AAML,IAAK,4CAAAC,6BAAL;AACLA,2BAAAA,yBAAA,aAAU,CAAA,IAAV;AACAA,2BAAAA,yBAAA,kBAAe,CAAA,IAAf;AACAA,2BAAAA,yBAAA,qBAAkB,CAAA,IAAlB;AACAA,2BAAAA,yBAAA,iBAAc,CAAA,IAAd;AAJU,SAAAA;AAAA,GAAA,2BAAA,CAAA,CAAA;AAyCL,IAAK,8BAAAC,eAAL;AACLA,aAAAA,WAAA,aAAU,CAAA,IAAV;AACAA,aAAAA,WAAA,WAAQ,CAAA,IAAR;AACAA,aAAAA,WAAA,WAAQ,CAAA,IAAR;AACAA,aAAAA,WAAA,WAAQ,CAAA,IAAR;AACAA,aAAAA,WAAA,cAAW,CAAA,IAAX;AACAA,aAAAA,WAAA,aAAU,CAAA,IAAV;AANU,SAAAA;AAAA,GAAA,aAAA,CAAA,CAAA;AA0HL,IAAK,qCAAAC,sBAAL;AACLA,oBAAAA,kBAAA,UAAO,CAAA,IAAP;AACAA,oBAAAA,kBAAA,WAAQ,CAAA,IAAR;AACAA,oBAAAA,kBAAA,WAAQ,CAAA,IAAR;AACAA,oBAAAA,kBAAA,WAAQ,CAAA,IAAR;AAJU,SAAAA;AAAA,GAAA,oBAAA,CAAA,CAAA;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GAAA,IAAjB;AALU,SAAAA;AAAA,GAAA,iBAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/types/webhook.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { VerifiedName } from './user.js';
|
|
1
2
|
export declare enum WebhookEventType {
|
|
2
3
|
MESSAGE = "Message",
|
|
3
4
|
UNDECRYPTABLE_MESSAGE = "UndecryptableMessage",
|
|
4
5
|
RECEIPT = "Receipt",
|
|
6
|
+
READ_RECEIPT = "ReadReceipt",
|
|
5
7
|
MEDIA_RETRY = "MediaRetry",
|
|
6
8
|
GROUP_INFO = "GroupInfo",
|
|
7
9
|
JOINED_GROUP = "JoinedGroup",
|
|
@@ -43,10 +45,11 @@ export declare enum WebhookEventType {
|
|
|
43
45
|
NEWSLETTER_LEAVE = "NewsletterLeave",
|
|
44
46
|
NEWSLETTER_MUTE_CHANGE = "NewsletterMuteChange",
|
|
45
47
|
NEWSLETTER_LIVE_UPDATE = "NewsletterLiveUpdate",
|
|
46
|
-
FB_MESSAGE = "FBMessage"
|
|
48
|
+
FB_MESSAGE = "FBMessage",
|
|
49
|
+
ALL = "All"
|
|
47
50
|
}
|
|
48
51
|
export declare const WEBHOOK_EVENTS: WebhookEventType[];
|
|
49
|
-
export type WebhookEvent = keyof typeof WebhookEventType
|
|
52
|
+
export type WebhookEvent = keyof typeof WebhookEventType;
|
|
50
53
|
export interface SetWebhookRequest {
|
|
51
54
|
webhook: string;
|
|
52
55
|
events: (WebhookEvent | string)[];
|
|
@@ -84,6 +87,7 @@ export interface WebhookPayloadBase<T = unknown> {
|
|
|
84
87
|
event: T;
|
|
85
88
|
type: string;
|
|
86
89
|
token: string;
|
|
90
|
+
state?: string;
|
|
87
91
|
}
|
|
88
92
|
export interface WebhookPayload<T = unknown> extends WebhookPayloadBase<T> {
|
|
89
93
|
s3?: S3MediaInfo;
|
|
@@ -106,7 +110,383 @@ export interface BothMediaWebhookPayload<T = unknown> extends WebhookPayloadBase
|
|
|
106
110
|
fileName: string;
|
|
107
111
|
}
|
|
108
112
|
export type AnyWebhookPayload<T = unknown> = WebhookPayload<T> | S3OnlyWebhookPayload<T> | Base64OnlyWebhookPayload<T> | BothMediaWebhookPayload<T>;
|
|
113
|
+
export interface WebhookMessageContextInfo {
|
|
114
|
+
deviceListMetadata?: WebhookDeviceListMetadata;
|
|
115
|
+
deviceListMetadataVersion?: number;
|
|
116
|
+
messageSecret?: string;
|
|
117
|
+
limitSharingV2?: {
|
|
118
|
+
initiatedByMe: boolean;
|
|
119
|
+
trigger: number;
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
export interface WebhookDeviceListMetadata {
|
|
123
|
+
senderKeyHash?: string;
|
|
124
|
+
senderTimestamp?: number;
|
|
125
|
+
recipientKeyHash?: string;
|
|
126
|
+
recipientTimestamp?: number;
|
|
127
|
+
senderAccountType?: number;
|
|
128
|
+
receiverAccountType?: number;
|
|
129
|
+
}
|
|
130
|
+
export interface WebhookContextInfo {
|
|
131
|
+
disappearingMode?: {
|
|
132
|
+
initiator: number;
|
|
133
|
+
initiatedByMe?: boolean;
|
|
134
|
+
trigger?: number;
|
|
135
|
+
};
|
|
136
|
+
ephemeralSettingTimestamp?: number;
|
|
137
|
+
expiration?: number;
|
|
138
|
+
forwardingScore?: number;
|
|
139
|
+
isForwarded?: boolean;
|
|
140
|
+
pairedMediaType?: number;
|
|
141
|
+
statusSourceType?: number;
|
|
142
|
+
featureEligibilities?: {
|
|
143
|
+
canBeReshared?: boolean;
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
export interface WebhookExtendedTextMessage {
|
|
147
|
+
text: string;
|
|
148
|
+
contextInfo?: WebhookContextInfo;
|
|
149
|
+
inviteLinkGroupTypeV2?: number;
|
|
150
|
+
previewType?: number;
|
|
151
|
+
}
|
|
152
|
+
export interface WebhookImageMessage {
|
|
153
|
+
URL: string;
|
|
154
|
+
JPEGThumbnail?: string;
|
|
155
|
+
contextInfo?: WebhookContextInfo;
|
|
156
|
+
directPath: string;
|
|
157
|
+
fileEncSHA256: string;
|
|
158
|
+
fileLength: number;
|
|
159
|
+
fileSHA256: string;
|
|
160
|
+
height: number;
|
|
161
|
+
imageSourceType: number;
|
|
162
|
+
mediaKey: string;
|
|
163
|
+
mediaKeyTimestamp: number;
|
|
164
|
+
midQualityFileSHA256: string;
|
|
165
|
+
mimetype: string;
|
|
166
|
+
scanLengths: number[];
|
|
167
|
+
scansSidecar: string;
|
|
168
|
+
firstScanLength?: number;
|
|
169
|
+
firstScanSidecar?: string;
|
|
170
|
+
width: number;
|
|
171
|
+
}
|
|
172
|
+
export interface WebhookVideoMessage {
|
|
173
|
+
URL: string;
|
|
174
|
+
JPEGThumbnail?: string;
|
|
175
|
+
accessibilityLabel?: string;
|
|
176
|
+
caption?: string;
|
|
177
|
+
contextInfo?: WebhookContextInfo;
|
|
178
|
+
directPath: string;
|
|
179
|
+
externalShareFullVideoDurationInSeconds?: number;
|
|
180
|
+
fileEncSHA256: string;
|
|
181
|
+
fileLength: number;
|
|
182
|
+
fileSHA256: string;
|
|
183
|
+
height: number;
|
|
184
|
+
mediaKey: string;
|
|
185
|
+
mediaKeyTimestamp: number;
|
|
186
|
+
mimetype: string;
|
|
187
|
+
seconds: number;
|
|
188
|
+
streamingSidecar?: string;
|
|
189
|
+
thumbnailDirectPath?: string;
|
|
190
|
+
thumbnailEncSHA256?: string;
|
|
191
|
+
thumbnailSHA256?: string;
|
|
192
|
+
videoSourceType: number;
|
|
193
|
+
width: number;
|
|
194
|
+
}
|
|
195
|
+
export interface WebhookAudioMessage {
|
|
196
|
+
URL?: string;
|
|
197
|
+
contextInfo?: WebhookContextInfo;
|
|
198
|
+
directPath?: string;
|
|
199
|
+
fileEncSHA256?: string;
|
|
200
|
+
fileLength?: number;
|
|
201
|
+
fileSHA256?: string;
|
|
202
|
+
mediaKey?: string;
|
|
203
|
+
mediaKeyTimestamp?: number;
|
|
204
|
+
mimetype?: string;
|
|
205
|
+
seconds?: number;
|
|
206
|
+
ptt?: boolean;
|
|
207
|
+
streamingSidecar?: string;
|
|
208
|
+
waveform?: string;
|
|
209
|
+
}
|
|
210
|
+
export interface WebhookDocumentMessage {
|
|
211
|
+
URL: string;
|
|
212
|
+
contactVcard: boolean;
|
|
213
|
+
contextInfo?: WebhookContextInfo;
|
|
214
|
+
directPath: string;
|
|
215
|
+
fileEncSHA256: string;
|
|
216
|
+
fileLength: number;
|
|
217
|
+
fileName: string;
|
|
218
|
+
fileSHA256: string;
|
|
219
|
+
mediaKey: string;
|
|
220
|
+
mediaKeyTimestamp: number;
|
|
221
|
+
mimetype: string;
|
|
222
|
+
pageCount?: number;
|
|
223
|
+
title: string;
|
|
224
|
+
}
|
|
225
|
+
export interface WebhookContactMessage {
|
|
226
|
+
contextInfo?: WebhookContextInfo;
|
|
227
|
+
displayName: string;
|
|
228
|
+
vcard: string;
|
|
229
|
+
}
|
|
230
|
+
export interface WebhookPollCreationMessageV3 {
|
|
231
|
+
contextInfo?: WebhookContextInfo;
|
|
232
|
+
name: string;
|
|
233
|
+
options: Array<{
|
|
234
|
+
optionHash: string;
|
|
235
|
+
optionName: string;
|
|
236
|
+
}>;
|
|
237
|
+
pollContentType: number;
|
|
238
|
+
selectableOptionsCount: number;
|
|
239
|
+
}
|
|
240
|
+
export interface WebhookLocationMessage {
|
|
241
|
+
JPEGThumbnail?: string;
|
|
242
|
+
contextInfo?: WebhookContextInfo;
|
|
243
|
+
degreesLatitude: number;
|
|
244
|
+
degreesLongitude: number;
|
|
245
|
+
}
|
|
246
|
+
export interface WebhookEditedMessage {
|
|
247
|
+
message?: unknown;
|
|
248
|
+
timestampMS?: string;
|
|
249
|
+
editedMessageID?: string;
|
|
250
|
+
}
|
|
251
|
+
export interface WebhookMessageKey {
|
|
252
|
+
ID: string;
|
|
253
|
+
fromMe: boolean;
|
|
254
|
+
participant?: string;
|
|
255
|
+
remoteJID: string;
|
|
256
|
+
}
|
|
257
|
+
export interface UserReceipt {
|
|
258
|
+
userJID?: string;
|
|
259
|
+
receiptTimestamp?: number;
|
|
260
|
+
readTimestamp?: number;
|
|
261
|
+
playedTimestamp?: number;
|
|
262
|
+
}
|
|
263
|
+
export interface WebhookReaction {
|
|
264
|
+
key?: WebhookMessageKey;
|
|
265
|
+
text?: string;
|
|
266
|
+
senderTimestampMS?: number;
|
|
267
|
+
}
|
|
268
|
+
export interface WebhookGenericMessage {
|
|
269
|
+
messageContextInfo?: WebhookMessageContextInfo;
|
|
270
|
+
conversation?: string;
|
|
271
|
+
extendedTextMessage?: WebhookExtendedTextMessage;
|
|
272
|
+
imageMessage?: WebhookImageMessage;
|
|
273
|
+
videoMessage?: WebhookVideoMessage;
|
|
274
|
+
audioMessage?: WebhookAudioMessage;
|
|
275
|
+
documentMessage?: WebhookDocumentMessage;
|
|
276
|
+
contactMessage?: WebhookContactMessage;
|
|
277
|
+
pollCreationMessageV3?: WebhookPollCreationMessageV3;
|
|
278
|
+
locationMessage?: WebhookLocationMessage;
|
|
279
|
+
editedMessage?: WebhookEditedMessage;
|
|
280
|
+
protocolMessage?: {
|
|
281
|
+
type?: number;
|
|
282
|
+
historySyncNotification?: WebhookHistorySyncNotification;
|
|
283
|
+
initialSecurityNotificationSettingSync?: {
|
|
284
|
+
securityNotificationEnabled: boolean;
|
|
285
|
+
};
|
|
286
|
+
};
|
|
287
|
+
deviceSentMessage?: {
|
|
288
|
+
destinationJID: string;
|
|
289
|
+
message: WebhookGenericMessage;
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
export declare enum MessageType {
|
|
293
|
+
TEXT = "conversation",
|
|
294
|
+
EXTENDED_TEXT = "extendedTextMessage",
|
|
295
|
+
IMAGE = "imageMessage",
|
|
296
|
+
VIDEO = "videoMessage",
|
|
297
|
+
AUDIO = "audioMessage",
|
|
298
|
+
DOCUMENT = "documentMessage",
|
|
299
|
+
CONTACT = "contactMessage",
|
|
300
|
+
POLL_CREATION = "pollCreationMessageV3",
|
|
301
|
+
LOCATION = "locationMessage",
|
|
302
|
+
EDITED = "editedMessage",
|
|
303
|
+
PROTOCOL = "protocolMessage",
|
|
304
|
+
DEVICE_SENT = "deviceSentMessage",
|
|
305
|
+
UNKNOWN = "unknown"
|
|
306
|
+
}
|
|
307
|
+
export interface WebhookHistorySyncNotification {
|
|
308
|
+
chunkOrder?: number;
|
|
309
|
+
directPath: string;
|
|
310
|
+
encHandle: string;
|
|
311
|
+
fileEncSHA256: string;
|
|
312
|
+
fileLength: number;
|
|
313
|
+
fileSHA256: string;
|
|
314
|
+
mediaKey: string;
|
|
315
|
+
progress?: number;
|
|
316
|
+
syncType: number;
|
|
317
|
+
}
|
|
318
|
+
export interface QRWebhookEvent {
|
|
319
|
+
}
|
|
320
|
+
export interface ConnectedWebhookEvent {
|
|
321
|
+
}
|
|
322
|
+
export interface ReadReceiptWebhookEvent {
|
|
323
|
+
AddressingMode: string;
|
|
324
|
+
BroadcastListOwner: string;
|
|
325
|
+
Chat: string;
|
|
326
|
+
IsFromMe: boolean;
|
|
327
|
+
IsGroup: boolean;
|
|
328
|
+
MessageIDs: string[];
|
|
329
|
+
MessageSender: string;
|
|
330
|
+
RecipientAlt: string;
|
|
331
|
+
Sender: string;
|
|
332
|
+
SenderAlt: string;
|
|
333
|
+
Timestamp: string;
|
|
334
|
+
Type: string;
|
|
335
|
+
}
|
|
336
|
+
export interface HistorySyncWebhookEvent {
|
|
337
|
+
Data: {
|
|
338
|
+
pastParticipants?: Array<{
|
|
339
|
+
groupJID: string;
|
|
340
|
+
pastParticipants: Array<{
|
|
341
|
+
leaveReason: number;
|
|
342
|
+
leaveTS: number;
|
|
343
|
+
userJID: string;
|
|
344
|
+
}>;
|
|
345
|
+
}>;
|
|
346
|
+
recentStickers?: Array<{
|
|
347
|
+
URL: string;
|
|
348
|
+
directPath: string;
|
|
349
|
+
fileEncSHA256: string;
|
|
350
|
+
fileLength: number;
|
|
351
|
+
fileSHA256: string;
|
|
352
|
+
height: number;
|
|
353
|
+
isLottie: boolean;
|
|
354
|
+
lastStickerSentTS: number;
|
|
355
|
+
mediaKey: string;
|
|
356
|
+
mimetype: string;
|
|
357
|
+
weight: number;
|
|
358
|
+
width: number;
|
|
359
|
+
}>;
|
|
360
|
+
statusV3Messages?: Array<{
|
|
361
|
+
key: WebhookMessageKey;
|
|
362
|
+
message: WebhookGenericMessage;
|
|
363
|
+
messageTimestamp: number;
|
|
364
|
+
participant: string;
|
|
365
|
+
reportingTokenInfo?: {
|
|
366
|
+
reportingTag: string;
|
|
367
|
+
};
|
|
368
|
+
}>;
|
|
369
|
+
conversations?: Array<{
|
|
370
|
+
ID: string;
|
|
371
|
+
messages: Array<{
|
|
372
|
+
message: {
|
|
373
|
+
key: WebhookMessageKey;
|
|
374
|
+
message: WebhookGenericMessage;
|
|
375
|
+
messageTimestamp: number;
|
|
376
|
+
messageC2STimestamp?: number;
|
|
377
|
+
ephemeralStartTimestamp?: number;
|
|
378
|
+
originalSelfAuthorUserJIDString?: string;
|
|
379
|
+
status?: number;
|
|
380
|
+
userReceipt?: UserReceipt[];
|
|
381
|
+
reactions?: WebhookReaction[];
|
|
382
|
+
reportingTokenInfo?: {
|
|
383
|
+
reportingTag: string;
|
|
384
|
+
};
|
|
385
|
+
};
|
|
386
|
+
msgOrderID: number;
|
|
387
|
+
}>;
|
|
388
|
+
}>;
|
|
389
|
+
phoneNumberToLidMappings?: Array<{
|
|
390
|
+
lidJID: string;
|
|
391
|
+
pnJID: string;
|
|
392
|
+
}>;
|
|
393
|
+
chunkOrder?: number;
|
|
394
|
+
progress?: number;
|
|
395
|
+
syncType: number;
|
|
396
|
+
};
|
|
397
|
+
}
|
|
398
|
+
export interface MessageWebhookEvent {
|
|
399
|
+
Info: {
|
|
400
|
+
AddressingMode: string;
|
|
401
|
+
BroadcastListOwner: string;
|
|
402
|
+
Category: string;
|
|
403
|
+
Chat: string;
|
|
404
|
+
DeviceSentMeta: {
|
|
405
|
+
DestinationJID: string;
|
|
406
|
+
Phash: string;
|
|
407
|
+
} | null;
|
|
408
|
+
Edit: string;
|
|
409
|
+
ID: string;
|
|
410
|
+
IsFromMe: boolean;
|
|
411
|
+
IsGroup: boolean;
|
|
412
|
+
MediaType: string;
|
|
413
|
+
MsgBotInfo: {
|
|
414
|
+
EditSenderTimestampMS: string;
|
|
415
|
+
EditTargetID: string;
|
|
416
|
+
EditType: string;
|
|
417
|
+
};
|
|
418
|
+
MsgMetaInfo: {
|
|
419
|
+
DeprecatedLIDSession: unknown | null;
|
|
420
|
+
TargetID: string;
|
|
421
|
+
TargetSender: string;
|
|
422
|
+
ThreadMessageID: string;
|
|
423
|
+
ThreadMessageSenderJID: string;
|
|
424
|
+
};
|
|
425
|
+
Multicast: boolean;
|
|
426
|
+
PushName: string;
|
|
427
|
+
RecipientAlt: string;
|
|
428
|
+
Sender: string;
|
|
429
|
+
SenderAlt: string;
|
|
430
|
+
ServerID: number;
|
|
431
|
+
Timestamp: string;
|
|
432
|
+
Type: string;
|
|
433
|
+
VerifiedName: VerifiedName | null;
|
|
434
|
+
};
|
|
435
|
+
IsDocumentWithCaption: boolean;
|
|
436
|
+
IsEdit: boolean;
|
|
437
|
+
IsEphemeral: boolean;
|
|
438
|
+
IsLottieSticker: boolean;
|
|
439
|
+
IsViewOnce: boolean;
|
|
440
|
+
IsViewOnceV2: boolean;
|
|
441
|
+
IsViewOnceV2Extension: boolean;
|
|
442
|
+
Message: WebhookGenericMessage;
|
|
443
|
+
NewsletterMeta: unknown | null;
|
|
444
|
+
RawMessage: WebhookGenericMessage;
|
|
445
|
+
RetryCount: number;
|
|
446
|
+
SourceWebMsg: unknown | null;
|
|
447
|
+
UnavailableRequestID: string;
|
|
448
|
+
}
|
|
449
|
+
export type QRWebhookPayload = AnyWebhookPayload<QRWebhookEvent> & {
|
|
450
|
+
qrCodeBase64: string;
|
|
451
|
+
};
|
|
452
|
+
export type ConnectedWebhookPayload = AnyWebhookPayload<ConnectedWebhookEvent>;
|
|
453
|
+
export type ReadReceiptWebhookPayload = AnyWebhookPayload<ReadReceiptWebhookEvent>;
|
|
454
|
+
export type HistorySyncWebhookPayload = AnyWebhookPayload<HistorySyncWebhookEvent>;
|
|
455
|
+
export type MessageWebhookPayload = AnyWebhookPayload<MessageWebhookEvent>;
|
|
456
|
+
export interface WebhookEventMap {
|
|
457
|
+
QR: QRWebhookEvent;
|
|
458
|
+
Connected: ConnectedWebhookEvent;
|
|
459
|
+
ReadReceipt: ReadReceiptWebhookEvent;
|
|
460
|
+
HistorySync: HistorySyncWebhookEvent;
|
|
461
|
+
Message: MessageWebhookEvent;
|
|
462
|
+
}
|
|
463
|
+
export type WebhookEventHandler<T extends keyof WebhookEventMap> = (payload: AnyWebhookPayload<WebhookEventMap[T]>) => void | Promise<void>;
|
|
464
|
+
export type SpecificWebhookPayload = QRWebhookPayload | ConnectedWebhookPayload | ReadReceiptWebhookPayload | HistorySyncWebhookPayload | MessageWebhookPayload;
|
|
465
|
+
export declare function isWebhookEventType<T extends keyof WebhookEventMap>(payload: WebhookPayloadBase, eventType: T): payload is AnyWebhookPayload<WebhookEventMap[T]>;
|
|
109
466
|
export declare function hasS3Media(payload: WebhookPayloadBase): payload is S3OnlyWebhookPayload | BothMediaWebhookPayload;
|
|
110
467
|
export declare function hasBase64Media(payload: WebhookPayloadBase): payload is Base64OnlyWebhookPayload | BothMediaWebhookPayload;
|
|
111
468
|
export declare function hasBothMedia(payload: WebhookPayloadBase): payload is BothMediaWebhookPayload;
|
|
112
469
|
export declare function isValidWebhookPayload(payload: unknown): payload is WebhookPayloadBase;
|
|
470
|
+
/**
|
|
471
|
+
* Utility function to discover the type of a GenericMessage
|
|
472
|
+
* @param message - The GenericMessage to analyze
|
|
473
|
+
* @returns MessageType enum value indicating the message type
|
|
474
|
+
*
|
|
475
|
+
* @example
|
|
476
|
+
* ```typescript
|
|
477
|
+
* import { discoverMessageType, MessageType } from "wuzapi";
|
|
478
|
+
*
|
|
479
|
+
* const messageType = discoverMessageType(webhookPayload.event.Message);
|
|
480
|
+
*
|
|
481
|
+
* switch (messageType) {
|
|
482
|
+
* case MessageType.IMAGE:
|
|
483
|
+
* console.log("Received an image message");
|
|
484
|
+
* break;
|
|
485
|
+
* case MessageType.EXTENDED_TEXT:
|
|
486
|
+
* console.log("Received a text message");
|
|
487
|
+
* break;
|
|
488
|
+
* // ... handle other types
|
|
489
|
+
* }
|
|
490
|
+
* ```
|
|
491
|
+
*/
|
|
492
|
+
export declare function discoverMessageType(message: WebhookGenericMessage): MessageType;
|
package/dist/webhook.js
CHANGED
|
@@ -3,6 +3,7 @@ var WebhookEventType = /* @__PURE__ */ ((WebhookEventType2) => {
|
|
|
3
3
|
WebhookEventType2["MESSAGE"] = "Message";
|
|
4
4
|
WebhookEventType2["UNDECRYPTABLE_MESSAGE"] = "UndecryptableMessage";
|
|
5
5
|
WebhookEventType2["RECEIPT"] = "Receipt";
|
|
6
|
+
WebhookEventType2["READ_RECEIPT"] = "ReadReceipt";
|
|
6
7
|
WebhookEventType2["MEDIA_RETRY"] = "MediaRetry";
|
|
7
8
|
WebhookEventType2["GROUP_INFO"] = "GroupInfo";
|
|
8
9
|
WebhookEventType2["JOINED_GROUP"] = "JoinedGroup";
|
|
@@ -45,9 +46,29 @@ var WebhookEventType = /* @__PURE__ */ ((WebhookEventType2) => {
|
|
|
45
46
|
WebhookEventType2["NEWSLETTER_MUTE_CHANGE"] = "NewsletterMuteChange";
|
|
46
47
|
WebhookEventType2["NEWSLETTER_LIVE_UPDATE"] = "NewsletterLiveUpdate";
|
|
47
48
|
WebhookEventType2["FB_MESSAGE"] = "FBMessage";
|
|
49
|
+
WebhookEventType2["ALL"] = "All";
|
|
48
50
|
return WebhookEventType2;
|
|
49
51
|
})(WebhookEventType || {});
|
|
50
52
|
const WEBHOOK_EVENTS = Object.values(WebhookEventType);
|
|
53
|
+
var MessageType = /* @__PURE__ */ ((MessageType2) => {
|
|
54
|
+
MessageType2["TEXT"] = "conversation";
|
|
55
|
+
MessageType2["EXTENDED_TEXT"] = "extendedTextMessage";
|
|
56
|
+
MessageType2["IMAGE"] = "imageMessage";
|
|
57
|
+
MessageType2["VIDEO"] = "videoMessage";
|
|
58
|
+
MessageType2["AUDIO"] = "audioMessage";
|
|
59
|
+
MessageType2["DOCUMENT"] = "documentMessage";
|
|
60
|
+
MessageType2["CONTACT"] = "contactMessage";
|
|
61
|
+
MessageType2["POLL_CREATION"] = "pollCreationMessageV3";
|
|
62
|
+
MessageType2["LOCATION"] = "locationMessage";
|
|
63
|
+
MessageType2["EDITED"] = "editedMessage";
|
|
64
|
+
MessageType2["PROTOCOL"] = "protocolMessage";
|
|
65
|
+
MessageType2["DEVICE_SENT"] = "deviceSentMessage";
|
|
66
|
+
MessageType2["UNKNOWN"] = "unknown";
|
|
67
|
+
return MessageType2;
|
|
68
|
+
})(MessageType || {});
|
|
69
|
+
function isWebhookEventType(payload, eventType) {
|
|
70
|
+
return payload.type === eventType;
|
|
71
|
+
}
|
|
51
72
|
function hasS3Media(payload) {
|
|
52
73
|
return !!payload.s3;
|
|
53
74
|
}
|
|
@@ -60,10 +81,29 @@ function hasBothMedia(payload) {
|
|
|
60
81
|
function isValidWebhookPayload(payload) {
|
|
61
82
|
return typeof payload === "object" && payload !== null && "event" in payload && "type" in payload && "token" in payload;
|
|
62
83
|
}
|
|
84
|
+
function discoverMessageType(message) {
|
|
85
|
+
if (!message) return "unknown";
|
|
86
|
+
if (message.conversation) return "conversation";
|
|
87
|
+
if (message.extendedTextMessage) return "extendedTextMessage";
|
|
88
|
+
if (message.imageMessage) return "imageMessage";
|
|
89
|
+
if (message.videoMessage) return "videoMessage";
|
|
90
|
+
if (message.audioMessage) return "audioMessage";
|
|
91
|
+
if (message.documentMessage) return "documentMessage";
|
|
92
|
+
if (message.contactMessage) return "contactMessage";
|
|
93
|
+
if (message.locationMessage) return "locationMessage";
|
|
94
|
+
if (message.pollCreationMessageV3) return "pollCreationMessageV3";
|
|
95
|
+
if (message.editedMessage) return "editedMessage";
|
|
96
|
+
if (message.protocolMessage) return "protocolMessage";
|
|
97
|
+
if (message.deviceSentMessage) return "deviceSentMessage";
|
|
98
|
+
return "unknown";
|
|
99
|
+
}
|
|
100
|
+
exports.MessageType = MessageType;
|
|
63
101
|
exports.WEBHOOK_EVENTS = WEBHOOK_EVENTS;
|
|
64
102
|
exports.WebhookEventType = WebhookEventType;
|
|
103
|
+
exports.discoverMessageType = discoverMessageType;
|
|
65
104
|
exports.hasBase64Media = hasBase64Media;
|
|
66
105
|
exports.hasBothMedia = hasBothMedia;
|
|
67
106
|
exports.hasS3Media = hasS3Media;
|
|
68
107
|
exports.isValidWebhookPayload = isValidWebhookPayload;
|
|
108
|
+
exports.isWebhookEventType = isWebhookEventType;
|
|
69
109
|
//# sourceMappingURL=webhook.js.map
|
package/dist/webhook.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhook.js","sources":["../src/types/webhook.ts"],"sourcesContent":["// Webhook endpoints types\n\n// Webhook event types (events that can be subscribed to via webhooks)\nexport enum WebhookEventType {\n MESSAGE = \"Message\",\n UNDECRYPTABLE_MESSAGE = \"UndecryptableMessage\",\n RECEIPT = \"Receipt\",\n MEDIA_RETRY = \"MediaRetry\",\n GROUP_INFO = \"GroupInfo\",\n JOINED_GROUP = \"JoinedGroup\",\n PICTURE = \"Picture\",\n BLOCKLIST_CHANGE = \"BlocklistChange\",\n BLOCKLIST = \"Blocklist\",\n CONNECTED = \"Connected\",\n DISCONNECTED = \"Disconnected\",\n CONNECT_FAILURE = \"ConnectFailure\",\n KEEP_ALIVE_RESTORED = \"KeepAliveRestored\",\n KEEP_ALIVE_TIMEOUT = \"KeepAliveTimeout\",\n LOGGED_OUT = \"LoggedOut\",\n CLIENT_OUTDATED = \"ClientOutdated\",\n TEMPORARY_BAN = \"TemporaryBan\",\n STREAM_ERROR = \"StreamError\",\n STREAM_REPLACED = \"StreamReplaced\",\n PAIR_SUCCESS = \"PairSuccess\",\n PAIR_ERROR = \"PairError\",\n QR = \"QR\",\n QR_SCANNED_WITHOUT_MULTIDEVICE = \"QRScannedWithoutMultidevice\",\n PRIVACY_SETTINGS = \"PrivacySettings\",\n PUSH_NAME_SETTING = \"PushNameSetting\",\n USER_ABOUT = \"UserAbout\",\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 CALL_OFFER = \"CallOffer\",\n CALL_ACCEPT = \"CallAccept\",\n CALL_TERMINATE = \"CallTerminate\",\n CALL_OFFER_NOTICE = \"CallOfferNotice\",\n CALL_RELAY_LATENCY = \"CallRelayLatency\",\n PRESENCE = \"Presence\",\n CHAT_PRESENCE = \"ChatPresence\",\n IDENTITY_CHANGE = \"IdentityChange\",\n CAT_REFRESH_ERROR = \"CATRefreshError\",\n NEWSLETTER_JOIN = \"NewsletterJoin\",\n NEWSLETTER_LEAVE = \"NewsletterLeave\",\n NEWSLETTER_MUTE_CHANGE = \"NewsletterMuteChange\",\n NEWSLETTER_LIVE_UPDATE = \"NewsletterLiveUpdate\",\n FB_MESSAGE = \"FBMessage\",\n}\n\n// Helper to get all webhook event values as string array\nexport const WEBHOOK_EVENTS = Object.values(WebhookEventType);\n\n// Type for webhook event names\nexport type WebhookEvent = keyof typeof WebhookEventType | \"All\";\n\nexport interface SetWebhookRequest {\n webhook: string;\n events: (WebhookEvent | string)[];\n}\n\nexport interface SetWebhookResponse {\n WebhookURL: string;\n Events: string[];\n}\n\nexport interface GetWebhookResponse {\n subscribe: string[];\n webhook: string;\n}\n\nexport interface UpdateWebhookRequest {\n webhook?: string;\n events?: (WebhookEvent | string)[];\n Active?: boolean;\n}\n\nexport interface UpdateWebhookResponse {\n WebhookURL: string;\n Events: string[];\n active: boolean;\n}\n\nexport interface DeleteWebhookResponse {\n Details: 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\n// Base interface that all webhook payloads extend from\nexport interface WebhookPayloadBase<T = unknown> {\n event: T;\n type: string;\n token: string;\n}\n\n// Standard webhook payload with optional media\nexport interface WebhookPayload<T = unknown> extends WebhookPayloadBase<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 extends WebhookPayloadBase<T> {\n s3: S3MediaInfo;\n}\n\n// Base64 only delivery\nexport interface Base64OnlyWebhookPayload<T = unknown>\n extends WebhookPayloadBase<T> {\n base64: string;\n mimeType: string;\n fileName: string;\n}\n\n// Both S3 and Base64 delivery\nexport interface BothMediaWebhookPayload<T = unknown>\n extends WebhookPayloadBase<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: WebhookPayloadBase\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: WebhookPayloadBase\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: WebhookPayloadBase\n): payload is BothMediaWebhookPayload {\n return hasS3Media(payload) && hasBase64Media(payload);\n}\n\n// Helper type guard to check if payload has token (all webhook payloads should)\nexport function isValidWebhookPayload(\n payload: unknown\n): payload is WebhookPayloadBase {\n return (\n typeof payload === \"object\" &&\n payload !== null &&\n \"event\" in payload &&\n \"type\" in payload &&\n \"token\" in payload\n );\n}\n"],"names":["WebhookEventType"],"mappings":";AAGO,IAAK,qCAAAA,sBAAL;AACLA,oBAAA,SAAA,IAAU;AACVA,oBAAA,uBAAA,IAAwB;AACxBA,oBAAA,SAAA,IAAU;AACVA,oBAAA,aAAA,IAAc;AACdA,oBAAA,YAAA,IAAa;AACbA,oBAAA,cAAA,IAAe;AACfA,oBAAA,SAAA,IAAU;AACVA,oBAAA,kBAAA,IAAmB;AACnBA,oBAAA,WAAA,IAAY;AACZA,oBAAA,WAAA,IAAY;AACZA,oBAAA,cAAA,IAAe;AACfA,oBAAA,iBAAA,IAAkB;AAClBA,oBAAA,qBAAA,IAAsB;AACtBA,oBAAA,oBAAA,IAAqB;AACrBA,oBAAA,YAAA,IAAa;AACbA,oBAAA,iBAAA,IAAkB;AAClBA,oBAAA,eAAA,IAAgB;AAChBA,oBAAA,cAAA,IAAe;AACfA,oBAAA,iBAAA,IAAkB;AAClBA,oBAAA,cAAA,IAAe;AACfA,oBAAA,YAAA,IAAa;AACbA,oBAAA,IAAA,IAAK;AACLA,oBAAA,gCAAA,IAAiC;AACjCA,oBAAA,kBAAA,IAAmB;AACnBA,oBAAA,mBAAA,IAAoB;AACpBA,oBAAA,YAAA,IAAa;AACbA,oBAAA,WAAA,IAAY;AACZA,oBAAA,yBAAA,IAA0B;AAC1BA,oBAAA,cAAA,IAAe;AACfA,oBAAA,wBAAA,IAAyB;AACzBA,oBAAA,sBAAA,IAAuB;AACvBA,oBAAA,YAAA,IAAa;AACbA,oBAAA,aAAA,IAAc;AACdA,oBAAA,gBAAA,IAAiB;AACjBA,oBAAA,mBAAA,IAAoB;AACpBA,oBAAA,oBAAA,IAAqB;AACrBA,oBAAA,UAAA,IAAW;AACXA,oBAAA,eAAA,IAAgB;AAChBA,oBAAA,iBAAA,IAAkB;AAClBA,oBAAA,mBAAA,IAAoB;AACpBA,oBAAA,iBAAA,IAAkB;AAClBA,oBAAA,kBAAA,IAAmB;AACnBA,oBAAA,wBAAA,IAAyB;AACzBA,oBAAA,wBAAA,IAAyB;AACzBA,oBAAA,YAAA,IAAa;AA7CH,SAAAA;AAAA,GAAA,oBAAA,CAAA,CAAA;AAiDL,MAAM,iBAAiB,OAAO,OAAO,gBAAgB;AA+FrD,SAAS,WACd,SAC2D;AAE3D,SAAO,CAAC,CAAE,QAAgB;AAC5B;AAEO,SAAS,eACd,SAC+D;AAE/D,SAAO,CAAC,CAAE,QAAgB;AAC5B;AAEO,SAAS,aACd,SACoC;AACpC,SAAO,WAAW,OAAO,KAAK,eAAe,OAAO;AACtD;AAGO,SAAS,sBACd,SAC+B;AAC/B,SACE,OAAO,YAAY,YACnB,YAAY,QACZ,WAAW,WACX,UAAU,WACV,WAAW;AAEf;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"webhook.js","sources":["../src/types/webhook.ts"],"sourcesContent":["// Import types that are identical from other modules\nimport type { VerifiedName } from \"./user.js\";\n\n// Webhook endpoints types\n\n// Webhook event types (events that can be subscribed to via webhooks)\nexport enum WebhookEventType {\n MESSAGE = \"Message\",\n UNDECRYPTABLE_MESSAGE = \"UndecryptableMessage\",\n RECEIPT = \"Receipt\",\n READ_RECEIPT = \"ReadReceipt\",\n MEDIA_RETRY = \"MediaRetry\",\n GROUP_INFO = \"GroupInfo\",\n JOINED_GROUP = \"JoinedGroup\",\n PICTURE = \"Picture\",\n BLOCKLIST_CHANGE = \"BlocklistChange\",\n BLOCKLIST = \"Blocklist\",\n CONNECTED = \"Connected\",\n DISCONNECTED = \"Disconnected\",\n CONNECT_FAILURE = \"ConnectFailure\",\n KEEP_ALIVE_RESTORED = \"KeepAliveRestored\",\n KEEP_ALIVE_TIMEOUT = \"KeepAliveTimeout\",\n LOGGED_OUT = \"LoggedOut\",\n CLIENT_OUTDATED = \"ClientOutdated\",\n TEMPORARY_BAN = \"TemporaryBan\",\n STREAM_ERROR = \"StreamError\",\n STREAM_REPLACED = \"StreamReplaced\",\n PAIR_SUCCESS = \"PairSuccess\",\n PAIR_ERROR = \"PairError\",\n QR = \"QR\",\n QR_SCANNED_WITHOUT_MULTIDEVICE = \"QRScannedWithoutMultidevice\",\n PRIVACY_SETTINGS = \"PrivacySettings\",\n PUSH_NAME_SETTING = \"PushNameSetting\",\n USER_ABOUT = \"UserAbout\",\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 CALL_OFFER = \"CallOffer\",\n CALL_ACCEPT = \"CallAccept\",\n CALL_TERMINATE = \"CallTerminate\",\n CALL_OFFER_NOTICE = \"CallOfferNotice\",\n CALL_RELAY_LATENCY = \"CallRelayLatency\",\n PRESENCE = \"Presence\",\n CHAT_PRESENCE = \"ChatPresence\",\n IDENTITY_CHANGE = \"IdentityChange\",\n CAT_REFRESH_ERROR = \"CATRefreshError\",\n NEWSLETTER_JOIN = \"NewsletterJoin\",\n NEWSLETTER_LEAVE = \"NewsletterLeave\",\n NEWSLETTER_MUTE_CHANGE = \"NewsletterMuteChange\",\n NEWSLETTER_LIVE_UPDATE = \"NewsletterLiveUpdate\",\n FB_MESSAGE = \"FBMessage\",\n ALL = \"All\",\n}\n\n// Helper to get all webhook event values as string array\nexport const WEBHOOK_EVENTS = Object.values(WebhookEventType);\n\n// Type for webhook event names\nexport type WebhookEvent = keyof typeof WebhookEventType;\n\nexport interface SetWebhookRequest {\n webhook: string;\n events: (WebhookEvent | string)[];\n}\n\nexport interface SetWebhookResponse {\n WebhookURL: string;\n Events: string[];\n}\n\nexport interface GetWebhookResponse {\n subscribe: string[];\n webhook: string;\n}\n\nexport interface UpdateWebhookRequest {\n webhook?: string;\n events?: (WebhookEvent | string)[];\n Active?: boolean;\n}\n\nexport interface UpdateWebhookResponse {\n WebhookURL: string;\n Events: string[];\n active: boolean;\n}\n\nexport interface DeleteWebhookResponse {\n Details: 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\n// Base interface that all webhook payloads extend from\nexport interface WebhookPayloadBase<T = unknown> {\n event: T;\n type: string;\n token: string;\n state?: string; // Optional state field (e.g., \"Read\" or \"Delivered\" for ReadReceipt events)\n}\n\n// Standard webhook payload with optional media\nexport interface WebhookPayload<T = unknown> extends WebhookPayloadBase<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 extends WebhookPayloadBase<T> {\n s3: S3MediaInfo;\n}\n\n// Base64 only delivery\nexport interface Base64OnlyWebhookPayload<T = unknown>\n extends WebhookPayloadBase<T> {\n base64: string;\n mimeType: string;\n fileName: string;\n}\n\n// Both S3 and Base64 delivery\nexport interface BothMediaWebhookPayload<T = unknown>\n extends WebhookPayloadBase<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// Shared message and media interfaces for reusability across webhook events\n//\n// Note: Webhook events may have different structures than the corresponding\n// WhatsApp events in events.ts. Webhook events use flat structures with\n// string-based JIDs and ISO timestamp strings, while internal events use\n// structured JID objects and Date objects.\n\n// Common context info structures\nexport interface WebhookMessageContextInfo {\n deviceListMetadata?: WebhookDeviceListMetadata;\n deviceListMetadataVersion?: number;\n messageSecret?: string; // Encryption secret (string format for webhook)\n limitSharingV2?: {\n initiatedByMe: boolean;\n trigger: number;\n };\n}\n\nexport interface WebhookDeviceListMetadata {\n senderKeyHash?: string; // Base64 string format for webhook (vs Uint8Array in message.ts)\n senderTimestamp?: number;\n recipientKeyHash?: string; // Base64 string format for webhook\n recipientTimestamp?: number;\n senderAccountType?: number; // Webhook-specific field\n receiverAccountType?: number; // Webhook-specific field\n}\n\nexport interface WebhookContextInfo {\n disappearingMode?: {\n initiator: number;\n initiatedByMe?: boolean; // Webhook-specific field\n trigger?: number; // Webhook-specific field\n };\n ephemeralSettingTimestamp?: number;\n expiration?: number;\n forwardingScore?: number;\n isForwarded?: boolean;\n pairedMediaType?: number;\n statusSourceType?: number;\n featureEligibilities?: {\n canBeReshared?: boolean;\n };\n}\n\n// Common message types that are reused across different webhook events\nexport interface WebhookExtendedTextMessage {\n text: string;\n contextInfo?: WebhookContextInfo;\n inviteLinkGroupTypeV2?: number; // Webhook-specific field\n previewType?: number; // Webhook-specific field\n}\n\nexport interface WebhookImageMessage {\n URL: string; // Full WhatsApp media URL (uppercase for webhook)\n JPEGThumbnail?: string; // Base64 encoded JPEG thumbnail\n contextInfo?: WebhookContextInfo;\n directPath: string; // Direct path to media\n fileEncSHA256: string; // Encrypted file SHA256 hash (string format for webhook)\n fileLength: number; // File size in bytes\n fileSHA256: string; // File SHA256 hash (string format for webhook)\n height: number;\n imageSourceType: number; // Webhook-specific field\n mediaKey: string; // Media encryption key (string format for webhook)\n mediaKeyTimestamp: number; // Unix timestamp\n midQualityFileSHA256: string; // Mid quality file hash (webhook-specific)\n mimetype: string; // MIME type (e.g., \"image/jpeg\")\n scanLengths: number[]; // Progressive scan lengths (webhook-specific)\n scansSidecar: string; // Progressive scan sidecar data (webhook-specific)\n firstScanLength?: number; // First scan length (webhook-specific)\n firstScanSidecar?: string; // First scan sidecar (webhook-specific)\n width: number;\n}\n\nexport interface WebhookVideoMessage {\n URL: string; // Full WhatsApp media URL (uppercase for webhook)\n JPEGThumbnail?: string; // Base64 encoded JPEG thumbnail\n accessibilityLabel?: string;\n caption?: string;\n contextInfo?: WebhookContextInfo;\n directPath: string; // Direct path to media\n externalShareFullVideoDurationInSeconds?: number; // Webhook-specific field\n fileEncSHA256: string; // Encrypted file SHA256 hash (string format for webhook)\n fileLength: number; // File size in bytes\n fileSHA256: string; // File SHA256 hash (string format for webhook)\n height: number;\n mediaKey: string; // Media encryption key (string format for webhook)\n mediaKeyTimestamp: number; // Unix timestamp\n mimetype: string; // MIME type (e.g., \"video/mp4\")\n seconds: number; // Video duration in seconds\n streamingSidecar?: string; // Streaming sidecar data for video streaming\n thumbnailDirectPath?: string; // Thumbnail direct path (webhook-specific)\n thumbnailEncSHA256?: string; // Thumbnail encrypted SHA256 (webhook-specific)\n thumbnailSHA256?: string; // Thumbnail SHA256 (webhook-specific)\n videoSourceType: number; // Webhook-specific field\n width: number;\n}\n\nexport interface WebhookAudioMessage {\n URL?: string; // Uppercase for webhook\n contextInfo?: WebhookContextInfo;\n directPath?: string;\n fileEncSHA256?: string; // String format for webhook\n fileLength?: number;\n fileSHA256?: string; // String format for webhook\n mediaKey?: string; // String format for webhook\n mediaKeyTimestamp?: number;\n mimetype?: string;\n seconds?: number;\n ptt?: boolean; // Push to talk (voice message) - Note: payload uses uppercase \"PTT\"\n streamingSidecar?: string; // Streaming sidecar data for audio streaming (webhook-specific)\n waveform?: string; // Base64 encoded waveform for voice messages (webhook-specific)\n}\n\nexport interface WebhookDocumentMessage {\n URL: string; // Full WhatsApp media URL (uppercase for webhook)\n contactVcard: boolean; // Whether this is a contact vCard (webhook-specific field)\n contextInfo?: WebhookContextInfo;\n directPath: string; // Direct path to media\n fileEncSHA256: string; // Encrypted file SHA256 hash (string format for webhook)\n fileLength: number; // File size in bytes\n fileName: string; // Original file name\n fileSHA256: string; // File SHA256 hash (string format for webhook)\n mediaKey: string; // Media encryption key (string format for webhook)\n mediaKeyTimestamp: number; // Unix timestamp\n mimetype: string; // MIME type (e.g., \"application/vnd.openxmlformats-officedocument.wordprocessingml.document\", \"application/pdf\")\n pageCount?: number; // Number of pages in the document (webhook-specific field)\n title: string; // Document title (usually filename without extension)\n}\n\nexport interface WebhookContactMessage {\n contextInfo?: WebhookContextInfo;\n displayName: string; // Display name of the contact\n vcard: string; // vCard data in standard vCard format\n}\n\nexport interface WebhookPollCreationMessageV3 {\n contextInfo?: WebhookContextInfo;\n name: string; // Poll question/title\n options: Array<{\n optionHash: string; // Hash for the option\n optionName: string; // Display text for the option\n }>;\n pollContentType: number; // Type of poll content\n selectableOptionsCount: number; // Number of options that can be selected (0 = single choice, >0 = multiple choice)\n}\n\nexport interface WebhookLocationMessage {\n JPEGThumbnail?: string; // Base64 encoded JPEG thumbnail of the location (webhook-specific field)\n contextInfo?: WebhookContextInfo;\n degreesLatitude: number; // Latitude coordinate\n degreesLongitude: number; // Longitude coordinate\n}\n\nexport interface WebhookEditedMessage {\n message?: unknown; // The edited message content\n timestampMS?: string; // Edit timestamp\n editedMessageID?: string; // ID of original message being edited\n}\n\n// Message key structure\nexport interface WebhookMessageKey {\n ID: string; // Uppercase field name for webhook (vs lowercase 'id' in message.ts)\n fromMe: boolean; // Required in webhook (vs optional in message.ts)\n participant?: string; // JID in string format\n remoteJID: string; // Uppercase JID field name for webhook (vs 'remoteJid' in message.ts)\n}\n\n// User receipt structure\nexport interface UserReceipt {\n userJID?: string;\n receiptTimestamp?: number;\n readTimestamp?: number;\n playedTimestamp?: number;\n}\n\n// Reaction structure\nexport interface WebhookReaction {\n key?: WebhookMessageKey;\n text?: string;\n senderTimestampMS?: number;\n}\n\n// Generic message wrapper for webhook payloads\nexport interface WebhookGenericMessage {\n messageContextInfo?: WebhookMessageContextInfo;\n conversation?: string; // Simple text message\n extendedTextMessage?: WebhookExtendedTextMessage;\n imageMessage?: WebhookImageMessage;\n videoMessage?: WebhookVideoMessage;\n audioMessage?: WebhookAudioMessage;\n documentMessage?: WebhookDocumentMessage;\n contactMessage?: WebhookContactMessage;\n pollCreationMessageV3?: WebhookPollCreationMessageV3;\n locationMessage?: WebhookLocationMessage;\n editedMessage?: WebhookEditedMessage;\n protocolMessage?: {\n type?: number;\n historySyncNotification?: WebhookHistorySyncNotification;\n initialSecurityNotificationSettingSync?: {\n securityNotificationEnabled: boolean;\n };\n };\n deviceSentMessage?: {\n destinationJID: string;\n message: WebhookGenericMessage;\n };\n}\n\n// Message types enum for easier handling of different message types\nexport enum MessageType {\n TEXT = \"conversation\",\n EXTENDED_TEXT = \"extendedTextMessage\",\n IMAGE = \"imageMessage\",\n VIDEO = \"videoMessage\",\n AUDIO = \"audioMessage\",\n DOCUMENT = \"documentMessage\",\n CONTACT = \"contactMessage\",\n POLL_CREATION = \"pollCreationMessageV3\",\n LOCATION = \"locationMessage\",\n EDITED = \"editedMessage\",\n PROTOCOL = \"protocolMessage\",\n DEVICE_SENT = \"deviceSentMessage\",\n UNKNOWN = \"unknown\",\n}\n// History sync notification structure\nexport interface WebhookHistorySyncNotification {\n chunkOrder?: number;\n directPath: string;\n encHandle: string; // Webhook-specific field\n fileEncSHA256: string; // String format for webhook\n fileLength: number;\n fileSHA256: string; // String format for webhook\n mediaKey: string; // String format for webhook\n progress?: number;\n syncType: number;\n}\n\n// Using VerifiedName imported from user.ts (identical interface)\n\n// Specific webhook event data interfaces\n\n// QR webhook event data (based on observed webhook payload)\n// Note: For QR events, the event field is actually just the string \"code\"\n// We represent this as an empty interface since the real data is at payload level\nexport interface QRWebhookEvent {\n // The event field contains just the string \"code\"\n // The actual QR code data is in qrCodeBase64 at the payload level\n}\n\n// Connected webhook event data (based on observed webhook payload)\n// Note: For Connected events, the event field is an empty object {}\nexport interface ConnectedWebhookEvent {\n // The event field contains an empty object {}\n // No additional data is provided for Connected events\n}\n\n// ReadReceipt webhook event data (based on observed webhook payload)\n// Maps to Receipt event type but with webhook-specific structure\nexport interface ReadReceiptWebhookEvent {\n AddressingMode: string;\n BroadcastListOwner: string;\n Chat: string; // JID in string format (e.g., \"554198387899-1431900789@g.us\")\n IsFromMe: boolean;\n IsGroup: boolean;\n MessageIDs: string[];\n MessageSender: string;\n RecipientAlt: string;\n Sender: string; // JID in string format (e.g., \"554198387899@s.whatsapp.net\")\n SenderAlt: string;\n Timestamp: string; // ISO string timestamp\n Type: string; // Receipt type (e.g., \"read\")\n}\n\n// HistorySync webhook event data (based on observed webhook payload)\n// Contains different types of historical data - can be pastParticipants, statusV3Messages, conversations, etc.\nexport interface HistorySyncWebhookEvent {\n Data: {\n // Variant 1: Past participants data (groups and stickers)\n pastParticipants?: Array<{\n groupJID: string; // JID in string format (e.g., \"120363388053770128@g.us\")\n pastParticipants: Array<{\n leaveReason: number; // 0 = left voluntarily, 1 = kicked/removed\n leaveTS: number; // Unix timestamp\n userJID: string; // JID in string format\n }>;\n }>;\n recentStickers?: Array<{\n URL: string; // Full WhatsApp media URL\n directPath: string; // Direct path to media\n fileEncSHA256: string; // Encrypted file SHA256 hash\n fileLength: number; // File size in bytes\n fileSHA256: string; // File SHA256 hash\n height: number;\n isLottie: boolean; // Whether it's an animated Lottie sticker\n lastStickerSentTS: number; // Unix timestamp of last usage\n mediaKey: string; // Media encryption key\n mimetype: string; // MIME type (e.g., \"image/webp\")\n weight: number; // Usage weight/frequency\n width: number;\n }>;\n\n // Variant 2: Status messages data (stories/status updates)\n statusV3Messages?: Array<{\n key: WebhookMessageKey;\n message: WebhookGenericMessage;\n messageTimestamp: number; // Unix timestamp\n participant: string; // JID in string format\n reportingTokenInfo?: {\n reportingTag: string;\n };\n }>;\n\n // Variant 3: Conversation histories data\n conversations?: Array<{\n ID: string; // JID in string format (chat identifier)\n messages: Array<{\n message: {\n key: WebhookMessageKey;\n message: WebhookGenericMessage;\n messageTimestamp: number; // Unix timestamp\n messageC2STimestamp?: number; // Client to server timestamp\n ephemeralStartTimestamp?: number; // Ephemeral message start timestamp\n originalSelfAuthorUserJIDString?: string; // Original author for messages sent by self\n status?: number; // Message status (3=delivered, 4=read, 5=played)\n userReceipt?: UserReceipt[];\n reactions?: WebhookReaction[];\n reportingTokenInfo?: {\n reportingTag: string;\n };\n };\n msgOrderID: number; // Message order ID\n }>;\n }>;\n phoneNumberToLidMappings?: Array<{\n lidJID: string; // LID JID (e.g., \"165434221441206@lid\")\n pnJID: string; // Phone number JID (e.g., \"554199392033@s.whatsapp.net\")\n }>;\n\n // Common fields for all variants\n chunkOrder?: number; // Chunk order for paginated sync\n progress?: number; // Sync progress\n syncType: number; // Sync operation type\n };\n}\n\n// Message webhook event data (based on observed webhook payload)\n// Complex structure similar to MessageEvent in events.ts but with webhook-specific format\nexport interface MessageWebhookEvent {\n Info: {\n AddressingMode: string;\n BroadcastListOwner: string;\n Category: string;\n Chat: string; // JID in string format\n DeviceSentMeta: {\n DestinationJID: string;\n Phash: string;\n } | null;\n Edit: string;\n ID: string;\n IsFromMe: boolean;\n IsGroup: boolean;\n MediaType: string;\n MsgBotInfo: {\n EditSenderTimestampMS: string; // ISO timestamp\n EditTargetID: string;\n EditType: string;\n };\n MsgMetaInfo: {\n DeprecatedLIDSession: unknown | null;\n TargetID: string;\n TargetSender: string;\n ThreadMessageID: string;\n ThreadMessageSenderJID: string;\n };\n Multicast: boolean;\n PushName: string;\n RecipientAlt: string;\n Sender: string; // JID in string format\n SenderAlt: string;\n ServerID: number;\n Timestamp: string; // ISO string timestamp\n Type: string; // Message type (e.g., \"text\")\n VerifiedName: VerifiedName | null;\n };\n IsDocumentWithCaption: boolean;\n IsEdit: boolean;\n IsEphemeral: boolean;\n IsLottieSticker: boolean;\n IsViewOnce: boolean;\n IsViewOnceV2: boolean;\n IsViewOnceV2Extension: boolean;\n Message: WebhookGenericMessage; // Using webhook-specific message structure\n NewsletterMeta: unknown | null;\n RawMessage: WebhookGenericMessage; // Using webhook-specific message structure\n RetryCount: number;\n SourceWebMsg: unknown | null;\n UnavailableRequestID: string;\n}\n\n// Typed webhook payloads for specific events\nexport type QRWebhookPayload = AnyWebhookPayload<QRWebhookEvent> & {\n qrCodeBase64: string; // QR code as base64 data URL\n};\nexport type ConnectedWebhookPayload = AnyWebhookPayload<ConnectedWebhookEvent>;\nexport type ReadReceiptWebhookPayload =\n AnyWebhookPayload<ReadReceiptWebhookEvent>;\nexport type HistorySyncWebhookPayload =\n AnyWebhookPayload<HistorySyncWebhookEvent>;\nexport type MessageWebhookPayload = AnyWebhookPayload<MessageWebhookEvent>;\n\n// Webhook event mapping types for type-safe handling\nexport interface WebhookEventMap {\n QR: QRWebhookEvent;\n Connected: ConnectedWebhookEvent;\n ReadReceipt: ReadReceiptWebhookEvent;\n HistorySync: HistorySyncWebhookEvent;\n Message: MessageWebhookEvent;\n // Add more webhook event mappings here as they are discovered\n}\n\n// Type-safe webhook handler function type\nexport type WebhookEventHandler<T extends keyof WebhookEventMap> = (\n payload: AnyWebhookPayload<WebhookEventMap[T]>\n) => void | Promise<void>;\n\n// Union type for all specific webhook payloads\nexport type SpecificWebhookPayload =\n | QRWebhookPayload\n | ConnectedWebhookPayload\n | ReadReceiptWebhookPayload\n | HistorySyncWebhookPayload\n | MessageWebhookPayload;\n\n// Type guard to check if payload is a specific webhook event type\nexport function isWebhookEventType<T extends keyof WebhookEventMap>(\n payload: WebhookPayloadBase,\n eventType: T\n): payload is AnyWebhookPayload<WebhookEventMap[T]> {\n return payload.type === eventType;\n}\n\n// Helper type guards\nexport function hasS3Media(\n payload: WebhookPayloadBase\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: WebhookPayloadBase\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: WebhookPayloadBase\n): payload is BothMediaWebhookPayload {\n return hasS3Media(payload) && hasBase64Media(payload);\n}\n\n// Helper type guard to check if payload has token (all webhook payloads should)\nexport function isValidWebhookPayload(\n payload: unknown\n): payload is WebhookPayloadBase {\n return (\n typeof payload === \"object\" &&\n payload !== null &&\n \"event\" in payload &&\n \"type\" in payload &&\n \"token\" in payload\n );\n}\n\n/**\n * Utility function to discover the type of a GenericMessage\n * @param message - The GenericMessage to analyze\n * @returns MessageType enum value indicating the message type\n *\n * @example\n * ```typescript\n * import { discoverMessageType, MessageType } from \"wuzapi\";\n *\n * const messageType = discoverMessageType(webhookPayload.event.Message);\n *\n * switch (messageType) {\n * case MessageType.IMAGE:\n * console.log(\"Received an image message\");\n * break;\n * case MessageType.EXTENDED_TEXT:\n * console.log(\"Received a text message\");\n * break;\n * // ... handle other types\n * }\n * ```\n */\nexport function discoverMessageType(\n message: WebhookGenericMessage\n): MessageType {\n if (!message) return MessageType.UNKNOWN;\n\n // Check for each message type in order of most common to least common\n if (message.conversation) return MessageType.TEXT;\n if (message.extendedTextMessage) return MessageType.EXTENDED_TEXT;\n if (message.imageMessage) return MessageType.IMAGE;\n if (message.videoMessage) return MessageType.VIDEO;\n if (message.audioMessage) return MessageType.AUDIO;\n if (message.documentMessage) return MessageType.DOCUMENT;\n if (message.contactMessage) return MessageType.CONTACT;\n if (message.locationMessage) return MessageType.LOCATION;\n if (message.pollCreationMessageV3) return MessageType.POLL_CREATION;\n if (message.editedMessage) return MessageType.EDITED;\n if (message.protocolMessage) return MessageType.PROTOCOL;\n if (message.deviceSentMessage) return MessageType.DEVICE_SENT;\n\n return MessageType.UNKNOWN;\n}\n"],"names":["WebhookEventType","MessageType"],"mappings":";AAMO,IAAK,qCAAAA,sBAAL;AACLA,oBAAA,SAAA,IAAU;AACVA,oBAAA,uBAAA,IAAwB;AACxBA,oBAAA,SAAA,IAAU;AACVA,oBAAA,cAAA,IAAe;AACfA,oBAAA,aAAA,IAAc;AACdA,oBAAA,YAAA,IAAa;AACbA,oBAAA,cAAA,IAAe;AACfA,oBAAA,SAAA,IAAU;AACVA,oBAAA,kBAAA,IAAmB;AACnBA,oBAAA,WAAA,IAAY;AACZA,oBAAA,WAAA,IAAY;AACZA,oBAAA,cAAA,IAAe;AACfA,oBAAA,iBAAA,IAAkB;AAClBA,oBAAA,qBAAA,IAAsB;AACtBA,oBAAA,oBAAA,IAAqB;AACrBA,oBAAA,YAAA,IAAa;AAC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