@kasabaileys/baileys 0.0.0-stage → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of @kasabaileys/baileys might be problematic. Click here for more details.

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