@fhkryxv/baileys-new 0.3.21

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