@elfhkry666/baileys 0.0.0-stage → 0.3.20

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