@vanzxy/baileys 1.0.0

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