@queenanya/baileys 9.2.4 → 9.4.3

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 (301) hide show
  1. package/README.md +329 -1237
  2. package/WAProto/fix-imports.js +22 -18
  3. package/WAProto/index.js +22 -18
  4. package/lib/Defaults/index.d.ts +17 -0
  5. package/lib/Defaults/index.d.ts.map +1 -1
  6. package/lib/Defaults/index.js +29 -3
  7. package/lib/Defaults/index.js.map +1 -1
  8. package/lib/Signal/libsignal.d.ts.map +1 -1
  9. package/lib/Signal/libsignal.js +61 -2
  10. package/lib/Signal/libsignal.js.map +1 -1
  11. package/lib/Signal/lid-mapping.d.ts +5 -9
  12. package/lib/Signal/lid-mapping.d.ts.map +1 -1
  13. package/lib/Signal/lid-mapping.js +170 -70
  14. package/lib/Signal/lid-mapping.js.map +1 -1
  15. package/lib/Socket/business.d.ts +114 -2
  16. package/lib/Socket/business.d.ts.map +1 -1
  17. package/lib/Socket/chats.d.ts +14 -1
  18. package/lib/Socket/chats.d.ts.map +1 -1
  19. package/lib/Socket/chats.js +253 -38
  20. package/lib/Socket/chats.js.map +1 -1
  21. package/lib/Socket/communities.d.ts +114 -2
  22. package/lib/Socket/communities.d.ts.map +1 -1
  23. package/lib/Socket/groups.d.ts +9 -0
  24. package/lib/Socket/groups.d.ts.map +1 -1
  25. package/lib/Socket/groups.js +6 -0
  26. package/lib/Socket/groups.js.map +1 -1
  27. package/lib/Socket/index.d.ts +114 -2
  28. package/lib/Socket/index.d.ts.map +1 -1
  29. package/lib/Socket/index.js +0 -6
  30. package/lib/Socket/index.js.map +1 -1
  31. package/lib/Socket/messages-recv.d.ts +115 -3
  32. package/lib/Socket/messages-recv.d.ts.map +1 -1
  33. package/lib/Socket/messages-recv.js +739 -150
  34. package/lib/Socket/messages-recv.js.map +1 -1
  35. package/lib/Socket/messages-send.d.ts +118 -4
  36. package/lib/Socket/messages-send.d.ts.map +1 -1
  37. package/lib/Socket/messages-send.js +328 -86
  38. package/lib/Socket/messages-send.js.map +1 -1
  39. package/lib/Socket/newsletter.d.ts +9 -0
  40. package/lib/Socket/newsletter.d.ts.map +1 -1
  41. package/lib/Socket/newsletter.js +2 -2
  42. package/lib/Socket/newsletter.js.map +1 -1
  43. package/lib/Socket/socket.d.ts +2 -0
  44. package/lib/Socket/socket.d.ts.map +1 -1
  45. package/lib/Socket/socket.js +143 -17
  46. package/lib/Socket/socket.js.map +1 -1
  47. package/lib/Types/Auth.d.ts +2 -0
  48. package/lib/Types/Auth.d.ts.map +1 -1
  49. package/lib/Types/Call.d.ts +10 -1
  50. package/lib/Types/Call.d.ts.map +1 -1
  51. package/lib/Types/Contact.d.ts +2 -0
  52. package/lib/Types/Contact.d.ts.map +1 -1
  53. package/lib/Types/Events.d.ts +21 -1
  54. package/lib/Types/Events.d.ts.map +1 -1
  55. package/lib/Types/GroupMetadata.d.ts +4 -0
  56. package/lib/Types/GroupMetadata.d.ts.map +1 -1
  57. package/lib/Types/Message.d.ts +530 -16
  58. package/lib/Types/Message.d.ts.map +1 -1
  59. package/lib/Types/Message.js.map +1 -1
  60. package/lib/Types/Newsletter.d.ts +37 -31
  61. package/lib/Types/Newsletter.d.ts.map +1 -1
  62. package/lib/Types/Newsletter.js +27 -23
  63. package/lib/Types/Newsletter.js.map +1 -1
  64. package/lib/Types/State.d.ts +54 -0
  65. package/lib/Types/State.d.ts.map +1 -1
  66. package/lib/Types/State.js +42 -0
  67. package/lib/Types/State.js.map +1 -1
  68. package/lib/Types/index.d.ts +9 -0
  69. package/lib/Types/index.d.ts.map +1 -1
  70. package/lib/Types/index.js.map +1 -1
  71. package/lib/Utils/browser-utils.d.ts +13 -0
  72. package/lib/Utils/browser-utils.d.ts.map +1 -1
  73. package/lib/Utils/browser-utils.js +90 -10
  74. package/lib/Utils/browser-utils.js.map +1 -1
  75. package/lib/Utils/chat-utils.d.ts +30 -0
  76. package/lib/Utils/chat-utils.d.ts.map +1 -1
  77. package/lib/Utils/chat-utils.js +81 -52
  78. package/lib/Utils/chat-utils.js.map +1 -1
  79. package/lib/Utils/companion-reg-client-utils.d.ts +17 -0
  80. package/lib/Utils/companion-reg-client-utils.d.ts.map +1 -0
  81. package/lib/Utils/companion-reg-client-utils.js +34 -0
  82. package/lib/Utils/companion-reg-client-utils.js.map +1 -0
  83. package/lib/Utils/crypto.d.ts +4 -8
  84. package/lib/Utils/crypto.d.ts.map +1 -1
  85. package/lib/Utils/crypto.js +2 -26
  86. package/lib/Utils/crypto.js.map +1 -1
  87. package/lib/Utils/decode-wa-message.d.ts +12 -0
  88. package/lib/Utils/decode-wa-message.d.ts.map +1 -1
  89. package/lib/Utils/decode-wa-message.js +16 -0
  90. package/lib/Utils/decode-wa-message.js.map +1 -1
  91. package/lib/Utils/event-buffer.js +10 -1
  92. package/lib/Utils/event-buffer.js.map +1 -1
  93. package/lib/Utils/generics.d.ts +3 -1
  94. package/lib/Utils/generics.d.ts.map +1 -1
  95. package/lib/Utils/generics.js +16 -3
  96. package/lib/Utils/generics.js.map +1 -1
  97. package/lib/Utils/history.d.ts +5 -2
  98. package/lib/Utils/history.d.ts.map +1 -1
  99. package/lib/Utils/history.js +53 -17
  100. package/lib/Utils/history.js.map +1 -1
  101. package/lib/Utils/identity-change-handler.d.ts +44 -0
  102. package/lib/Utils/identity-change-handler.d.ts.map +1 -0
  103. package/lib/Utils/identity-change-handler.js +50 -0
  104. package/lib/Utils/identity-change-handler.js.map +1 -0
  105. package/lib/Utils/index.d.ts +6 -0
  106. package/lib/Utils/index.d.ts.map +1 -1
  107. package/lib/Utils/index.js +6 -0
  108. package/lib/Utils/index.js.map +1 -1
  109. package/lib/Utils/interactive-message.d.ts +201 -0
  110. package/lib/Utils/interactive-message.d.ts.map +1 -0
  111. package/lib/Utils/interactive-message.js +256 -0
  112. package/lib/Utils/interactive-message.js.map +1 -0
  113. package/lib/Utils/lt-hash.d.ts +7 -12
  114. package/lib/Utils/lt-hash.d.ts.map +1 -1
  115. package/lib/Utils/lt-hash.js +2 -42
  116. package/lib/Utils/lt-hash.js.map +1 -1
  117. package/lib/Utils/message-composer.d.ts +5 -0
  118. package/lib/Utils/message-composer.d.ts.map +1 -0
  119. package/lib/Utils/message-composer.js +5 -0
  120. package/lib/Utils/message-composer.js.map +1 -0
  121. package/lib/Utils/message-retry-manager.d.ts +30 -2
  122. package/lib/Utils/message-retry-manager.d.ts.map +1 -1
  123. package/lib/Utils/message-retry-manager.js +59 -2
  124. package/lib/Utils/message-retry-manager.js.map +1 -1
  125. package/lib/Utils/messages-media.d.ts +19 -5
  126. package/lib/Utils/messages-media.d.ts.map +1 -1
  127. package/lib/Utils/messages-media.js +26 -17
  128. package/lib/Utils/messages-media.js.map +1 -1
  129. package/lib/Utils/messages.d.ts.map +1 -1
  130. package/lib/Utils/messages.js +433 -13
  131. package/lib/Utils/messages.js.map +1 -1
  132. package/lib/Utils/noise-handler.d.ts +2 -2
  133. package/lib/Utils/noise-handler.d.ts.map +1 -1
  134. package/lib/Utils/noise-handler.js +10 -10
  135. package/lib/Utils/noise-handler.js.map +1 -1
  136. package/lib/Utils/offline-node-processor.d.ts +17 -0
  137. package/lib/Utils/offline-node-processor.d.ts.map +1 -0
  138. package/lib/Utils/offline-node-processor.js +40 -0
  139. package/lib/Utils/offline-node-processor.js.map +1 -0
  140. package/lib/Utils/process-message.d.ts.map +1 -1
  141. package/lib/Utils/process-message.js +96 -16
  142. package/lib/Utils/process-message.js.map +1 -1
  143. package/lib/Utils/reporting-utils.js +2 -2
  144. package/lib/Utils/reporting-utils.js.map +1 -1
  145. package/lib/Utils/stanza-ack.d.ts +11 -0
  146. package/lib/Utils/stanza-ack.d.ts.map +1 -0
  147. package/lib/Utils/stanza-ack.js +38 -0
  148. package/lib/Utils/stanza-ack.js.map +1 -0
  149. package/lib/Utils/sync-action-utils.d.ts.map +1 -1
  150. package/lib/Utils/sync-action-utils.js +2 -1
  151. package/lib/Utils/sync-action-utils.js.map +1 -1
  152. package/lib/Utils/tc-token-utils.d.ts +26 -1
  153. package/lib/Utils/tc-token-utils.d.ts.map +1 -1
  154. package/lib/Utils/tc-token-utils.js +149 -4
  155. package/lib/Utils/tc-token-utils.js.map +1 -1
  156. package/lib/Utils/use-mongo-file-auth-state.d.ts +16 -0
  157. package/lib/Utils/use-mongo-file-auth-state.d.ts.map +1 -0
  158. package/lib/Utils/use-mongo-file-auth-state.js +60 -0
  159. package/lib/Utils/use-mongo-file-auth-state.js.map +1 -0
  160. package/lib/Utils/use-multi-file-auth-state.js +1 -1
  161. package/lib/Utils/use-multi-file-auth-state.js.map +1 -1
  162. package/lib/Utils/validate-connection.d.ts.map +1 -1
  163. package/lib/Utils/validate-connection.js +11 -1
  164. package/lib/Utils/validate-connection.js.map +1 -1
  165. package/lib/WABinary/generic-utils.d.ts +9 -0
  166. package/lib/WABinary/generic-utils.d.ts.map +1 -1
  167. package/lib/WABinary/generic-utils.js +23 -0
  168. package/lib/WABinary/generic-utils.js.map +1 -1
  169. package/lib/WABinary/jid-utils.js.map +1 -1
  170. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts.map +1 -1
  171. package/lib/WAUSync/Protocols/USyncContactProtocol.js +26 -3
  172. package/lib/WAUSync/Protocols/USyncContactProtocol.js.map +1 -1
  173. package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts +10 -0
  174. package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts.map +1 -0
  175. package/lib/WAUSync/Protocols/USyncUsernameProtocol.js +25 -0
  176. package/lib/WAUSync/Protocols/USyncUsernameProtocol.js.map +1 -0
  177. package/lib/WAUSync/Protocols/index.d.ts +1 -0
  178. package/lib/WAUSync/Protocols/index.d.ts.map +1 -1
  179. package/lib/WAUSync/Protocols/index.js +1 -0
  180. package/lib/WAUSync/Protocols/index.js.map +1 -1
  181. package/lib/WAUSync/USyncQuery.d.ts +1 -0
  182. package/lib/WAUSync/USyncQuery.d.ts.map +1 -1
  183. package/lib/WAUSync/USyncQuery.js +5 -1
  184. package/lib/WAUSync/USyncQuery.js.map +1 -1
  185. package/lib/WAUSync/USyncUser.d.ts +4 -0
  186. package/lib/WAUSync/USyncUser.d.ts.map +1 -1
  187. package/lib/WAUSync/USyncUser.js +8 -0
  188. package/lib/WAUSync/USyncUser.js.map +1 -1
  189. package/lib/addons/anti-delete.d.ts +72 -0
  190. package/lib/addons/anti-delete.d.ts.map +1 -0
  191. package/lib/addons/anti-delete.js +165 -0
  192. package/lib/addons/anti-delete.js.map +1 -0
  193. package/lib/addons/auto-reply.d.ts +67 -0
  194. package/lib/addons/auto-reply.d.ts.map +1 -0
  195. package/lib/addons/auto-reply.js +145 -0
  196. package/lib/addons/auto-reply.js.map +1 -0
  197. package/lib/addons/browser-presets.d.ts +16 -0
  198. package/lib/addons/browser-presets.d.ts.map +1 -0
  199. package/lib/addons/browser-presets.js +24 -0
  200. package/lib/addons/browser-presets.js.map +1 -0
  201. package/lib/addons/button-sender.d.ts +260 -0
  202. package/lib/addons/button-sender.d.ts.map +1 -0
  203. package/lib/addons/button-sender.js +771 -0
  204. package/lib/addons/button-sender.js.map +1 -0
  205. package/lib/addons/call-handler.d.ts +79 -0
  206. package/lib/addons/call-handler.d.ts.map +1 -0
  207. package/lib/addons/call-handler.js +342 -0
  208. package/lib/addons/call-handler.js.map +1 -0
  209. package/lib/addons/from-chats.d.ts +30 -0
  210. package/lib/addons/from-chats.d.ts.map +1 -0
  211. package/lib/addons/from-chats.js +38 -0
  212. package/lib/addons/from-chats.js.map +1 -0
  213. package/lib/addons/from-messages-recv.d.ts +59 -0
  214. package/lib/addons/from-messages-recv.d.ts.map +1 -0
  215. package/lib/addons/from-messages-recv.js +326 -0
  216. package/lib/addons/from-messages-recv.js.map +1 -0
  217. package/lib/addons/from-messages-send.d.ts +50 -0
  218. package/lib/addons/from-messages-send.d.ts.map +1 -0
  219. package/lib/addons/from-messages-send.js +148 -0
  220. package/lib/addons/from-messages-send.js.map +1 -0
  221. package/lib/addons/from-messages.d.ts +52 -0
  222. package/lib/addons/from-messages.d.ts.map +1 -0
  223. package/lib/addons/from-messages.js +304 -0
  224. package/lib/addons/from-messages.js.map +1 -0
  225. package/lib/addons/index.d.ts +67 -0
  226. package/lib/addons/index.d.ts.map +1 -0
  227. package/lib/addons/index.js +86 -0
  228. package/lib/addons/index.js.map +1 -0
  229. package/lib/addons/interactive-message.d.ts +201 -0
  230. package/lib/addons/interactive-message.d.ts.map +1 -0
  231. package/lib/addons/interactive-message.js +256 -0
  232. package/lib/addons/interactive-message.js.map +1 -0
  233. package/lib/addons/jid-plot.d.ts +49 -0
  234. package/lib/addons/jid-plot.d.ts.map +1 -0
  235. package/lib/addons/jid-plot.js +84 -0
  236. package/lib/addons/jid-plot.js.map +1 -0
  237. package/lib/addons/jid-plotting.d.ts +54 -0
  238. package/lib/addons/jid-plotting.d.ts.map +1 -0
  239. package/lib/addons/jid-plotting.js +150 -0
  240. package/lib/addons/jid-plotting.js.map +1 -0
  241. package/lib/addons/lid-support.d.ts +41 -0
  242. package/lib/addons/lid-support.d.ts.map +1 -0
  243. package/lib/addons/lid-support.js +42 -0
  244. package/lib/addons/lid-support.js.map +1 -0
  245. package/lib/addons/message-composer.d.ts +142 -0
  246. package/lib/addons/message-composer.d.ts.map +1 -0
  247. package/lib/addons/message-composer.js +377 -0
  248. package/lib/addons/message-composer.js.map +1 -0
  249. package/lib/addons/message-scheduler.d.ts +77 -0
  250. package/lib/addons/message-scheduler.d.ts.map +1 -0
  251. package/lib/addons/message-scheduler.js +108 -0
  252. package/lib/addons/message-scheduler.js.map +1 -0
  253. package/lib/addons/message-search.d.ts +51 -0
  254. package/lib/addons/message-search.d.ts.map +1 -0
  255. package/lib/addons/message-search.js +171 -0
  256. package/lib/addons/message-search.js.map +1 -0
  257. package/lib/addons/message-utils.d.ts +88 -0
  258. package/lib/addons/message-utils.d.ts.map +1 -0
  259. package/lib/addons/message-utils.js +292 -0
  260. package/lib/addons/message-utils.js.map +1 -0
  261. package/lib/addons/outgoing-calls.d.ts +64 -0
  262. package/lib/addons/outgoing-calls.d.ts.map +1 -0
  263. package/lib/addons/outgoing-calls.js +139 -0
  264. package/lib/addons/outgoing-calls.js.map +1 -0
  265. package/lib/addons/pairing-fix.d.ts +31 -0
  266. package/lib/addons/pairing-fix.d.ts.map +1 -0
  267. package/lib/addons/pairing-fix.js +74 -0
  268. package/lib/addons/pairing-fix.js.map +1 -0
  269. package/lib/addons/past-participants.d.ts +42 -0
  270. package/lib/addons/past-participants.d.ts.map +1 -0
  271. package/lib/addons/past-participants.js +41 -0
  272. package/lib/addons/past-participants.js.map +1 -0
  273. package/lib/addons/rich-response.d.ts +111 -0
  274. package/lib/addons/rich-response.d.ts.map +1 -0
  275. package/lib/addons/rich-response.js +152 -0
  276. package/lib/addons/rich-response.js.map +1 -0
  277. package/lib/addons/scheduling.d.ts +41 -0
  278. package/lib/addons/scheduling.d.ts.map +1 -0
  279. package/lib/addons/scheduling.js +110 -0
  280. package/lib/addons/scheduling.js.map +1 -0
  281. package/lib/addons/status-posting.d.ts +177 -0
  282. package/lib/addons/status-posting.d.ts.map +1 -0
  283. package/lib/addons/status-posting.js +240 -0
  284. package/lib/addons/status-posting.js.map +1 -0
  285. package/lib/addons/stickerpack.d.ts +37 -0
  286. package/lib/addons/stickerpack.d.ts.map +1 -0
  287. package/lib/addons/stickerpack.js +39 -0
  288. package/lib/addons/stickerpack.js.map +1 -0
  289. package/lib/addons/templates.d.ts +72 -0
  290. package/lib/addons/templates.d.ts.map +1 -0
  291. package/lib/addons/templates.js +145 -0
  292. package/lib/addons/templates.js.map +1 -0
  293. package/lib/addons/vcard.d.ts +59 -0
  294. package/lib/addons/vcard.d.ts.map +1 -0
  295. package/lib/addons/vcard.js +88 -0
  296. package/lib/addons/vcard.js.map +1 -0
  297. package/lib/index.d.ts +1 -0
  298. package/lib/index.d.ts.map +1 -1
  299. package/lib/index.js +1 -0
  300. package/lib/index.js.map +1 -1
  301. package/package.json +5 -3
@@ -21,6 +21,8 @@ export type WAMessageKey = proto.IMessageKey & {
21
21
  server_id?: string;
22
22
  addressingMode?: string;
23
23
  isViewOnce?: boolean;
24
+ remoteJidUsername?: string;
25
+ participantUsername?: string;
24
26
  };
25
27
  export type WATextMessage = proto.Message.IExtendedTextMessage;
26
28
  export type WAContextInfo = proto.IContextInfo;
@@ -70,6 +72,8 @@ export interface WAUrlInfo {
70
72
  type Mentionable = {
71
73
  /** list of jids that are mentioned in the accompanying text */
72
74
  mentions?: string[];
75
+ /** mention all */
76
+ mentionAll?: boolean;
73
77
  };
74
78
  type Contextable = {
75
79
  /** add contextInfo to the message */
@@ -81,10 +85,371 @@ type ViewOnce = {
81
85
  type Editable = {
82
86
  edit?: WAMessageKey;
83
87
  };
88
+ /** Send image/video at HD quality */
89
+ type HDable = {
90
+ hd?: boolean;
91
+ };
92
+ /** Attach classic buttons (up to 3) to a text or media message */
93
+ type Buttonable = {
94
+ buttons?: proto.Message.ButtonsMessage.IButton[];
95
+ };
96
+ /** Attach template buttons (quickReply / url / call) to a message */
97
+ type Templatable = {
98
+ templateButtons?: proto.IHydratedTemplateButton[];
99
+ footer?: string;
100
+ };
101
+ /** Attach native-flow interactive buttons to a message */
102
+ type Interactiveable = {
103
+ interactiveButtons?: proto.Message.InteractiveMessage.NativeFlowMessage.INativeFlowButton[];
104
+ title?: string;
105
+ subtitle?: string;
106
+ footer?: string;
107
+ hasMediaAttachment?: boolean;
108
+ };
109
+ /** Attach a single-select list to a text message */
110
+ type Listable = {
111
+ sections?: proto.Message.ListMessage.ISection[];
112
+ /** Title shown above the list */
113
+ title?: string;
114
+ /** Label on the button that opens the list (required) */
115
+ buttonText?: string;
116
+ footer?: string;
117
+ };
118
+ /** Attach a WhatsApp Shop storefront to a message */
119
+ type Shopable = {
120
+ shop?: proto.Message.InteractiveMessage.IShopMessage;
121
+ title?: string;
122
+ subtitle?: string;
123
+ footer?: string;
124
+ hasMediaAttachment?: boolean;
125
+ };
126
+ /** Attach a WhatsApp Collection to a message */
127
+ type Collectionable = {
128
+ collection?: proto.Message.InteractiveMessage.ICollectionMessage;
129
+ title?: string;
130
+ subtitle?: string;
131
+ footer?: string;
132
+ hasMediaAttachment?: boolean;
133
+ };
134
+ /** Attach a carousel of cards to a message */
135
+ type Cardsable = {
136
+ cards?: Carousel[];
137
+ title?: string;
138
+ subtitle?: string;
139
+ footer?: string;
140
+ };
84
141
  type WithDimensions = {
85
142
  width?: number;
86
143
  height?: number;
87
144
  };
145
+ export type AlbumMessageOptions = {
146
+ /** Number of images expected in the album */
147
+ expectedImageCount?: number;
148
+ /** Number of videos expected in the album */
149
+ expectedVideoCount?: number;
150
+ };
151
+ export type KeepMessageOptions = {
152
+ /** The message key to keep */
153
+ key: proto.IMessageKey;
154
+ /** Keep duration in seconds (86400 = 24h, 604800 = 7d, 0 = unkeep) */
155
+ keepDurationSeconds?: number;
156
+ };
157
+ export type ButtonContent = {
158
+ /** Button display text */
159
+ displayText: string;
160
+ /** Button ID */
161
+ id: string;
162
+ /** Button type */
163
+ type?: 'reply' | 'url' | 'call' | 'copy';
164
+ /** URL for url-type buttons */
165
+ url?: string;
166
+ /** Phone number for call-type buttons */
167
+ phoneNumber?: string;
168
+ /** Text to copy for copy-type buttons */
169
+ copyCode?: string;
170
+ };
171
+ export type ButtonsMessageOptions = {
172
+ /** Message body text */
173
+ text: string;
174
+ /** Footer text */
175
+ footer?: string;
176
+ /** Header text */
177
+ headerText?: string;
178
+ /** Buttons to display */
179
+ buttons: ButtonContent[];
180
+ /** Header type: text | image | video | document */
181
+ headerType?: 'text' | 'image' | 'video' | 'document';
182
+ /** Media for header */
183
+ headerMedia?: WAMediaUpload;
184
+ };
185
+ export type ListMessageSection = {
186
+ title: string;
187
+ rows: {
188
+ title: string;
189
+ rowId: string;
190
+ description?: string;
191
+ }[];
192
+ };
193
+ export type ListMessageOptions = {
194
+ text: string;
195
+ footer?: string;
196
+ title?: string;
197
+ buttonText: string;
198
+ sections: ListMessageSection[];
199
+ };
200
+ export type TemplateButtonContent = {
201
+ index: number;
202
+ urlButton: {
203
+ displayText: string;
204
+ url: string;
205
+ };
206
+ } | {
207
+ index: number;
208
+ callButton: {
209
+ displayText: string;
210
+ phoneNumber: string;
211
+ };
212
+ } | {
213
+ index: number;
214
+ quickReplyButton: {
215
+ displayText: string;
216
+ id: string;
217
+ };
218
+ };
219
+ export type TemplateMessageOptions = {
220
+ text: string;
221
+ footer?: string;
222
+ templateButtons: TemplateButtonContent[];
223
+ /** Optional header: text, image, video, document */
224
+ header?: string;
225
+ headerMedia?: WAMediaUpload;
226
+ };
227
+ type InteractiveButton = {
228
+ type: 'reply';
229
+ displayText: string;
230
+ id: string;
231
+ } | {
232
+ type: 'url';
233
+ displayText: string;
234
+ url: string;
235
+ merchantUrl?: string;
236
+ } | {
237
+ type: 'cta_call';
238
+ displayText: string;
239
+ phoneNumber: string;
240
+ } | {
241
+ type: 'cta_copy';
242
+ displayText: string;
243
+ copyCode: string;
244
+ };
245
+ export type CarouselCard = {
246
+ body: string;
247
+ footer?: string;
248
+ headerImage?: WAMediaUpload;
249
+ headerVideo?: WAMediaUpload;
250
+ buttons: InteractiveButton[];
251
+ };
252
+ export type InteractiveMessageOptions = {
253
+ body: string;
254
+ footer?: string;
255
+ /** Header options */
256
+ header?: {
257
+ title?: string;
258
+ subtitle?: string;
259
+ hasMediaAttachment?: boolean;
260
+ };
261
+ /** Buttons (for native-flow / button-list style) */
262
+ buttons?: InteractiveButton[];
263
+ /** Carousel cards */
264
+ cards?: CarouselCard[];
265
+ /** Products list */
266
+ shop?: {
267
+ id: string;
268
+ thumbnail?: WAMediaUpload;
269
+ title?: string;
270
+ };
271
+ };
272
+ export type InteractiveMessagePIXOptions = InteractiveMessageOptions & {
273
+ /** PIX payment key */
274
+ pixKey: string;
275
+ /** Payment amount in cents */
276
+ amount: number;
277
+ /** Merchant name */
278
+ merchantName: string;
279
+ };
280
+ export type InteractiveMessagePAYOptions = InteractiveMessageOptions & {
281
+ /** Payment amount */
282
+ amount: number;
283
+ /** Currency code, e.g. "BRL" */
284
+ currency: string;
285
+ /** Reference ID */
286
+ referenceId?: string;
287
+ /** Payment note */
288
+ note?: string;
289
+ };
290
+ export type PaymentMessageOptions = {
291
+ /** Amount in smallest currency unit (e.g. cents) */
292
+ amount: number;
293
+ /** Currency code (e.g. "USD", "BRL") */
294
+ currency: string;
295
+ /** Note/memo for the payment */
296
+ note?: string;
297
+ /** Receiver JID */
298
+ receiverJid: string;
299
+ /** Request or send */
300
+ type?: 'request' | 'send';
301
+ /** Background color (hex) */
302
+ backgroundColor?: string;
303
+ };
304
+ export type PaymentInviteInfoo = {
305
+ type?: number;
306
+ expiry?: number;
307
+ };
308
+ export type PaymentInviteMessageOptions = {
309
+ /** Type of payment service */
310
+ serviceType: 'UNKNOWN' | 'FACEBOOK_PAY' | 'NOVI' | 'UPI' | 'PAYTM' | 'BR_GPY' | 'BR_PIX';
311
+ /** Expiry timestamp (ms since epoch) */
312
+ expiryTimestamp?: number;
313
+ };
314
+ export type OrderMessageOptions = {
315
+ /** Order ID */
316
+ orderId: string;
317
+ /** Thumbnail image of an order item */
318
+ thumbnail?: WAMediaUpload;
319
+ /** Item count */
320
+ itemCount: number;
321
+ /** Order status */
322
+ status?: 'INQUIRY' | 'ACCEPTED' | 'DECLINED' | 'EXPIRED' | 'CANCELED';
323
+ /** Surface (e.g. 1 = catalog, 2 = message) */
324
+ surface?: number;
325
+ /** Message associated with the order */
326
+ message?: string;
327
+ /** Order title */
328
+ title?: string;
329
+ /** Seller JID */
330
+ sellerJid?: string;
331
+ /** Token */
332
+ token?: string;
333
+ };
334
+ /**
335
+ * Individual sticker within a sticker pack (V1 style)
336
+ */
337
+ export type Sticker = {
338
+ /** Sticker media source */
339
+ data: WAMediaUpload;
340
+ /** Emoji tags for this sticker */
341
+ emojis?: string[];
342
+ /** Accessibility label */
343
+ accessibilityLabel?: string;
344
+ };
345
+ /**
346
+ * Individual sticker within a sticker pack (V2 style)
347
+ */
348
+ export type StickerPackStickerr = {
349
+ sticker: WAMediaUpload;
350
+ emojis?: string[];
351
+ accessibilityLabel?: string;
352
+ isAnimated?: boolean;
353
+ isLottie?: boolean;
354
+ };
355
+ /**
356
+ * Full sticker pack definition (Merged V1/V2)
357
+ */
358
+ export type StickerPackk = {
359
+ /** All stickers in the pack (V1 uses Sticker[], V2 uses StickerPackSticker[]) */
360
+ stickers: StickerPackSticker[] | Sticker[];
361
+ /** Cover sticker shown in the tray */
362
+ cover: WAMediaUpload;
363
+ /** Display name of the pack */
364
+ name: string;
365
+ /** Publisher name */
366
+ publisher: string;
367
+ /** Optional description */
368
+ description?: string;
369
+ /** Pack ID — auto-generated if not provided */
370
+ packId?: string;
371
+ };
372
+ export type StickerPackMessageOptions = {
373
+ /** Pack name */
374
+ packName: string;
375
+ /** Pack publisher */
376
+ publisher?: string;
377
+ /** Pack ID */
378
+ packId?: string;
379
+ /** Sticker count */
380
+ stickerCount?: number;
381
+ };
382
+ export type StatusMentionOptions = {
383
+ /** Status JIDs to mention */
384
+ statusJidList: string[];
385
+ /** Text to accompany */
386
+ text: string;
387
+ /** Background color */
388
+ backgroundColor?: string;
389
+ /** Font */
390
+ font?: number;
391
+ };
392
+ export type ShopMessageOptions = {
393
+ /** Surface: 1=unknown, 2=catalog */
394
+ surface?: number;
395
+ /** Message */
396
+ message?: string;
397
+ };
398
+ export type CollectionMessageOptions = {
399
+ /** Business JID owning the collection */
400
+ bizJid: string;
401
+ /** Collection ID */
402
+ id: string;
403
+ /** Message version */
404
+ messageVersion?: number;
405
+ };
406
+ export type RichTextTable = {
407
+ /** Table data rows (first row = header if headerRow=true) */
408
+ rows: string[][];
409
+ /** Whether first row is a header */
410
+ headerRow?: boolean;
411
+ /** Optional title */
412
+ title?: string;
413
+ };
414
+ export type RichTextList = {
415
+ /** List items */
416
+ items: string[];
417
+ /** Ordered (numbered) list */
418
+ ordered?: boolean;
419
+ /** Optional title */
420
+ title?: string;
421
+ };
422
+ export type CodeBlockOptions = {
423
+ /** Code string */
424
+ code: string;
425
+ /** Language hint */
426
+ language?: string;
427
+ };
428
+ export type LatexOptions = {
429
+ /** LaTeX expression */
430
+ expression: string;
431
+ };
432
+ export type RichMessageOptions = {
433
+ /** Rich text content parts */
434
+ parts: ({
435
+ type: 'text';
436
+ text: string;
437
+ } | {
438
+ type: 'table';
439
+ table: RichTextTable;
440
+ } | {
441
+ type: 'list';
442
+ list: RichTextList;
443
+ } | {
444
+ type: 'code';
445
+ code: CodeBlockOptions;
446
+ } | {
447
+ type: 'latex';
448
+ latex: LatexOptions;
449
+ })[];
450
+ /** Optional caption */
451
+ caption?: string;
452
+ };
88
453
  export type PollMessageOptions = {
89
454
  name: string;
90
455
  selectableCount?: number;
@@ -92,6 +457,11 @@ export type PollMessageOptions = {
92
457
  /** 32 byte message secret to encrypt poll selections */
93
458
  messageSecret?: Uint8Array;
94
459
  toAnnouncementGroup?: boolean;
460
+ /**
461
+ * Poll content type — used for newsletter polls meta node.
462
+ * 1 = TEXT (default), 2 = IMAGE
463
+ */
464
+ pollContentType?: 1 | 2;
95
465
  };
96
466
  export type EventMessageOptions = {
97
467
  name: string;
@@ -115,14 +485,14 @@ export type AnyMediaMessageContent = (({
115
485
  image: WAMediaUpload;
116
486
  caption?: string;
117
487
  jpegThumbnail?: string;
118
- } & Mentionable & Contextable & WithDimensions) | ({
488
+ } & Mentionable & Contextable & Buttonable & Templatable & Interactiveable & Shopable & Collectionable & HDable & WithDimensions) | ({
119
489
  video: WAMediaUpload;
120
490
  caption?: string;
121
491
  gifPlayback?: boolean;
122
492
  jpegThumbnail?: string;
123
493
  /** if set to true, will send as a `video note` */
124
494
  ptv?: boolean;
125
- } & Mentionable & Contextable & WithDimensions) | {
495
+ } & Mentionable & Contextable & Buttonable & Templatable & Interactiveable & Shopable & Collectionable & HDable & WithDimensions) | {
126
496
  audio: WAMediaUpload;
127
497
  /** if set to true, will send as a `voice note` */
128
498
  ptt?: boolean;
@@ -136,13 +506,25 @@ export type AnyMediaMessageContent = (({
136
506
  mimetype: string;
137
507
  fileName?: string;
138
508
  caption?: string;
139
- } & Contextable)) & {
509
+ } & Contextable & Buttonable & Templatable & Interactiveable & Shopable & Collectionable)) & {
140
510
  mimetype?: string;
141
- } & Editable;
511
+ } & Editable & {
512
+ /** key of the parent albumMessage to associate this media with */
513
+ albumParentKey?: WAMessageKey;
514
+ };
515
+ /** Info for replying to a button */
142
516
  export type ButtonReplyInfo = {
143
- displayText: string;
144
- id: string;
145
- index: number;
517
+ displayText?: string;
518
+ id?: string;
519
+ index?: number;
520
+ title?: string;
521
+ description?: string;
522
+ rowId?: string;
523
+ nativeFlows?: {
524
+ name: string;
525
+ paramsJson: string;
526
+ version?: number;
527
+ };
146
528
  };
147
529
  export type GroupInviteInfo = {
148
530
  inviteCode: string;
@@ -154,14 +536,65 @@ export type GroupInviteInfo = {
154
536
  export type WASendableProduct = Omit<proto.Message.ProductMessage.IProductSnapshot, 'productImage'> & {
155
537
  productImage: WAMediaUpload;
156
538
  };
539
+ /** One card / slide in a carousel message */
540
+ export type Carousel = {
541
+ image?: WAMediaUpload;
542
+ video?: WAMediaUpload;
543
+ document?: WAMediaUpload;
544
+ mimetype?: string;
545
+ fileName?: string;
546
+ product?: WASendableProduct;
547
+ title?: string;
548
+ body?: string;
549
+ footer?: string;
550
+ buttons?: proto.Message.InteractiveMessage.NativeFlowMessage.INativeFlowButton[];
551
+ };
552
+ /** Product entry for productList messages */
553
+ export type ProductListEntry = {
554
+ productId: string;
555
+ };
556
+ export type ProductListSection = {
557
+ title: string;
558
+ products: ProductListEntry[];
559
+ };
560
+ export type StickerPackSticker = {
561
+ sticker: WAMediaUpload;
562
+ emojis?: string[];
563
+ accessibilityLabel?: string;
564
+ isAnimated?: boolean;
565
+ isLottie?: boolean;
566
+ };
567
+ export type StickerPack = {
568
+ stickers: StickerPackSticker[];
569
+ cover: WAMediaUpload;
570
+ name: string;
571
+ publisher: string;
572
+ description?: string;
573
+ packId?: string;
574
+ };
575
+ export type AdminInviteInfo = {
576
+ jid: string;
577
+ name: string;
578
+ caption?: string;
579
+ expiration?: number;
580
+ };
581
+ export type CallCreationInfo = {
582
+ name?: string;
583
+ time?: number;
584
+ type?: number;
585
+ };
586
+ export type PaymentInviteInfo = {
587
+ type?: number;
588
+ expiry?: number;
589
+ };
157
590
  export type AnyRegularMessageContent = (({
158
591
  text: string;
159
592
  linkPreview?: WAUrlInfo | null;
160
- } & Mentionable & Contextable & Editable) | AnyMediaMessageContent | {
593
+ } & Mentionable & Contextable & Buttonable & Templatable & Interactiveable & Shopable & Collectionable & Cardsable & Listable & Editable) | AnyMediaMessageContent | {
161
594
  event: EventMessageOptions;
162
595
  } | ({
163
596
  poll: PollMessageOptions;
164
- } & Mentionable & Contextable & Editable) | {
597
+ } & Mentionable & Contextable & Buttonable & Templatable & Interactiveable & Shopable & Collectionable & Cardsable & Listable & Editable) | {
165
598
  contacts: {
166
599
  displayName?: string;
167
600
  contacts: proto.Message.IContactMessage[];
@@ -172,7 +605,7 @@ export type AnyRegularMessageContent = (({
172
605
  react: proto.Message.IReactionMessage;
173
606
  } | {
174
607
  buttonReply: ButtonReplyInfo;
175
- type: 'template' | 'plain';
608
+ type: 'template' | 'plain' | 'list' | 'interactive';
176
609
  } | {
177
610
  groupInvite: GroupInviteInfo;
178
611
  } | {
@@ -189,7 +622,68 @@ export type AnyRegularMessageContent = (({
189
622
  businessOwnerJid?: string;
190
623
  body?: string;
191
624
  footer?: string;
192
- } | SharePhoneNumber | RequestPhoneNumber) & ViewOnce;
625
+ /** attach interactive buttons to a product message */
626
+ interactiveButtons?: proto.Message.InteractiveMessage.NativeFlowMessage.INativeFlowButton[];
627
+ title?: string;
628
+ subtitle?: string;
629
+ hasMediaAttachment?: boolean;
630
+ } | {
631
+ /** productList — renders as a List Message with products */
632
+ productList: ProductListSection[];
633
+ text?: string;
634
+ title?: string;
635
+ buttonText?: string;
636
+ footer?: string;
637
+ businessOwnerJid?: string;
638
+ thumbnail?: WAMediaUpload | string;
639
+ } | SharePhoneNumber | RequestPhoneNumber | ({
640
+ album: AlbumMessageOptions;
641
+ } & Contextable & Mentionable) | {
642
+ stickerPack: StickerPack;
643
+ } | {
644
+ adminInvite: AdminInviteInfo;
645
+ } | {
646
+ call: CallCreationInfo;
647
+ } | {
648
+ paymentInvite: PaymentInviteInfo;
649
+ } | {
650
+ keep: KeepMessageOptions;
651
+ } | {
652
+ order: OrderMessageOptions;
653
+ } | {
654
+ payment: PaymentMessageOptions;
655
+ } | {
656
+ paymentInvite: PaymentInviteInfo | PaymentInviteMessageOptions;
657
+ } | {
658
+ interactive: InteractiveMessageOptions;
659
+ } | {
660
+ interactivePIX: InteractiveMessagePIXOptions;
661
+ } | {
662
+ interactivePAY: InteractiveMessagePAYOptions;
663
+ } | {
664
+ statusMention: StatusMentionOptions;
665
+ } | {
666
+ collection: CollectionMessageOptions;
667
+ } | {
668
+ hdImage: WAMediaUpload;
669
+ caption?: string;
670
+ mimetype?: string;
671
+ } | {
672
+ hdVideo: WAMediaUpload;
673
+ caption?: string;
674
+ mimetype?: string;
675
+ } | {
676
+ callMessage: proto.Message.IScheduledCallCreationMessage;
677
+ } | {
678
+ pollResult: proto.Message.IPollResultSnapshotMessage;
679
+ } | {
680
+ richResponse: {
681
+ text: string;
682
+ code?: string;
683
+ language?: string;
684
+ botJid?: string;
685
+ };
686
+ }) & ViewOnce;
193
687
  export type AnyMessageContent = AnyRegularMessageContent | {
194
688
  forward: WAMessage;
195
689
  force?: boolean;
@@ -200,6 +694,15 @@ export type AnyMessageContent = AnyRegularMessageContent | {
200
694
  disappearingMessagesInChat: boolean | number;
201
695
  } | {
202
696
  limitSharing: boolean;
697
+ } | {
698
+ /**
699
+ * Send as a group status (story visible to group members).
700
+ * Set to `true` to wrap the message in groupStatusMessageV2.
701
+ * The jid should be a group JID (e.g. `120363xxxxxxxx@g.us`).
702
+ * @example
703
+ * await sock.sendMessage('120363xxx@g.us', { text: 'Hello group!', groupStatus: true })
704
+ */
705
+ groupStatus: boolean;
203
706
  };
204
707
  export type GroupMetadataParticipants = Pick<GroupMetadata, 'participants'>;
205
708
  type MinimalRelayOptions = {
@@ -241,17 +744,28 @@ export type MiscMessageGenerationOptions = MinimalRelayOptions & {
241
744
  font?: number;
242
745
  /** if it is broadcast */
243
746
  broadcast?: boolean;
747
+ /** if the message is for a newsletter */
748
+ newsletter?: boolean;
749
+ /** additional binary nodes to attach to the message */
750
+ additionalNodes?: BinaryNode[];
751
+ /** if true, show AI icon on the message bubble */
752
+ ai?: boolean;
244
753
  };
245
754
  export type MessageGenerationOptionsFromContent = MiscMessageGenerationOptions & {
246
755
  userJid: string;
247
756
  };
248
- export type WAMediaUploadFunction = (encFilePath: string, opts: {
757
+ export type WAMediaUploadFunctionOpts = {
249
758
  fileEncSha256B64: string;
250
759
  mediaType: MediaType;
760
+ newsletter?: boolean;
251
761
  timeoutMs?: number;
252
- }) => Promise<{
762
+ };
763
+ export type WAMediaUploadFunction = (encFilePath: string, opts: WAMediaUploadFunctionOpts) => Promise<{
253
764
  mediaUrl: string;
254
765
  directPath: string;
766
+ thumbnailDirectPath?: string;
767
+ thumbnailSha256?: string;
768
+ handle?: string;
255
769
  meta_hmac?: string;
256
770
  ts?: number;
257
771
  fbid?: number;
@@ -297,9 +811,9 @@ export type MessageUserReceiptUpdate = {
297
811
  receipt: MessageUserReceipt;
298
812
  };
299
813
  export type MediaDecryptionKeyInfo = {
300
- iv: Buffer;
301
- cipherKey: Buffer;
302
- macKey?: Buffer;
814
+ iv: Uint8Array;
815
+ cipherKey: Uint8Array;
816
+ macKey?: Uint8Array;
303
817
  };
304
818
  export type MinimalMessage = Pick<WAMessage, 'key' | 'messageTimestamp'>;
305
819
  //# sourceMappingURL=Message.d.ts.map