@risacakep/risayap 0.0.0-stage → 7.0.0-rc25.7

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 (423) hide show
  1. package/CLARISSA-BAILEYS-RC25.md +168 -0
  2. package/LICENSE +21 -0
  3. package/MIGRASI-CLARISSA-BAILEYS-RC25.md +102 -0
  4. package/README.md +1399 -2
  5. package/THIRD_PARTY_NOTICES.md +49 -0
  6. package/WAProto/GenerateStatics.sh +3 -0
  7. package/WAProto/WAProto.proto +5526 -0
  8. package/WAProto/fix-imports.js +85 -0
  9. package/WAProto/index.d.ts +14130 -0
  10. package/WAProto/index.js +97990 -0
  11. package/engine-requirements.js +10 -0
  12. package/lib/Defaults/index.d.ts +75 -0
  13. package/lib/Defaults/index.d.ts.map +1 -0
  14. package/lib/Defaults/index.js +131 -0
  15. package/lib/Defaults/index.js.map +1 -0
  16. package/lib/Extensions/advanced.d.ts +247 -0
  17. package/lib/Extensions/advanced.d.ts.map +1 -0
  18. package/lib/Extensions/advanced.js +821 -0
  19. package/lib/Extensions/advanced.js.map +1 -0
  20. package/lib/Extensions/experimental.d.ts +378 -0
  21. package/lib/Extensions/experimental.d.ts.map +1 -0
  22. package/lib/Extensions/experimental.js +628 -0
  23. package/lib/Extensions/experimental.js.map +1 -0
  24. package/lib/MessageBuilder/index.d.ts +210 -0
  25. package/lib/MessageBuilder/index.d.ts.map +1 -0
  26. package/lib/MessageBuilder/index.js +676 -0
  27. package/lib/MessageBuilder/index.js.map +1 -0
  28. package/lib/Signal/Group/ciphertext-message.d.ts +10 -0
  29. package/lib/Signal/Group/ciphertext-message.d.ts.map +1 -0
  30. package/lib/Signal/Group/ciphertext-message.js +12 -0
  31. package/lib/Signal/Group/ciphertext-message.js.map +1 -0
  32. package/lib/Signal/Group/group-session-builder.d.ts +15 -0
  33. package/lib/Signal/Group/group-session-builder.d.ts.map +1 -0
  34. package/lib/Signal/Group/group-session-builder.js +30 -0
  35. package/lib/Signal/Group/group-session-builder.js.map +1 -0
  36. package/lib/Signal/Group/group_cipher.d.ts +17 -0
  37. package/lib/Signal/Group/group_cipher.d.ts.map +1 -0
  38. package/lib/Signal/Group/group_cipher.js +82 -0
  39. package/lib/Signal/Group/group_cipher.js.map +1 -0
  40. package/lib/Signal/Group/index.d.ts +12 -0
  41. package/lib/Signal/Group/index.d.ts.map +1 -0
  42. package/lib/Signal/Group/index.js +12 -0
  43. package/lib/Signal/Group/index.js.map +1 -0
  44. package/lib/Signal/Group/keyhelper.d.ts +11 -0
  45. package/lib/Signal/Group/keyhelper.d.ts.map +1 -0
  46. package/lib/Signal/Group/keyhelper.js +18 -0
  47. package/lib/Signal/Group/keyhelper.js.map +1 -0
  48. package/lib/Signal/Group/sender-chain-key.d.ts +14 -0
  49. package/lib/Signal/Group/sender-chain-key.d.ts.map +1 -0
  50. package/lib/Signal/Group/sender-chain-key.js +26 -0
  51. package/lib/Signal/Group/sender-chain-key.js.map +1 -0
  52. package/lib/Signal/Group/sender-key-distribution-message.d.ts +17 -0
  53. package/lib/Signal/Group/sender-key-distribution-message.d.ts.map +1 -0
  54. package/lib/Signal/Group/sender-key-distribution-message.js +63 -0
  55. package/lib/Signal/Group/sender-key-distribution-message.js.map +1 -0
  56. package/lib/Signal/Group/sender-key-message.d.ts +19 -0
  57. package/lib/Signal/Group/sender-key-message.d.ts.map +1 -0
  58. package/lib/Signal/Group/sender-key-message.js +66 -0
  59. package/lib/Signal/Group/sender-key-message.js.map +1 -0
  60. package/lib/Signal/Group/sender-key-name.d.ts +18 -0
  61. package/lib/Signal/Group/sender-key-name.d.ts.map +1 -0
  62. package/lib/Signal/Group/sender-key-name.js +48 -0
  63. package/lib/Signal/Group/sender-key-name.js.map +1 -0
  64. package/lib/Signal/Group/sender-key-record.d.ts +31 -0
  65. package/lib/Signal/Group/sender-key-record.d.ts.map +1 -0
  66. package/lib/Signal/Group/sender-key-record.js +41 -0
  67. package/lib/Signal/Group/sender-key-record.js.map +1 -0
  68. package/lib/Signal/Group/sender-key-state.d.ts +39 -0
  69. package/lib/Signal/Group/sender-key-state.d.ts.map +1 -0
  70. package/lib/Signal/Group/sender-key-state.js +84 -0
  71. package/lib/Signal/Group/sender-key-state.js.map +1 -0
  72. package/lib/Signal/Group/sender-message-key.d.ts +12 -0
  73. package/lib/Signal/Group/sender-message-key.d.ts.map +1 -0
  74. package/lib/Signal/Group/sender-message-key.js +26 -0
  75. package/lib/Signal/Group/sender-message-key.js.map +1 -0
  76. package/lib/Signal/libsignal.d.ts +5 -0
  77. package/lib/Signal/libsignal.d.ts.map +1 -0
  78. package/lib/Signal/libsignal.js +431 -0
  79. package/lib/Signal/libsignal.js.map +1 -0
  80. package/lib/Signal/lid-mapping.d.ts +23 -0
  81. package/lib/Signal/lid-mapping.d.ts.map +1 -0
  82. package/lib/Signal/lid-mapping.js +277 -0
  83. package/lib/Signal/lid-mapping.js.map +1 -0
  84. package/lib/Socket/Client/index.d.ts +3 -0
  85. package/lib/Socket/Client/index.d.ts.map +1 -0
  86. package/lib/Socket/Client/index.js +3 -0
  87. package/lib/Socket/Client/index.js.map +1 -0
  88. package/lib/Socket/Client/types.d.ts +16 -0
  89. package/lib/Socket/Client/types.d.ts.map +1 -0
  90. package/lib/Socket/Client/types.js +11 -0
  91. package/lib/Socket/Client/types.js.map +1 -0
  92. package/lib/Socket/Client/websocket.d.ts +13 -0
  93. package/lib/Socket/Client/websocket.d.ts.map +1 -0
  94. package/lib/Socket/Client/websocket.js +54 -0
  95. package/lib/Socket/Client/websocket.js.map +1 -0
  96. package/lib/Socket/business.d.ts +219 -0
  97. package/lib/Socket/business.d.ts.map +1 -0
  98. package/lib/Socket/business.js +379 -0
  99. package/lib/Socket/business.js.map +1 -0
  100. package/lib/Socket/chats.d.ts +127 -0
  101. package/lib/Socket/chats.d.ts.map +1 -0
  102. package/lib/Socket/chats.js +1198 -0
  103. package/lib/Socket/chats.js.map +1 -0
  104. package/lib/Socket/communities.d.ts +275 -0
  105. package/lib/Socket/communities.d.ts.map +1 -0
  106. package/lib/Socket/communities.js +431 -0
  107. package/lib/Socket/communities.js.map +1 -0
  108. package/lib/Socket/groups.d.ts +163 -0
  109. package/lib/Socket/groups.d.ts.map +1 -0
  110. package/lib/Socket/groups.js +347 -0
  111. package/lib/Socket/groups.js.map +1 -0
  112. package/lib/Socket/index.d.ts +262 -0
  113. package/lib/Socket/index.d.ts.map +1 -0
  114. package/lib/Socket/index.js +33 -0
  115. package/lib/Socket/index.js.map +1 -0
  116. package/lib/Socket/messages-recv.d.ts +205 -0
  117. package/lib/Socket/messages-recv.d.ts.map +1 -0
  118. package/lib/Socket/messages-recv.js +1772 -0
  119. package/lib/Socket/messages-recv.js.map +1 -0
  120. package/lib/Socket/messages-send.d.ts +201 -0
  121. package/lib/Socket/messages-send.d.ts.map +1 -0
  122. package/lib/Socket/messages-send.js +1205 -0
  123. package/lib/Socket/messages-send.js.map +1 -0
  124. package/lib/Socket/mex.d.ts +3 -0
  125. package/lib/Socket/mex.d.ts.map +1 -0
  126. package/lib/Socket/mex.js +42 -0
  127. package/lib/Socket/mex.js.map +1 -0
  128. package/lib/Socket/newsletter.d.ts +172 -0
  129. package/lib/Socket/newsletter.d.ts.map +1 -0
  130. package/lib/Socket/newsletter.js +181 -0
  131. package/lib/Socket/newsletter.js.map +1 -0
  132. package/lib/Socket/socket.d.ts +59 -0
  133. package/lib/Socket/socket.d.ts.map +1 -0
  134. package/lib/Socket/socket.js +1015 -0
  135. package/lib/Socket/socket.js.map +1 -0
  136. package/lib/Types/Auth.d.ts +117 -0
  137. package/lib/Types/Auth.d.ts.map +1 -0
  138. package/lib/Types/Auth.js +2 -0
  139. package/lib/Types/Auth.js.map +1 -0
  140. package/lib/Types/Bussines.d.ts +25 -0
  141. package/lib/Types/Bussines.d.ts.map +1 -0
  142. package/lib/Types/Bussines.js +2 -0
  143. package/lib/Types/Bussines.js.map +1 -0
  144. package/lib/Types/Call.d.ts +15 -0
  145. package/lib/Types/Call.d.ts.map +1 -0
  146. package/lib/Types/Call.js +2 -0
  147. package/lib/Types/Call.js.map +1 -0
  148. package/lib/Types/Chat.d.ts +124 -0
  149. package/lib/Types/Chat.d.ts.map +1 -0
  150. package/lib/Types/Chat.js +8 -0
  151. package/lib/Types/Chat.js.map +1 -0
  152. package/lib/Types/Contact.d.ts +26 -0
  153. package/lib/Types/Contact.d.ts.map +1 -0
  154. package/lib/Types/Contact.js +2 -0
  155. package/lib/Types/Contact.js.map +1 -0
  156. package/lib/Types/Events.d.ts +256 -0
  157. package/lib/Types/Events.d.ts.map +1 -0
  158. package/lib/Types/Events.js +2 -0
  159. package/lib/Types/Events.js.map +1 -0
  160. package/lib/Types/GroupMetadata.d.ts +71 -0
  161. package/lib/Types/GroupMetadata.d.ts.map +1 -0
  162. package/lib/Types/GroupMetadata.js +2 -0
  163. package/lib/Types/GroupMetadata.js.map +1 -0
  164. package/lib/Types/Label.d.ts +47 -0
  165. package/lib/Types/Label.d.ts.map +1 -0
  166. package/lib/Types/Label.js +25 -0
  167. package/lib/Types/Label.js.map +1 -0
  168. package/lib/Types/LabelAssociation.d.ts +30 -0
  169. package/lib/Types/LabelAssociation.d.ts.map +1 -0
  170. package/lib/Types/LabelAssociation.js +7 -0
  171. package/lib/Types/LabelAssociation.js.map +1 -0
  172. package/lib/Types/Message.d.ts +331 -0
  173. package/lib/Types/Message.d.ts.map +1 -0
  174. package/lib/Types/Message.js +11 -0
  175. package/lib/Types/Message.js.map +1 -0
  176. package/lib/Types/Mex.d.ts +141 -0
  177. package/lib/Types/Mex.d.ts.map +1 -0
  178. package/lib/Types/Mex.js +37 -0
  179. package/lib/Types/Mex.js.map +1 -0
  180. package/lib/Types/Product.d.ts +79 -0
  181. package/lib/Types/Product.d.ts.map +1 -0
  182. package/lib/Types/Product.js +2 -0
  183. package/lib/Types/Product.js.map +1 -0
  184. package/lib/Types/Signal.d.ts +87 -0
  185. package/lib/Types/Signal.d.ts.map +1 -0
  186. package/lib/Types/Signal.js +2 -0
  187. package/lib/Types/Signal.js.map +1 -0
  188. package/lib/Types/Socket.d.ts +140 -0
  189. package/lib/Types/Socket.d.ts.map +1 -0
  190. package/lib/Types/Socket.js +3 -0
  191. package/lib/Types/Socket.js.map +1 -0
  192. package/lib/Types/State.d.ts +97 -0
  193. package/lib/Types/State.d.ts.map +1 -0
  194. package/lib/Types/State.js +56 -0
  195. package/lib/Types/State.js.map +1 -0
  196. package/lib/Types/USync.d.ts +26 -0
  197. package/lib/Types/USync.d.ts.map +1 -0
  198. package/lib/Types/USync.js +2 -0
  199. package/lib/Types/USync.js.map +1 -0
  200. package/lib/Types/index.d.ts +66 -0
  201. package/lib/Types/index.d.ts.map +1 -0
  202. package/lib/Types/index.js +26 -0
  203. package/lib/Types/index.js.map +1 -0
  204. package/lib/Utils/auth-utils.d.ts +24 -0
  205. package/lib/Utils/auth-utils.d.ts.map +1 -0
  206. package/lib/Utils/auth-utils.js +302 -0
  207. package/lib/Utils/auth-utils.js.map +1 -0
  208. package/lib/Utils/browser-utils.d.ts +4 -0
  209. package/lib/Utils/browser-utils.d.ts.map +1 -0
  210. package/lib/Utils/browser-utils.js +29 -0
  211. package/lib/Utils/browser-utils.js.map +1 -0
  212. package/lib/Utils/business.d.ts +23 -0
  213. package/lib/Utils/business.d.ts.map +1 -0
  214. package/lib/Utils/business.js +231 -0
  215. package/lib/Utils/business.js.map +1 -0
  216. package/lib/Utils/chat-utils.d.ts +100 -0
  217. package/lib/Utils/chat-utils.d.ts.map +1 -0
  218. package/lib/Utils/chat-utils.js +872 -0
  219. package/lib/Utils/chat-utils.js.map +1 -0
  220. package/lib/Utils/companion-reg-client-utils.d.ts +50 -0
  221. package/lib/Utils/companion-reg-client-utils.d.ts.map +1 -0
  222. package/lib/Utils/companion-reg-client-utils.js +90 -0
  223. package/lib/Utils/companion-reg-client-utils.js.map +1 -0
  224. package/lib/Utils/crypto.d.ts +37 -0
  225. package/lib/Utils/crypto.d.ts.map +1 -0
  226. package/lib/Utils/crypto.js +118 -0
  227. package/lib/Utils/crypto.js.map +1 -0
  228. package/lib/Utils/decode-wa-message.d.ts +66 -0
  229. package/lib/Utils/decode-wa-message.d.ts.map +1 -0
  230. package/lib/Utils/decode-wa-message.js +317 -0
  231. package/lib/Utils/decode-wa-message.js.map +1 -0
  232. package/lib/Utils/event-buffer.d.ts +36 -0
  233. package/lib/Utils/event-buffer.d.ts.map +1 -0
  234. package/lib/Utils/event-buffer.js +622 -0
  235. package/lib/Utils/event-buffer.js.map +1 -0
  236. package/lib/Utils/generics.d.ts +92 -0
  237. package/lib/Utils/generics.d.ts.map +1 -0
  238. package/lib/Utils/generics.js +393 -0
  239. package/lib/Utils/generics.js.map +1 -0
  240. package/lib/Utils/history.d.ts +24 -0
  241. package/lib/Utils/history.d.ts.map +1 -0
  242. package/lib/Utils/history.js +134 -0
  243. package/lib/Utils/history.js.map +1 -0
  244. package/lib/Utils/identity-change-handler.d.ts +44 -0
  245. package/lib/Utils/identity-change-handler.d.ts.map +1 -0
  246. package/lib/Utils/identity-change-handler.js +50 -0
  247. package/lib/Utils/identity-change-handler.js.map +1 -0
  248. package/lib/Utils/index.d.ts +22 -0
  249. package/lib/Utils/index.d.ts.map +1 -0
  250. package/lib/Utils/index.js +22 -0
  251. package/lib/Utils/index.js.map +1 -0
  252. package/lib/Utils/link-preview.d.ts +21 -0
  253. package/lib/Utils/link-preview.d.ts.map +1 -0
  254. package/lib/Utils/link-preview.js +85 -0
  255. package/lib/Utils/link-preview.js.map +1 -0
  256. package/lib/Utils/logger.d.ts +12 -0
  257. package/lib/Utils/logger.d.ts.map +1 -0
  258. package/lib/Utils/logger.js +3 -0
  259. package/lib/Utils/logger.js.map +1 -0
  260. package/lib/Utils/lt-hash.d.ts +8 -0
  261. package/lib/Utils/lt-hash.d.ts.map +1 -0
  262. package/lib/Utils/lt-hash.js +8 -0
  263. package/lib/Utils/lt-hash.js.map +1 -0
  264. package/lib/Utils/make-mutex.d.ts +9 -0
  265. package/lib/Utils/make-mutex.d.ts.map +1 -0
  266. package/lib/Utils/make-mutex.js +33 -0
  267. package/lib/Utils/make-mutex.js.map +1 -0
  268. package/lib/Utils/message-retry-manager.d.ts +115 -0
  269. package/lib/Utils/message-retry-manager.d.ts.map +1 -0
  270. package/lib/Utils/message-retry-manager.js +265 -0
  271. package/lib/Utils/message-retry-manager.js.map +1 -0
  272. package/lib/Utils/messages-media.d.ts +135 -0
  273. package/lib/Utils/messages-media.d.ts.map +1 -0
  274. package/lib/Utils/messages-media.js +791 -0
  275. package/lib/Utils/messages-media.js.map +1 -0
  276. package/lib/Utils/messages.d.ts +91 -0
  277. package/lib/Utils/messages.d.ts.map +1 -0
  278. package/lib/Utils/messages.js +910 -0
  279. package/lib/Utils/messages.js.map +1 -0
  280. package/lib/Utils/noise-handler.d.ts +20 -0
  281. package/lib/Utils/noise-handler.d.ts.map +1 -0
  282. package/lib/Utils/noise-handler.js +201 -0
  283. package/lib/Utils/noise-handler.js.map +1 -0
  284. package/lib/Utils/offline-node-processor.d.ts +17 -0
  285. package/lib/Utils/offline-node-processor.d.ts.map +1 -0
  286. package/lib/Utils/offline-node-processor.js +40 -0
  287. package/lib/Utils/offline-node-processor.js.map +1 -0
  288. package/lib/Utils/pre-key-manager.d.ts +28 -0
  289. package/lib/Utils/pre-key-manager.d.ts.map +1 -0
  290. package/lib/Utils/pre-key-manager.js +106 -0
  291. package/lib/Utils/pre-key-manager.js.map +1 -0
  292. package/lib/Utils/process-message.d.ts +60 -0
  293. package/lib/Utils/process-message.d.ts.map +1 -0
  294. package/lib/Utils/process-message.js +630 -0
  295. package/lib/Utils/process-message.js.map +1 -0
  296. package/lib/Utils/reporting-utils.d.ts +11 -0
  297. package/lib/Utils/reporting-utils.d.ts.map +1 -0
  298. package/lib/Utils/reporting-utils.js +258 -0
  299. package/lib/Utils/reporting-utils.js.map +1 -0
  300. package/lib/Utils/signal.d.ts +47 -0
  301. package/lib/Utils/signal.d.ts.map +1 -0
  302. package/lib/Utils/signal.js +201 -0
  303. package/lib/Utils/signal.js.map +1 -0
  304. package/lib/Utils/stanza-ack.d.ts +11 -0
  305. package/lib/Utils/stanza-ack.d.ts.map +1 -0
  306. package/lib/Utils/stanza-ack.js +38 -0
  307. package/lib/Utils/stanza-ack.js.map +1 -0
  308. package/lib/Utils/sync-action-utils.d.ts +19 -0
  309. package/lib/Utils/sync-action-utils.d.ts.map +1 -0
  310. package/lib/Utils/sync-action-utils.js +49 -0
  311. package/lib/Utils/sync-action-utils.js.map +1 -0
  312. package/lib/Utils/tc-token-utils.d.ts +37 -0
  313. package/lib/Utils/tc-token-utils.d.ts.map +1 -0
  314. package/lib/Utils/tc-token-utils.js +164 -0
  315. package/lib/Utils/tc-token-utils.js.map +1 -0
  316. package/lib/Utils/terminal-welcome.d.ts +11 -0
  317. package/lib/Utils/terminal-welcome.d.ts.map +1 -0
  318. package/lib/Utils/terminal-welcome.js +215 -0
  319. package/lib/Utils/terminal-welcome.js.map +1 -0
  320. package/lib/Utils/use-multi-file-auth-state.d.ts +13 -0
  321. package/lib/Utils/use-multi-file-auth-state.d.ts.map +1 -0
  322. package/lib/Utils/use-multi-file-auth-state.js +121 -0
  323. package/lib/Utils/use-multi-file-auth-state.js.map +1 -0
  324. package/lib/Utils/validate-connection.d.ts +11 -0
  325. package/lib/Utils/validate-connection.d.ts.map +1 -0
  326. package/lib/Utils/validate-connection.js +210 -0
  327. package/lib/Utils/validate-connection.js.map +1 -0
  328. package/lib/WABinary/constants.d.ts +28 -0
  329. package/lib/WABinary/constants.d.ts.map +1 -0
  330. package/lib/WABinary/constants.js +1301 -0
  331. package/lib/WABinary/constants.js.map +1 -0
  332. package/lib/WABinary/decode.d.ts +7 -0
  333. package/lib/WABinary/decode.d.ts.map +1 -0
  334. package/lib/WABinary/decode.js +262 -0
  335. package/lib/WABinary/decode.js.map +1 -0
  336. package/lib/WABinary/encode.d.ts +3 -0
  337. package/lib/WABinary/encode.d.ts.map +1 -0
  338. package/lib/WABinary/encode.js +220 -0
  339. package/lib/WABinary/encode.js.map +1 -0
  340. package/lib/WABinary/generic-utils.d.ts +31 -0
  341. package/lib/WABinary/generic-utils.d.ts.map +1 -0
  342. package/lib/WABinary/generic-utils.js +224 -0
  343. package/lib/WABinary/generic-utils.js.map +1 -0
  344. package/lib/WABinary/index.d.ts +6 -0
  345. package/lib/WABinary/index.d.ts.map +1 -0
  346. package/lib/WABinary/index.js +6 -0
  347. package/lib/WABinary/index.js.map +1 -0
  348. package/lib/WABinary/jid-utils.d.ts +48 -0
  349. package/lib/WABinary/jid-utils.d.ts.map +1 -0
  350. package/lib/WABinary/jid-utils.js +96 -0
  351. package/lib/WABinary/jid-utils.js.map +1 -0
  352. package/lib/WABinary/types.d.ts +19 -0
  353. package/lib/WABinary/types.d.ts.map +1 -0
  354. package/lib/WABinary/types.js +2 -0
  355. package/lib/WABinary/types.js.map +1 -0
  356. package/lib/WAM/BinaryInfo.d.ts +9 -0
  357. package/lib/WAM/BinaryInfo.d.ts.map +1 -0
  358. package/lib/WAM/BinaryInfo.js +10 -0
  359. package/lib/WAM/BinaryInfo.js.map +1 -0
  360. package/lib/WAM/constants.d.ts +40 -0
  361. package/lib/WAM/constants.d.ts.map +1 -0
  362. package/lib/WAM/constants.js +22853 -0
  363. package/lib/WAM/constants.js.map +1 -0
  364. package/lib/WAM/encode.d.ts +3 -0
  365. package/lib/WAM/encode.d.ts.map +1 -0
  366. package/lib/WAM/encode.js +150 -0
  367. package/lib/WAM/encode.js.map +1 -0
  368. package/lib/WAM/index.d.ts +4 -0
  369. package/lib/WAM/index.d.ts.map +1 -0
  370. package/lib/WAM/index.js +4 -0
  371. package/lib/WAM/index.js.map +1 -0
  372. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +10 -0
  373. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts.map +1 -0
  374. package/lib/WAUSync/Protocols/USyncContactProtocol.js +52 -0
  375. package/lib/WAUSync/Protocols/USyncContactProtocol.js.map +1 -0
  376. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +23 -0
  377. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts.map +1 -0
  378. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +54 -0
  379. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js.map +1 -0
  380. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +13 -0
  381. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts.map +1 -0
  382. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +27 -0
  383. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js.map +1 -0
  384. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +13 -0
  385. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts.map +1 -0
  386. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +38 -0
  387. package/lib/WAUSync/Protocols/USyncStatusProtocol.js.map +1 -0
  388. package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts +10 -0
  389. package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts.map +1 -0
  390. package/lib/WAUSync/Protocols/USyncUsernameProtocol.js +25 -0
  391. package/lib/WAUSync/Protocols/USyncUsernameProtocol.js.map +1 -0
  392. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +26 -0
  393. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts.map +1 -0
  394. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +51 -0
  395. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js.map +1 -0
  396. package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +10 -0
  397. package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts.map +1 -0
  398. package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +29 -0
  399. package/lib/WAUSync/Protocols/UsyncLIDProtocol.js.map +1 -0
  400. package/lib/WAUSync/Protocols/index.d.ts +6 -0
  401. package/lib/WAUSync/Protocols/index.d.ts.map +1 -0
  402. package/lib/WAUSync/Protocols/index.js +6 -0
  403. package/lib/WAUSync/Protocols/index.js.map +1 -0
  404. package/lib/WAUSync/USyncQuery.d.ts +30 -0
  405. package/lib/WAUSync/USyncQuery.d.ts.map +1 -0
  406. package/lib/WAUSync/USyncQuery.js +98 -0
  407. package/lib/WAUSync/USyncQuery.js.map +1 -0
  408. package/lib/WAUSync/USyncUser.d.ts +17 -0
  409. package/lib/WAUSync/USyncUser.d.ts.map +1 -0
  410. package/lib/WAUSync/USyncUser.js +31 -0
  411. package/lib/WAUSync/USyncUser.js.map +1 -0
  412. package/lib/WAUSync/index.d.ts +4 -0
  413. package/lib/WAUSync/index.d.ts.map +1 -0
  414. package/lib/WAUSync/index.js +4 -0
  415. package/lib/WAUSync/index.js.map +1 -0
  416. package/lib/extensions/clarissa-MessageBuilder.js +3257 -0
  417. package/lib/extensions/clarissa-ai-rich.js +658 -0
  418. package/lib/extensions/clarissa-carousel.js +275 -0
  419. package/lib/index.d.ts +15 -0
  420. package/lib/index.d.ts.map +1 -0
  421. package/lib/index.js +16 -0
  422. package/lib/index.js.map +1 -0
  423. package/package.json +147 -4
package/README.md CHANGED
@@ -1,3 +1,1400 @@
1
- # Temporary Holding Version
1
+ <div align="center">
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
+ <p align="center"><img src="https://raw.githubusercontent.com/Clarissa/clarissa-baileys-assets/main/clarissa-banner.png" alt="Clarissa Baileys — Clarissa" width="100%" /></p>
4
+
5
+ <p align="center">
6
+ <img src="https://raw.githubusercontent.com/Clarissa/clarissa-baileys-assets/main/clarissa-mark.png" alt="Clarissa Baileys Emblem" width="104" />
7
+ </p>
8
+
9
+ # ⚡ CLARISSA BAILEYS
10
+
11
+ **CLARISSA · WHATSAPP WEB TOOLKIT**
12
+
13
+ A Baileys-based TypeScript toolkit with additional Clarissa extensions.
14
+
15
+ <p>
16
+ <a href="https://www.npmjs.com/package/@risacakep/risayap"><img alt="Latest release" src="https://img.shields.io/npm/v/%40risacakep%2Frisayap?label=LATEST&style=for-the-badge&color=64748b" /></a>
17
+ <a href="https://www.npmjs.com/package/@risacakep/risayap?activeTab=versions"><img alt="Next release" src="https://img.shields.io/npm/v/%40risacakep%2Frisayap/next?label=NEXT&style=for-the-badge&color=7c3aed" /></a>
18
+ <a href="https://www.npmjs.com/package/@risacakep/risayap"><img alt="Weekly downloads" src="https://img.shields.io/npm/dw/%40risacakep%2Frisayap?style=for-the-badge&color=0891b2" /></a>
19
+ <img alt="Node.js 20+" src="https://img.shields.io/badge/Node.js-20%2B-339933?style=for-the-badge&logo=node.js&logoColor=white" />
20
+ <img alt="License MIT" src="https://img.shields.io/badge/license-MIT-2563eb?style=for-the-badge" />
21
+ </p>
22
+
23
+ <p align="center">
24
+ <a href="https://clarissa.github.io/clarissa-baileys-docs/">
25
+ <img src="https://img.shields.io/badge/CLARISSA_DOCS-OPEN-0B9F91?style=for-the-badge&logo=readthedocs&logoColor=white" alt="Open official Clarissa documentation" />
26
+ </a>
27
+ </p>
28
+
29
+ **BUILD · CONNECT · AUTOMATE**
30
+
31
+ [ NPM PACKAGE ](https://www.npmjs.com/package/@risacakep/risayap) · [ UPSTREAM PROJECT ](https://github.com/WhiskeySockets/Baileys) · [ VISUAL ASSETS ](https://github.com/Clarissa/clarissa-baileys-assets)
32
+
33
+ </div>
34
+
35
+ ---
36
+
37
+ ## ◈ What is Clarissa Baileys?
38
+
39
+ Clarissa Baileys is an unofficial distribution based on [WhiskeySockets/Baileys](https://github.com/WhiskeySockets/Baileys), maintained and extended by **Clarissa**. It brings the Baileys WhatsApp Web toolkit together with additional Clarissa experiments in one package.
40
+
41
+ > Clarissa is an independent community fork. It is not affiliated with WhatsApp, Meta, or the upstream maintainers.
42
+
43
+ ## ⚡ Toolkit at a glance
44
+
45
+ | BAILEYS CORE | CLARISSA EXTENSIONS |
46
+ |:--|:--|
47
+ | WhatsApp Web connection and event workflows | Additional interactive-message helpers |
48
+ | Messaging, media, groups, and authentication APIs | MessageBuilder, Button, ButtonV2, Carousel, and AIRich* |
49
+ | TypeScript declarations and Node.js runtime | Experimental features documented separately |
50
+
51
+ <sub>*Experimental helpers may have client-side limitations and can change between prereleases. Check the exports in the version you install before using them in production.</sub>
52
+
53
+ ## 🚀 Installation
54
+
55
+ Choose the release channel that matches your needs:
56
+
57
+ **Prerelease channel — receives the `next` tag**
58
+
59
+ ```bash
60
+ npm install @risacakep/risayap@next
61
+ ```
62
+
63
+ **Default channel — receives the `latest` tag**
64
+
65
+ ```bash
66
+ npm install @risacakep/risayap
67
+ ```
68
+
69
+ The `latest` and `next` tags are independent. The badges at the top show the version currently assigned to each channel.
70
+
71
+ ## ⌘ Quick start
72
+
73
+ The package follows the Baileys API model. Start with the connection and authentication guide in the API index below, then explore the Clarissa extension notes for experimental helpers.
74
+
75
+ ```ts
76
+ import makeWASocket from '@risacakep/risayap'
77
+ ```
78
+
79
+ See **[Connecting Account](#connecting-account)** and **[Save Auth Info](#saving--restoring-sessions)** in the guide below for the complete setup flow.
80
+
81
+ ## 🧩 Clarissa feature showcase
82
+
83
+ | Extension | Purpose | Availability |
84
+ |:--|:--|:--|
85
+ | MessageBuilder | Helper for composing message payloads | Experimental |
86
+ | Button / ButtonV2 | Interactive button helpers | Experimental |
87
+ | Carousel | Carousel-style interactive content helper | Experimental |
88
+ | AIRich | Rich interactive-message helper | Experimental |
89
+
90
+ The exact API and compatibility depend on the installed release and the receiving WhatsApp client. Use the examples included with the project and test experimental formats with a separate account before production use.
91
+
92
+ ## 🛠 Compatibility
93
+
94
+ - **Runtime:** Node.js 20 or newer.
95
+ - **Language:** TypeScript declarations are included with the package.
96
+ - **Platform behavior:** WhatsApp client support for experimental interactive messages may vary.
97
+
98
+ ## 📚 Documentation & resources
99
+
100
+ | Resource | Description |
101
+ |:--|:--|
102
+ | [API index below](#index) | Inherited Baileys connection, authentication, events, messaging, media, and utility guide |
103
+ | [Official Clarissa documentation](https://clarissa.github.io/clarissa-baileys-docs/) | Developer documentation and project guides |
104
+ | [RC25 Developer Guide](https://unpkg.com/@risacakep/risayap@next/CLARISSA-BAILEYS-RC25.md) | Complete Clarissa feature and usage guide |
105
+ | [Migration Guide](https://unpkg.com/@risacakep/risayap@next/MIGRASI-CLARISSA-BAILEYS-RC25.md) | Upgrade, compatibility and rollback guidance |
106
+ | [Third-Party Notices](https://unpkg.com/@risacakep/risayap@next/THIRD_PARTY_NOTICES.md) | Dependency licenses and upstream attribution |
107
+ | [npm package](https://www.npmjs.com/package/@risacakep/risayap) | Published versions and installation details |
108
+ | [Upstream Baileys](https://github.com/WhiskeySockets/Baileys) | Original project and upstream context |
109
+ | [Clarissa visual assets](https://github.com/Clarissa/clarissa-baileys-assets) | Public banners and project artwork |
110
+ | `Example/` | TypeScript usage examples included in the source repository |
111
+
112
+ ## ⚠️ Experimental features & responsible use
113
+
114
+ Clarissa's additional interactive-message helpers are experimental. Their behavior may differ across WhatsApp clients and may change between prereleases. Do not assume universal device support. Use a separate test account while evaluating experimental formats, and comply with applicable laws and platform terms.
115
+
116
+ ## 🤝 Credits & disclaimer
117
+
118
+ Clarissa Baileys is derived from [WhiskeySockets/Baileys](https://github.com/WhiskeySockets/Baileys). Credit and respect the upstream project's license and contributors when using or redistributing this fork.
119
+
120
+ This project is unofficial and is not affiliated with WhatsApp or Meta. WhatsApp is a trademark of its respective owner.
121
+
122
+ ---
123
+
124
+ # Index
125
+
126
+ - [Connecting Account](#connecting-account)
127
+ - [Connect with QR-CODE](#starting-socket-with-qr-code)
128
+ - [Connect with Pairing Code](#starting-socket-with-pairing-code)
129
+ - [Receive Full History](#receive-full-history)
130
+ - [Important Notes About Socket Config](#important-notes-about-socket-config)
131
+ - [Caching Group Metadata (Recommended)](#caching-group-metadata-recommended)
132
+ - [Improve Retry System & Decrypt Poll Votes](#improve-retry-system--decrypt-poll-votes)
133
+ - [Receive Notifications in Whatsapp App](#receive-notifications-in-whatsapp-app)
134
+
135
+ - [Save Auth Info](#saving--restoring-sessions)
136
+ - [Handling Events](#handling-events)
137
+ - [Example to Start](#example-to-start)
138
+ - [Decrypt Poll Votes](#decrypt-poll-votes)
139
+ - [Summary of Events on First Connection](#summary-of-events-on-first-connection)
140
+ - [Implementing a Data Store](#implementing-a-data-store)
141
+ - [Whatsapp IDs Explain](#whatsapp-ids-explain)
142
+ - [Utility Functions](#utility-functions)
143
+ - [Sending Messages](#sending-messages)
144
+ - [Non-Media Messages](#non-media-messages)
145
+ - [Text Message](#text-message)
146
+ - [Quote Message](#quote-message-works-with-all-types)
147
+ - [Mention User](#mention-user-works-with-most-types)
148
+ - [Forward Messages](#forward-messages)
149
+ - [Location Message](#location-message)
150
+ - [Contact Message](#contact-message)
151
+ - [Reaction Message](#reaction-message)
152
+ - [Pin Message](#pin-message)
153
+ - [Poll Message](#poll-message)
154
+ - [Sending with Link Preview](#sending-messages-with-link-previews)
155
+ - [Media Messages](#media-messages)
156
+ - [Gif Message](#gif-message)
157
+ - [Video Message](#video-message)
158
+ - [Audio Message](#audio-message)
159
+ - [Image Message](#image-message)
160
+ - [ViewOnce Message](#view-once-message)
161
+ - [Modify Messages](#modify-messages)
162
+ - [Delete Messages (for everyone)](#deleting-messages-for-everyone)
163
+ - [Edit Messages](#editing-messages)
164
+ - [Manipulating Media Messages](#manipulating-media-messages)
165
+ - [Thumbnail in Media Messages](#thumbnail-in-media-messages)
166
+ - [Downloading Media Messages](#downloading-media-messages)
167
+ - [Re-upload Media Message to Whatsapp](#re-upload-media-message-to-whatsapp)
168
+ - [Reject Call](#reject-call)
169
+ - [Send States in Chat](#send-states-in-chat)
170
+ - [Reading Messages](#reading-messages)
171
+ - [Update Presence](#update-presence)
172
+ - [Modifying Chats](#modifying-chats)
173
+ - [Archive a Chat](#archive-a-chat)
174
+ - [Mute/Unmute a Chat](#muteunmute-a-chat)
175
+ - [Mark a Chat Read/Unread](#mark-a-chat-readunread)
176
+ - [Delete a Message for Me](#delete-a-message-for-me)
177
+ - [Delete a Chat](#delete-a-chat)
178
+ - [Star/Unstar a Message](#starunstar-a-message)
179
+ - [Disappearing Messages](#disappearing-messages)
180
+ - [User Querys](#user-querys)
181
+ - [Check If ID Exists in Whatsapp](#check-if-id-exists-in-whatsapp)
182
+ - [Query Chat History (groups too)](#query-chat-history-groups-too)
183
+ - [Fetch Status](#fetch-status)
184
+ - [Fetch Profile Picture (groups too)](#fetch-profile-picture-groups-too)
185
+ - [Fetch Bussines Profile (such as description or category)](#fetch-bussines-profile-such-as-description-or-category)
186
+ - [Fetch Someone's Presence (if they're typing or online)](#fetch-someones-presence-if-theyre-typing-or-online)
187
+ - [Change Profile](#change-profile)
188
+ - [Change Profile Status](#change-profile-status)
189
+ - [Change Profile Name](#change-profile-name)
190
+ - [Change Display Picture (groups too)](#change-display-picture-groups-too)
191
+ - [Remove display picture (groups too)](#remove-display-picture-groups-too)
192
+ - [Groups](#groups)
193
+ - [Create a Group](#create-a-group)
194
+ - [Add/Remove or Demote/Promote](#addremove-or-demotepromote)
195
+ - [Change Subject (name)](#change-subject-name)
196
+ - [Change Description](#change-description)
197
+ - [Change Settings](#change-settings)
198
+ - [Leave a Group](#leave-a-group)
199
+ - [Get Invite Code](#get-invite-code)
200
+ - [Revoke Invite Code](#revoke-invite-code)
201
+ - [Join Using Invitation Code](#join-using-invitation-code)
202
+ - [Get Group Info by Invite Code](#get-group-info-by-invite-code)
203
+ - [Query Metadata (participants, name, description...)](#query-metadata-participants-name-description)
204
+ - [Join using groupInviteMessage](#join-using-groupinvitemessage)
205
+ - [Get Request Join List](#get-request-join-list)
206
+ - [Approve/Reject Request Join](#approvereject-request-join)
207
+ - [Get All Participating Groups Metadata](#get-all-participating-groups-metadata)
208
+ - [Toggle Ephemeral](#toggle-ephemeral)
209
+ - [Change Add Mode](#change-add-mode)
210
+ - [Privacy](#privacy)
211
+ - [Block/Unblock User](#blockunblock-user)
212
+ - [Get Privacy Settings](#get-privacy-settings)
213
+ - [Get BlockList](#get-blocklist)
214
+ - [Update LastSeen Privacy](#update-lastseen-privacy)
215
+ - [Update Online Privacy](#update-online-privacy)
216
+ - [Update Profile Picture Privacy](#update-profile-picture-privacy)
217
+ - [Update Status Privacy](#update-status-privacy)
218
+ - [Update Read Receipts Privacy](#update-read-receipts-privacy)
219
+ - [Update Groups Add Privacy](#update-groups-add-privacy)
220
+ - [Update Default Disappearing Mode](#update-default-disappearing-mode)
221
+ - [Broadcast Lists & Stories](#broadcast-lists--stories)
222
+ - [Send Broadcast & Stories](#send-broadcast--stories)
223
+ - [Query a Broadcast List's Recipients & Name](#query-a-broadcast-lists-recipients--name)
224
+ - [Writing Custom Functionality](#writing-custom-functionality)
225
+ - [Enabling Debug Level in Baileys Logs](#enabling-debug-level-in-baileys-logs)
226
+ - [How Whatsapp Communicate With Us](#how-whatsapp-communicate-with-us)
227
+ - [Register a Callback for Websocket Events](#register-a-callback-for-websocket-events)
228
+
229
+ ## Connecting Account
230
+
231
+ WhatsApp provides a multi-device API that allows Baileys to be authenticated as a second WhatsApp client by scanning a **QR code** or **Pairing Code** with WhatsApp on your phone.
232
+
233
+ > [!NOTE]
234
+ > **[Here](#example-to-start) is a simple example of event handling**
235
+
236
+ > [!TIP]
237
+ > **You can see all supported socket configs in the [SocketConfig type alias](https://baileys.wiki/docs/api/type-aliases/SocketConfig/) (Recommended)**
238
+
239
+ ### Starting socket with **QR-CODE**
240
+
241
+ > [!TIP]
242
+ > You can customize browser name if you connect with **QR-CODE**, with `Browser` constant, we have some browsers config, **see the [BrowsersMap type alias](https://baileys.wiki/docs/api/type-aliases/BrowsersMap/)**
243
+
244
+ ```ts
245
+ import makeWASocket from '@risacakep/risayap'
246
+
247
+ const sock = makeWASocket({
248
+ // can provide additional config here
249
+ browser: Browsers.ubuntu('My App'),
250
+ printQRInTerminal: true
251
+ })
252
+ ```
253
+
254
+ If the connection is successful, you will see a QR code printed on your terminal screen, scan it with WhatsApp on your phone and you'll be logged in!
255
+
256
+ ### Starting socket with **Pairing Code**
257
+
258
+
259
+ > [!IMPORTANT]
260
+ > Pairing Code isn't Mobile API, it's a method to connect Whatsapp Web without QR-CODE, you can connect only with one device, see [here](https://faq.whatsapp.com/1324084875126592/?cms_platform=web)
261
+
262
+ The phone number can't have `+` or `()` or `-`, only numbers, you must provide country code.
263
+
264
+ In Clarissa Baileys, omitting the second argument uses the default custom code `CLARISSA`. Supply another 8-character uppercase alphanumeric code to customize it, or pass `null` when you want Baileys to generate a random code. Because `CLARISSA` is a public default in this distribution, applications that need distinct pairing codes should pass a unique code or `null`.
265
+
266
+ ```ts
267
+ import makeWASocket from '@risacakep/risayap'
268
+
269
+ const sock = makeWASocket({
270
+ // can provide additional config here
271
+ printQRInTerminal: false //need to be false
272
+ })
273
+
274
+ if (!sock.authState.creds.registered) {
275
+ const number = 'XXXXXXXXXXX'
276
+ const code = await sock.requestPairingCode(number, 'CLARISSA')
277
+ console.log(code)
278
+ }
279
+ ```
280
+
281
+ ### Receive Full History
282
+
283
+ 1. Set `syncFullHistory` as `true`
284
+ 2. Baileys, by default, use chrome browser config
285
+ - If you'd like to emulate a desktop connection (and receive more message history), this browser setting to your Socket config:
286
+
287
+ ```ts
288
+ const sock = makeWASocket({
289
+ ...otherOpts,
290
+ // can use Windows, Ubuntu here too
291
+ browser: Browsers.macOS('Desktop'),
292
+ syncFullHistory: true
293
+ })
294
+ ```
295
+
296
+ ## Important Notes About Socket Config
297
+
298
+ ### Caching Group Metadata (Recommended)
299
+ - If you use baileys for groups, we recommend you to set `cachedGroupMetadata` in socket config, you need to implement a cache like this:
300
+
301
+ ```ts
302
+ const groupCache = new NodeCache({stdTTL: 5 * 60, useClones: false})
303
+
304
+ const sock = makeWASocket({
305
+ cachedGroupMetadata: async (jid) => groupCache.get(jid)
306
+ })
307
+
308
+ sock.ev.on('groups.update', async ([event]) => {
309
+ const metadata = await sock.groupMetadata(event.id)
310
+ groupCache.set(event.id, metadata)
311
+ })
312
+
313
+ sock.ev.on('group-participants.update', async (event) => {
314
+ const metadata = await sock.groupMetadata(event.id)
315
+ groupCache.set(event.id, metadata)
316
+ })
317
+ ```
318
+
319
+ ### Improve Retry System & Decrypt Poll Votes
320
+ - If you want to improve sending message, retrying when error occurs and decrypt poll votes, you need to have a store and set `getMessage` config in socket like this:
321
+ ```ts
322
+ const sock = makeWASocket({
323
+ getMessage: async (key) => await getMessageFromStore(key)
324
+ })
325
+ ```
326
+
327
+ ### Receive Notifications in Whatsapp App
328
+ - If you want to receive notifications in whatsapp app, set `markOnlineOnConnect` to `false`
329
+ ```ts
330
+ const sock = makeWASocket({
331
+ markOnlineOnConnect: false
332
+ })
333
+ ```
334
+ ## Saving & Restoring Sessions
335
+
336
+ You obviously don't want to keep scanning the QR code every time you want to connect.
337
+
338
+ So, you can load the credentials to log back in:
339
+ ```ts
340
+ import makeWASocket, { useMultiFileAuthState } from '@risacakep/risayap'
341
+
342
+ const { state, saveCreds } = await useMultiFileAuthState('auth_info_baileys')
343
+
344
+ // will use the given state to connect
345
+ // so if valid credentials are available -- it'll connect without QR
346
+ const sock = makeWASocket({ auth: state })
347
+
348
+ // this will be called as soon as the credentials are updated
349
+ sock.ev.on('creds.update', saveCreds)
350
+ ```
351
+
352
+ > [!IMPORTANT]
353
+ > `useMultiFileAuthState` is a utility function to help save the auth state in a single folder, this function serves as a good guide to help write auth & key states for SQL/no-SQL databases, which I would recommend in any production grade system.
354
+
355
+ > [!NOTE]
356
+ > When a message is received/sent, due to signal sessions needing updating, the auth keys (`authState.keys`) will update. Whenever that happens, you must save the updated keys (`authState.keys.set()` is called). Not doing so will prevent your messages from reaching the recipient & cause other unexpected consequences. The `useMultiFileAuthState` function automatically takes care of that, but for any other serious implementation -- you will need to be very careful with the key state management.
357
+
358
+ ## Handling Events
359
+
360
+ - Baileys uses the EventEmitter syntax for events.
361
+ They're all nicely typed up, so you shouldn't have any issues with an Intellisense editor like VS Code.
362
+
363
+ > [!IMPORTANT]
364
+ > **The events are in the [BaileysEventMap type alias](https://baileys.wiki/docs/api/type-aliases/BaileysEventMap/)**, it's important you see all events
365
+
366
+ You can listen to these events like this:
367
+ ```ts
368
+ const sock = makeWASocket()
369
+ sock.ev.on('messages.upsert', ({ messages }) => {
370
+ console.log('got messages', messages)
371
+ })
372
+ ```
373
+
374
+ ### Example to Start
375
+
376
+ > [!NOTE]
377
+ > This example includes basic auth storage too
378
+
379
+ > [!NOTE]
380
+ > For reliable serialization of the authentication state, especially when storing as JSON, always use the BufferJSON utility.
381
+
382
+ ```ts
383
+ import makeWASocket, { DisconnectReason, useMultiFileAuthState } from '@risacakep/risayap'
384
+ import { Boom } from '@hapi/boom'
385
+
386
+ async function connectToWhatsApp () {
387
+ const { state, saveCreds } = await useMultiFileAuthState('auth_info_baileys')
388
+ const sock = makeWASocket({
389
+ // can provide additional config here
390
+ auth: state,
391
+ printQRInTerminal: true
392
+ })
393
+ sock.ev.on('connection.update', (update) => {
394
+ const { connection, lastDisconnect } = update
395
+ if(connection === 'close') {
396
+ const shouldReconnect = (lastDisconnect.error as Boom)?.output?.statusCode !== DisconnectReason.loggedOut
397
+ console.log('connection closed due to ', lastDisconnect.error, ', reconnecting ', shouldReconnect)
398
+ // reconnect if not logged out
399
+ if(shouldReconnect) {
400
+ connectToWhatsApp()
401
+ }
402
+ } else if(connection === 'open') {
403
+ console.log('opened connection')
404
+ }
405
+ })
406
+ sock.ev.on('messages.upsert', event => {
407
+ for (const m of event.messages) {
408
+ console.log(JSON.stringify(m, undefined, 2))
409
+
410
+ console.log('replying to', m.key.remoteJid)
411
+ await sock.sendMessage(m.key.remoteJid!, { text: 'Hello Word' })
412
+ }
413
+ })
414
+
415
+ // to storage creds (session info) when it updates
416
+ sock.ev.on('creds.update', saveCreds)
417
+ }
418
+ // run in main file
419
+ connectToWhatsApp()
420
+ ```
421
+
422
+ > [!IMPORTANT]
423
+ > In `messages.upsert` it's recommended to use a loop like `for (const message of event.messages)` to handle all messages in array
424
+
425
+ ### Decrypt Poll Votes
426
+
427
+ - By default poll votes are encrypted and handled in `messages.update`
428
+ - That's a simple example
429
+ ```ts
430
+ sock.ev.on('messages.update', event => {
431
+ for(const { key, update } of event) {
432
+ if(update.pollUpdates) {
433
+ const pollCreation = await getMessage(key)
434
+ if(pollCreation) {
435
+ console.log(
436
+ 'got poll update, aggregation: ',
437
+ getAggregateVotesInPollMessage({
438
+ message: pollCreation,
439
+ pollUpdates: update.pollUpdates,
440
+ })
441
+ )
442
+ }
443
+ }
444
+ }
445
+ })
446
+ ```
447
+
448
+ - `getMessage` is a [store](#implementing-a-data-store) implementation (in your end)
449
+
450
+ ### Summary of Events on First Connection
451
+
452
+ 1. When you connect first time, `connection.update` will be fired requesting you to restart sock
453
+ 2. Then, history messages will be received in `messaging.history-set`
454
+
455
+ ## Implementing a Data Store
456
+
457
+ - Baileys does not come with a defacto storage for chats, contacts, or messages. However, a simple in-memory implementation has been provided. The store listens for chat updates, new messages, message updates, etc., to always have an up-to-date version of the data.
458
+
459
+ > [!IMPORTANT]
460
+ > I highly recommend building your own data store, as storing someone's entire chat history in memory is a terrible waste of RAM.
461
+
462
+ It can be used as follows:
463
+
464
+ ```ts
465
+ import makeWASocket, { makeInMemoryStore } from '@risacakep/risayap'
466
+ // the store maintains the data of the WA connection in memory
467
+ // can be written out to a file & read from it
468
+ const store = makeInMemoryStore({ })
469
+ // can be read from a file
470
+ store.readFromFile('./baileys_store.json')
471
+ // saves the state to a file every 10s
472
+ setInterval(() => {
473
+ store.writeToFile('./baileys_store.json')
474
+ }, 10_000)
475
+
476
+ const sock = makeWASocket({ })
477
+ // will listen from this socket
478
+ // the store can listen from a new socket once the current socket outlives its lifetime
479
+ store.bind(sock.ev)
480
+
481
+ sock.ev.on('chats.upsert', () => {
482
+ // can use 'store.chats' however you want, even after the socket dies out
483
+ // 'chats' => a KeyedDB instance
484
+ console.log('got chats', store.chats.all())
485
+ })
486
+
487
+ sock.ev.on('contacts.upsert', () => {
488
+ console.log('got contacts', Object.values(store.contacts))
489
+ })
490
+
491
+ ```
492
+
493
+ The store also provides some simple functions such as `loadMessages` that utilize the store to speed up data retrieval.
494
+
495
+ ## Whatsapp IDs Explain
496
+
497
+ - `id` is the WhatsApp ID, called `jid` too, of the person or group you're sending the message to.
498
+ - It must be in the format ```[country code][phone number]@s.whatsapp.net```
499
+ - Example for people: ```+19999999999@s.whatsapp.net```.
500
+ - For groups, it must be in the format ``` 123456789-123345@g.us ```.
501
+ - For broadcast lists, it's `[timestamp of creation]@broadcast`.
502
+ - For stories, the ID is `status@broadcast`.
503
+
504
+ ## Utility Functions
505
+
506
+ - `getContentType`, returns the content type for any message
507
+ - `getDevice`, returns the device from message
508
+ - `makeCacheableSignalKeyStore`, make auth store more fast
509
+ - `downloadContentFromMessage`, download content from any message
510
+
511
+ ## Sending Messages
512
+
513
+ - Send all types of messages with a single function
514
+ - **In the [AnyMessageContent type alias](https://baileys.wiki/docs/api/type-aliases/AnyMessageContent/) you can see all message contents supported, like text message**
515
+ - **In the [MiscMessageGenerationOptions type alias](https://baileys.wiki/docs/api/type-aliases/MiscMessageGenerationOptions/) you can see all options supported, like quote message**
516
+
517
+ ```ts
518
+ const jid: string
519
+ const content: AnyMessageContent
520
+ const options: MiscMessageGenerationOptions
521
+
522
+ sock.sendMessage(jid, content, options)
523
+ ```
524
+
525
+ ### Non-Media Messages
526
+
527
+ #### Text Message
528
+ ```ts
529
+ await sock.sendMessage(jid, { text: 'hello word' })
530
+ ```
531
+
532
+ #### Quote Message (works with all types)
533
+ ```ts
534
+ await sock.sendMessage(jid, { text: 'hello word' }, { quoted: message })
535
+ ```
536
+
537
+ #### Mention User (works with most types)
538
+ - @number is to mention in text, it's optional
539
+ ```ts
540
+ await sock.sendMessage(
541
+ jid,
542
+ {
543
+ text: '@12345678901',
544
+ mentions: ['12345678901@s.whatsapp.net']
545
+ }
546
+ )
547
+ ```
548
+
549
+ #### Forward Messages
550
+ - You need to have message object, can be retrieved from [store](#implementing-a-data-store) or use a [message](https://baileys.wiki/docs/api/type-aliases/WAMessage/) object
551
+ ```ts
552
+ const msg = getMessageFromStore() // implement this on your end
553
+ await sock.sendMessage(jid, { forward: msg }) // WA forward the message!
554
+ ```
555
+
556
+ #### Location Message
557
+ ```ts
558
+ await sock.sendMessage(
559
+ jid,
560
+ {
561
+ location: {
562
+ degreesLatitude: 24.121231,
563
+ degreesLongitude: 55.1121221
564
+ }
565
+ }
566
+ )
567
+ ```
568
+ #### Contact Message
569
+ ```ts
570
+ const vcard = 'BEGIN:VCARD\n' // metadata of the contact card
571
+ + 'VERSION:3.0\n'
572
+ + 'FN:Jeff Singh\n' // full name
573
+ + 'ORG:Ashoka Uni;\n' // the organization of the contact
574
+ + 'TEL;type=CELL;type=VOICE;waid=911234567890:+91 12345 67890\n' // WhatsApp ID + phone number
575
+ + 'END:VCARD'
576
+
577
+ await sock.sendMessage(
578
+ id,
579
+ {
580
+ contacts: {
581
+ displayName: 'Jeff',
582
+ contacts: [{ vcard }]
583
+ }
584
+ }
585
+ )
586
+ ```
587
+
588
+ #### Reaction Message
589
+ - You need to pass the key of message, you can retrieve from [store](#implementing-a-data-store) or use a [key](https://baileys.wiki/docs/api/type-aliases/WAMessageKey/) object
590
+ ```ts
591
+ await sock.sendMessage(
592
+ jid,
593
+ {
594
+ react: {
595
+ text: '💖', // use an empty string to remove the reaction
596
+ key: message.key
597
+ }
598
+ }
599
+ )
600
+ ```
601
+
602
+ #### Pin Message
603
+ - You need to pass the key of message, you can retrieve from [store](#implementing-a-data-store) or use a [key](https://baileys.wiki/docs/api/type-aliases/WAMessageKey/) object
604
+
605
+ - Time can be:
606
+
607
+ | Time | Seconds |
608
+ |-------|----------------|
609
+ | 24h | 86.400 |
610
+ | 7d | 604.800 |
611
+ | 30d | 2.592.000 |
612
+
613
+ ```ts
614
+ await sock.sendMessage(
615
+ jid,
616
+ {
617
+ pin: {
618
+ type: 1, // 0 to remove
619
+ time: 86400
620
+ key: message.key
621
+ }
622
+ }
623
+ )
624
+ ```
625
+
626
+ #### Poll Message
627
+ ```ts
628
+ await sock.sendMessage(
629
+ jid,
630
+ {
631
+ poll: {
632
+ name: 'My Poll',
633
+ values: ['Option 1', 'Option 2', ...],
634
+ selectableCount: 1,
635
+ toAnnouncementGroup: false // or true
636
+ }
637
+ }
638
+ )
639
+ ```
640
+
641
+ ### Sending Messages with Link Previews
642
+
643
+ 1. By default, wa does not have link generation when sent from the web
644
+ 2. Baileys has a function to generate the content for these link previews
645
+ 3. To enable this function's usage, add `link-preview-js` as a dependency to your project with `yarn add link-preview-js`
646
+ 4. Send a link:
647
+ ```ts
648
+ await sock.sendMessage(
649
+ jid,
650
+ {
651
+ text: 'Hi, this was sent using https://github.com/whiskeysockets/baileys'
652
+ }
653
+ )
654
+ ```
655
+
656
+ ### Media Messages
657
+
658
+ Sending media (video, stickers, images) is easier & more efficient than ever.
659
+
660
+ > [!NOTE]
661
+ > In media messages, you can pass `{ stream: Stream }` or `{ url: Url }` or `Buffer` directly, you can see more in the [WAMediaUpload type alias](https://baileys.wiki/docs/api/type-aliases/WAMediaUpload/)
662
+
663
+ - When specifying a media url, Baileys never loads the entire buffer into memory; it even encrypts the media as a readable stream.
664
+
665
+ > [!TIP]
666
+ > It's recommended to use Stream or Url to save memory
667
+
668
+ #### Gif Message
669
+ - Whatsapp doesn't support `.gif` files, that's why we send gifs as common `.mp4` video with `gifPlayback` flag
670
+ ```ts
671
+ await sock.sendMessage(
672
+ jid,
673
+ {
674
+ video: fs.readFileSync('Media/ma_gif.mp4'),
675
+ caption: 'hello word',
676
+ gifPlayback: true
677
+ }
678
+ )
679
+ ```
680
+
681
+ #### Video Message
682
+ ```ts
683
+ await sock.sendMessage(
684
+ id,
685
+ {
686
+ video: {
687
+ url: './Media/ma_gif.mp4'
688
+ },
689
+ caption: 'hello word',
690
+ ptv: false // if set to true, will send as a `video note`
691
+ }
692
+ )
693
+ ```
694
+
695
+ #### Audio Message
696
+ - To audio message work in all devices you need to convert with some tool like `ffmpeg` with this flags:
697
+ ```bash
698
+ codec: libopus //ogg file
699
+ ac: 1 //one channel
700
+ avoid_negative_ts
701
+ make_zero
702
+ ```
703
+ - Example:
704
+ ```bash
705
+ ffmpeg -i input.mp4 -avoid_negative_ts make_zero -ac 1 output.ogg
706
+ ```
707
+ ```ts
708
+ await sock.sendMessage(
709
+ jid,
710
+ {
711
+ audio: {
712
+ url: './Media/audio.mp3'
713
+ },
714
+ mimetype: 'audio/mp4'
715
+ }
716
+ )
717
+ ```
718
+
719
+ #### Image Message
720
+ ```ts
721
+ await sock.sendMessage(
722
+ id,
723
+ {
724
+ image: {
725
+ url: './Media/ma_img.png'
726
+ },
727
+ caption: 'hello word'
728
+ }
729
+ )
730
+ ```
731
+
732
+ #### View Once Message
733
+
734
+ - You can send all messages above as `viewOnce`, you only need to pass `viewOnce: true` in content object
735
+
736
+ ```ts
737
+ await sock.sendMessage(
738
+ id,
739
+ {
740
+ image: {
741
+ url: './Media/ma_img.png'
742
+ },
743
+ viewOnce: true, //works with video, audio too
744
+ caption: 'hello word'
745
+ }
746
+ )
747
+ ```
748
+
749
+ ## Modify Messages
750
+
751
+ ### Deleting Messages (for everyone)
752
+
753
+ ```ts
754
+ const msg = await sock.sendMessage(jid, { text: 'hello word' })
755
+ await sock.sendMessage(jid, { delete: msg.key })
756
+ ```
757
+
758
+ **Note:** deleting for oneself is supported via `chatModify`, see in [this section](#modifying-chats)
759
+
760
+ ### Editing Messages
761
+
762
+ - You can pass all editable contents here
763
+ ```ts
764
+ await sock.sendMessage(jid, {
765
+ text: 'updated text goes here',
766
+ edit: response.key,
767
+ });
768
+ ```
769
+
770
+ ## Manipulating Media Messages
771
+
772
+ ### Thumbnail in Media Messages
773
+ - For media messages, the thumbnail can be generated automatically for images & stickers provided you add `jimp` or `sharp` as a dependency in your project using `yarn add jimp` or `yarn add sharp`.
774
+ - Thumbnails for videos can also be generated automatically, though, you need to have `ffmpeg` installed on your system.
775
+
776
+ ### Downloading Media Messages
777
+
778
+ If you want to save the media you received
779
+ ```ts
780
+ import { createWriteStream } from 'fs'
781
+ import { downloadMediaMessage, getContentType } from '@risacakep/risayap'
782
+
783
+ sock.ev.on('messages.upsert', async ({ [m] }) => {
784
+ if (!m.message) return // if there is no text or media message
785
+ const messageType = getContentType(m) // get what type of message it is (text, image, video...)
786
+
787
+ // if the message is an image
788
+ if (messageType === 'imageMessage') {
789
+ // download the message
790
+ const stream = await downloadMediaMessage(
791
+ m,
792
+ 'stream', // can be 'buffer' too
793
+ { },
794
+ {
795
+ logger,
796
+ // pass this so that baileys can request a reupload of media
797
+ // that has been deleted
798
+ reuploadRequest: sock.updateMediaMessage
799
+ }
800
+ )
801
+ // save to file
802
+ const writeStream = createWriteStream('./my-download.jpeg')
803
+ stream.pipe(writeStream)
804
+ }
805
+ }
806
+ ```
807
+
808
+ ### Re-upload Media Message to Whatsapp
809
+
810
+ - WhatsApp automatically removes old media from their servers. For the device to access said media -- a re-upload is required by another device that has it. This can be accomplished using:
811
+ ```ts
812
+ await sock.updateMediaMessage(msg)
813
+ ```
814
+
815
+ ## Reject Call
816
+
817
+ - You can obtain `callId` and `callFrom` from `call` event
818
+
819
+ ```ts
820
+ await sock.rejectCall(callId, callFrom)
821
+ ```
822
+
823
+ ## Send States in Chat
824
+
825
+ ### Reading Messages
826
+ - A set of message [keys](https://baileys.wiki/docs/api/type-aliases/WAMessageKey/) must be explicitly marked read now.
827
+ - You cannot mark an entire 'chat' read as it were with Baileys Web.
828
+ This means you have to keep track of unread messages.
829
+
830
+ ```ts
831
+ const key: WAMessageKey
832
+ // can pass multiple keys to read multiple messages as well
833
+ await sock.readMessages([key])
834
+ ```
835
+
836
+ The message ID is the unique identifier of the message that you are marking as read.
837
+ On a `WAMessage`, the `messageID` can be accessed using ```messageID = message.key.id```.
838
+
839
+ ### Update Presence
840
+
841
+ - ``` presence ``` can be one of the values in the [WAPresence type alias](https://baileys.wiki/docs/api/type-aliases/WAPresence/)
842
+ - The presence expires after about 10 seconds.
843
+ - This lets the person/group with `jid` know whether you're online, offline, typing etc.
844
+
845
+ ```ts
846
+ await sock.sendPresenceUpdate('available', jid)
847
+ ```
848
+
849
+ > [!NOTE]
850
+ > If a desktop client is active, WA doesn't send push notifications to the device. If you would like to receive said notifications -- mark your Baileys client offline using `sock.sendPresenceUpdate('unavailable')`
851
+
852
+ ## Modifying Chats
853
+
854
+ WA uses an encrypted form of communication to send chat/app updates. This has been implemented mostly and you can send the following updates:
855
+
856
+ > [!IMPORTANT]
857
+ > If you mess up one of your updates, WA can log you out of all your devices and you'll have to log in again.
858
+
859
+ ### Archive a Chat
860
+ ```ts
861
+ const lastMsgInChat = await getLastMessageInChat(jid) // implement this on your end
862
+ await sock.chatModify({ archive: true, lastMessages: [lastMsgInChat] }, jid)
863
+ ```
864
+ ### Mute/Unmute a Chat
865
+
866
+ - Supported times:
867
+
868
+ | Time | Miliseconds |
869
+ |-------|-----------------|
870
+ | Remove | null |
871
+ | 8h | 86.400.000 |
872
+ | 7d | 604.800.000 |
873
+
874
+ ```ts
875
+ // mute for 8 hours
876
+ await sock.chatModify({ mute: 8 * 60 * 60 * 1000 }, jid)
877
+ // unmute
878
+ await sock.chatModify({ mute: null }, jid)
879
+ ```
880
+ ### Mark a Chat Read/Unread
881
+ ```ts
882
+ const lastMsgInChat = await getLastMessageInChat(jid) // implement this on your end
883
+ // mark it unread
884
+ await sock.chatModify({ markRead: false, lastMessages: [lastMsgInChat] }, jid)
885
+ ```
886
+
887
+ ### Delete a Message for Me
888
+ ```ts
889
+ await sock.chatModify(
890
+ {
891
+ clear: {
892
+ messages: [
893
+ {
894
+ id: 'ATWYHDNNWU81732J',
895
+ fromMe: true,
896
+ timestamp: '1654823909'
897
+ }
898
+ ]
899
+ }
900
+ },
901
+ jid
902
+ )
903
+
904
+ ```
905
+ ### Delete a Chat
906
+ ```ts
907
+ const lastMsgInChat = await getLastMessageInChat(jid) // implement this on your end
908
+ await sock.chatModify({
909
+ delete: true,
910
+ lastMessages: [
911
+ {
912
+ key: lastMsgInChat.key,
913
+ messageTimestamp: lastMsgInChat.messageTimestamp
914
+ }
915
+ ]
916
+ },
917
+ jid
918
+ )
919
+ ```
920
+ ### Pin/Unpin a Chat
921
+ ```ts
922
+ await sock.chatModify({
923
+ pin: true // or `false` to unpin
924
+ },
925
+ jid
926
+ )
927
+ ```
928
+ ### Star/Unstar a Message
929
+ ```ts
930
+ await sock.chatModify({
931
+ star: {
932
+ messages: [
933
+ {
934
+ id: 'messageID',
935
+ fromMe: true // or `false`
936
+ }
937
+ ],
938
+ star: true // - true: Star Message; false: Unstar Message
939
+ }
940
+ },
941
+ jid
942
+ )
943
+ ```
944
+
945
+ ### Disappearing Messages
946
+
947
+ - Ephemeral can be:
948
+
949
+ | Time | Seconds |
950
+ |-------|----------------|
951
+ | Remove | 0 |
952
+ | 24h | 86.400 |
953
+ | 7d | 604.800 |
954
+ | 90d | 7.776.000 |
955
+
956
+ - You need to pass in **Seconds**, default is 7 days
957
+
958
+ ```ts
959
+ // turn on disappearing messages
960
+ await sock.sendMessage(
961
+ jid,
962
+ // this is 1 week in seconds -- how long you want messages to appear for
963
+ { disappearingMessagesInChat: WA_DEFAULT_EPHEMERAL }
964
+ )
965
+
966
+ // will send as a disappearing message
967
+ await sock.sendMessage(jid, { text: 'hello' }, { ephemeralExpiration: WA_DEFAULT_EPHEMERAL })
968
+
969
+ // turn off disappearing messages
970
+ await sock.sendMessage(
971
+ jid,
972
+ { disappearingMessagesInChat: false }
973
+ )
974
+ ```
975
+
976
+ ## User Querys
977
+
978
+ ### Check If ID Exists in Whatsapp
979
+ ```ts
980
+ const [result] = await sock.onWhatsApp(jid)
981
+ if (result.exists) console.log (`${jid} exists on WhatsApp, as jid: ${result.jid}`)
982
+ ```
983
+
984
+ ### Query Chat History (groups too)
985
+
986
+ - You need to have oldest message in chat
987
+ ```ts
988
+ const msg = await getOldestMessageInChat(jid) // implement this on your end
989
+ await sock.fetchMessageHistory(
990
+ 50, //quantity (max: 50 per query)
991
+ msg.key,
992
+ msg.messageTimestamp
993
+ )
994
+ ```
995
+ - Messages will be received in `messaging.history-set` event
996
+
997
+ ### Fetch Status
998
+ ```ts
999
+ const status = await sock.fetchStatus(jid)
1000
+ console.log('status: ' + status)
1001
+ ```
1002
+
1003
+ ### Fetch Profile Picture (groups too)
1004
+ - To get the display picture of some person/group
1005
+ ```ts
1006
+ // for low res picture
1007
+ const ppUrl = await sock.profilePictureUrl(jid)
1008
+ console.log(ppUrl)
1009
+
1010
+ // for high res picture
1011
+ const ppUrl = await sock.profilePictureUrl(jid, 'image')
1012
+ ```
1013
+
1014
+ ### Fetch Bussines Profile (such as description or category)
1015
+ ```ts
1016
+ const profile = await sock.getBusinessProfile(jid)
1017
+ console.log('business description: ' + profile.description + ', category: ' + profile.category)
1018
+ ```
1019
+
1020
+ ### Fetch Someone's Presence (if they're typing or online)
1021
+ ```ts
1022
+ // the presence update is fetched and called here
1023
+ sock.ev.on('presence.update', console.log)
1024
+
1025
+ // request updates for a chat
1026
+ await sock.presenceSubscribe(jid)
1027
+ ```
1028
+
1029
+ ## Change Profile
1030
+
1031
+ ### Change Profile Status
1032
+ ```ts
1033
+ await sock.updateProfileStatus('Hello World!')
1034
+ ```
1035
+ ### Change Profile Name
1036
+ ```ts
1037
+ await sock.updateProfileName('My name')
1038
+ ```
1039
+ ### Change Display Picture (groups too)
1040
+ - To change your display picture or a group's
1041
+
1042
+ > [!NOTE]
1043
+ > Like media messages, you can pass `{ stream: Stream }` or `{ url: Url }` or `Buffer` directly, you can see more in the [WAMediaUpload type alias](https://baileys.wiki/docs/api/type-aliases/WAMediaUpload/)
1044
+
1045
+ ```ts
1046
+ await sock.updateProfilePicture(jid, { url: './new-profile-picture.jpeg' })
1047
+ ```
1048
+ ### Remove display picture (groups too)
1049
+ ```ts
1050
+ await sock.removeProfilePicture(jid)
1051
+ ```
1052
+
1053
+ ## Groups
1054
+
1055
+ - To change group properties you need to be admin
1056
+
1057
+ ### Create a Group
1058
+ ```ts
1059
+ // title & participants
1060
+ const group = await sock.groupCreate('My Fab Group', ['1234@s.whatsapp.net', '4564@s.whatsapp.net'])
1061
+ console.log('created group with id: ' + group.gid)
1062
+ await sock.sendMessage(group.id, { text: 'hello there' }) // say hello to everyone on the group
1063
+ ```
1064
+ ### Add/Remove or Demote/Promote
1065
+ ```ts
1066
+ // id & people to add to the group (will throw error if it fails)
1067
+ await sock.groupParticipantsUpdate(
1068
+ jid,
1069
+ ['abcd@s.whatsapp.net', 'efgh@s.whatsapp.net'],
1070
+ 'add' // replace this parameter with 'remove' or 'demote' or 'promote'
1071
+ )
1072
+ ```
1073
+ ### Change Subject (name)
1074
+ ```ts
1075
+ await sock.groupUpdateSubject(jid, 'New Subject!')
1076
+ ```
1077
+ ### Change Description
1078
+ ```ts
1079
+ await sock.groupUpdateDescription(jid, 'New Description!')
1080
+ ```
1081
+ ### Change Settings
1082
+ ```ts
1083
+ // only allow admins to send messages
1084
+ await sock.groupSettingUpdate(jid, 'announcement')
1085
+ // allow everyone to send messages
1086
+ await sock.groupSettingUpdate(jid, 'not_announcement')
1087
+ // allow everyone to modify the group's settings -- like display picture etc.
1088
+ await sock.groupSettingUpdate(jid, 'unlocked')
1089
+ // only allow admins to modify the group's settings
1090
+ await sock.groupSettingUpdate(jid, 'locked')
1091
+ ```
1092
+ ### Leave a Group
1093
+ ```ts
1094
+ // will throw error if it fails
1095
+ await sock.groupLeave(jid)
1096
+ ```
1097
+ ### Get Invite Code
1098
+ - To create link with code use `'https://chat.whatsapp.com/' + code`
1099
+ ```ts
1100
+ const code = await sock.groupInviteCode(jid)
1101
+ console.log('group code: ' + code)
1102
+ ```
1103
+ ### Revoke Invite Code
1104
+ ```ts
1105
+ const code = await sock.groupRevokeInvite(jid)
1106
+ console.log('New group code: ' + code)
1107
+ ```
1108
+ ### Join Using Invitation Code
1109
+ - Code can't have `https://chat.whatsapp.com/`, only code
1110
+ ```ts
1111
+ const response = await sock.groupAcceptInvite(code)
1112
+ console.log('joined to: ' + response)
1113
+ ```
1114
+ ### Get Group Info by Invite Code
1115
+ ```ts
1116
+ const response = await sock.groupGetInviteInfo(code)
1117
+ console.log('group information: ' + response)
1118
+ ```
1119
+ ### Query Metadata (participants, name, description...)
1120
+ ```ts
1121
+ const metadata = await sock.groupMetadata(jid)
1122
+ console.log(metadata.id + ', title: ' + metadata.subject + ', description: ' + metadata.desc)
1123
+ ```
1124
+ ### Join using `groupInviteMessage`
1125
+ ```ts
1126
+ const response = await sock.groupAcceptInviteV4(jid, groupInviteMessage)
1127
+ console.log('joined to: ' + response)
1128
+ ```
1129
+ ### Get Request Join List
1130
+ ```ts
1131
+ const response = await sock.groupRequestParticipantsList(jid)
1132
+ console.log(response)
1133
+ ```
1134
+ ### Approve/Reject Request Join
1135
+ ```ts
1136
+ const response = await sock.groupRequestParticipantsUpdate(
1137
+ jid, // group id
1138
+ ['abcd@s.whatsapp.net', 'efgh@s.whatsapp.net'],
1139
+ 'approve' // or 'reject'
1140
+ )
1141
+ console.log(response)
1142
+ ```
1143
+ ### Get All Participating Groups Metadata
1144
+ ```ts
1145
+ const response = await sock.groupFetchAllParticipating()
1146
+ console.log(response)
1147
+ ```
1148
+ ### Toggle Ephemeral
1149
+
1150
+ - Ephemeral can be:
1151
+
1152
+ | Time | Seconds |
1153
+ |-------|----------------|
1154
+ | Remove | 0 |
1155
+ | 24h | 86.400 |
1156
+ | 7d | 604.800 |
1157
+ | 90d | 7.776.000 |
1158
+
1159
+ ```ts
1160
+ await sock.groupToggleEphemeral(jid, 86400)
1161
+ ```
1162
+
1163
+ ### Change Add Mode
1164
+ ```ts
1165
+ await sock.groupMemberAddMode(
1166
+ jid,
1167
+ 'all_member_add' // or 'admin_add'
1168
+ )
1169
+ ```
1170
+
1171
+ ## Privacy
1172
+
1173
+ ### Block/Unblock User
1174
+ ```ts
1175
+ await sock.updateBlockStatus(jid, 'block') // Block user
1176
+ await sock.updateBlockStatus(jid, 'unblock') // Unblock user
1177
+ ```
1178
+ ### Get Privacy Settings
1179
+ ```ts
1180
+ const privacySettings = await sock.fetchPrivacySettings(true)
1181
+ console.log('privacy settings: ' + privacySettings)
1182
+ ```
1183
+ ### Get BlockList
1184
+ ```ts
1185
+ const response = await sock.fetchBlocklist()
1186
+ console.log(response)
1187
+ ```
1188
+ ### Update LastSeen Privacy
1189
+ ```ts
1190
+ const value = 'all' // 'contacts' | 'contact_blacklist' | 'none'
1191
+ await sock.updateLastSeenPrivacy(value)
1192
+ ```
1193
+ ### Update Online Privacy
1194
+ ```ts
1195
+ const value = 'all' // 'match_last_seen'
1196
+ await sock.updateOnlinePrivacy(value)
1197
+ ```
1198
+ ### Update Profile Picture Privacy
1199
+ ```ts
1200
+ const value = 'all' // 'contacts' | 'contact_blacklist' | 'none'
1201
+ await sock.updateProfilePicturePrivacy(value)
1202
+ ```
1203
+ ### Update Status Privacy
1204
+ ```ts
1205
+ const value = 'all' // 'contacts' | 'contact_blacklist' | 'none'
1206
+ await sock.updateStatusPrivacy(value)
1207
+ ```
1208
+ ### Update Read Receipts Privacy
1209
+ ```ts
1210
+ const value = 'all' // 'none'
1211
+ await sock.updateReadReceiptsPrivacy(value)
1212
+ ```
1213
+ ### Update Groups Add Privacy
1214
+ ```ts
1215
+ const value = 'all' // 'contacts' | 'contact_blacklist'
1216
+ await sock.updateGroupsAddPrivacy(value)
1217
+ ```
1218
+ ### Update Default Disappearing Mode
1219
+
1220
+ - Like [this](#disappearing-messages), ephemeral can be:
1221
+
1222
+ | Time | Seconds |
1223
+ |-------|----------------|
1224
+ | Remove | 0 |
1225
+ | 24h | 86.400 |
1226
+ | 7d | 604.800 |
1227
+ | 90d | 7.776.000 |
1228
+
1229
+ ```ts
1230
+ const ephemeral = 86400
1231
+ await sock.updateDefaultDisappearingMode(ephemeral)
1232
+ ```
1233
+
1234
+ ## Broadcast Lists & Stories
1235
+
1236
+ ### Send Broadcast & Stories
1237
+ - Messages can be sent to broadcasts & stories. You need to add the following message options in sendMessage, like this:
1238
+ ```ts
1239
+ await sock.sendMessage(
1240
+ jid,
1241
+ {
1242
+ image: {
1243
+ url: url
1244
+ },
1245
+ caption: caption
1246
+ },
1247
+ {
1248
+ backgroundColor: backgroundColor,
1249
+ font: font,
1250
+ statusJidList: statusJidList,
1251
+ broadcast: true
1252
+ }
1253
+ )
1254
+ ```
1255
+ - Message body can be a `extendedTextMessage` or `imageMessage` or `videoMessage` or `voiceMessage`, see the [AnyRegularMessageContent type alias](https://baileys.wiki/docs/api/type-aliases/AnyRegularMessageContent/)
1256
+ - You can add `backgroundColor` and other options in the message options, see the [MiscMessageGenerationOptions type alias](https://baileys.wiki/docs/api/type-aliases/MiscMessageGenerationOptions/)
1257
+ - `broadcast: true` enables broadcast mode
1258
+ - `statusJidList`: a list of people that you can get which you need to provide, which are the people who will get this status message.
1259
+
1260
+ - You can send messages to broadcast lists the same way you send messages to groups & individual chats.
1261
+ - Right now, WA Web does not support creating broadcast lists, but you can still delete them.
1262
+ - Broadcast IDs are in the format `12345678@broadcast`
1263
+ ### Query a Broadcast List's Recipients & Name
1264
+ ```ts
1265
+ const bList = await sock.getBroadcastListInfo('1234@broadcast')
1266
+ console.log (`list name: ${bList.name}, recps: ${bList.recipients}`)
1267
+ ```
1268
+
1269
+ ## Writing Custom Functionality
1270
+ Baileys is written with custom functionality in mind. Instead of forking the project & re-writing the internals, you can simply write your own extensions.
1271
+
1272
+ ### Enabling Debug Level in Baileys Logs
1273
+ First, enable the logging of unhandled messages from WhatsApp by setting:
1274
+ ```ts
1275
+ const sock = makeWASocket({
1276
+ logger: P({ level: 'debug' }),
1277
+ })
1278
+ ```
1279
+ This will enable you to see all sorts of messages WhatsApp sends in the console.
1280
+
1281
+ ### How Whatsapp Communicate With Us
1282
+
1283
+ > [!TIP]
1284
+ > If you want to learn whatsapp protocol, we recommend to study about Libsignal Protocol and Noise Protocol
1285
+
1286
+ - **Example:** Functionality to track the battery percentage of your phone. You enable logging and you'll see a message about your battery pop up in the console:
1287
+ ```
1288
+ {
1289
+ "level": 10,
1290
+ "fromMe": false,
1291
+ "frame": {
1292
+ "tag": "ib",
1293
+ "attrs": {
1294
+ "from": "@s.whatsapp.net"
1295
+ },
1296
+ "content": [
1297
+ {
1298
+ "tag": "edge_routing",
1299
+ "attrs": {},
1300
+ "content": [
1301
+ {
1302
+ "tag": "routing_info",
1303
+ "attrs": {},
1304
+ "content": {
1305
+ "type": "Buffer",
1306
+ "data": [8,2,8,5]
1307
+ }
1308
+ }
1309
+ ]
1310
+ }
1311
+ ]
1312
+ },
1313
+ "msg":"communication"
1314
+ }
1315
+ ```
1316
+
1317
+ The `'frame'` is what the message received is, it has three components:
1318
+ - `tag` -- what this frame is about (eg. message will have 'message')
1319
+ - `attrs` -- a string key-value pair with some metadata (contains ID of the message usually)
1320
+ - `content` -- the actual data (eg. a message node will have the actual message content in it)
1321
+ - read more about this format [here](/src/WABinary/readme.md)
1322
+
1323
+ ### Register a Callback for Websocket Events
1324
+
1325
+ > [!TIP]
1326
+ > Recommended to see `onMessageReceived` function in `socket.ts` file to understand how websockets events are fired
1327
+
1328
+ ```ts
1329
+ // for any message with tag 'edge_routing'
1330
+ sock.ws.on('CB:edge_routing', (node: BinaryNode) => { })
1331
+
1332
+ // for any message with tag 'edge_routing' and id attribute = abcd
1333
+ sock.ws.on('CB:edge_routing,id:abcd', (node: BinaryNode) => { })
1334
+
1335
+ // for any message with tag 'edge_routing', id attribute = abcd & first content node routing_info
1336
+ sock.ws.on('CB:edge_routing,id:abcd,routing_info', (node: BinaryNode) => { })
1337
+ ```
1338
+
1339
+ # License
1340
+ Copyright (c) 2025 Rajeh Taher/WhiskeySockets
1341
+
1342
+ Licensed under the MIT License:
1343
+ Permission is hereby granted, free of charge, to any person obtaining a copy
1344
+ of this software and associated documentation files (the "Software"), to deal
1345
+ in the Software without restriction, including without limitation the rights
1346
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1347
+ copies of the Software, and to permit persons to whom the Software is
1348
+ furnished to do so, subject to the following conditions:
1349
+
1350
+ The above copyright notice and this permission notice shall be included in all
1351
+ copies or substantial portions of the Software.
1352
+
1353
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1354
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1355
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1356
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1357
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1358
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1359
+ SOFTWARE.
1360
+
1361
+ Thus, the maintainers of the project can't be held liable for any potential misuse of this project.
1362
+
1363
+
1364
+ ## Clarissa Baileys experimental MessageBuilder
1365
+
1366
+ The unofficial Clarissa distribution exports a lightweight builder API from the package root. This API validates payload structure locally; it does not bypass WhatsApp client/server feature gates. Interactive-message types and rendering may vary by client version.
1367
+
1368
+ ```ts
1369
+ import makeWASocket, { Button } from '@risacakep/risayap'
1370
+
1371
+ // `sock` is an authenticated socket created with makeWASocket.
1372
+ const message = new Button(sock)
1373
+ .setTitle('Clarissa')
1374
+ .setBody('Choose an action')
1375
+ .setFooter('Clarissa Baileys')
1376
+ .addReply('Status', 'clarissa_status')
1377
+
1378
+ await message.send('15551234567@s.whatsapp.net')
1379
+ ```
1380
+
1381
+ `Button`, `ButtonV2`, `Carousel`, and `AIRich` are experimental helpers. Carousel cards require pre-prepared media metadata. The validator rejects malformed runtime inputs with descriptive errors, and carousel batch additions are atomic: an invalid card does not leave earlier cards from that batch attached. This improves local payload safety but does not confirm server acceptance or universal client rendering. Only use payload formats supported by the target WhatsApp clients.
1382
+
1383
+
1384
+ ### Clarissa extensions (RC23)
1385
+
1386
+ The package ships the following optional extensions copied byte-for-byte from the Clarissa project. Import only the extension you use:
1387
+
1388
+ ```js
1389
+ import { AIRich } from '@risacakep/risayap/lib/extensions/clarissa-MessageBuilder.js'
1390
+ import { ClarissaAIRich } from '@risacakep/risayap/lib/extensions/clarissa-ai-rich.js'
1391
+ import { sendCarousel } from '@risacakep/risayap/lib/extensions/clarissa-carousel.js'
1392
+ ```
1393
+
1394
+ `clarissa-MessageBuilder.js` and `clarissa-carousel.js` use the public `@risacakep/risayap` root API. `axios` and `fluent-ffmpeg` are dependencies for the bundled extensions, while `sharp` is a peer dependency.
1395
+
1396
+ ## Clarissa Baileys RC25: Advanced/Experimental APIs
1397
+
1398
+ The RC25 source adds optional WebUI/A2UI/Rich Menu payload builders, image polls, scheduled-message primitives, modern status/question/Add Yours/comment helpers and protobuf declarations. It also retains the RC24 reader/media/auth/store utilities. These experimental APIs are not guaranteed to render or be accepted by WhatsApp. See [`CLARISSA-BAILEYS-RC25.md`](./CLARISSA-BAILEYS-RC25.md) for API examples and limitations, and [`MIGRASI-CLARISSA-BAILEYS-RC25.md`](./MIGRASI-CLARISSA-BAILEYS-RC25.md) for pre-release checks.
1399
+
1400
+ **RC25 source has not been built, fully type-checked, tested against a live WhatsApp account, or published to npm.** `makeVoipClient()` is an engine-injection scaffold only; it does not bundle a complete VoIP engine.