@vinzsocket/baileys 3.3.1 → 3.3.2

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