@zhuxee/baileys 0.0.0-stage → 0.3.19

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 (431) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +2085 -2
  3. package/README.md.bak +2077 -0
  4. package/WAProto/index.d.ts +15932 -0
  5. package/WAProto/index.js +115856 -0
  6. package/engine-requirements.js +13 -0
  7. package/lib/Defaults/index.d.ts +145 -0
  8. package/lib/Defaults/index.d.ts.map +1 -0
  9. package/lib/Defaults/index.js +152 -0
  10. package/lib/Defaults/index.js.map +1 -0
  11. package/lib/Signal/Group/ciphertext-message.d.ts +10 -0
  12. package/lib/Signal/Group/ciphertext-message.d.ts.map +1 -0
  13. package/lib/Signal/Group/ciphertext-message.js +12 -0
  14. package/lib/Signal/Group/ciphertext-message.js.map +1 -0
  15. package/lib/Signal/Group/group-session-builder.d.ts +8 -0
  16. package/lib/Signal/Group/group-session-builder.d.ts.map +1 -0
  17. package/lib/Signal/Group/group-session-builder.js +30 -0
  18. package/lib/Signal/Group/group-session-builder.js.map +1 -0
  19. package/lib/Signal/Group/group_cipher.d.ts +11 -0
  20. package/lib/Signal/Group/group_cipher.d.ts.map +1 -0
  21. package/lib/Signal/Group/group_cipher.js +82 -0
  22. package/lib/Signal/Group/group_cipher.js.map +1 -0
  23. package/lib/Signal/Group/index.d.ts +12 -0
  24. package/lib/Signal/Group/index.d.ts.map +1 -0
  25. package/lib/Signal/Group/index.js +12 -0
  26. package/lib/Signal/Group/index.js.map +1 -0
  27. package/lib/Signal/Group/keyhelper.d.ts +7 -0
  28. package/lib/Signal/Group/keyhelper.d.ts.map +1 -0
  29. package/lib/Signal/Group/keyhelper.js +18 -0
  30. package/lib/Signal/Group/keyhelper.js.map +1 -0
  31. package/lib/Signal/Group/sender-chain-key.d.ts +14 -0
  32. package/lib/Signal/Group/sender-chain-key.d.ts.map +1 -0
  33. package/lib/Signal/Group/sender-chain-key.js +26 -0
  34. package/lib/Signal/Group/sender-chain-key.js.map +1 -0
  35. package/lib/Signal/Group/sender-key-distribution-message.d.ts +17 -0
  36. package/lib/Signal/Group/sender-key-distribution-message.d.ts.map +1 -0
  37. package/lib/Signal/Group/sender-key-distribution-message.js +63 -0
  38. package/lib/Signal/Group/sender-key-distribution-message.js.map +1 -0
  39. package/lib/Signal/Group/sender-key-message.d.ts +19 -0
  40. package/lib/Signal/Group/sender-key-message.d.ts.map +1 -0
  41. package/lib/Signal/Group/sender-key-message.js +66 -0
  42. package/lib/Signal/Group/sender-key-message.js.map +1 -0
  43. package/lib/Signal/Group/sender-key-name.d.ts +12 -0
  44. package/lib/Signal/Group/sender-key-name.d.ts.map +1 -0
  45. package/lib/Signal/Group/sender-key-name.js +48 -0
  46. package/lib/Signal/Group/sender-key-name.js.map +1 -0
  47. package/lib/Signal/Group/sender-key-record.d.ts +13 -0
  48. package/lib/Signal/Group/sender-key-record.d.ts.map +1 -0
  49. package/lib/Signal/Group/sender-key-record.js +41 -0
  50. package/lib/Signal/Group/sender-key-record.js.map +1 -0
  51. package/lib/Signal/Group/sender-key-state.d.ts +17 -0
  52. package/lib/Signal/Group/sender-key-state.d.ts.map +1 -0
  53. package/lib/Signal/Group/sender-key-state.js +84 -0
  54. package/lib/Signal/Group/sender-key-state.js.map +1 -0
  55. package/lib/Signal/Group/sender-message-key.d.ts +12 -0
  56. package/lib/Signal/Group/sender-message-key.d.ts.map +1 -0
  57. package/lib/Signal/Group/sender-message-key.js +26 -0
  58. package/lib/Signal/Group/sender-message-key.js.map +1 -0
  59. package/lib/Signal/libsignal.d.ts +55 -0
  60. package/lib/Signal/libsignal.d.ts.map +1 -0
  61. package/lib/Signal/libsignal.js +431 -0
  62. package/lib/Signal/libsignal.js.map +1 -0
  63. package/lib/Signal/lid-mapping.d.ts +21 -0
  64. package/lib/Signal/lid-mapping.d.ts.map +1 -0
  65. package/lib/Signal/lid-mapping.js +277 -0
  66. package/lib/Signal/lid-mapping.js.map +1 -0
  67. package/lib/Socket/Client/index.d.ts +3 -0
  68. package/lib/Socket/Client/index.d.ts.map +1 -0
  69. package/lib/Socket/Client/index.js +3 -0
  70. package/lib/Socket/Client/index.js.map +1 -0
  71. package/lib/Socket/Client/types.d.ts +6 -0
  72. package/lib/Socket/Client/types.d.ts.map +1 -0
  73. package/lib/Socket/Client/types.js +11 -0
  74. package/lib/Socket/Client/types.js.map +1 -0
  75. package/lib/Socket/Client/websocket.d.ts +13 -0
  76. package/lib/Socket/Client/websocket.d.ts.map +1 -0
  77. package/lib/Socket/Client/websocket.js +54 -0
  78. package/lib/Socket/Client/websocket.js.map +1 -0
  79. package/lib/Socket/business.d.ts +395 -0
  80. package/lib/Socket/business.d.ts.map +1 -0
  81. package/lib/Socket/business.js +380 -0
  82. package/lib/Socket/business.js.map +1 -0
  83. package/lib/Socket/chats.d.ts +144 -0
  84. package/lib/Socket/chats.d.ts.map +1 -0
  85. package/lib/Socket/chats.js +1219 -0
  86. package/lib/Socket/chats.js.map +1 -0
  87. package/lib/Socket/communities.d.ts +562 -0
  88. package/lib/Socket/communities.d.ts.map +1 -0
  89. package/lib/Socket/communities.js +432 -0
  90. package/lib/Socket/communities.js.map +1 -0
  91. package/lib/Socket/groups.d.ts +286 -0
  92. package/lib/Socket/groups.d.ts.map +1 -0
  93. package/lib/Socket/groups.js +348 -0
  94. package/lib/Socket/groups.js.map +1 -0
  95. package/lib/Socket/index.d.ts +530 -0
  96. package/lib/Socket/index.d.ts.map +1 -0
  97. package/lib/Socket/index.js +12 -0
  98. package/lib/Socket/index.js.map +1 -0
  99. package/lib/Socket/messages-recv.d.ts +334 -0
  100. package/lib/Socket/messages-recv.d.ts.map +1 -0
  101. package/lib/Socket/messages-recv.js +1772 -0
  102. package/lib/Socket/messages-recv.js.map +1 -0
  103. package/lib/Socket/messages-send.d.ts +330 -0
  104. package/lib/Socket/messages-send.d.ts.map +1 -0
  105. package/lib/Socket/messages-send.js +1368 -0
  106. package/lib/Socket/messages-send.js.map +1 -0
  107. package/lib/Socket/mex.d.ts +2 -0
  108. package/lib/Socket/mex.d.ts.map +1 -0
  109. package/lib/Socket/mex.js +42 -0
  110. package/lib/Socket/mex.js.map +1 -0
  111. package/lib/Socket/newsletter.d.ts +283 -0
  112. package/lib/Socket/newsletter.d.ts.map +1 -0
  113. package/lib/Socket/newsletter.js +226 -0
  114. package/lib/Socket/newsletter.js.map +1 -0
  115. package/lib/Socket/socket.d.ts +61 -0
  116. package/lib/Socket/socket.d.ts.map +1 -0
  117. package/lib/Socket/socket.js +970 -0
  118. package/lib/Socket/socket.js.map +1 -0
  119. package/lib/Store/index.d.ts +4 -0
  120. package/lib/Store/index.d.ts.map +1 -0
  121. package/lib/Store/index.js +4 -0
  122. package/lib/Store/index.js.map +1 -0
  123. package/lib/Store/make-in-memory-store.d.ts +63 -0
  124. package/lib/Store/make-in-memory-store.d.ts.map +1 -0
  125. package/lib/Store/make-in-memory-store.js +421 -0
  126. package/lib/Store/make-in-memory-store.js.map +1 -0
  127. package/lib/Store/make-ordered-dictionary.d.ts +13 -0
  128. package/lib/Store/make-ordered-dictionary.d.ts.map +1 -0
  129. package/lib/Store/make-ordered-dictionary.js +79 -0
  130. package/lib/Store/make-ordered-dictionary.js.map +1 -0
  131. package/lib/Store/object-repository.d.ts +11 -0
  132. package/lib/Store/object-repository.d.ts.map +1 -0
  133. package/lib/Store/object-repository.js +24 -0
  134. package/lib/Store/object-repository.js.map +1 -0
  135. package/lib/Types/Auth.d.ts +2 -0
  136. package/lib/Types/Auth.d.ts.map +1 -0
  137. package/lib/Types/Auth.js +2 -0
  138. package/lib/Types/Auth.js.map +1 -0
  139. package/lib/Types/Bussines.d.ts +2 -0
  140. package/lib/Types/Bussines.d.ts.map +1 -0
  141. package/lib/Types/Bussines.js +2 -0
  142. package/lib/Types/Bussines.js.map +1 -0
  143. package/lib/Types/Call.d.ts +2 -0
  144. package/lib/Types/Call.d.ts.map +1 -0
  145. package/lib/Types/Call.js +2 -0
  146. package/lib/Types/Call.js.map +1 -0
  147. package/lib/Types/Chat.d.ts +2 -0
  148. package/lib/Types/Chat.d.ts.map +1 -0
  149. package/lib/Types/Chat.js +8 -0
  150. package/lib/Types/Chat.js.map +1 -0
  151. package/lib/Types/Contact.d.ts +2 -0
  152. package/lib/Types/Contact.d.ts.map +1 -0
  153. package/lib/Types/Contact.js +2 -0
  154. package/lib/Types/Contact.js.map +1 -0
  155. package/lib/Types/Events.d.ts +2 -0
  156. package/lib/Types/Events.d.ts.map +1 -0
  157. package/lib/Types/Events.js +2 -0
  158. package/lib/Types/Events.js.map +1 -0
  159. package/lib/Types/GroupMetadata.d.ts +2 -0
  160. package/lib/Types/GroupMetadata.d.ts.map +1 -0
  161. package/lib/Types/GroupMetadata.js +2 -0
  162. package/lib/Types/GroupMetadata.js.map +1 -0
  163. package/lib/Types/Label.d.ts +3 -0
  164. package/lib/Types/Label.d.ts.map +1 -0
  165. package/lib/Types/Label.js +25 -0
  166. package/lib/Types/Label.js.map +1 -0
  167. package/lib/Types/LabelAssociation.d.ts +3 -0
  168. package/lib/Types/LabelAssociation.d.ts.map +1 -0
  169. package/lib/Types/LabelAssociation.js +7 -0
  170. package/lib/Types/LabelAssociation.js.map +1 -0
  171. package/lib/Types/Message.d.ts +12 -0
  172. package/lib/Types/Message.d.ts.map +1 -0
  173. package/lib/Types/Message.js +18 -0
  174. package/lib/Types/Message.js.map +1 -0
  175. package/lib/Types/Mex.d.ts +3 -0
  176. package/lib/Types/Mex.d.ts.map +1 -0
  177. package/lib/Types/Mex.js +39 -0
  178. package/lib/Types/Mex.js.map +1 -0
  179. package/lib/Types/Product.d.ts +2 -0
  180. package/lib/Types/Product.d.ts.map +1 -0
  181. package/lib/Types/Product.js +2 -0
  182. package/lib/Types/Product.js.map +1 -0
  183. package/lib/Types/RichType.d.ts +3 -0
  184. package/lib/Types/RichType.d.ts.map +1 -0
  185. package/lib/Types/RichType.js +23 -0
  186. package/lib/Types/RichType.js.map +1 -0
  187. package/lib/Types/Signal.d.ts +2 -0
  188. package/lib/Types/Signal.d.ts.map +1 -0
  189. package/lib/Types/Signal.js +2 -0
  190. package/lib/Types/Signal.js.map +1 -0
  191. package/lib/Types/Socket.d.ts +2 -0
  192. package/lib/Types/Socket.d.ts.map +1 -0
  193. package/lib/Types/Socket.js +2 -0
  194. package/lib/Types/Socket.js.map +1 -0
  195. package/lib/Types/State.d.ts +6 -0
  196. package/lib/Types/State.d.ts.map +1 -0
  197. package/lib/Types/State.js +56 -0
  198. package/lib/Types/State.js.map +1 -0
  199. package/lib/Types/USync.d.ts +2 -0
  200. package/lib/Types/USync.d.ts.map +1 -0
  201. package/lib/Types/USync.js +2 -0
  202. package/lib/Types/USync.js.map +1 -0
  203. package/lib/Types/index.d.ts +14 -0
  204. package/lib/Types/index.d.ts.map +1 -0
  205. package/lib/Types/index.js +26 -0
  206. package/lib/Types/index.js.map +1 -0
  207. package/lib/Utils/auth-utils.d.ts +58 -0
  208. package/lib/Utils/auth-utils.d.ts.map +1 -0
  209. package/lib/Utils/auth-utils.js +306 -0
  210. package/lib/Utils/auth-utils.js.map +1 -0
  211. package/lib/Utils/browser-utils.d.ts +10 -0
  212. package/lib/Utils/browser-utils.d.ts.map +1 -0
  213. package/lib/Utils/browser-utils.js +29 -0
  214. package/lib/Utils/browser-utils.js.map +1 -0
  215. package/lib/Utils/business.d.ts +50 -0
  216. package/lib/Utils/business.d.ts.map +1 -0
  217. package/lib/Utils/business.js +231 -0
  218. package/lib/Utils/business.js.map +1 -0
  219. package/lib/Utils/chat-utils.d.ts +409 -0
  220. package/lib/Utils/chat-utils.d.ts.map +1 -0
  221. package/lib/Utils/chat-utils.js +872 -0
  222. package/lib/Utils/chat-utils.js.map +1 -0
  223. package/lib/Utils/companion-reg-client-utils.d.ts +5 -0
  224. package/lib/Utils/companion-reg-client-utils.d.ts.map +1 -0
  225. package/lib/Utils/companion-reg-client-utils.js +40 -0
  226. package/lib/Utils/companion-reg-client-utils.js.map +1 -0
  227. package/lib/Utils/crypto.d.ts +40 -0
  228. package/lib/Utils/crypto.d.ts.map +1 -0
  229. package/lib/Utils/crypto.js +118 -0
  230. package/lib/Utils/crypto.js.map +1 -0
  231. package/lib/Utils/decode-wa-message.d.ts +84 -0
  232. package/lib/Utils/decode-wa-message.d.ts.map +1 -0
  233. package/lib/Utils/decode-wa-message.js +317 -0
  234. package/lib/Utils/decode-wa-message.js.map +1 -0
  235. package/lib/Utils/event-buffer.d.ts +13 -0
  236. package/lib/Utils/event-buffer.d.ts.map +1 -0
  237. package/lib/Utils/event-buffer.js +622 -0
  238. package/lib/Utils/event-buffer.js.map +1 -0
  239. package/lib/Utils/generics.d.ts +64 -0
  240. package/lib/Utils/generics.d.ts.map +1 -0
  241. package/lib/Utils/generics.js +395 -0
  242. package/lib/Utils/generics.js.map +1 -0
  243. package/lib/Utils/history.d.ts +76 -0
  244. package/lib/Utils/history.d.ts.map +1 -0
  245. package/lib/Utils/history.js +134 -0
  246. package/lib/Utils/history.js.map +1 -0
  247. package/lib/Utils/identity-change-handler.d.ts +14 -0
  248. package/lib/Utils/identity-change-handler.d.ts.map +1 -0
  249. package/lib/Utils/identity-change-handler.js +50 -0
  250. package/lib/Utils/identity-change-handler.js.map +1 -0
  251. package/lib/Utils/index.d.ts +25 -0
  252. package/lib/Utils/index.d.ts.map +1 -0
  253. package/lib/Utils/index.js +25 -0
  254. package/lib/Utils/index.js.map +1 -0
  255. package/lib/Utils/link-preview.d.ts +13 -0
  256. package/lib/Utils/link-preview.d.ts.map +1 -0
  257. package/lib/Utils/link-preview.js +85 -0
  258. package/lib/Utils/link-preview.js.map +1 -0
  259. package/lib/Utils/logger.d.ts +3 -0
  260. package/lib/Utils/logger.d.ts.map +1 -0
  261. package/lib/Utils/logger.js +3 -0
  262. package/lib/Utils/logger.js.map +1 -0
  263. package/lib/Utils/lt-hash.d.ts +7 -0
  264. package/lib/Utils/lt-hash.d.ts.map +1 -0
  265. package/lib/Utils/lt-hash.js +8 -0
  266. package/lib/Utils/lt-hash.js.map +1 -0
  267. package/lib/Utils/make-mutex.d.ts +7 -0
  268. package/lib/Utils/make-mutex.d.ts.map +1 -0
  269. package/lib/Utils/make-mutex.js +33 -0
  270. package/lib/Utils/make-mutex.js.map +1 -0
  271. package/lib/Utils/message-retry-manager.d.ts +80 -0
  272. package/lib/Utils/message-retry-manager.d.ts.map +1 -0
  273. package/lib/Utils/message-retry-manager.js +265 -0
  274. package/lib/Utils/message-retry-manager.js.map +1 -0
  275. package/lib/Utils/messages-media.d.ts +137 -0
  276. package/lib/Utils/messages-media.d.ts.map +1 -0
  277. package/lib/Utils/messages-media.js +843 -0
  278. package/lib/Utils/messages-media.js.map +1 -0
  279. package/lib/Utils/messages.d.ts +46 -0
  280. package/lib/Utils/messages.d.ts.map +1 -0
  281. package/lib/Utils/messages.js +1840 -0
  282. package/lib/Utils/messages.js.map +1 -0
  283. package/lib/Utils/noise-handler.d.ts +21 -0
  284. package/lib/Utils/noise-handler.d.ts.map +1 -0
  285. package/lib/Utils/noise-handler.js +201 -0
  286. package/lib/Utils/noise-handler.js.map +1 -0
  287. package/lib/Utils/offline-node-processor.d.ts +10 -0
  288. package/lib/Utils/offline-node-processor.d.ts.map +1 -0
  289. package/lib/Utils/offline-node-processor.js +40 -0
  290. package/lib/Utils/offline-node-processor.js.map +1 -0
  291. package/lib/Utils/pre-key-manager.d.ts +26 -0
  292. package/lib/Utils/pre-key-manager.d.ts.map +1 -0
  293. package/lib/Utils/pre-key-manager.js +106 -0
  294. package/lib/Utils/pre-key-manager.js.map +1 -0
  295. package/lib/Utils/process-message.d.ts +84 -0
  296. package/lib/Utils/process-message.d.ts.map +1 -0
  297. package/lib/Utils/process-message.js +749 -0
  298. package/lib/Utils/process-message.js.map +1 -0
  299. package/lib/Utils/reporting-utils.d.ts +13 -0
  300. package/lib/Utils/reporting-utils.d.ts.map +1 -0
  301. package/lib/Utils/reporting-utils.js +258 -0
  302. package/lib/Utils/reporting-utils.js.map +1 -0
  303. package/lib/Utils/rich-message-utils.d.ts +49 -0
  304. package/lib/Utils/rich-message-utils.d.ts.map +1 -0
  305. package/lib/Utils/rich-message-utils.js +370 -0
  306. package/lib/Utils/rich-message-utils.js.map +1 -0
  307. package/lib/Utils/signal.d.ts +83 -0
  308. package/lib/Utils/signal.d.ts.map +1 -0
  309. package/lib/Utils/signal.js +201 -0
  310. package/lib/Utils/signal.js.map +1 -0
  311. package/lib/Utils/stanza-ack.d.ts +17 -0
  312. package/lib/Utils/stanza-ack.d.ts.map +1 -0
  313. package/lib/Utils/stanza-ack.js +38 -0
  314. package/lib/Utils/stanza-ack.js.map +1 -0
  315. package/lib/Utils/sync-action-utils.d.ts +3 -0
  316. package/lib/Utils/sync-action-utils.d.ts.map +1 -0
  317. package/lib/Utils/sync-action-utils.js +49 -0
  318. package/lib/Utils/sync-action-utils.js.map +1 -0
  319. package/lib/Utils/tc-token-utils.d.ts +30 -0
  320. package/lib/Utils/tc-token-utils.d.ts.map +1 -0
  321. package/lib/Utils/tc-token-utils.js +164 -0
  322. package/lib/Utils/tc-token-utils.js.map +1 -0
  323. package/lib/Utils/use-multi-file-auth-state.d.ts +11 -0
  324. package/lib/Utils/use-multi-file-auth-state.d.ts.map +1 -0
  325. package/lib/Utils/use-multi-file-auth-state.js +121 -0
  326. package/lib/Utils/use-multi-file-auth-state.js.map +1 -0
  327. package/lib/Utils/use-single-file-auth-state.d.ts +11 -0
  328. package/lib/Utils/use-single-file-auth-state.d.ts.map +1 -0
  329. package/lib/Utils/use-single-file-auth-state.js +109 -0
  330. package/lib/Utils/use-single-file-auth-state.js.map +1 -0
  331. package/lib/Utils/use-sqlite-auth-state.d.ts +11 -0
  332. package/lib/Utils/use-sqlite-auth-state.d.ts.map +1 -0
  333. package/lib/Utils/use-sqlite-auth-state.js +109 -0
  334. package/lib/Utils/use-sqlite-auth-state.js.map +1 -0
  335. package/lib/Utils/validate-connection.d.ts +44 -0
  336. package/lib/Utils/validate-connection.d.ts.map +1 -0
  337. package/lib/Utils/validate-connection.js +210 -0
  338. package/lib/Utils/validate-connection.js.map +1 -0
  339. package/lib/WABinary/constants.d.ts +62 -0
  340. package/lib/WABinary/constants.d.ts.map +1 -0
  341. package/lib/WABinary/constants.js +1467 -0
  342. package/lib/WABinary/constants.js.map +1 -0
  343. package/lib/WABinary/decode.d.ts +10 -0
  344. package/lib/WABinary/decode.d.ts.map +1 -0
  345. package/lib/WABinary/decode.js +262 -0
  346. package/lib/WABinary/decode.js.map +1 -0
  347. package/lib/WABinary/encode.d.ts +3 -0
  348. package/lib/WABinary/encode.d.ts.map +1 -0
  349. package/lib/WABinary/encode.js +220 -0
  350. package/lib/WABinary/encode.js.map +1 -0
  351. package/lib/WABinary/generic-utils.d.ts +77 -0
  352. package/lib/WABinary/generic-utils.d.ts.map +1 -0
  353. package/lib/WABinary/generic-utils.js +226 -0
  354. package/lib/WABinary/generic-utils.js.map +1 -0
  355. package/lib/WABinary/index.d.ts +6 -0
  356. package/lib/WABinary/index.d.ts.map +1 -0
  357. package/lib/WABinary/index.js +6 -0
  358. package/lib/WABinary/index.js.map +1 -0
  359. package/lib/WABinary/jid-utils.d.ts +29 -0
  360. package/lib/WABinary/jid-utils.d.ts.map +1 -0
  361. package/lib/WABinary/jid-utils.js +96 -0
  362. package/lib/WABinary/jid-utils.js.map +1 -0
  363. package/lib/WABinary/types.d.ts +2 -0
  364. package/lib/WABinary/types.d.ts.map +1 -0
  365. package/lib/WABinary/types.js +2 -0
  366. package/lib/WABinary/types.js.map +1 -0
  367. package/lib/WAM/BinaryInfo.d.ts +8 -0
  368. package/lib/WAM/BinaryInfo.d.ts.map +1 -0
  369. package/lib/WAM/BinaryInfo.js +10 -0
  370. package/lib/WAM/BinaryInfo.js.map +1 -0
  371. package/lib/WAM/constants.d.ts +34927 -0
  372. package/lib/WAM/constants.d.ts.map +1 -0
  373. package/lib/WAM/constants.js +22853 -0
  374. package/lib/WAM/constants.js.map +1 -0
  375. package/lib/WAM/encode.d.ts +2 -0
  376. package/lib/WAM/encode.d.ts.map +1 -0
  377. package/lib/WAM/encode.js +150 -0
  378. package/lib/WAM/encode.js.map +1 -0
  379. package/lib/WAM/index.d.ts +4 -0
  380. package/lib/WAM/index.d.ts.map +1 -0
  381. package/lib/WAM/index.js +4 -0
  382. package/lib/WAM/index.js.map +1 -0
  383. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +37 -0
  384. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts.map +1 -0
  385. package/lib/WAUSync/Protocols/USyncContactProtocol.js +52 -0
  386. package/lib/WAUSync/Protocols/USyncContactProtocol.js.map +1 -0
  387. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +23 -0
  388. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts.map +1 -0
  389. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +54 -0
  390. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js.map +1 -0
  391. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +13 -0
  392. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts.map +1 -0
  393. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +27 -0
  394. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js.map +1 -0
  395. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +13 -0
  396. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts.map +1 -0
  397. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +38 -0
  398. package/lib/WAUSync/Protocols/USyncStatusProtocol.js.map +1 -0
  399. package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts +10 -0
  400. package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts.map +1 -0
  401. package/lib/WAUSync/Protocols/USyncUsernameProtocol.js +25 -0
  402. package/lib/WAUSync/Protocols/USyncUsernameProtocol.js.map +1 -0
  403. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +39 -0
  404. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts.map +1 -0
  405. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +51 -0
  406. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js.map +1 -0
  407. package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +15 -0
  408. package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts.map +1 -0
  409. package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +29 -0
  410. package/lib/WAUSync/Protocols/UsyncLIDProtocol.js.map +1 -0
  411. package/lib/WAUSync/Protocols/index.d.ts +6 -0
  412. package/lib/WAUSync/Protocols/index.d.ts.map +1 -0
  413. package/lib/WAUSync/Protocols/index.js +6 -0
  414. package/lib/WAUSync/Protocols/index.js.map +1 -0
  415. package/lib/WAUSync/USyncQuery.d.ts +21 -0
  416. package/lib/WAUSync/USyncQuery.d.ts.map +1 -0
  417. package/lib/WAUSync/USyncQuery.js +98 -0
  418. package/lib/WAUSync/USyncQuery.js.map +1 -0
  419. package/lib/WAUSync/USyncUser.d.ts +17 -0
  420. package/lib/WAUSync/USyncUser.d.ts.map +1 -0
  421. package/lib/WAUSync/USyncUser.js +31 -0
  422. package/lib/WAUSync/USyncUser.js.map +1 -0
  423. package/lib/WAUSync/index.d.ts +4 -0
  424. package/lib/WAUSync/index.d.ts.map +1 -0
  425. package/lib/WAUSync/index.js +4 -0
  426. package/lib/WAUSync/index.js.map +1 -0
  427. package/lib/index.d.ts +12 -0
  428. package/lib/index.d.ts.map +1 -0
  429. package/lib/index.js +12 -0
  430. package/lib/index.js.map +1 -0
  431. package/package.json +107 -5
package/README.md CHANGED
@@ -1,3 +1,2086 @@
1
- # Temporary Holding Version
1
+ # @zhuxee/baileys
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ > **Fork dari [@itsliaaa/baileys](https://github.com/itsliaaa/baileys)**
4
+ > Original credit: **@itsliaaa**
5
+ > Modifikasi oleh: **Abay** (Zhuxee-Asistance)
6
+ > GitHub: https://github.com/abay/zenaa-md
7
+
8
+ ---
9
+
10
+ # 🌱 @itsliaaa/baileys
11
+
12
+ [![Logo](https://files.catbox.moe/c5s9g0.jpg)](https://www.npmjs.com/package/@itsliaaa/baileys)
13
+
14
+ <p align="center">
15
+ Enhanced Baileys v7 with fixes for newsletter media uploads, plus support for interactive messages, albums, and additional message types.
16
+ <br><br>
17
+ <a href="https://www.npmjs.com/package/@itsliaaa/baileys">
18
+ <img src="https://img.shields.io/npm/v/@itsliaaa/baileys?style=for-the-badge&logo=npm"/>
19
+ </a>
20
+ <a href="https://www.npmjs.com/package/@itsliaaa/baileys">
21
+ <img src="https://img.shields.io/npm/dm/@itsliaaa/baileys?style=for-the-badge&logo=npm"/>
22
+ </a>
23
+ <a href="https://github.com/itsliaaa/baileys">
24
+ <img src="https://img.shields.io/github/stars/itsliaaa/baileys?style=for-the-badge&logo=github"/>
25
+ </a>
26
+ <a href="LICENSE">
27
+ <img src="https://img.shields.io/badge/license-MIT-blue?style=for-the-badge"/>
28
+ </a>
29
+ <a href="https://nodejs.org">
30
+ <img src="https://img.shields.io/badge/node-%3E%3D20-339933?logo=node.js&labelColor=green&logoColor=white&style=for-the-badge"/>
31
+ </a>
32
+ <a href="#">
33
+ <img src="https://img.shields.io/badge/ESM-only?logo=javascript&labelColor=yellow&logoColor=black&style=for-the-badge"/>
34
+ </a>
35
+ </p>
36
+
37
+ ☕ For donation: [Saweria](https://saweria.co/itsliaaa)
38
+
39
+ ### ✨ Highlights
40
+
41
+ This fork designed for production use with a focus on clarity and safety:
42
+
43
+ - 🚫 No obfuscation. Easy to read and audit.
44
+ - 🚫 No auto-follow channel (newsletter) behavior.
45
+
46
+ > [!IMPORTANT]
47
+ > Hi everyone,
48
+ >
49
+ > I want to clarify two separate attribution issues regarding packages derived from this fork.
50
+ >
51
+ > 1. Direct redistribution of my modifications without attribution
52
+ >
53
+ > The following packages are operated by the same individual under multiple npm accounts:
54
+ >
55
+ > - [@nuisockets](https://www.npmjs.com/package/@nuisockets/baileys)
56
+ > - [@nuiisatoru](https://www.npmjs.com/package/@nuiisatoru/baileys)
57
+ > - [@nuiisweetberry](https://www.npmjs.com/package/@nuiisweetberry/baileys)
58
+ > - [@nuiisweety](https://www.npmjs.com/package/@nuiisweety/baileys)
59
+ >
60
+ > These packages redistribute files and modifications originating from this fork while removing contributor credits and modification notes.
61
+ >
62
+ > 2. Rebranded republishes of this fork
63
+ >
64
+ > - [@lumina-md](https://www.npmjs.com/package/@lumina-md/baileys)
65
+ > - [@sairidev](https://www.npmjs.com/package/@sairidev/baileys-new)
66
+ > - [@lordmega/baileys](https://www.npmjs.com/package/@lordmega/baileys)
67
+ > - [phantom-baileys](https://www.npmjs.com/package/phantom-baileys)
68
+ > - [nexora-baileys](https://www.npmjs.com/package/nexora-baileys)
69
+ >
70
+ > These packages primarily repackage or republish this fork under different names while failing to preserve proper attribution, credits, or modification notes.
71
+ >
72
+ > To be clear, I am **NOT** the original maintainer of Baileys. Full credit and respect belong to:
73
+ >
74
+ > https://github.com/WhiskeySockets/Baileys
75
+ >
76
+ > **Forking is completely acceptable. Removing attribution, contributor credits, or modification history is not.**
77
+ >
78
+ > Please report if necessary.
79
+ >
80
+ > Thank you. 🤍
81
+
82
+ > [!NOTE]
83
+ > 📄 This project is maintained with limited scope and is not intended to replace upstream Baileys.
84
+ >
85
+ > 😞 And, really sorry for my bad english.
86
+
87
+ ### 📋 Table of Contents
88
+ - [📋 Table of Contents](#-table-of-contents)
89
+ - [✨ Highlights](#-highlights)
90
+ - [🛠️ Internal Adjustments](#%EF%B8%8F-internal-adjustments)
91
+ - [📨 Messages Handling & Compatibility](#-highlights)
92
+ - [🧩 Additional Message Options](#-additional-message-options)
93
+ - [📥 Installation](#-installation)
94
+ - [🧩 Import (ESM & CJS)](#-import-esm--cjs)
95
+ - [🌐 Connect to WhatsApp (Quick Step)](#-connect-to-whatsapp-quick-step)
96
+ - [🔐 Auth State](#-auth-state)
97
+ - [🗄️ Implementing Data Store](#%EF%B8%8F-implementing-data-store)
98
+ - [🪪 WhatsApp IDs Explain](#-whatsapp-ids-explain)
99
+ - [✉️ Sending Messages](#%EF%B8%8F-sending-messages)
100
+ - [🔠 Text](#-text)
101
+ - [🔔 Mention](#-mention)
102
+ - [😁 Reaction](#-reaction)
103
+ - [📌 Pin Message](#-pin-message)
104
+ - [🔖 Keep Chat](#-keep-chat)
105
+ - [➡️ Forward Message](#%EF%B8%8F-forward-message)
106
+ - [👤 Contact](#-contact)
107
+ - [📍 Location](#-location)
108
+ - [🗓️ Event](#%EF%B8%8F-event)
109
+ - [👥 Group Invite](#-group-invite)
110
+ - [🛍️ Product](#%EF%B8%8F-product)
111
+ - [📊 Poll](#-poll)
112
+ - [💭 Button Response](#-button-response)
113
+ - [✨ Rich Response](#-rich-response)
114
+ - [🧾 Message with Code Block](#-message-with-code-block)
115
+ - [🌏 Message with Inline Entities](#-message-with-inline-entities)
116
+ - [📋 Message with Table](#-message-with-table)
117
+ - [🎞️ Status Mention](#%EF%B8%8F-status-mention)
118
+ - [📁 Sending Media Messages](#-sending-media-messages)
119
+ - [🖼️ Image](#%EF%B8%8F-image)
120
+ - [🎥 Video](#-video)
121
+ - [📃 Sticker](#-sticker)
122
+ - [💽 Audio](#-audio)
123
+ - [🗂️ Document](#%EF%B8%8F-document)
124
+ - [🖼️ Album (Image & Video)](#%EF%B8%8F-album-image--video)
125
+ - [📦 Sticker Pack](#-sticker-pack)
126
+ - [👉🏻 Sending Interactive Messages](#-sending-interactive-messages)
127
+ - [🔘 Buttons](#-buttons)
128
+ - [📋 List](#-list)
129
+ - [🗄️ Interactive](#%EF%B8%8F-interactive)
130
+ - [🫙 Hydrated Template](#-hydrated-template)
131
+ - [💳 Sending Payment Messages](#-sending-payment-messages)
132
+ - [➕ Invite Payment](#-invite-payment)
133
+ - [🧾 Invoice](#-invoice)
134
+ - [🛍️ Order](#%EF%B8%8F-order)
135
+ - [💳 Request Payment](#-request-payment)
136
+ - [👁️ Other Message Options](#%EF%B8%8F-other-message-options)
137
+ - [🤖 AI Icon](#-ai-icon)
138
+ - [🕒 Ephemeral](#-ephemeral)
139
+ - [📰 External Ad Reply](#-external-ad-reply)
140
+ - [🧑‍🧑‍🧒 Group Status](#%E2%80%8D%E2%80%8D-group-status)
141
+ - [🐱 Lottie Sticker](#-lottie-sticker)
142
+ - [🧩 Raw](#-raw)
143
+ - [🏷️ Secure Meta Service Label](#%EF%B8%8F-secure-meta-service-label)
144
+ - [📑 Spoiler](#-spoiler)
145
+ - [👁️ View Once](#%EF%B8%8F-view-once)
146
+ - [👁️ View Once V2](#%EF%B8%8F-view-once-v2)
147
+ - [👁️ View Once V2 Extension](#%EF%B8%8F-view-once-v2-extension)
148
+ - [♻️ Modify Messages](#%EF%B8%8F-modify-messages)
149
+ - [🗑️ Delete Messages](#%EF%B8%8F-delete-messages)
150
+ - [✏️ Edit Messages](#%EF%B8%8F-edit-messages)
151
+ - [🧰 Additional Contents](#-additional-contents)
152
+ - [🏷️ Find User ID (JID|PN/LID)](#%EF%B8%8F-find-user-id-jidpnlid)
153
+ - [🔑 Request Custom Pairing Code](#-request-custom-pairing-code)
154
+ - [🖼️ Image Processing](#%EF%B8%8F-image-processing)
155
+ - [📣 Newsletter Management](#-newsletter-management)
156
+ - [👥 Group Management](#-group-management)
157
+ - [👥 Community Management](#-community-management)
158
+ - [👤 Profile Management](#-profile-management)
159
+ - [🛒 Business Management](#-business-management)
160
+ - [🔐 Privacy Management](#-privacy-management)
161
+ - [📡 Events](#-events)
162
+ - [🚀 Try the Bot](#-try-the-bot)
163
+ - [📦 Fork Base](#-fork-base)
164
+ - [📣 Credits](#-credits)
165
+
166
+ ### 🛠️ Internal Adjustments
167
+ - 🖼️ Fixed an issue where media could not be sent to newsletters due to an upstream issue.
168
+ - 📁 Reintroduced [`makeInMemoryStore`](#%EF%B8%8F-implementing-data-store) with a minimal ESM adaptation and small adjustments for Baileys v7.
169
+ - 📦 Switched FFmpeg execution from `exec` to `spawn` for safer process handling.
170
+ - 🗃️ Added [`@napi-rs/image`](https://www.npmjs.com/package/@napi-rs/image) as a supported image processing backend in [`getImageProcessingLibrary()`](#%EF%B8%8F-image-processing), offering a balance between performance and compatibility.
171
+
172
+ ### 📨 Messages Handling & Compatibility
173
+ - 📩 Expanded messages support for:
174
+ - 🖼️ [Album Message](#%EF%B8%8F-album-image--video)
175
+ - 👤 [Group Status Message](#%E2%80%8D%E2%80%8D-group-status)
176
+ - 👉🏻 [Interactive Message](#-sending-interactive-messages) (buttons, lists, native flows, templates, carousels).
177
+ - 🎞️ [Status Mention Message](#%EF%B8%8F-status-mention)
178
+ - 📦 [Sticker Pack Message](#-sticker-pack)
179
+ - ✨ [Rich Response Message](#-rich-response) **[NEW]**
180
+ - 🧾 [Message with Code Blocks](#-message-with-code-block) **[NEW]**
181
+ - [🌏 Message with Inline Entities](#-message-with-inline-entities) **[NEW]**
182
+ - 📋 [Message with Table](#-message-with-table) **[NEW]**
183
+ - 💳 [Payment-related Message](#-sending-payment-messages) (payment requests, invites, orders, invoices).
184
+ - 📰 Simplified sending messages with ad thumbnail using [`externalAdReply`](#-external-ad-reply), without requiring manual `contextInfo`.
185
+ - 💭 Added support for quoting messages inside channel (newsletter). **[NEW]**
186
+ - 🎀 Added support for [custom button icon](#%EF%B8%8F-interactive). **[NEW]**
187
+
188
+ ### 🧩 Additional Message Options
189
+ - 👁️ Added optional boolean flags for message handling:
190
+ - 🤖 [`ai`](#-ai-icon) - AI icon on message
191
+ - 📣 [`mentionAll`](#-mention) - Mention all group participants without requiring their JIDs in `mentions` or `mentionedJid` **[NEW]**
192
+ - 🔧 [`ephemeral`](#-ephemeral), [`groupStatus`](#%E2%80%8D%E2%80%8D-group-status), [`isLottie`](#-lottie-sticker), [`spoiler`](#-spoiler), [`viewOnce`](#%EF%B8%8F-view-once), [`viewOnceV2`](#%EF%B8%8F-view-once-v2), [`viewOnceV2Extension`](#%EF%B8%8F-view-once-v2-extension), [`interactiveAsTemplate`](#%EF%B8%8F-interactive) - Message wrappers
193
+ - 🔒 [`secureMetaServiceLabel`](#%EF%B8%8F-secure-meta-service-label) - Secure meta service label on message **[NEW]**
194
+ - 📄 [`raw`](#-raw) - Build your message manually **(DO NOT USE FOR EXPLOITATION)**
195
+
196
+ ### 📥 Installation
197
+
198
+ - 📄 Via `package.json`
199
+
200
+ ```json
201
+ # NPM
202
+ "dependencies": {
203
+ "@itsliaaa/baileys": "latest"
204
+ }
205
+
206
+ # GitHub
207
+ "dependencies": {
208
+ "@itsliaaa/baileys": "github:itsliaaa/baileys"
209
+ }
210
+ ```
211
+
212
+ - ⌨️ Via terminal
213
+
214
+ ```bash
215
+ # NPM
216
+ npm i @itsliaaa/baileys@latest
217
+
218
+ # GitHub
219
+ npm i github:itsliaaa/baileys
220
+ ```
221
+
222
+ #### 🧩 Import (ESM & CJS)
223
+
224
+ ```javascript
225
+ // --- ESM
226
+ import { makeWASocket } from '@itsliaaa/baileys'
227
+
228
+ // --- CJS (tested and working on Node.js 24 ✅)
229
+ const { makeWASocket } = require('@itsliaaa/baileys')
230
+ ```
231
+
232
+ ### 🌐 Connect to WhatsApp (Quick Step)
233
+
234
+ ```javascript
235
+ import { makeWASocket, delay, DisconnectReason, useMultiFileAuthState } from '@itsliaaa/baileys'
236
+ import { Boom } from '@hapi/boom'
237
+ import pino from 'pino'
238
+
239
+ // --- Connect with pairing code
240
+ const myPhoneNumber = '6288888888888'
241
+
242
+ const logger = pino({ level: 'silent' })
243
+
244
+ const connectToWhatsApp = async () => {
245
+ const { state, saveCreds } = await useMultiFileAuthState('session')
246
+
247
+ const sock = makeWASocket({
248
+ logger,
249
+ auth: state
250
+ })
251
+
252
+ sock.ev.on('creds.update', saveCreds)
253
+
254
+ sock.ev.on('connection.update', (update) => {
255
+ const { connection, lastDisconnect } = update
256
+ if (connection === 'connecting' && !sock.authState.creds.registered) {
257
+ await delay(1500)
258
+ const code = await sock.requestPairingCode(myPhoneNumber)
259
+ console.log('🔗 Pairing code', ':', code)
260
+ }
261
+ else if (connection === 'close') {
262
+ const shouldReconnect = new Boom(connection?.lastDisconnect?.error)?.output?.statusCode !== DisconnectReason.loggedOut
263
+ console.log('⚠️ Connection closed because', lastDisconnect.error, ', reconnecting ', shouldReconnect)
264
+ if (shouldReconnect) {
265
+ connectToWhatsApp()
266
+ }
267
+ }
268
+ else if (connection === 'open') {
269
+ console.log('✅ Successfully connected to WhatsApp')
270
+ }
271
+ })
272
+
273
+ sock.ev.on('messages.upsert', async ({ messages }) => {
274
+ for (const message of messages) {
275
+ if (!message.message) continue
276
+
277
+ console.log('🔔 Got new message', ':', message)
278
+ await sock.sendMessage(message.key.remoteJid, {
279
+ text: '👋🏻 Hello world'
280
+ })
281
+ }
282
+ })
283
+ }
284
+
285
+ connectToWhatsApp()
286
+ ```
287
+
288
+ #### 🔐 Auth State
289
+
290
+ > [!NOTE]
291
+ > You can use the experimental `useSingleFileAuthState` and `useSqliteAuthState` as an alternative to `useMultiFileAuthState`. However, `useSingleFileAuthState` already includes an internal caching mechanism, so there is no need to wrap `state.keys` with `makeCacheableSignalKeyStore`.
292
+
293
+ ### 🗄️ Implementing Data Store
294
+
295
+ > [!CAUTION]
296
+ > I highly recommend building your own data store, as keeping an entire chat history in memory can lead to excessive RAM usage.
297
+
298
+ ```javascript
299
+ import { makeWASocket, makeInMemoryStore, delay, DisconnectReason, useMultiFileAuthState } from '@itsliaaa/baileys'
300
+ import { Boom } from '@hapi/boom'
301
+ import pino from 'pino'
302
+
303
+ const myPhoneNumber = '6288888888888'
304
+
305
+ // --- Create your store path
306
+ const storePath = './store.json'
307
+
308
+ const logger = pino({ level: 'silent' })
309
+
310
+ const connectToWhatsApp = async () => {
311
+ const { state, saveCreds } = await useMultiFileAuthState('session')
312
+
313
+ const sock = makeWASocket({
314
+ logger,
315
+ auth: state
316
+ })
317
+
318
+ const store = makeInMemoryStore({
319
+ logger,
320
+ socket: sock
321
+ })
322
+
323
+ store.bind(sock.ev)
324
+
325
+ sock.ev.on('creds.update', saveCreds)
326
+
327
+ sock.ev.on('connection.update', (update) => {
328
+ const { connection, lastDisconnect } = update
329
+ if (connection === 'connecting' && !sock.authState.creds.registered) {
330
+ await delay(1500)
331
+ const code = await sock.requestPairingCode(myPhoneNumber)
332
+ console.log('🔗 Pairing code', ':', code)
333
+ }
334
+ else if (connection === 'close') {
335
+ const shouldReconnect = new Boom(connection?.lastDisconnect?.error)?.output?.statusCode !== DisconnectReason.loggedOut
336
+ console.log('⚠️ Connection closed because', lastDisconnect.error, ', reconnecting ', shouldReconnect)
337
+ if (shouldReconnect) {
338
+ connectToWhatsApp()
339
+ }
340
+ }
341
+ else if (connection === 'open') {
342
+ console.log('✅ Successfully connected to WhatsApp')
343
+ }
344
+ })
345
+
346
+ sock.ev.on('chats.upsert', () => {
347
+ console.log('✉️ Got chats', store.chats.all())
348
+ })
349
+
350
+ sock.ev.on('contacts.upsert', () => {
351
+ console.log('👥 Got contacts', Object.values(store.contacts))
352
+ })
353
+
354
+ // --- Read store from file
355
+ store.readFromFile(storePath)
356
+
357
+ // --- Save store every 3 minutes
358
+ setInterval(() => {
359
+ store.writeToFile(storePath)
360
+ }, 180000)
361
+ }
362
+
363
+ connectToWhatsApp()
364
+ ```
365
+
366
+ ### 🪪 WhatsApp IDs Explain
367
+
368
+ `id` is the WhatsApp ID, called `jid` and `lid` too, of the person or group you're sending the message to.
369
+ - It must be in the format `[country code][phone number]@s.whatsapp.net`
370
+ - Example for people: `19999999999@s.whatsapp.net` and `12699999999@lid`.
371
+ - For groups, it must be in the format `123456789-123345@g.us`.
372
+ - For Meta AI, it's `11111111111@bot`.
373
+ - For broadcast lists, it's `[timestamp of creation]@broadcast`.
374
+ - For stories, the ID is `status@broadcast`.
375
+
376
+ ### ✉️ Sending Messages
377
+
378
+ > [!NOTE]
379
+ > You can get the `jid` from `message.key.remoteJid` in the first example.
380
+
381
+ #### 🔠 Text
382
+
383
+ ```javascript
384
+ // --- Send a regular text message
385
+ sock.sendMessage(jid, {
386
+ text: '👋🏻 Hello'
387
+ }, {
388
+ quoted: message
389
+ })
390
+
391
+ // --- Send a text message with a link preview
392
+ const urlA = 'https://www.npmjs.com/package/@itsliaaa/baileys'
393
+
394
+ sock.sendMessage(jid, {
395
+ text: urlA + ' 👆🏻 Check it out!',
396
+ linkPreview: {
397
+ 'matched-text': urlA,
398
+ title: '🌱 @itsliaaa/baileys',
399
+ description: 'Underrated Baileys Fork',
400
+ previewType: 0, // --- Use 1 for video playback in the link preview
401
+ jpegThumbnail: fs.readFileSync('./path/to/image.jpg')
402
+ }
403
+ })
404
+
405
+ // --- Send a text message with a large link preview and favicon
406
+ import { prepareWAMessageMedia } from '@itsliaaa/baileys'
407
+
408
+ const urlB = 'https://www.npmjs.com/package/@itsliaaa/baileys#readme'
409
+
410
+ const { imageMessage: image } = await prepareWAMessageMedia({
411
+ image: {
412
+ url: './path/to/image.jpg'
413
+ }
414
+ }, {
415
+ upload: sock.waUploadToServer,
416
+ mediaTypeOverride: 'thumbnail-link'
417
+ })
418
+
419
+ // --- Set the thumbnail display size
420
+ image.height = 720
421
+ image.width = 480
422
+
423
+ sock.sendMessage(jid, {
424
+ text: urlB + ' 👆🏻 Check it out!',
425
+ linkPreview: {
426
+ 'matched-text': urlB,
427
+ title: '🌱 @itsliaaa/baileys',
428
+ description: 'Underrated Baileys Fork',
429
+ previewType: 0,
430
+ jpegThumbnail: fs.readFileSync('./path/to/image.jpg'),
431
+ highQualityThumbnail: image,
432
+ linkPreviewMetadata: {
433
+ linkMediaDuration: 0, // --- Duration in seconds (for video/audio content)
434
+ socialMediaPostType: 1, // --- Enum: 0 = NONE, 1 = REEL, 2 = LIVE_VIDEO, 3 = LONG_VIDEO, 4 = SINGLE_IMAGE, 5 = CAROUSEL
435
+ } // --- Additional metadata for large link preview
436
+ },
437
+ favicon: {
438
+ url: './path/to/tiny-image.ico'
439
+ }
440
+ })
441
+ ```
442
+
443
+ #### 🔔 Mention
444
+
445
+ ```javascript
446
+ // --- Regular mention
447
+ sock.sendMessage(jid, {
448
+ text: '👋🏻 Hello @628123456789',
449
+ mentions: ['628123456789@s.whatsapp.net']
450
+ }, {
451
+ quoted: message
452
+ })
453
+
454
+ // --- Mention all
455
+ sock.sendMessage(jid, {
456
+ text: '👋🏻 Hello @all',
457
+ mentionAll: true
458
+ }, {
459
+ quoted: message
460
+ })
461
+ ```
462
+
463
+ #### 😁 Reaction
464
+
465
+ ```javascript
466
+ sock.sendMessage(jid, {
467
+ react: {
468
+ key: message.key,
469
+ text: '✨'
470
+ }
471
+ })
472
+ ```
473
+
474
+ #### 📌 Pin Message
475
+
476
+ ```javascript
477
+ sock.sendMessage(jid, {
478
+ pin: message.key,
479
+ time: 86400, // --- Set the value in seconds: 86400 (1d), 604800 (7d), or 2592000 (30d)
480
+ type: 1 // --- Or 2 to remove
481
+ })
482
+ ```
483
+
484
+ #### 🔖 Keep Chat
485
+
486
+ > [!NOTE]
487
+ > Keep Chat can only be used in chats or groups with disappearing messages enabled.
488
+
489
+ ```javascript
490
+ sock.sendMessage(jid, {
491
+ keep: message.key,
492
+ type: 1 // --- Or 2 to remove
493
+ })
494
+ ```
495
+
496
+ #### ➡️ Forward Message
497
+
498
+ ```javascript
499
+ sock.sendMessage(jid, {
500
+ forward: message,
501
+ force: true // --- Optional
502
+ })
503
+ ```
504
+
505
+ #### 👤 Contact
506
+
507
+ ```javascript
508
+ const vcard = 'BEGIN:VCARD\n'
509
+ + 'VERSION:3.0\n'
510
+ + 'FN:Lia Wynn\n'
511
+ + 'ORG:Waitress;\n'
512
+ + 'TEL;type=CELL;type=VOICE;waid=628123456789:+62 8123 4567 89\n'
513
+ + 'END:VCARD'
514
+
515
+ sock.sendMessage(jid, {
516
+ contacts: {
517
+ displayName: 'Lia Wynn',
518
+ contacts: [
519
+ { vcard }
520
+ ]
521
+ }
522
+ }, {
523
+ quoted: message
524
+ })
525
+ ```
526
+
527
+ #### 📍 Location
528
+
529
+ ```javascript
530
+ sock.sendMessage(jid, {
531
+ location: {
532
+ degreesLatitude: 24.121231,
533
+ degreesLongitude: 55.1121221,
534
+ name: '👋🏻 I am here'
535
+ }
536
+ }, {
537
+ quoted: message
538
+ })
539
+ ```
540
+
541
+ #### 🗓️ Event
542
+
543
+ ```javascript
544
+ sock.sendMessage(jid, {
545
+ event: {
546
+ name: '🎶 Meet & Mingle Party',
547
+ description: 'Meet & Mingle Party is a fun, casual gathering to connect, chat, and build new relationships within the community.',
548
+ call: 'audio', // --- Or "video", this field is optional
549
+ startDate: new Date(Date.now() + 3600000),
550
+ endDate: new Date(Date.now() + 28800000),
551
+ isCancelled: false, // --- Optional
552
+ isScheduleCall: false, // --- Optional
553
+ extraGuestsAllowed: false, // --- Optional
554
+ location: {
555
+ name: 'Jakarta',
556
+ degreesLatitude: -6.2,
557
+ degreesLongitude: 106.8
558
+ }
559
+ }
560
+ }, {
561
+ quoted: message
562
+ })
563
+ ```
564
+
565
+ #### 👥 Group Invite
566
+
567
+ ```javascript
568
+ const inviteCode = groupUrl
569
+ .split('chat.whatsapp.com/')[1]
570
+ ?.split('?')[0]
571
+
572
+ const groupJid = '1201111111111@g.us'
573
+ const groupName = '@itsliaaa/baileys'
574
+
575
+ sock.sendMessage(jid, {
576
+ groupInvite: {
577
+ inviteCode,
578
+ inviteExpiration: Date.now() + 86400000,
579
+ text: '👋🏻 Hello, we invite you to join our group.',
580
+ jid: groupJid,
581
+ subject: groupName,
582
+ }
583
+ }, {
584
+ quoted: message
585
+ })
586
+ ```
587
+
588
+ #### 🛍️ Product
589
+
590
+ ```javascript
591
+ import { randomUUID } from 'crypto'
592
+
593
+ sock.sendMessage(jid, {
594
+ image: {
595
+ url: './path/to/image.jpg'
596
+ },
597
+ body: '👋🏻 Check my product here!',
598
+ footer: '@itsliaaa/baileys',
599
+ product: {
600
+ currencyCode: 'IDR',
601
+ description: '🛍️ Interesting product!',
602
+ priceAmount1000: 70_000_000,
603
+ productId: randomUUID(),
604
+ productImageCount: 1,
605
+ salePriceAmount1000: 65_000_000,
606
+ signedUrl: 'https://www.npmjs.com/package/@itsliaaa/baileys',
607
+ title: '📦 Starseed (Premium)',
608
+ url: 'https://www.npmjs.com/package/@itsliaaa/baileys'
609
+ },
610
+ businessOwnerJid: '0@s.whatsapp.net'
611
+ })
612
+ ```
613
+
614
+ #### 📊 Poll
615
+
616
+ ```javascript
617
+ // --- Regular poll message
618
+ sock.sendMessage(jid, {
619
+ poll: {
620
+ name: '🔥 Voting time',
621
+ values: ['Yes', 'No'],
622
+ selectableCount: 1,
623
+ toAnnouncementGroup: false,
624
+ endDate: new Date(Date.now() + 28800000), // --- Optional
625
+ hideVoter: false, // --- Optional
626
+ canAddOption: false // --- Optional
627
+ }
628
+ }, {
629
+ quoted: message
630
+ })
631
+
632
+ // --- Quiz (only for newsletter)
633
+ sock.sendMessage('1211111111111@newsletter', {
634
+ poll: {
635
+ name: '🔥 Quiz',
636
+ values: ['Yes', 'No'],
637
+ correctAnswer: 'Yes',
638
+ pollType: 1
639
+ }
640
+ }, {
641
+ quoted: message
642
+ })
643
+
644
+ // --- Poll result
645
+ sock.sendMessage(jid, {
646
+ pollResult: {
647
+ name: '📝 Poll Result',
648
+ votes: [{
649
+ name: 'Nice',
650
+ voteCount: 10
651
+ }, {
652
+ name: 'Nah',
653
+ voteCount: 2
654
+ }],
655
+ pollType: 0 // Or 1 for quiz
656
+ }
657
+ }, {
658
+ quoted: message
659
+ })
660
+
661
+ // --- Poll update
662
+ sock.sendMessage(jid, {
663
+ pollUpdate: {
664
+ metadata: {},
665
+ key: message.key,
666
+ vote: {
667
+ enclv: /* <Buffer> */,
668
+ encPayload: /* <Buffer> */
669
+ }
670
+ }
671
+ }, {
672
+ quoted: message
673
+ })
674
+ ```
675
+
676
+ #### 💭 Button Response
677
+
678
+ ```javascript
679
+ // --- Using buttonsResponseMessage
680
+ sock.sendMessage(jid, {
681
+ type: 'plain',
682
+ buttonReply: {
683
+ id: '#Menu',
684
+ displayText: '✨ Interesting Menu'
685
+ }
686
+ }, {
687
+ quoted: message
688
+ })
689
+
690
+ // --- Using interactiveResponseMessage
691
+ sock.sendMessage(jid, {
692
+ flowReply: {
693
+ format: 0,
694
+ text: '💭 Response',
695
+ name: 'menu_options',
696
+ paramsJson: JSON.stringify({
697
+ id: '#Menu',
698
+ description: '✨ Interesting Menu'
699
+ })
700
+ }
701
+ }, {
702
+ quoted: message
703
+ })
704
+
705
+ // --- Using listResponseMessage
706
+ sock.sendMessage(jid, {
707
+ listReply: {
708
+ title: '📄 See More',
709
+ description: '✨ Interesting Menu',
710
+ id: '#Menu'
711
+ }
712
+ }, {
713
+ quoted: message
714
+ })
715
+
716
+ // --- Using templateButtonReplyMessage
717
+ sock.sendMessage(jid, {
718
+ type: 'template',
719
+ buttonReply: {
720
+ id: '#Menu',
721
+ displayText: '✨ Interesting Menu',
722
+ index: 1
723
+ }
724
+ }, {
725
+ quoted: message
726
+ })
727
+ ```
728
+
729
+ #### ✨ Rich Response
730
+
731
+ > [!NOTE]
732
+ > `richResponse[]` is a representation of [`submessages[]`](https://baileys.wiki/docs/api/namespaces/proto/interfaces/IAIRichResponseSubMessage) inside `richResponseMessage`.
733
+
734
+ > [!TIP]
735
+ > You can still use the original [`submessages[]`](https://baileys.wiki/docs/api/namespaces/proto/interfaces/IAIRichResponseSubMessage) field directly.
736
+ > The code example below is just an implementation using a helper, not a required structure.
737
+
738
+ ```javascript
739
+ sock.sendMessage(jid, {
740
+ disclaimerText: 'RAW submessages structure example',
741
+ richResponse: [{
742
+ text: 'Example Usage',
743
+ }, {
744
+ language: 'javascript',
745
+ code: [{
746
+ highlightType: 0,
747
+ codeContent: 'console.log("Hello, World!")'
748
+ }]
749
+ }, {
750
+ text: 'Pretty simple, right?\n'
751
+ }, {
752
+ text: 'Comparison between Node.js, Bun, and Deno',
753
+ }, {
754
+ title: 'Runtime Comparison',
755
+ table: [{
756
+ isHeading: true,
757
+ items: ['', 'Node.js', 'Bun', 'Deno']
758
+ }, {
759
+ isHeading: false,
760
+ items: ['Engine', 'V8 (C++)', 'JavaScriptCore (C++)', 'V8 (C++)']
761
+ }, {
762
+ isHeading: false,
763
+ items: ['Performance', '4/5', '5/5', '4/5']
764
+ }]
765
+ }, {
766
+ text: 'Does this help clarify the differences?'
767
+ }]
768
+ })
769
+ ```
770
+
771
+ > [!TIP]
772
+ > You can easily add syntax highlighting by importing `tokenizeCode` directly from Baileys.
773
+
774
+ ```javascript
775
+ import { tokenizeCode } from '@itsliaaa/baileys'
776
+
777
+ const language = 'javascript'
778
+ const code = 'console.log("Hello, World!")'
779
+
780
+ sock.sendMessage(jid, {
781
+ disclaimerText: 'Example of tokenizing Code Block',
782
+ richResponse: [{
783
+ text: 'Example Usage',
784
+ }, {
785
+ language,
786
+ code: tokenizeCode(code, language)
787
+ }, {
788
+ text: 'Pretty simple, right?'
789
+ }]
790
+ })
791
+ ```
792
+
793
+ > 💡 Supported Languages: `css`, `html`, `javascript`, `typescript`, `python`, `golang`, `rust`, `c`, `c#`, `c++`, `bash`, `bat`, `powershell`.
794
+
795
+ #### 🧾 Message with Code Block
796
+
797
+ > [!NOTE]
798
+ > This feature already includes a built-in tokenizer with `tokenizeCode`.
799
+
800
+ ```javascript
801
+ sock.sendMessage(jid, {
802
+ disclaimerText: 'Code Block',
803
+ headerText: '## Example Usage',
804
+ contentText: '---',
805
+ code: 'console.log("Hello, World!")',
806
+ language: 'javascript',
807
+ footerText: 'Pretty simple, right?'
808
+ })
809
+ ```
810
+
811
+ #### 🌏 Message with Inline Entities
812
+
813
+ ```javascript
814
+ sock.sendMessage(jid, {
815
+ disclaimerText: 'Inline Entities',
816
+ headerText: '## Check Out!',
817
+ contentText: '---',
818
+ links: [{
819
+ text: '1. Google',
820
+ title: 'Popular Search Engine',
821
+ url: 'https://www.google.com/'
822
+ }, {
823
+ text: '2. YouTube',
824
+ title: 'Popular Streaming Platform',
825
+ url: 'https://www.youtube.com/'
826
+ }, {
827
+ text: '3. Modded Baileys',
828
+ title: 'Underrated Baileys Fork',
829
+ url: 'https://www.npmjs.com/package/@itsliaaa/baileys'
830
+ }],
831
+ footerText: '---'
832
+ })
833
+ ```
834
+
835
+ #### 📋 Message with Table
836
+
837
+ ```javascript
838
+ sock.sendMessage(jid, {
839
+ disclaimerText: 'Table',
840
+ headerText: '## Comparison between Node.js, Bun, and Deno',
841
+ contentText: '---',
842
+ title: 'Runtime Comparison',
843
+ table: [
844
+ ['', 'Node.js', 'Bun', 'Deno'],
845
+ ['Engine', 'V8 (C++)', 'JavaScriptCore (C++)', 'V8 (C++)'],
846
+ ['Performance', '4/5', '5/5', '4/5']
847
+ ],
848
+ noHeading: false, // --- Optional
849
+ footerText: 'Does this help clarify the differences?'
850
+ })
851
+ ```
852
+
853
+ #### 🎞️ Status Mention
854
+
855
+ ```javascript
856
+ sock.sendMessage([jidA, jidB, jidC], {
857
+ text: 'Hello! 👋🏻'
858
+ })
859
+ ```
860
+
861
+ ### 📁 Sending Media Messages
862
+
863
+ > [!NOTE]
864
+ > For media messages, you can pass a `Buffer` directly, or an object with either `{ stream: Readable }` or `{ url: string }` (local file path or HTTP/HTTPS URL).
865
+
866
+ #### 🖼️ Image
867
+
868
+ ```javascript
869
+ sock.sendMessage(jid, {
870
+ image: {
871
+ url: './path/to/image.jpg'
872
+ },
873
+ caption: '🔥 Superb'
874
+ }, {
875
+ quoted: message
876
+ })
877
+ ```
878
+
879
+ #### 🎥 Video
880
+
881
+ ```javascript
882
+ sock.sendMessage(jid, {
883
+ video: {
884
+ url: './path/to/video.mp4'
885
+ },
886
+ gifPlayback: false, // --- Set true if you want to send video as GIF
887
+ ptv: false, // --- Set true if you want to send video as PTV
888
+ caption: '🔥 Superb'
889
+ }, {
890
+ quoted: message
891
+ })
892
+ ```
893
+
894
+ #### 📃 Sticker
895
+
896
+ ```javascript
897
+ sock.sendMessage(jid, {
898
+ sticker: {
899
+ url: './path/to/sticker.webp'
900
+ }
901
+ }, {
902
+ quoted: message
903
+ })
904
+ ```
905
+
906
+ #### 💽 Audio
907
+
908
+ ```javascript
909
+ sock.sendMessage(jid, {
910
+ audio: {
911
+ url: './path/to/audio.mp3'
912
+ },
913
+ ptt: false // --- Set true if you want to send audio as Voice Note
914
+ }, {
915
+ quoted: message
916
+ })
917
+ ```
918
+
919
+ #### 🗂️ Document
920
+
921
+ ```javascript
922
+ sock.sendMessage(jid, {
923
+ document: {
924
+ url: './path/to/document.pdf'
925
+ },
926
+ mimetype: 'application/pdf',
927
+ caption: '✨ My work!'
928
+ }, {
929
+ quoted: message
930
+ })
931
+ ```
932
+
933
+ #### 🖼️ Album (Image & Video)
934
+
935
+ ```javascript
936
+ sock.sendMessage(jid, {
937
+ album: [{
938
+ image: {
939
+ url: './path/to/image.jpg'
940
+ },
941
+ caption: '1st image'
942
+ }, {
943
+ video: {
944
+ url: './path/to/video.mp4'
945
+ },
946
+ caption: '1st video'
947
+ }, {
948
+ image: {
949
+ url: './path/to/image.jpg'
950
+ },
951
+ caption: '2nd image'
952
+ }, {
953
+ video: {
954
+ url: './path/to/video.mp4'
955
+ },
956
+ caption: '2nd video'
957
+ }]
958
+ }, {
959
+ quoted: message
960
+ })
961
+ ```
962
+
963
+ #### 📦 Sticker Pack
964
+
965
+ > [!IMPORTANT]
966
+ > If `sharp` or `@napi-rs/image` is not installed, the `cover` and `stickers` must already be in WebP format.
967
+
968
+ ```javascript
969
+ sock.sendMessage(jid, {
970
+ cover: {
971
+ url: './path/to/image.webp'
972
+ },
973
+ stickers: [{
974
+ data: {
975
+ url: './path/to/image.webp'
976
+ }
977
+ }, {
978
+ data: {
979
+ url: './path/to/image.webp'
980
+ }
981
+ }, {
982
+ data: {
983
+ url: './path/to/image.webp'
984
+ }
985
+ }],
986
+ name: '📦 My Sticker Pack',
987
+ publisher: '🌟 Lia Wynn',
988
+ description: '@itsliaaa/baileys'
989
+ }, {
990
+ quoted: message
991
+ })
992
+ ```
993
+
994
+ ### 👉🏻 Sending Interactive Messages
995
+
996
+ #### 🔘 Buttons
997
+
998
+ ```javascript
999
+ // --- Regular buttons message
1000
+ sock.sendMessage(jid, {
1001
+ text: '👆🏻 Buttons!',
1002
+ footer: '@itsliaaa/baileys',
1003
+ buttons: [{
1004
+ text: '👋🏻 SignUp',
1005
+ id: '#SignUp'
1006
+ }]
1007
+ }, {
1008
+ quoted: message
1009
+ })
1010
+
1011
+ // --- Buttons with Media & Native Flow
1012
+ sock.sendMessage(jid, {
1013
+ image: {
1014
+ url: './path/to/image.jpg'
1015
+ },
1016
+ caption: '👆🏻 Buttons and Native Flow!',
1017
+ footer: '@itsliaaa/baileys',
1018
+ buttons: [{
1019
+ text: '👋🏻 Rating',
1020
+ id: '#Rating'
1021
+ }, {
1022
+ text: '📋 Select',
1023
+ sections: [{
1024
+ title: '✨ Section 1',
1025
+ rows: [{
1026
+ header: '',
1027
+ title: '💭 Secret Ingredient',
1028
+ description: '',
1029
+ id: '#SecretIngredient'
1030
+ }]
1031
+ }, {
1032
+ title: '✨ Section 2',
1033
+ highlight_label: '🔥 Popular',
1034
+ rows: [{
1035
+ header: '',
1036
+ title: '🏷️ Coupon',
1037
+ description: '',
1038
+ id: '#CouponCode'
1039
+ }]
1040
+ }]
1041
+ }]
1042
+ }, {
1043
+ quoted: message
1044
+ })
1045
+ ```
1046
+
1047
+ #### 📋 List
1048
+
1049
+ > [!NOTE]
1050
+ > It only works in private chat (`@s.whatsapp.net`).
1051
+
1052
+ ```javascript
1053
+ sock.sendMessage(jid, {
1054
+ text: '📋 List!',
1055
+ footer: '@itsliaaa/baileys',
1056
+ buttonText: '📋 Select',
1057
+ title: '👋🏻 Hello',
1058
+ sections: [{
1059
+ title: '🚀 Menu 1',
1060
+ rows: [{
1061
+ title: '✨ AI',
1062
+ description: '',
1063
+ rowId: '#AI'
1064
+ }]
1065
+ }, {
1066
+ title: '🌱 Menu 2',
1067
+ rows: [{
1068
+ title: '🔍 Search',
1069
+ description: '',
1070
+ rowId: '#Search'
1071
+ }]
1072
+ }]
1073
+ }, {
1074
+ quoted: message
1075
+ })
1076
+ ```
1077
+
1078
+ #### 🗄️ Interactive
1079
+
1080
+ ```javascript
1081
+ // --- Native Flow
1082
+ sock.sendMessage(jid, {
1083
+ image: {
1084
+ url: './path/to/image.jpg'
1085
+ },
1086
+ caption: '🗄️️ Interactive!',
1087
+ footer: '@itsliaaa/baileys',
1088
+ optionText: '👉🏻 Select Options', // --- Optional, wrap all native flow into a single list
1089
+ optionTitle: '📄 Select Options', // --- Optional
1090
+ offerText: '🏷️ Newest Coupon!', // --- Optional, add an offer into message
1091
+ offerCode: '@itsliaaa/baileys', // --- Optional
1092
+ offerUrl: 'https://www.npmjs.com/package/@itsliaaa/baileys', // --- Optional
1093
+ offerExpiration: Date.now() + 3_600_000, // --- Optional
1094
+ nativeFlow: [{
1095
+ text: '👋🏻 Greeting',
1096
+ id: '#Greeting',
1097
+ icon: 'review' // --- Optional
1098
+ }, {
1099
+ text: '📞 Call',
1100
+ call: '628123456789'
1101
+ }, {
1102
+ text: '📋 Copy',
1103
+ copy: '@itsliaaa/baileys'
1104
+ }, {
1105
+ text: '🌐 Source',
1106
+ url: 'https://www.npmjs.com/package/@itsliaaa/baileys',
1107
+ useWebview: true // --- Optional
1108
+ }, {
1109
+ text: '📋 Select',
1110
+ sections: [{
1111
+ title: '✨ Section 1',
1112
+ rows: [{
1113
+ header: '',
1114
+ title: '🏷️ Coupon',
1115
+ description: '',
1116
+ id: '#CouponCode'
1117
+ }]
1118
+ }, {
1119
+ title: '✨ Section 2',
1120
+ highlight_label: '🔥 Popular',
1121
+ rows: [{
1122
+ header: '',
1123
+ title: '💭 Secret Ingredient',
1124
+ description: '',
1125
+ id: '#SecretIngredient'
1126
+ }]
1127
+ }],
1128
+ icon: 'default' // --- Optional
1129
+ }],
1130
+ interactiveAsTemplate: false, // --- Optional, wrap the interactive message into a template
1131
+ }, {
1132
+ quoted: message
1133
+ })
1134
+
1135
+ // --- Carousel & Native Flow
1136
+ sock.sendMessage(jid, {
1137
+ text: '🗂️ Interactive with Carousel!',
1138
+ footer: '@itsliaaa/baileys',
1139
+ cards: [{
1140
+ image: {
1141
+ url: './path/to/image.jpg'
1142
+ },
1143
+ caption: '🖼️ Image 1',
1144
+ footer: '🏷️️ Pinterest',
1145
+ nativeFlow: [{
1146
+ text: '🌐 Source',
1147
+ url: 'https://www.npmjs.com/package/@itsliaaa/baileys',
1148
+ useWebview: true
1149
+ }]
1150
+ }, {
1151
+ image: {
1152
+ url: './path/to/image.jpg'
1153
+ },
1154
+ caption: '🖼️ Image 2',
1155
+ footer: '🏷️ Pinterest',
1156
+ offerText: '🏷️ New Coupon!',
1157
+ offerCode: '@itsliaaa/baileys',
1158
+ offerUrl: 'https://www.npmjs.com/package/@itsliaaa/baileys',
1159
+ offerExpiration: Date.now() + 3_600_000,
1160
+ nativeFlow: [{
1161
+ text: '🌐 Source',
1162
+ url: 'https://www.npmjs.com/package/@itsliaaa/baileys'
1163
+ }]
1164
+ }, {
1165
+ image: {
1166
+ url: './path/to/image.jpg'
1167
+ },
1168
+ caption: '🖼️ Image 3',
1169
+ footer: '🏷️ Pinterest',
1170
+ optionText: '👉🏻 Select Options',
1171
+ optionTitle: '👉🏻 Select Options',
1172
+ offerText: '🏷️ New Coupon!',
1173
+ offerCode: '@itsliaaa/baileys',
1174
+ offerUrl: 'https://www.npmjs.com/package/@itsliaaa/baileys',
1175
+ offerExpiration: Date.now() + 3_600_000,
1176
+ nativeFlow: [{
1177
+ text: '🛒 Product',
1178
+ id: '#Product',
1179
+ icon: 'default'
1180
+ }, {
1181
+ text: '🌐 Source',
1182
+ url: 'https://www.npmjs.com/package/@itsliaaa/baileys'
1183
+ }]
1184
+ }]
1185
+ }, {
1186
+ quoted: message
1187
+ })
1188
+
1189
+ // --- Native Flow with Audio in the Footer
1190
+ sock.sendMessage(jid, {
1191
+ text: '🔈 Music in the footer!',
1192
+ audioFooter: {
1193
+ url: './path/to/audio.mp3'
1194
+ }, // --- Like other media upload methods, buffers and streams are supported
1195
+ nativeFlow: [{
1196
+ text: '👍🏻 Good, next',
1197
+ id: '#Next',
1198
+ icon: 'review'
1199
+ }, {
1200
+ text: '👎🏻 Skip',
1201
+ id: '#Skip',
1202
+ icon: 'default'
1203
+ }]
1204
+ }, {
1205
+ quoted: message
1206
+ })
1207
+ ```
1208
+
1209
+ #### 🫙 Hydrated Template
1210
+
1211
+ ```javascript
1212
+ sock.sendMessage(jid, {
1213
+ title: '👋🏻 Hello',
1214
+ image: {
1215
+ url: './path/to/image.jpg'
1216
+ },
1217
+ caption: '🫙 Template!',
1218
+ footer: '@itsliaaa/baileys',
1219
+ templateButtons: [{
1220
+ text: '👉?? Tap Here',
1221
+ id: '#Order'
1222
+ }, {
1223
+ text: '🌐 Source',
1224
+ url: 'https://www.npmjs.com/package/@itsliaaa/baileys'
1225
+ }, {
1226
+ text: '📞 Call',
1227
+ call: '628123456789'
1228
+ }]
1229
+ }, {
1230
+ quoted: message
1231
+ })
1232
+ ```
1233
+
1234
+ ### 💳 Sending Payment Messages
1235
+
1236
+ #### ➕ Invite Payment
1237
+
1238
+ ```javascript
1239
+ sock.sendMessage(jid, {
1240
+ paymentInviteServiceType: 3 // 1, 2, or 3
1241
+ })
1242
+ ```
1243
+
1244
+ #### 🧾 Invoice
1245
+
1246
+ > [!NOTE]
1247
+ > Invoice message are not supported yet.
1248
+
1249
+ ```javascript
1250
+ sock.sendMessage(jid, {
1251
+ image: {
1252
+ url: './path/to/image.jpg'
1253
+ },
1254
+ invoiceNote: '🏷️ Invoice'
1255
+ })
1256
+ ```
1257
+
1258
+ #### 🛍️ Order
1259
+
1260
+ ```javascript
1261
+ sock.sendMessage(chat, {
1262
+ orderText: '🛍️ Order',
1263
+ thumbnail: fs.readFileSync('./path/to/image.jpg') // --- Must in buffer format
1264
+ }, {
1265
+ quoted: message
1266
+ })
1267
+ ```
1268
+
1269
+ #### 💳 Request Payment
1270
+
1271
+ ```javascript
1272
+ sock.sendMessage(jid, {
1273
+ text: '💳 Request Payment',
1274
+ requestPaymentFrom: '0@s.whatsapp.net'
1275
+ })
1276
+ ```
1277
+
1278
+ ### 👁️ Other Message Options
1279
+
1280
+ #### 🤖 AI Icon
1281
+
1282
+ > [!NOTE]
1283
+ > It only works in private chat (`@s.whatsapp.net`).
1284
+
1285
+ ```javascript
1286
+ sock.sendMessage(jid, {
1287
+ image: {
1288
+ url: './path/to/image.jpg'
1289
+ },
1290
+ caption: '🤖 With AI icon!',
1291
+ ai: true
1292
+ }, {
1293
+ quoted: message
1294
+ })
1295
+ ```
1296
+
1297
+ #### 🕒 Ephemeral
1298
+
1299
+ > [!NOTE]
1300
+ > Wrap message into `ephemeralMessage`
1301
+
1302
+ ```javascript
1303
+ sock.sendMessage(jid, {
1304
+ image: {
1305
+ url: './path/to/image.jpg'
1306
+ },
1307
+ caption: '👁️ Ephemeral',
1308
+ ephemeral: true
1309
+ })
1310
+ ```
1311
+
1312
+ #### 📰 External Ad Reply
1313
+
1314
+ > [!NOTE]
1315
+ > Add an ad thumbnail to messages (may not be displayed on some WhatsApp versions).
1316
+
1317
+ ```javascript
1318
+ sock.sendMessage(jid, {
1319
+ text: '📰 External Ad Reply',
1320
+ externalAdReply: {
1321
+ title: '📝 Did you know?',
1322
+ body: '❓ I dont know',
1323
+ thumbnail: fs.readFileSync('./path/to/image.jpg'), // --- Must in buffer format
1324
+ largeThumbnail: false, // --- Or true for bigger thumbnail
1325
+ url: 'https://www.npmjs.com/package/@itsliaaa/baileys' // --- Optional, used for WhatsApp internal thumbnail caching and direct URL
1326
+ }
1327
+ }, {
1328
+ quoted: message
1329
+ })
1330
+ ```
1331
+
1332
+ #### 🧑‍🧑‍🧒 Group Status
1333
+
1334
+ > [!NOTE]
1335
+ > It only works in group chat (`@g.us`)
1336
+
1337
+ ```javascript
1338
+ sock.sendMessage(jid, {
1339
+ image: {
1340
+ url: './path/to/image.jpg'
1341
+ },
1342
+ caption: '👥 Group Status!',
1343
+ groupStatus: true
1344
+ })
1345
+ ```
1346
+
1347
+ #### 🐱 Lottie Sticker
1348
+
1349
+ > [!NOTE]
1350
+ > Wrap message into `lottieStickerMessage`
1351
+
1352
+ ```javascript
1353
+ sock.sendMessage(jid, {
1354
+ sticker: {
1355
+ url: './path/to/sticker.webp'
1356
+ },
1357
+ isLottie: true
1358
+ })
1359
+ ```
1360
+
1361
+ #### 🧩 Raw
1362
+
1363
+ ```javascript
1364
+ sock.sendMessage(jid, {
1365
+ extendedTextMessage: {
1366
+ text: '📃 Built manually from scratch using the raw WhatsApp proto structure',
1367
+ contextInfo: {
1368
+ externalAdReply: {
1369
+ title: '@itsliaaa/baileys',
1370
+ thumbnail: fs.readFileSync('./path/to/image.jpg'),
1371
+ sourceApp: 'whatsapp',
1372
+ showAdAttribution: true,
1373
+ mediaType: 1
1374
+ }
1375
+ }
1376
+ },
1377
+ raw: true
1378
+ }, {
1379
+ quoted: message
1380
+ })
1381
+ ```
1382
+
1383
+ #### 🏷️ Secure Meta Service Label
1384
+
1385
+ ```javascript
1386
+ sock.sendMessage(jid, {
1387
+ text: '🏷️ Just a label!',
1388
+ secureMetaServiceLabel: true
1389
+ })
1390
+ ```
1391
+
1392
+ #### 📑 Spoiler
1393
+
1394
+ > [!NOTE]
1395
+ > Wrap message into `spoilerMessage`
1396
+
1397
+ ```javascript
1398
+ sock.sendMessage(jid, {
1399
+ image: {
1400
+ url: './path/to/image.jpg'
1401
+ },
1402
+ caption: '❔ Spoiler',
1403
+ spoiler: true
1404
+ })
1405
+ ```
1406
+
1407
+ #### 👁️ View Once
1408
+
1409
+ > [!NOTE]
1410
+ > Wrap message into `viewOnceMessage`
1411
+
1412
+ ```javascript
1413
+ sock.sendMessage(jid, {
1414
+ image: {
1415
+ url: './path/to/image.jpg'
1416
+ },
1417
+ caption: '👁️ View Once',
1418
+ viewOnce: true
1419
+ })
1420
+ ```
1421
+
1422
+ #### 👁️ View Once V2
1423
+
1424
+ > [!NOTE]
1425
+ > Wrap message into `viewOnceMessageV2`
1426
+
1427
+ ```javascript
1428
+ sock.sendMessage(jid, {
1429
+ image: {
1430
+ url: './path/to/image.jpg'
1431
+ },
1432
+ caption: '👁️ View Once V2',
1433
+ viewOnceV2: true
1434
+ })
1435
+ ```
1436
+
1437
+ #### 👁️ View Once V2 Extension
1438
+
1439
+ > [!NOTE]
1440
+ > Wrap message into `viewOnceMessageV2Extension`
1441
+
1442
+ ```javascript
1443
+ sock.sendMessage(jid, {
1444
+ image: {
1445
+ url: './path/to/image.jpg'
1446
+ },
1447
+ caption: '👁️ View Once V2 Extension',
1448
+ viewOnceV2Extension: true
1449
+ })
1450
+ ```
1451
+
1452
+ ### ♻️ Modify Messages
1453
+
1454
+ #### 🗑️ Delete Messages
1455
+
1456
+ ```javascript
1457
+ sock.sendMessage(jid, {
1458
+ delete: message.key
1459
+ })
1460
+ ```
1461
+
1462
+ #### ✏️ Edit Messages
1463
+
1464
+ ```javascript
1465
+ // --- Edit plain text
1466
+ sock.sendMessage(jid, {
1467
+ text: '✨ I mean, nice!',
1468
+ edit: message.key
1469
+ })
1470
+
1471
+ // --- Edit media messages caption
1472
+ sock.sendMessage(jid, {
1473
+ caption: '✨ I mean, here is the image!',
1474
+ edit: message.key
1475
+ })
1476
+ ```
1477
+
1478
+ ### 🧰 Additional Contents
1479
+
1480
+ #### 🏷️ Find User ID (JID|PN/LID)
1481
+
1482
+ > [!NOTE]
1483
+ > The ID must contain numbers only (no +, (), or -) and must include the country code with WhatsApp ID format.
1484
+
1485
+ ```javascript
1486
+ // --- PN (Phone Number)
1487
+ const phoneNumber = '6281111111111@s.whatsapp.net'
1488
+
1489
+ const ids = await sock.findUserId(phoneNumber)
1490
+
1491
+ console.log('🏷️ Got user ID', ':', ids)
1492
+
1493
+ // --- LID (Local Identifier)
1494
+ const lid = '43411111111111@lid'
1495
+
1496
+ const ids = await sock.findUserId(lid)
1497
+
1498
+ console.log('🏷️ Got user ID', ':', ids)
1499
+
1500
+ // --- Output
1501
+ // {
1502
+ // phoneNumber: '6281111111111@s.whatsapp.net',
1503
+ // lid: '43411111111111@lid'
1504
+ // }
1505
+ // --- Output when failed
1506
+ // {
1507
+ // phoneNumber: '6281111111111@s.whatsapp.net',
1508
+ // lid: undefined
1509
+ // }
1510
+ // --- Same output shape regardless of input type
1511
+ ```
1512
+
1513
+ #### 🔑 Request Custom Pairing Code
1514
+
1515
+ > [!NOTE]
1516
+ > The phone number must contain numbers only (no +, (), or -) and must include the country code.
1517
+
1518
+ ```javascript
1519
+ const phoneNumber = '6281111111111'
1520
+ const customPairingCode = 'STARFALL'
1521
+
1522
+ await sock.requestPairingCode(phoneNumber, customPairingCode)
1523
+
1524
+ console.log('🔗 Pairing code', ':', customPairingCode)
1525
+ ```
1526
+
1527
+ #### 🖼️ Image Processing
1528
+
1529
+ > [!NOTE]
1530
+ > Automatically use available image processing library: `sharp`, `@napi-rs/image`, or `jimp`
1531
+
1532
+ ```javascript
1533
+ import { getImageProcessingLibrary } from '@itsliaaa/baileys'
1534
+ import { readFile } from 'fs/promises'
1535
+
1536
+ const lib = await getImageProcessingLibrary()
1537
+
1538
+ const bufferOrFilePath = './path/to/image.jpg'
1539
+ const width = 512
1540
+
1541
+ let output
1542
+
1543
+ // --- If sharp installed
1544
+ if (lib.sharp?.default) {
1545
+ const img = lib.sharp.default(bufferOrFilePath)
1546
+
1547
+ output = await img.resize(width)
1548
+ .jpeg({ quality: 80 })
1549
+ .toBuffer()
1550
+ }
1551
+
1552
+ // --- If @napi-rs/image installed
1553
+ else if (lib.image?.Transformer) {
1554
+ // --- Must in buffer format
1555
+ const inputBuffer = Buffer.isBuffer(bufferOrFilePath)
1556
+ ? bufferOrFilePath
1557
+ : await readFile(bufferOrFilePath)
1558
+
1559
+ const img = new lib.image.Transformer(inputBuffer)
1560
+
1561
+ output = await img.resize(width, undefined, 0)
1562
+ .jpeg(50)
1563
+ }
1564
+
1565
+ // --- If jimp installed
1566
+ else if (lib.jimp?.Jimp) {
1567
+ const img = await lib.jimp.Jimp.read(bufferOrFilePath)
1568
+
1569
+ output = await img
1570
+ .resize({ w: width, mode: lib.jimp.ResizeStrategy.BILINEAR })
1571
+ .getBuffer('image/jpeg', { quality: 50 })
1572
+ }
1573
+
1574
+ // --- Fallback
1575
+ else {
1576
+ throw new Error('No image processing available')
1577
+ }
1578
+
1579
+ console.log('✅ Process completed!')
1580
+ console.dir(output, { depth: null })
1581
+ ```
1582
+
1583
+ #### 📣 Newsletter Management
1584
+
1585
+ ```javascript
1586
+ // --- Create a new one
1587
+ sock.newsletterCreate('@itsliaaa/baileys', '📣 Fresh updates weekly')
1588
+
1589
+ // --- Get info
1590
+ const metadata = sock.newsletterMetadata('1231111111111@newsletter')
1591
+ console.dir(metadata, { depth: null })
1592
+
1593
+ // --- Get subscribers count
1594
+ const subscribers = await sock.newsletterSubscribers('1231111111111@newsletter')
1595
+ console.dir(subscribers, { depth: null })
1596
+
1597
+ // --- Follow and Unfollow
1598
+ sock.newsletterFollow('1231111111111@newsletter')
1599
+ sock.newsletterUnfollow('1231111111111@newsletter')
1600
+
1601
+ // --- Mute and Unmute
1602
+ sock.newsletterMute('1231111111111@newsletter')
1603
+ sock.newsletterUnmute('1231111111111@newsletter')
1604
+
1605
+ // --- Demote admin
1606
+ sock.newsletterDemote('1231111111111@newsletter', '6281111111111@s.whatsapp.net')
1607
+
1608
+ // --- Change owner
1609
+ sock.newsletterChangeOwner('1231111111111@newsletter', '6281111111111@s.whatsapp.net')
1610
+
1611
+ // --- Update newsletter
1612
+ sock.newsletterUpdate('1231111111111@newsletter', { name: '@itsliaaa/baileys' })
1613
+
1614
+ // --- Change name
1615
+ sock.newsletterUpdateName('1231111111111@newsletter', '📦 @itsliaaa/baileys')
1616
+
1617
+ // --- Change description
1618
+ sock.newsletterUpdateDescription('1231111111111@newsletter', '📣 Fresh updates weekly')
1619
+
1620
+ // --- Change photo
1621
+ sock.newsletterUpdatePicture('1231111111111@newsletter', {
1622
+ url: 'path/to/image.jpg'
1623
+ })
1624
+
1625
+ // --- Remove photo
1626
+ sock.newsletterRemovePicture('1231111111111@newsletter')
1627
+
1628
+ // --- React to a message
1629
+ sock.newsletterReactMessage('1231111111111@newsletter', '100', '💛')
1630
+
1631
+ // --- Get admin count
1632
+ const count = await sock.newsletterAdminCount('1231111111111@newsletter')
1633
+
1634
+ // --- Get all subscribed newsletters
1635
+ const newsletters = await sock.newsletterSubscribed()
1636
+ console.dir(newsletters, { depth: null })
1637
+
1638
+ // --- Fetch newsletter messages
1639
+ const messages = sock.newsletterFetchMessages('jid', '1231111111111@newsletter', 50, 0, 0)
1640
+ console.dir(messages, { depth: null })
1641
+
1642
+ // --- Delete newsletter
1643
+ sock.newsletterDelete('1231111111111@newsletter')
1644
+ ```
1645
+
1646
+ #### 👥 Group Management
1647
+
1648
+ ```javascript
1649
+ // --- Create a new one and add participants using their JIDs
1650
+ const group = sock.groupCreate('@itsliaaa/baileys', ['628123456789@s.whatsapp.net'])
1651
+ console.dir(group, { depth: null })
1652
+
1653
+ // --- Get info
1654
+ const metadata = await sock.groupMetadata(jid)
1655
+ console.dir(metadata, { depth: null })
1656
+
1657
+ // --- Get group invite code
1658
+ const inviteCode = await sock.groupInviteCode(jid)
1659
+ console.dir(inviteCode, { depth: null })
1660
+
1661
+
1662
+ // --- Revoke invite link
1663
+ sock.groupRevokeInvite(jid)
1664
+
1665
+ // --- Accept group invite
1666
+ sock.groupAcceptInvite(inviteCode)
1667
+
1668
+ // --- Leave group
1669
+ sock.groupLeave(jid)
1670
+
1671
+ // --- Add participants
1672
+ sock.groupParticipantsUpdate(jid, ['628123456789@s.whatsapp.net'], 'add')
1673
+
1674
+ // --- Remove participants
1675
+ sock.groupParticipantsUpdate(jid, ['628123456789@s.whatsapp.net'], 'remove')
1676
+
1677
+ // --- Promote to admin
1678
+ sock.groupParticipantsUpdate(jid, ['628123456789@s.whatsapp.net'], 'promote')
1679
+
1680
+ // --- Demote from admin
1681
+ sock.groupParticipantsUpdate(jid, ['628123456789@s.whatsapp.net'], 'demote')
1682
+
1683
+ // --- Accept join requests
1684
+ sock.groupRequestParticipantsUpdate(jid, ['628123456789@s.whatsapp.net'], 'approve')
1685
+
1686
+ // --- Change name
1687
+ sock.groupUpdateSubject(jid, '📦 @itsliaaa/baileys')
1688
+
1689
+ // --- Change description
1690
+ sock.groupUpdateDescription(jid, 'Updated description')
1691
+
1692
+ // --- Change photo
1693
+ sock.updateProfilePicture(jid, {
1694
+ url: 'path/to/image.jpg'
1695
+ })
1696
+
1697
+ // --- Remove photo
1698
+ sock.removeProfilePicture(jid)
1699
+
1700
+ // --- Set group as admin only for chatting
1701
+ sock.groupSettingUpdate(jid, 'announcement')
1702
+
1703
+ // --- Set group as open to all for chatting
1704
+ sock.groupSettingUpdate(jid, 'not_announcement')
1705
+
1706
+ // --- Set admin only can edit group info
1707
+ sock.groupSettingUpdate(jid, 'locked')
1708
+
1709
+ // --- Set all participants can edit group info
1710
+ sock.groupSettingUpdate(jid, 'unlocked')
1711
+
1712
+ // --- Set admin only can add participants
1713
+ sock.groupMemberAddMode(jid, 'admin_add')
1714
+
1715
+ // --- Set all participants can add participants
1716
+ sock.groupMemberAddMode(jid, 'all_member_add')
1717
+
1718
+ // --- Enable or disable temporary messages with seconds format
1719
+ sock.groupToggleEphemeral(jid, 86400)
1720
+
1721
+ // --- Disable temporary messages
1722
+ sock.groupToggleEphemeral(jid, 0)
1723
+
1724
+ // --- Enable or disable membership approval mode
1725
+ sock.groupJoinApprovalMode(jid, 'on')
1726
+ sock.groupJoinApprovalMode(jid, 'off')
1727
+
1728
+ // --- Get all groups metadata
1729
+ const groups = await sock.groupFetchAllParticipating()
1730
+ console.dir(groups, { depth: null })
1731
+
1732
+ // --- Get pending join requests
1733
+ const requests = await sock.groupRequestParticipantsList(jid)
1734
+ console.dir(requests, { depth: null })
1735
+
1736
+ // --- Get group info from link
1737
+ const group = await sock.groupGetInviteInfo('ABC123456789')
1738
+ console.log('👥 Got group info from invite code', ':', group)
1739
+
1740
+ // --- Update bot member label
1741
+ sock.updateMemberLabel(jid, '@itsliaaa/baileys')
1742
+ ```
1743
+
1744
+ #### 👥 Community Management
1745
+
1746
+ ```javascript
1747
+ // --- Create a new one and add description
1748
+ const community = await sock.communityCreate('@itsliaaa/baileys', '📣 Fresh updates weekly')
1749
+ console.dir(community, { depth: null })
1750
+
1751
+ // --- Create a subgroup for community and add participants using their JIDs
1752
+ const group = await sock.communityCreateGroup('📢 Announcements', ['628123456789@s.whatsapp.net'], communityJid)
1753
+
1754
+ // --- Link an existing group
1755
+ sock.communityLinkGroup(groupJid, communityJid)
1756
+
1757
+ // --- Unlink an existing group
1758
+ sock.communityUnlinkGroup(groupJid, communityJid)
1759
+
1760
+ // --- Get info
1761
+ const metadata = await sock.communityMetadata(jid)
1762
+ console.dir(metadata, { depth: null })
1763
+
1764
+ // --- Get community invite code
1765
+ const inviteCode = await sock.communityInviteCode(jid)
1766
+ console.dir(inviteCode, { depth: null })
1767
+
1768
+ // --- Revoke invite link
1769
+ sock.communityRevokeInvite(jid)
1770
+
1771
+ // --- Accept community invite
1772
+ sock.communityAcceptInvite(inviteCode)
1773
+
1774
+ // --- Leave community
1775
+ sock.communityLeave(jid)
1776
+
1777
+ // --- Accept join requests
1778
+ sock.communityRequestParticipantsUpdate(jid, ['628123456789@s.whatsapp.net'], 'approve')
1779
+
1780
+ // --- Change name
1781
+ sock.communityUpdateSubject(jid, '📦 @itsliaaa/baileys')
1782
+
1783
+ // --- Change description
1784
+ sock.communityUpdateDescription(jid, 'Updated description')
1785
+
1786
+ // --- Set community as admin only for chatting
1787
+ sock.communitySettingUpdate(jid, 'announcement')
1788
+
1789
+ // --- Set community as open to all for chatting
1790
+ sock.communitySettingUpdate(jid, 'not_announcement')
1791
+
1792
+ // --- Set admin only can edit community info
1793
+ sock.communitySettingUpdate(jid, 'locked')
1794
+
1795
+ // --- Set all participants can edit community info
1796
+ sock.communitySettingUpdate(jid, 'unlocked')
1797
+
1798
+ // --- Set admin only can add participants
1799
+ sock.communityMemberAddMode(jid, 'admin_add')
1800
+
1801
+ // --- Set all participants can add participants
1802
+ sock.communityMemberAddMode(jid, 'all_member_add')
1803
+
1804
+ // --- Enable or disable temporary messages with seconds format
1805
+ sock.communityToggleEphemeral(jid, 86400)
1806
+
1807
+ // --- Disable temporary messages
1808
+ sock.communityToggleEphemeral(jid, 0)
1809
+
1810
+ // --- Enable or disable membership approval mode
1811
+ sock.communityJoinApprovalMode(jid, 'on')
1812
+ sock.communityJoinApprovalMode(jid, 'off')
1813
+
1814
+ // --- Get all communities metadata
1815
+ const communities = await sock.communityFetchAllParticipating()
1816
+ console.dir(communities, { depth: null })
1817
+
1818
+ // --- Get all community linked groups
1819
+ const linked = await sock.communityFetchLinkedGroups(jid)
1820
+ console.dir(linked, { depth: null })
1821
+
1822
+ // --- Get pending join requests
1823
+ const requests = await sock.communityRequestParticipantsList(jid)
1824
+ console.dir(requests, { depth: null })
1825
+
1826
+ // --- Get community info from link
1827
+ const community = await sock.communityGetInviteInfo('ABC123456789')
1828
+ console.log('👥 Got community info from invite code', ':', community)
1829
+ ```
1830
+
1831
+ #### 👤 Profile Management
1832
+
1833
+ ```javascript
1834
+ // --- Get user profile picture
1835
+ const url = await sock.profilePictureUrl(jid, 'image')
1836
+ console.log('🖼️ Got user profile url', url)
1837
+
1838
+ // --- Update profile picture
1839
+ sock.updateProfilePicture(jid, buffer)
1840
+ sock.updateProfilePicture(jid, { url })
1841
+
1842
+ // --- Remove profile picture
1843
+ sock.removeProfilePicture(jid)
1844
+
1845
+ // --- Update profile name
1846
+ sock.updateProfileName('My Name')
1847
+
1848
+ // --- Update profile status
1849
+ sock.updateProfileStatus('Available')
1850
+
1851
+ // --- Presence
1852
+ sock.sendPresenceUpdate('available', jid)
1853
+ sock.presenceSubscribe(jid)
1854
+
1855
+ // --- Read receipts
1856
+ sock.readMessages([message.key])
1857
+ sock.sendReceipt(jid, participant, [messageId], 'read')
1858
+
1859
+ // --- Block user
1860
+ sock.updateBlockStatus(jid, 'block')
1861
+
1862
+ // --- Unblock user
1863
+ sock.updateBlockStatus(jid, 'unblock')
1864
+
1865
+ // --- Fetch blocklist
1866
+ const blocked = await sock.fetchBlocklist()
1867
+ console.dir(blocked, { depth: null })
1868
+
1869
+ // --- Modify chats
1870
+ sock.chatModify({
1871
+ archive: true,
1872
+ lastMessageOrig: message,
1873
+ lastMessage: message
1874
+ }, jid)
1875
+
1876
+ // --- Star messages
1877
+ sock.star(jid, [{ id: messageId, fromMe: true }], true)
1878
+
1879
+ // --- Contact
1880
+ sock.addOrEditContact(jid, { displayName: 'Starseed' })
1881
+ sock.removeContact(jid)
1882
+
1883
+ // --- Label
1884
+ sock.addChatLabel(jid, labelId)
1885
+ sock.removeChatLabel(jid, labelId)
1886
+ sock.addMessageLabel(jid, messageId, labelId)
1887
+
1888
+ // --- App state sync
1889
+ sock.resyncAppState(['regular', 'critical_block'], true)
1890
+
1891
+ // --- Get business profile
1892
+ const profile = await sock.getBusinessProfile(jid)
1893
+ console.dir(profile, { depth: null })
1894
+ ```
1895
+
1896
+ #### 🛒 Business Management
1897
+
1898
+ ```javascript
1899
+ // --- Create a new product
1900
+ const product = await sock.productCreate({
1901
+ name: '🧩 Starseed (Premium)',
1902
+ description: 'Get a full version of Starseed!',
1903
+ price: 100000,
1904
+ currency: 'IDR',
1905
+ originCountryCode: 'ID',
1906
+ images: [
1907
+ bufferImage,
1908
+ {
1909
+ url: './path/to/image.jpg'
1910
+ }
1911
+ ]
1912
+ })
1913
+ console.dir(product, { depth: null })
1914
+
1915
+ // --- Update product
1916
+ await sock.productUpdate(productId, {
1917
+ name: '🧩 Starseed (Premium)',
1918
+ description: 'Get a full version of Starseed with more features!',
1919
+ price: 75000,
1920
+ currency: 'IDR',
1921
+ images: [
1922
+ {
1923
+ url: './path/to/image.jpg'
1924
+ }
1925
+ ]
1926
+ })
1927
+
1928
+ // --- Delete product
1929
+ sock.productDelete([productId])
1930
+
1931
+ // --- Get catalog info
1932
+ const { products, nextPageCursor } = await sock.getCatalog({
1933
+ jid: '628123456789@s.whatsapp.net',
1934
+ limit: 10
1935
+ })
1936
+
1937
+ // --- Get collections
1938
+ const collections = await sock.getCollections('628123456789@s.whatsapp.net', 10)
1939
+ console.dir(collections, { depth: null })
1940
+
1941
+ // --- Get order info
1942
+ const order = await sock.getOrderDetails(orderId, tokenBase64)
1943
+ console.dir(order, { depth: null })
1944
+
1945
+ // --- Update business profile
1946
+ await sock.updateBusinessProfile({
1947
+ address: 'Jakarta, Indonesia',
1948
+ description: '🛒 Official Starseed Store',
1949
+ websites: ['https://www.npmjs.com/package/@itsliaaa/baileys'],
1950
+ email: 'more-more@gmail.com',
1951
+ hours: {
1952
+ timezone: 'Asia/Jakarta',
1953
+ days: [{ day: 'mon', mode: 'open_24h' }]
1954
+ }
1955
+ })
1956
+
1957
+ // --- Update cover
1958
+ sock.updateCoverPhoto({
1959
+ url: './path/to/image.jpg'
1960
+ })
1961
+
1962
+ // --- Remove cover
1963
+ sock.removeCoverPhoto(coverId)
1964
+
1965
+ // --- Update quick replies
1966
+ sock.addOrEditQuickReply({
1967
+ shortcut: 'hello',
1968
+ message: 'Hello from business account',
1969
+ })
1970
+
1971
+ // --- Remove quick reply
1972
+ sock.removeQuickReply(timestamp)
1973
+ ```
1974
+
1975
+ #### 🔐 Privacy Management
1976
+
1977
+ ```javascript
1978
+ // --- Update last seen privacy
1979
+ sock.updateLastSeenPrivacy('all')
1980
+ sock.updateLastSeenPrivacy('contacts')
1981
+ sock.updateLastSeenPrivacy('contact_blacklist')
1982
+ sock.updateLastSeenPrivacy('nobody')
1983
+
1984
+ // --- Update online privacy
1985
+ sock.updateOnlinePrivacy('all')
1986
+ sock.updateOnlinePrivacy('match_last_seen')
1987
+
1988
+ // --- Update profile picture privacy
1989
+ sock.updateProfilePicturePrivacy('contacts')
1990
+
1991
+ // --- Update status privacy
1992
+ sock.updateStatusPrivacy('contacts')
1993
+
1994
+ // --- Update read receipts privacy
1995
+ sock.updateReadReceiptsPrivacy('all')
1996
+ sock.updateReadReceiptsPrivacy('none')
1997
+
1998
+ // --- Update groups add privacy
1999
+ sock.updateGroupsAddPrivacy('all')
2000
+ sock.updateGroupsAddPrivacy('contacts')
2001
+
2002
+ // --- Update messages privacy
2003
+ sock.updateMessagesPrivacy('all')
2004
+ sock.updateMessagesPrivacy('contacts')
2005
+ sock.updateMessagesPrivacy('nobody')
2006
+
2007
+ // --- Update call privacy
2008
+ sock.updateCallPrivacy('everyone')
2009
+
2010
+ // --- Update default disappearing mode
2011
+ sock.updateDefaultDisappearingMode(86400)
2012
+
2013
+ // --- Update link previews privacy
2014
+ sock.updateDisableLinkPreviewsPrivacy(true)
2015
+ ```
2016
+
2017
+ #### 📡 Events
2018
+
2019
+ ```javascript
2020
+ sock.ev.on('connection.update', (update) => {})
2021
+ sock.ev.on('creds.update', (update) => {})
2022
+ sock.ev.on('messaging-history.set', (update) => {})
2023
+ sock.ev.on('messaging-history.status', (update) => {})
2024
+ sock.ev.on('chats.upsert', (update) => {})
2025
+ sock.ev.on('chats.update', (update) => {})
2026
+ sock.ev.on('chats.delete', (update) => {})
2027
+ sock.ev.on('chats.lock', (update) => {})
2028
+ sock.ev.on('lid-mapping.update', (update) => {})
2029
+ sock.ev.on('presence.update', (update) => {})
2030
+ sock.ev.on('contacts.upsert', (update) => {})
2031
+ sock.ev.on('contacts.update', (update) => {})
2032
+ sock.ev.on('messages.delete', (update) => {})
2033
+ sock.ev.on('messages.update', (update) => {})
2034
+ sock.ev.on('messages.media-update', (update) => {})
2035
+ sock.ev.on('messages.upsert', (update) => {})
2036
+ sock.ev.on('messages.reaction', (update) => {})
2037
+ sock.ev.on('message-receipt.update', (update) => {})
2038
+ sock.ev.on('groups.upsert', (update) => {})
2039
+ sock.ev.on('groups.update', (update) => {})
2040
+ sock.ev.on('group-participants.update', (update) => {})
2041
+ sock.ev.on('group.join-request', (update) => {})
2042
+ sock.ev.on('group.member-tag.update', (update) => {})
2043
+ sock.ev.on('blocklist.set', (update) => {})
2044
+ sock.ev.on('blocklist.update', (update) => {})
2045
+ sock.ev.on('call', (update) => {})
2046
+ sock.ev.on('labels.edit', (update) => {})
2047
+ sock.ev.on('labels.association', (update) => {})
2048
+ sock.ev.on('newsletter.reaction', (update) => {})
2049
+ sock.ev.on('newsletter.view', (update) => {})
2050
+ sock.ev.on('newsletter-participants.update', (update) => {})
2051
+ sock.ev.on('newsletter-settings.update', (update) => {})
2052
+ sock.ev.on('settings.update', (update) => {})
2053
+ ```
2054
+
2055
+ ### 🚀 Try the Bot
2056
+
2057
+ A fast, lightweight, and modular WhatsApp bot built with [@itsliaaa/baileys](https://www.npmjs.com/package/@itsliaaa/baileys).
2058
+ Perfect for managing groups, moderating chats, and adding fun with quiz games and handy tools.
2059
+
2060
+ 👉🏻 [@itsliaaa/starseed](https://github.com/itsliaaa/starseed#readme)
2061
+
2062
+ A lightweight yet powerful Baileys wrapper designed to simplify development while extending support for additional message types and WhatsApp features.
2063
+
2064
+ 👉🏻 [@itsliaaa/starcore](https://www.npmjs.com/package/@itsliaaa/starcore)
2065
+
2066
+ ### 📦 Fork Base
2067
+
2068
+ This fork is based on [Baileys (GitHub)](https://github.com/WhiskeySockets/Baileys)
2069
+
2070
+ ### 📣 Credits
2071
+
2072
+ This fork uses Protocol Buffer definitions maintained by [WPP Connect](https://github.com/wppconnect-team) via [`wa-proto`](https://github.com/wppconnect-team/wa-proto)
2073
+
2074
+ Full credit is attributed to the original maintainers and contributors of Baileys:
2075
+ - [purpshell](https://github.com/purpshell)
2076
+ - [jlucaso1](https://github.com/jlucaso1)
2077
+ - [adiwajshing](https://github.com/adiwajshing)
2078
+
2079
+ <!-- Please do not replace my name with yours. It's disrespectful. -->
2080
+
2081
+ This fork includes additional enhancements and modifications by [Lia Wynn](https://github.com/itsliaaa)
2082
+
2083
+ Special thanks to [itsreimau](https://github.com/itsreimau) for the fix to the `updateBlockStatus` implementation.
2084
+
2085
+ > [!CAUTION]
2086
+ > ⚠️ **Modification, removal, or misrepresentation of these credits is strictly prohibited. Any redistribution or fork must preserve this section in its original form without exception.**