@vinzsocket/baileys 3.3.0 → 3.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +1337 -2685
- package/WAProto/WAProto.proto +916 -360
- package/WAProto/fix-imports.js +18 -22
- package/WAProto/index.d.ts +0 -14015
- package/WAProto/index.js +80576 -45941
- package/lib/Defaults/index.d.ts +14 -15
- package/lib/Defaults/index.d.ts.map +1 -1
- package/lib/Defaults/index.js +109 -98
- package/lib/Defaults/index.js.map +1 -1
- package/lib/Modded/message_builder.js +2330 -0
- package/lib/Signal/Group/group_cipher.js.map +1 -1
- package/lib/Signal/Group/keyhelper.d.ts.map +1 -1
- package/lib/Signal/Group/keyhelper.js.map +1 -1
- package/lib/Signal/Group/sender-chain-key.js.map +1 -1
- package/lib/Signal/Group/sender-key-message.js.map +1 -1
- package/lib/Signal/Group/sender-message-key.js.map +1 -1
- package/lib/Signal/libsignal.d.ts.map +1 -1
- package/lib/Signal/libsignal.js +17 -45
- package/lib/Signal/libsignal.js.map +1 -1
- package/lib/Signal/lid-mapping.d.ts +0 -4
- package/lib/Signal/lid-mapping.d.ts.map +1 -1
- package/lib/Signal/lid-mapping.js +0 -6
- package/lib/Signal/lid-mapping.js.map +1 -1
- package/lib/Socket/business.d.ts +532 -213
- package/lib/Socket/business.d.ts.map +1 -1
- package/lib/Socket/business.js +401 -358
- package/lib/Socket/chats.d.ts +2 -15
- package/lib/Socket/chats.d.ts.map +1 -1
- package/lib/Socket/chats.js +40 -247
- package/lib/Socket/chats.js.map +1 -1
- package/lib/Socket/communities.d.ts +641 -269
- package/lib/Socket/communities.d.ts.map +1 -1
- package/lib/Socket/dugong.d.ts +127 -315
- package/lib/Socket/dugong.d.ts.map +1 -0
- package/lib/Socket/dugong.js +749 -623
- package/lib/Socket/dugong.js.map +1 -0
- package/lib/Socket/groups.d.ts +2 -13
- package/lib/Socket/groups.d.ts.map +1 -1
- package/lib/Socket/groups.js +1 -21
- package/lib/Socket/groups.js.map +1 -1
- package/lib/Socket/index.d.ts +631 -256
- package/lib/Socket/index.d.ts.map +1 -1
- package/lib/Socket/index.js +12 -9
- package/lib/Socket/index.js.map +1 -1
- package/lib/Socket/messages-recv.d.ts +58 -23
- package/lib/Socket/messages-recv.d.ts.map +1 -1
- package/lib/Socket/messages-recv.js +181 -645
- package/lib/Socket/messages-recv.js.map +1 -1
- package/lib/Socket/messages-send.d.ts +575 -201
- package/lib/Socket/messages-send.d.ts.map +1 -1
- package/lib/Socket/messages-send.js +1552 -1185
- package/lib/Socket/messages-send.js.map +1 -1
- package/lib/Socket/mex.d.ts.map +1 -1
- package/lib/Socket/mex.js +8 -2
- package/lib/Socket/mex.js.map +1 -1
- package/lib/Socket/newsletter.d.ts +18 -11
- package/lib/Socket/newsletter.d.ts.map +1 -1
- package/lib/Socket/newsletter.js +440 -165
- package/lib/Socket/newsletter.js.map +1 -1
- package/lib/Socket/socket.d.ts +2 -6
- package/lib/Socket/socket.d.ts.map +1 -1
- package/lib/Socket/socket.js +25 -59
- package/lib/Socket/socket.js.map +1 -1
- package/lib/Types/Auth.d.ts +0 -1
- package/lib/Types/Auth.d.ts.map +1 -1
- package/lib/Types/Bussines.d.ts +34 -22
- package/lib/Types/Call.d.ts +1 -1
- package/lib/Types/Call.d.ts.map +1 -1
- package/lib/Types/Chat.d.ts +0 -1
- package/lib/Types/Chat.d.ts.map +1 -1
- package/lib/Types/Contact.d.ts +0 -2
- package/lib/Types/Contact.d.ts.map +1 -1
- package/lib/Types/Events.d.ts +1 -20
- package/lib/Types/Events.d.ts.map +1 -1
- package/lib/Types/GroupMetadata.d.ts +1 -4
- package/lib/Types/GroupMetadata.d.ts.map +1 -1
- package/lib/Types/Message.d.ts +348 -294
- package/lib/Types/Message.d.ts.map +1 -1
- package/lib/Types/Message.js.map +1 -1
- package/lib/Types/{Mex.d.ts → Newsletter.d.ts} +5 -11
- package/lib/Types/Newsletter.d.ts.map +1 -0
- package/lib/Types/{Mex.js → Newsletter.js} +3 -9
- package/lib/Types/Newsletter.js.map +1 -0
- package/lib/Types/Signal.d.ts +1 -12
- package/lib/Types/Signal.d.ts.map +1 -1
- package/lib/Types/Socket.d.ts +148 -126
- package/lib/Types/Socket.d.ts.map +1 -1
- package/lib/Types/State.d.ts +0 -58
- package/lib/Types/State.d.ts.map +1 -1
- package/lib/Types/State.js +0 -43
- package/lib/Types/State.js.map +1 -1
- package/lib/Types/index.d.ts +52 -52
- package/lib/Types/index.d.ts.map +1 -1
- package/lib/Types/index.js +30 -23
- package/lib/Types/index.js.map +1 -1
- package/lib/Utils/auth-utils.d.ts +0 -5
- package/lib/Utils/auth-utils.d.ts.map +1 -1
- package/lib/Utils/auth-utils.js +0 -12
- package/lib/Utils/auth-utils.js.map +1 -1
- package/lib/Utils/browser-utils.js +0 -1
- package/lib/Utils/chat-utils.d.ts +4 -34
- package/lib/Utils/chat-utils.d.ts.map +1 -1
- package/lib/Utils/chat-utils.js +20 -80
- package/lib/Utils/chat-utils.js.map +1 -1
- package/lib/Utils/crypto.d.ts +12 -12
- package/lib/Utils/crypto.d.ts.map +1 -1
- package/lib/Utils/crypto.js.map +1 -1
- package/lib/Utils/decode-wa-message.d.ts +0 -18
- package/lib/Utils/decode-wa-message.d.ts.map +1 -1
- package/lib/Utils/decode-wa-message.js +0 -34
- package/lib/Utils/decode-wa-message.js.map +1 -1
- package/lib/Utils/event-buffer.d.ts +0 -2
- package/lib/Utils/event-buffer.d.ts.map +1 -1
- package/lib/Utils/event-buffer.js +1 -49
- package/lib/Utils/event-buffer.js.map +1 -1
- package/lib/Utils/generics.d.ts +2 -2
- package/lib/Utils/generics.d.ts.map +1 -1
- package/lib/Utils/generics.js +1 -10
- package/lib/Utils/generics.js.map +1 -1
- package/lib/Utils/history.d.ts +0 -2
- package/lib/Utils/history.d.ts.map +1 -1
- package/lib/Utils/history.js +9 -12
- package/lib/Utils/history.js.map +1 -1
- package/lib/Utils/identity-change-handler.d.ts +0 -7
- package/lib/Utils/identity-change-handler.d.ts.map +1 -1
- package/lib/Utils/identity-change-handler.js +0 -1
- package/lib/Utils/identity-change-handler.js.map +1 -1
- package/lib/Utils/index.d.ts +23 -23
- package/lib/Utils/index.d.ts.map +1 -1
- package/lib/Utils/index.js +2 -3
- package/lib/Utils/index.js.map +1 -1
- package/lib/Utils/link-preview.js +2 -2
- package/lib/Utils/link-preview.js.map +1 -1
- package/lib/Utils/logger.d.ts +2 -1
- package/lib/Utils/logger.d.ts.map +1 -1
- package/lib/Utils/message-retry-manager.d.ts +0 -5
- package/lib/Utils/message-retry-manager.d.ts.map +1 -1
- package/lib/Utils/message-retry-manager.js +0 -40
- package/lib/Utils/message-retry-manager.js.map +1 -1
- package/lib/Utils/messages-media.d.ts +13 -16
- package/lib/Utils/messages-media.d.ts.map +1 -1
- package/lib/Utils/messages-media.js +79 -85
- package/lib/Utils/messages-media.js.map +1 -1
- package/lib/Utils/messages.d.ts +1 -16
- package/lib/Utils/messages.d.ts.map +1 -1
- package/lib/Utils/messages.js +1121 -1021
- package/lib/Utils/messages.js.map +1 -1
- package/lib/Utils/noise-handler.d.ts +1 -1
- package/lib/Utils/process-message.d.ts.map +1 -1
- package/lib/Utils/process-message.js +1 -103
- package/lib/Utils/process-message.js.map +1 -1
- package/lib/Utils/rich-messages.d.ts +277 -0
- package/lib/Utils/rich-messages.d.ts.map +1 -0
- package/lib/Utils/rich-messages.js +1144 -0
- package/lib/Utils/rich-messages.js.map +1 -0
- package/lib/Utils/signal.d.ts +0 -13
- package/lib/Utils/signal.d.ts.map +1 -1
- package/lib/Utils/signal.js +0 -42
- package/lib/Utils/signal.js.map +1 -1
- package/lib/Utils/sticker-pack.d.ts +10 -0
- package/lib/Utils/sticker-pack.js +111 -0
- package/lib/Utils/sync-action-utils.d.ts.map +1 -1
- package/lib/Utils/sync-action-utils.js +0 -1
- package/lib/Utils/sync-action-utils.js.map +1 -1
- package/lib/Utils/tc-token-utils.d.ts +1 -26
- package/lib/Utils/tc-token-utils.d.ts.map +1 -1
- package/lib/Utils/tc-token-utils.js +5 -151
- package/lib/Utils/tc-token-utils.js.map +1 -1
- package/lib/Utils/validate-connection.d.ts.map +1 -1
- package/lib/Utils/validate-connection.js +2 -12
- package/lib/Utils/validate-connection.js.map +1 -1
- package/lib/VoIP/audio-feeder.d.ts +15 -0
- package/lib/VoIP/audio-feeder.js +132 -0
- package/lib/VoIP/index.js +277 -0
- package/lib/VoIP/relay-transport.d.ts +43 -0
- package/lib/VoIP/relay-transport.js +559 -0
- package/lib/VoIP/signaling.js +594 -0
- package/lib/VoIP/types.d.ts +69 -0
- package/lib/VoIP/types.js +17 -0
- package/lib/VoIP/wasm-engine.d.ts +103 -0
- package/lib/VoIP/wasm-engine.js +1214 -0
- package/lib/VoIP/worker-bootstrap.js +1042 -0
- package/lib/WABinary/decode.d.ts +1 -1
- package/lib/WABinary/decode.d.ts.map +1 -1
- package/lib/WABinary/generic-utils.d.ts +3 -1
- package/lib/WABinary/generic-utils.d.ts.map +1 -1
- package/lib/WABinary/generic-utils.js +78 -0
- package/lib/WABinary/generic-utils.js.map +1 -1
- package/lib/WAM/encode.d.ts +1 -1
- package/lib/WAM/encode.d.ts.map +1 -1
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts.map +1 -1
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +3 -26
- package/lib/WAUSync/Protocols/USyncContactProtocol.js.map +1 -1
- package/lib/WAUSync/Protocols/index.d.ts +0 -1
- package/lib/WAUSync/Protocols/index.d.ts.map +1 -1
- package/lib/WAUSync/Protocols/index.js +0 -1
- package/lib/WAUSync/Protocols/index.js.map +1 -1
- package/lib/WAUSync/USyncQuery.d.ts +0 -1
- package/lib/WAUSync/USyncQuery.d.ts.map +1 -1
- package/lib/WAUSync/USyncQuery.js +2 -6
- package/lib/WAUSync/USyncQuery.js.map +1 -1
- package/lib/WAUSync/USyncUser.d.ts +0 -4
- package/lib/WAUSync/USyncUser.d.ts.map +1 -1
- package/lib/WAUSync/USyncUser.js +0 -8
- package/lib/WAUSync/USyncUser.js.map +1 -1
- package/lib/assets/wasm/loader.js +5 -0
- package/lib/assets/wasm/whatsapp.wasm +0 -0
- package/lib/assets/wasm/worker-modules.js +273 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +3 -0
- package/lib/index.js.map +1 -1
- package/package.json +29 -92
- package/engine-requirements.js +0 -27
- package/lib/Types/Mex.d.ts.map +0 -1
- package/lib/Types/Mex.js.map +0 -1
- package/lib/Utils/companion-reg-client-utils.d.ts +0 -17
- package/lib/Utils/companion-reg-client-utils.d.ts.map +0 -1
- package/lib/Utils/companion-reg-client-utils.js +0 -35
- package/lib/Utils/companion-reg-client-utils.js.map +0 -1
- package/lib/Utils/mention.d.ts +0 -14
- package/lib/Utils/mention.js +0 -138
- package/lib/Utils/story-card.js +0 -107
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts +0 -10
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts.map +0 -1
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.js +0 -25
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.js.map +0 -1
package/lib/Types/Message.d.ts
CHANGED
|
@@ -1,368 +1,422 @@
|
|
|
1
|
-
import type { Readable } from
|
|
2
|
-
import type { URL } from
|
|
3
|
-
import { proto } from
|
|
4
|
-
import type { MediaType } from
|
|
5
|
-
import type { BinaryNode } from
|
|
6
|
-
import type { GroupMetadata } from
|
|
7
|
-
import type { CacheStore } from
|
|
1
|
+
import type { Readable } from "stream";
|
|
2
|
+
import type { URL } from "url";
|
|
3
|
+
import { proto } from "../../WAProto/index.js";
|
|
4
|
+
import type { MediaType } from "../Defaults/index.js";
|
|
5
|
+
import type { BinaryNode } from "../WABinary/index.js";
|
|
6
|
+
import type { GroupMetadata } from "./GroupMetadata.js";
|
|
7
|
+
import type { CacheStore } from "./Socket.js";
|
|
8
8
|
export { proto as WAProto };
|
|
9
9
|
export type WAMessage = proto.IWebMessageInfo & {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
key: WAMessageKey;
|
|
11
|
+
messageStubParameters?: any;
|
|
12
|
+
category?: string;
|
|
13
|
+
retryCount?: number;
|
|
14
14
|
};
|
|
15
15
|
export type WAMessageContent = proto.IMessage;
|
|
16
16
|
export type WAContactMessage = proto.Message.IContactMessage;
|
|
17
17
|
export type WAContactsArrayMessage = proto.Message.IContactsArrayMessage;
|
|
18
18
|
export type WAMessageKey = proto.IMessageKey & {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
addressingMode?: string;
|
|
25
|
-
isViewOnce?: boolean;
|
|
19
|
+
remoteJidAlt?: string;
|
|
20
|
+
participantAlt?: string;
|
|
21
|
+
server_id?: string;
|
|
22
|
+
addressingMode?: string;
|
|
23
|
+
isViewOnce?: boolean;
|
|
26
24
|
};
|
|
27
25
|
export type WATextMessage = proto.Message.IExtendedTextMessage;
|
|
28
26
|
export type WAContextInfo = proto.IContextInfo;
|
|
29
27
|
export type WALocationMessage = proto.Message.ILocationMessage;
|
|
30
|
-
export type WAGenericMediaMessage =
|
|
28
|
+
export type WAGenericMediaMessage =
|
|
29
|
+
| proto.Message.IVideoMessage
|
|
30
|
+
| proto.Message.IImageMessage
|
|
31
|
+
| proto.Message.IAudioMessage
|
|
32
|
+
| proto.Message.IDocumentMessage
|
|
33
|
+
| proto.Message.IStickerMessage;
|
|
31
34
|
export declare const WAMessageStubType: typeof proto.WebMessageInfo.StubType;
|
|
32
35
|
export declare const WAMessageStatus: typeof proto.WebMessageInfo.Status;
|
|
33
|
-
import type { ILogger } from
|
|
36
|
+
import type { ILogger } from "../Utils/logger.js";
|
|
34
37
|
export type WAMediaPayloadURL = {
|
|
35
|
-
|
|
38
|
+
url: URL | string;
|
|
36
39
|
};
|
|
37
40
|
export type WAMediaPayloadStream = {
|
|
38
|
-
|
|
41
|
+
stream: Readable;
|
|
39
42
|
};
|
|
40
43
|
export type WAMediaUpload = Buffer | WAMediaPayloadStream | WAMediaPayloadURL;
|
|
41
44
|
/** Set of message types that are supported by the library */
|
|
42
45
|
export type MessageType = keyof proto.Message;
|
|
43
46
|
export declare enum WAMessageAddressingMode {
|
|
44
|
-
|
|
45
|
-
|
|
47
|
+
PN = "pn",
|
|
48
|
+
LID = "lid",
|
|
46
49
|
}
|
|
47
|
-
export type MessageWithContextInfo =
|
|
50
|
+
export type MessageWithContextInfo =
|
|
51
|
+
| "imageMessage"
|
|
52
|
+
| "contactMessage"
|
|
53
|
+
| "locationMessage"
|
|
54
|
+
| "extendedTextMessage"
|
|
55
|
+
| "documentMessage"
|
|
56
|
+
| "audioMessage"
|
|
57
|
+
| "videoMessage"
|
|
58
|
+
| "call"
|
|
59
|
+
| "contactsArrayMessage"
|
|
60
|
+
| "liveLocationMessage"
|
|
61
|
+
| "templateMessage"
|
|
62
|
+
| "stickerMessage"
|
|
63
|
+
| "groupInviteMessage"
|
|
64
|
+
| "templateButtonReplyMessage"
|
|
65
|
+
| "productMessage"
|
|
66
|
+
| "listMessage"
|
|
67
|
+
| "orderMessage"
|
|
68
|
+
| "listResponseMessage"
|
|
69
|
+
| "buttonsMessage"
|
|
70
|
+
| "buttonsResponseMessage"
|
|
71
|
+
| "interactiveMessage"
|
|
72
|
+
| "interactiveResponseMessage"
|
|
73
|
+
| "pollCreationMessage"
|
|
74
|
+
| "requestPhoneNumberMessage"
|
|
75
|
+
| "messageHistoryBundle"
|
|
76
|
+
| "eventMessage"
|
|
77
|
+
| "newsletterAdminInviteMessage"
|
|
78
|
+
| "albumMessage"
|
|
79
|
+
| "stickerPackMessage"
|
|
80
|
+
| "pollResultSnapshotMessage"
|
|
81
|
+
| "messageHistoryNotice";
|
|
48
82
|
export type DownloadableMessage = {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
};
|
|
53
|
-
export type MessageReceiptType =
|
|
83
|
+
mediaKey?: Uint8Array | null;
|
|
84
|
+
directPath?: string | null;
|
|
85
|
+
url?: string | null;
|
|
86
|
+
};
|
|
87
|
+
export type MessageReceiptType =
|
|
88
|
+
| "read"
|
|
89
|
+
| "read-self"
|
|
90
|
+
| "hist_sync"
|
|
91
|
+
| "peer_msg"
|
|
92
|
+
| "sender"
|
|
93
|
+
| "inactive"
|
|
94
|
+
| "played"
|
|
95
|
+
| undefined;
|
|
54
96
|
export type MediaConnInfo = {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
97
|
+
auth: string;
|
|
98
|
+
ttl: number;
|
|
99
|
+
hosts: {
|
|
100
|
+
hostname: string;
|
|
101
|
+
maxContentLengthBytes: number;
|
|
102
|
+
}[];
|
|
103
|
+
fetchDate: Date;
|
|
62
104
|
};
|
|
63
105
|
export interface WAUrlInfo {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
106
|
+
"canonical-url": string;
|
|
107
|
+
"matched-text": string;
|
|
108
|
+
title: string;
|
|
109
|
+
description?: string;
|
|
110
|
+
jpegThumbnail?: Buffer;
|
|
111
|
+
highQualityThumbnail?: proto.Message.IImageMessage;
|
|
112
|
+
originalThumbnailUrl?: string;
|
|
71
113
|
}
|
|
72
114
|
type Mentionable = {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
115
|
+
/** list of jids that are mentioned in the accompanying text */
|
|
116
|
+
mentions?: string[];
|
|
117
|
+
/** mention all */
|
|
118
|
+
mentionAll?: boolean;
|
|
77
119
|
};
|
|
78
120
|
type Contextable = {
|
|
79
|
-
|
|
80
|
-
|
|
121
|
+
/** add contextInfo to the message */
|
|
122
|
+
contextInfo?: proto.IContextInfo;
|
|
81
123
|
};
|
|
82
124
|
type ViewOnce = {
|
|
83
|
-
|
|
125
|
+
viewOnce?: boolean;
|
|
84
126
|
};
|
|
85
127
|
type Editable = {
|
|
86
|
-
|
|
87
|
-
};
|
|
88
|
-
/** A single native flow button, already normalized, or one of the common legacy shapes
|
|
89
|
-
* that Baileys will auto-normalize into a native flow button. */
|
|
90
|
-
export type WAButtonShape = {
|
|
91
|
-
/** native flow button name, e.g. 'quick_reply', 'cta_url', 'cta_call', 'cta_copy', 'single_select' */
|
|
92
|
-
name: string;
|
|
93
|
-
buttonParamsJson: string;
|
|
94
|
-
} | {
|
|
95
|
-
buttonId: string;
|
|
96
|
-
buttonText: {
|
|
97
|
-
displayText: string;
|
|
98
|
-
};
|
|
99
|
-
type?: number;
|
|
100
|
-
} | {
|
|
101
|
-
id: string;
|
|
102
|
-
text?: string;
|
|
103
|
-
displayText?: string;
|
|
104
|
-
} | {
|
|
105
|
-
index?: number;
|
|
106
|
-
urlButton?: {
|
|
107
|
-
displayText: string;
|
|
108
|
-
url: string;
|
|
109
|
-
};
|
|
110
|
-
callButton?: {
|
|
111
|
-
displayText: string;
|
|
112
|
-
phoneNumber: string;
|
|
113
|
-
};
|
|
114
|
-
quickReplyButton?: {
|
|
115
|
-
displayText: string;
|
|
116
|
-
id: string;
|
|
117
|
-
};
|
|
118
|
-
};
|
|
119
|
-
type WithNativeFlowButtons = {
|
|
120
|
-
/** Buttons to render as a native flow (button/native flow/bottom sheet) interactive message.
|
|
121
|
-
* Accepts native flow shape, or common legacy shapes (auto-normalized). */
|
|
122
|
-
buttons?: WAButtonShape[];
|
|
123
|
-
/** alias of `buttons`, kept for compatibility with bots migrating from templateButtons */
|
|
124
|
-
templateButtons?: WAButtonShape[];
|
|
125
|
-
/** alias of `buttons`, the most explicit/preferred name for native flow buttons */
|
|
126
|
-
interactiveButtons?: WAButtonShape[];
|
|
127
|
-
/** header title shown above the body text when buttons/sections are present */
|
|
128
|
-
title?: string;
|
|
129
|
-
/** footer text shown below the body text */
|
|
130
|
-
footer?: string;
|
|
131
|
-
/** list sections, renders as a `listMessage` instead of buttons */
|
|
132
|
-
sections?: proto.Message.ListMessage.ISection[];
|
|
133
|
-
/** button label that opens the list, used together with `sections` */
|
|
134
|
-
buttonText?: string;
|
|
128
|
+
edit?: WAMessageKey;
|
|
135
129
|
};
|
|
136
130
|
type WithDimensions = {
|
|
137
|
-
|
|
138
|
-
|
|
131
|
+
width?: number;
|
|
132
|
+
height?: number;
|
|
139
133
|
};
|
|
140
134
|
export type PollMessageOptions = {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
135
|
+
name: string;
|
|
136
|
+
selectableCount?: number;
|
|
137
|
+
values: string[];
|
|
138
|
+
/** 32 byte message secret to encrypt poll selections */
|
|
139
|
+
messageSecret?: Uint8Array;
|
|
140
|
+
toAnnouncementGroup?: boolean;
|
|
147
141
|
};
|
|
148
142
|
export type EventMessageOptions = {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
};
|
|
160
|
-
export type AlbumMessageOptions = {
|
|
161
|
-
/** Number of images expected in the album */
|
|
162
|
-
expectedImageCount?: number;
|
|
163
|
-
/** Number of videos expected in the album */
|
|
164
|
-
expectedVideoCount?: number;
|
|
143
|
+
name: string;
|
|
144
|
+
description?: string;
|
|
145
|
+
startDate: Date;
|
|
146
|
+
endDate?: Date;
|
|
147
|
+
location?: WALocationMessage;
|
|
148
|
+
call?: "audio" | "video";
|
|
149
|
+
isCancelled?: boolean;
|
|
150
|
+
isScheduleCall?: boolean;
|
|
151
|
+
extraGuestsAllowed?: boolean;
|
|
152
|
+
messageSecret?: Uint8Array<ArrayBufferLike>;
|
|
165
153
|
};
|
|
166
154
|
type SharePhoneNumber = {
|
|
167
|
-
|
|
155
|
+
sharePhoneNumber: boolean;
|
|
168
156
|
};
|
|
169
157
|
type RequestPhoneNumber = {
|
|
170
|
-
|
|
171
|
-
};
|
|
172
|
-
export type AnyMediaMessageContent = (
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
158
|
+
requestPhoneNumber: boolean;
|
|
159
|
+
};
|
|
160
|
+
export type AnyMediaMessageContent = (
|
|
161
|
+
| ({
|
|
162
|
+
image: WAMediaUpload;
|
|
163
|
+
caption?: string;
|
|
164
|
+
jpegThumbnail?: string;
|
|
165
|
+
} & Mentionable &
|
|
166
|
+
Contextable &
|
|
167
|
+
WithDimensions)
|
|
168
|
+
| ({
|
|
169
|
+
video: WAMediaUpload;
|
|
170
|
+
caption?: string;
|
|
171
|
+
gifPlayback?: boolean;
|
|
172
|
+
jpegThumbnail?: string;
|
|
173
|
+
/** if set to true, will send as a `video note` */
|
|
174
|
+
ptv?: boolean;
|
|
175
|
+
} & Mentionable &
|
|
176
|
+
Contextable &
|
|
177
|
+
WithDimensions)
|
|
178
|
+
| {
|
|
179
|
+
audio: WAMediaUpload;
|
|
180
|
+
/** if set to true, will send as a `voice note` */
|
|
181
|
+
ptt?: boolean;
|
|
182
|
+
/** optionally tell the duration of the audio */
|
|
183
|
+
seconds?: number;
|
|
184
|
+
}
|
|
185
|
+
| ({
|
|
186
|
+
sticker: WAMediaUpload;
|
|
187
|
+
isAnimated?: boolean;
|
|
188
|
+
} & WithDimensions)
|
|
189
|
+
| ({
|
|
190
|
+
document: WAMediaUpload;
|
|
191
|
+
mimetype: string;
|
|
192
|
+
fileName?: string;
|
|
193
|
+
caption?: string;
|
|
194
|
+
} & Contextable)
|
|
195
|
+
) & {
|
|
196
|
+
mimetype?: string;
|
|
197
|
+
} & Editable;
|
|
203
198
|
export type ButtonReplyInfo = {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
199
|
+
displayText: string;
|
|
200
|
+
id: string;
|
|
201
|
+
index: number;
|
|
207
202
|
};
|
|
208
203
|
export type GroupInviteInfo = {
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
};
|
|
215
|
-
export type WASendableProduct = Omit<
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
}
|
|
228
|
-
|
|
204
|
+
inviteCode: string;
|
|
205
|
+
inviteExpiration: number;
|
|
206
|
+
text: string;
|
|
207
|
+
jid: string;
|
|
208
|
+
subject: string;
|
|
209
|
+
};
|
|
210
|
+
export type WASendableProduct = Omit<
|
|
211
|
+
proto.Message.ProductMessage.IProductSnapshot,
|
|
212
|
+
"productImage"
|
|
213
|
+
> & {
|
|
214
|
+
productImage: WAMediaUpload;
|
|
215
|
+
};
|
|
216
|
+
export type StickerPackItem =
|
|
217
|
+
| WAMediaUpload
|
|
218
|
+
| {
|
|
219
|
+
sticker: WAMediaUpload;
|
|
220
|
+
emojis?: string[];
|
|
221
|
+
accessibilityLabel?: string;
|
|
222
|
+
};
|
|
223
|
+
export type StickerPackContent = {
|
|
224
|
+
name: string;
|
|
225
|
+
publisher?: string;
|
|
226
|
+
description?: string;
|
|
227
|
+
packId?: string;
|
|
228
|
+
stickers: StickerPackItem[];
|
|
229
|
+
cover?: WAMediaUpload;
|
|
230
|
+
};
|
|
231
|
+
export type AnyRegularMessageContent = (
|
|
232
|
+
| ({
|
|
233
|
+
text: string;
|
|
234
|
+
linkPreview?: WAUrlInfo | null;
|
|
235
|
+
} & Mentionable &
|
|
236
|
+
Contextable &
|
|
237
|
+
Editable)
|
|
238
|
+
| AnyMediaMessageContent
|
|
239
|
+
| {
|
|
240
|
+
event: EventMessageOptions;
|
|
241
|
+
}
|
|
242
|
+
| ({
|
|
243
|
+
poll: PollMessageOptions;
|
|
244
|
+
} & Mentionable &
|
|
245
|
+
Contextable &
|
|
246
|
+
Editable)
|
|
247
|
+
| {
|
|
248
|
+
contacts: {
|
|
229
249
|
displayName?: string;
|
|
230
250
|
contacts: proto.Message.IContactMessage[];
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
| {
|
|
254
|
+
location: WALocationMessage;
|
|
255
|
+
}
|
|
256
|
+
| {
|
|
257
|
+
react: proto.Message.IReactionMessage;
|
|
258
|
+
}
|
|
259
|
+
| {
|
|
260
|
+
buttonReply: ButtonReplyInfo;
|
|
261
|
+
type: "template" | "plain";
|
|
262
|
+
}
|
|
263
|
+
| {
|
|
264
|
+
groupInvite: GroupInviteInfo;
|
|
265
|
+
}
|
|
266
|
+
| {
|
|
267
|
+
listReply: Omit<proto.Message.IListResponseMessage, "contextInfo">;
|
|
268
|
+
}
|
|
269
|
+
| {
|
|
270
|
+
pin: WAMessageKey;
|
|
271
|
+
type: proto.PinInChat.Type;
|
|
272
|
+
/**
|
|
273
|
+
* 24 hours, 7 days, 30 days
|
|
274
|
+
*/
|
|
275
|
+
time?: 86400 | 604800 | 2592000;
|
|
276
|
+
}
|
|
277
|
+
| {
|
|
278
|
+
product: WASendableProduct;
|
|
279
|
+
businessOwnerJid?: string;
|
|
280
|
+
body?: string;
|
|
281
|
+
footer?: string;
|
|
282
|
+
}
|
|
283
|
+
| ({
|
|
284
|
+
stickerPack: StickerPackContent;
|
|
285
|
+
} & Mentionable &
|
|
286
|
+
Contextable)
|
|
287
|
+
| SharePhoneNumber
|
|
288
|
+
| RequestPhoneNumber
|
|
289
|
+
) &
|
|
290
|
+
ViewOnce;
|
|
291
|
+
export type AnyMessageContent =
|
|
292
|
+
| AnyRegularMessageContent
|
|
293
|
+
| {
|
|
294
|
+
forward: WAMessage;
|
|
295
|
+
force?: boolean;
|
|
296
|
+
}
|
|
297
|
+
| {
|
|
298
|
+
/** Delete your message or anyone's message in a group (admin required) */
|
|
299
|
+
delete: WAMessageKey;
|
|
300
|
+
}
|
|
301
|
+
| {
|
|
302
|
+
disappearingMessagesInChat: boolean | number;
|
|
303
|
+
}
|
|
304
|
+
| {
|
|
305
|
+
limitSharing: boolean;
|
|
231
306
|
};
|
|
232
|
-
|
|
233
|
-
location: WALocationMessage;
|
|
234
|
-
} | {
|
|
235
|
-
react: proto.Message.IReactionMessage;
|
|
236
|
-
} | {
|
|
237
|
-
buttonReply: ButtonReplyInfo;
|
|
238
|
-
type: 'template' | 'plain';
|
|
239
|
-
} | {
|
|
240
|
-
groupInvite: GroupInviteInfo;
|
|
241
|
-
} | {
|
|
242
|
-
listReply: Omit<proto.Message.IListResponseMessage, 'contextInfo'>;
|
|
243
|
-
} | {
|
|
244
|
-
pin: WAMessageKey;
|
|
245
|
-
type: proto.PinInChat.Type;
|
|
246
|
-
/**
|
|
247
|
-
* 24 hours, 7 days, 30 days
|
|
248
|
-
*/
|
|
249
|
-
time?: 86400 | 604800 | 2592000;
|
|
250
|
-
} | {
|
|
251
|
-
product: WASendableProduct;
|
|
252
|
-
businessOwnerJid?: string;
|
|
253
|
-
body?: string;
|
|
254
|
-
footer?: string;
|
|
255
|
-
} | SharePhoneNumber | RequestPhoneNumber) & ViewOnce & WithNativeFlowButtons;
|
|
256
|
-
export type AnyMessageContent = AnyRegularMessageContent | {
|
|
257
|
-
forward: WAMessage;
|
|
258
|
-
force?: boolean;
|
|
259
|
-
} | {
|
|
260
|
-
/** Delete your message or anyone's message in a group (admin required) */
|
|
261
|
-
delete: WAMessageKey;
|
|
262
|
-
} | {
|
|
263
|
-
disappearingMessagesInChat: boolean | number;
|
|
264
|
-
} | {
|
|
265
|
-
limitSharing: boolean;
|
|
266
|
-
};
|
|
267
|
-
export type GroupMetadataParticipants = Pick<GroupMetadata, 'participants'>;
|
|
307
|
+
export type GroupMetadataParticipants = Pick<GroupMetadata, "participants">;
|
|
268
308
|
type MinimalRelayOptions = {
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
309
|
+
/** override the message ID with a custom provided string */
|
|
310
|
+
messageId?: string;
|
|
311
|
+
/** should we use group metadata cache, or fetch afresh from the server; default assumed to be "true" */
|
|
312
|
+
useCachedGroupMetadata?: boolean;
|
|
273
313
|
};
|
|
274
314
|
export type MessageRelayOptions = MinimalRelayOptions & {
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
315
|
+
/** only send to a specific participant; used when a message decryption fails for a single user */
|
|
316
|
+
participant?: {
|
|
317
|
+
jid: string;
|
|
318
|
+
count: number;
|
|
319
|
+
};
|
|
320
|
+
/** additional attributes to add to the WA binary node */
|
|
321
|
+
additionalAttributes?: {
|
|
322
|
+
[_: string]: string;
|
|
323
|
+
};
|
|
324
|
+
additionalNodes?: BinaryNode[];
|
|
325
|
+
/** should we use the devices cache, or fetch afresh from the server; default assumed to be "true" */
|
|
326
|
+
useUserDevicesCache?: boolean;
|
|
327
|
+
/** jid list of participants for status@broadcast */
|
|
328
|
+
statusJidList?: string[];
|
|
289
329
|
};
|
|
290
330
|
export type MiscMessageGenerationOptions = MinimalRelayOptions & {
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
};
|
|
308
|
-
export type MessageGenerationOptionsFromContent =
|
|
331
|
+
/** optional, if you want to manually set the timestamp of the message */
|
|
332
|
+
timestamp?: Date;
|
|
333
|
+
/** the message you want to quote */
|
|
334
|
+
quoted?: WAMessage;
|
|
335
|
+
/** disappearing messages settings */
|
|
336
|
+
ephemeralExpiration?: number | string;
|
|
337
|
+
/** timeout for media upload to WA server */
|
|
338
|
+
mediaUploadTimeoutMs?: number;
|
|
339
|
+
/** jid list of participants for status@broadcast */
|
|
340
|
+
statusJidList?: string[];
|
|
341
|
+
/** backgroundcolor for status */
|
|
342
|
+
backgroundColor?: string;
|
|
343
|
+
/** font type for status */
|
|
344
|
+
font?: number;
|
|
345
|
+
/** if it is broadcast */
|
|
346
|
+
broadcast?: boolean;
|
|
347
|
+
};
|
|
348
|
+
export type MessageGenerationOptionsFromContent =
|
|
349
|
+
MiscMessageGenerationOptions & {
|
|
309
350
|
userJid: string;
|
|
310
|
-
};
|
|
311
|
-
export type WAMediaUploadFunction = (
|
|
351
|
+
};
|
|
352
|
+
export type WAMediaUploadFunction = (
|
|
353
|
+
encFilePath: string,
|
|
354
|
+
opts: {
|
|
312
355
|
fileEncSha256B64: string;
|
|
313
356
|
mediaType: MediaType;
|
|
357
|
+
newsletter?: boolean;
|
|
314
358
|
timeoutMs?: number;
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
359
|
+
},
|
|
360
|
+
) => Promise<{
|
|
361
|
+
mediaUrl: string;
|
|
362
|
+
directPath: string;
|
|
363
|
+
meta_hmac?: string;
|
|
364
|
+
ts?: number;
|
|
365
|
+
fbid?: number;
|
|
321
366
|
}>;
|
|
322
367
|
export type MediaGenerationOptions = {
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
368
|
+
logger?: ILogger;
|
|
369
|
+
mediaTypeOverride?: MediaType;
|
|
370
|
+
upload: WAMediaUploadFunction;
|
|
371
|
+
/** cache media so it does not have to be uploaded again */
|
|
372
|
+
mediaCache?: CacheStore;
|
|
373
|
+
mediaUploadTimeoutMs?: number;
|
|
374
|
+
options?: RequestInit;
|
|
375
|
+
backgroundColor?: string;
|
|
376
|
+
font?: number;
|
|
332
377
|
};
|
|
333
378
|
export type MessageContentGenerationOptions = MediaGenerationOptions & {
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
379
|
+
getUrlInfo?: (text: string) => Promise<WAUrlInfo | undefined>;
|
|
380
|
+
getProfilePicUrl?: (
|
|
381
|
+
jid: string,
|
|
382
|
+
type: "image" | "preview",
|
|
383
|
+
) => Promise<string | undefined>;
|
|
384
|
+
getCallLink?: (
|
|
385
|
+
type: "audio" | "video",
|
|
386
|
+
event?: {
|
|
387
|
+
startTime: number;
|
|
388
|
+
},
|
|
389
|
+
) => Promise<string | undefined>;
|
|
390
|
+
jid?: string;
|
|
391
|
+
};
|
|
392
|
+
export type MessageGenerationOptions = MessageContentGenerationOptions &
|
|
393
|
+
MessageGenerationOptionsFromContent;
|
|
342
394
|
/**
|
|
343
395
|
* Type of message upsert
|
|
344
396
|
* 1. notify => notify the user, this message was just received
|
|
345
397
|
* 2. append => append the message to the chat history, no notification required
|
|
346
398
|
*/
|
|
347
|
-
export type MessageUpsertType =
|
|
399
|
+
export type MessageUpsertType = "append" | "notify";
|
|
348
400
|
export type MessageUserReceipt = proto.IUserReceipt;
|
|
349
401
|
export type WAMessageUpdate = {
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
};
|
|
353
|
-
export type WAMessageCursor =
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
402
|
+
update: Partial<WAMessage>;
|
|
403
|
+
key: WAMessageKey;
|
|
404
|
+
};
|
|
405
|
+
export type WAMessageCursor =
|
|
406
|
+
| {
|
|
407
|
+
before: WAMessageKey | undefined;
|
|
408
|
+
}
|
|
409
|
+
| {
|
|
410
|
+
after: WAMessageKey | undefined;
|
|
411
|
+
};
|
|
358
412
|
export type MessageUserReceiptUpdate = {
|
|
359
|
-
|
|
360
|
-
|
|
413
|
+
key: WAMessageKey;
|
|
414
|
+
receipt: MessageUserReceipt;
|
|
361
415
|
};
|
|
362
416
|
export type MediaDecryptionKeyInfo = {
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
417
|
+
iv: Uint8Array;
|
|
418
|
+
cipherKey: Uint8Array;
|
|
419
|
+
macKey?: Uint8Array;
|
|
366
420
|
};
|
|
367
|
-
export type MinimalMessage = Pick<WAMessage,
|
|
368
|
-
//# sourceMappingURL=Message.d.ts.map
|
|
421
|
+
export type MinimalMessage = Pick<WAMessage, "key" | "messageTimestamp">;
|
|
422
|
+
//# sourceMappingURL=Message.d.ts.map
|