@kaels/casileys 0.2.0

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