@kyyinfinite/baileys 1.0.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 (404) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1550 -0
  3. package/WAProto/GenerateStatics.sh +3 -0
  4. package/WAProto/WAProto.proto +6035 -0
  5. package/WAProto/fix-imports.js +81 -0
  6. package/WAProto/index.d.ts +2 -0
  7. package/WAProto/index.js +132326 -0
  8. package/lib/Defaults/index.d.ts +74 -0
  9. package/lib/Defaults/index.d.ts.map +1 -0
  10. package/lib/Defaults/index.js +137 -0
  11. package/lib/Defaults/index.js.map +1 -0
  12. package/lib/Signal/Group/ciphertext-message.d.ts +10 -0
  13. package/lib/Signal/Group/ciphertext-message.d.ts.map +1 -0
  14. package/lib/Signal/Group/ciphertext-message.js +12 -0
  15. package/lib/Signal/Group/ciphertext-message.js.map +1 -0
  16. package/lib/Signal/Group/group-session-builder.d.ts +15 -0
  17. package/lib/Signal/Group/group-session-builder.d.ts.map +1 -0
  18. package/lib/Signal/Group/group-session-builder.js +30 -0
  19. package/lib/Signal/Group/group-session-builder.js.map +1 -0
  20. package/lib/Signal/Group/group_cipher.d.ts +17 -0
  21. package/lib/Signal/Group/group_cipher.d.ts.map +1 -0
  22. package/lib/Signal/Group/group_cipher.js +82 -0
  23. package/lib/Signal/Group/group_cipher.js.map +1 -0
  24. package/lib/Signal/Group/index.d.ts +12 -0
  25. package/lib/Signal/Group/index.d.ts.map +1 -0
  26. package/lib/Signal/Group/index.js +12 -0
  27. package/lib/Signal/Group/index.js.map +1 -0
  28. package/lib/Signal/Group/keyhelper.d.ts +11 -0
  29. package/lib/Signal/Group/keyhelper.d.ts.map +1 -0
  30. package/lib/Signal/Group/keyhelper.js +18 -0
  31. package/lib/Signal/Group/keyhelper.js.map +1 -0
  32. package/lib/Signal/Group/sender-chain-key.d.ts +14 -0
  33. package/lib/Signal/Group/sender-chain-key.d.ts.map +1 -0
  34. package/lib/Signal/Group/sender-chain-key.js +26 -0
  35. package/lib/Signal/Group/sender-chain-key.js.map +1 -0
  36. package/lib/Signal/Group/sender-key-distribution-message.d.ts +17 -0
  37. package/lib/Signal/Group/sender-key-distribution-message.d.ts.map +1 -0
  38. package/lib/Signal/Group/sender-key-distribution-message.js +63 -0
  39. package/lib/Signal/Group/sender-key-distribution-message.js.map +1 -0
  40. package/lib/Signal/Group/sender-key-message.d.ts +19 -0
  41. package/lib/Signal/Group/sender-key-message.d.ts.map +1 -0
  42. package/lib/Signal/Group/sender-key-message.js +66 -0
  43. package/lib/Signal/Group/sender-key-message.js.map +1 -0
  44. package/lib/Signal/Group/sender-key-name.d.ts +18 -0
  45. package/lib/Signal/Group/sender-key-name.d.ts.map +1 -0
  46. package/lib/Signal/Group/sender-key-name.js +48 -0
  47. package/lib/Signal/Group/sender-key-name.js.map +1 -0
  48. package/lib/Signal/Group/sender-key-record.d.ts +31 -0
  49. package/lib/Signal/Group/sender-key-record.d.ts.map +1 -0
  50. package/lib/Signal/Group/sender-key-record.js +41 -0
  51. package/lib/Signal/Group/sender-key-record.js.map +1 -0
  52. package/lib/Signal/Group/sender-key-state.d.ts +39 -0
  53. package/lib/Signal/Group/sender-key-state.d.ts.map +1 -0
  54. package/lib/Signal/Group/sender-key-state.js +84 -0
  55. package/lib/Signal/Group/sender-key-state.js.map +1 -0
  56. package/lib/Signal/Group/sender-message-key.d.ts +12 -0
  57. package/lib/Signal/Group/sender-message-key.d.ts.map +1 -0
  58. package/lib/Signal/Group/sender-message-key.js +26 -0
  59. package/lib/Signal/Group/sender-message-key.js.map +1 -0
  60. package/lib/Signal/libsignal.d.ts +5 -0
  61. package/lib/Signal/libsignal.d.ts.map +1 -0
  62. package/lib/Signal/libsignal.js +403 -0
  63. package/lib/Signal/libsignal.js.map +1 -0
  64. package/lib/Signal/lid-mapping.d.ts +19 -0
  65. package/lib/Signal/lid-mapping.d.ts.map +1 -0
  66. package/lib/Signal/lid-mapping.js +271 -0
  67. package/lib/Signal/lid-mapping.js.map +1 -0
  68. package/lib/Socket/Client/index.d.ts +3 -0
  69. package/lib/Socket/Client/index.d.ts.map +1 -0
  70. package/lib/Socket/Client/index.js +3 -0
  71. package/lib/Socket/Client/index.js.map +1 -0
  72. package/lib/Socket/Client/types.d.ts +16 -0
  73. package/lib/Socket/Client/types.d.ts.map +1 -0
  74. package/lib/Socket/Client/types.js +11 -0
  75. package/lib/Socket/Client/types.js.map +1 -0
  76. package/lib/Socket/Client/websocket.d.ts +13 -0
  77. package/lib/Socket/Client/websocket.d.ts.map +1 -0
  78. package/lib/Socket/Client/websocket.js +54 -0
  79. package/lib/Socket/Client/websocket.js.map +1 -0
  80. package/lib/Socket/business.d.ts +536 -0
  81. package/lib/Socket/business.d.ts.map +1 -0
  82. package/lib/Socket/business.js +422 -0
  83. package/lib/Socket/business.js.map +1 -0
  84. package/lib/Socket/chats.d.ts +111 -0
  85. package/lib/Socket/chats.d.ts.map +1 -0
  86. package/lib/Socket/chats.js +991 -0
  87. package/lib/Socket/chats.js.map +1 -0
  88. package/lib/Socket/communities.d.ts +645 -0
  89. package/lib/Socket/communities.d.ts.map +1 -0
  90. package/lib/Socket/communities.js +431 -0
  91. package/lib/Socket/communities.js.map +1 -0
  92. package/lib/Socket/dugong.d.ts +130 -0
  93. package/lib/Socket/dugong.d.ts.map +1 -0
  94. package/lib/Socket/dugong.js +768 -0
  95. package/lib/Socket/dugong.js.map +1 -0
  96. package/lib/Socket/groups.d.ts +150 -0
  97. package/lib/Socket/groups.d.ts.map +1 -0
  98. package/lib/Socket/groups.js +327 -0
  99. package/lib/Socket/groups.js.map +1 -0
  100. package/lib/Socket/index.d.ts +636 -0
  101. package/lib/Socket/index.d.ts.map +1 -0
  102. package/lib/Socket/index.js +13 -0
  103. package/lib/Socket/index.js.map +1 -0
  104. package/lib/Socket/messages-recv.d.ts +238 -0
  105. package/lib/Socket/messages-recv.d.ts.map +1 -0
  106. package/lib/Socket/messages-recv.js +1308 -0
  107. package/lib/Socket/messages-recv.js.map +1 -0
  108. package/lib/Socket/messages-send.d.ts +579 -0
  109. package/lib/Socket/messages-send.d.ts.map +1 -0
  110. package/lib/Socket/messages-send.js +1595 -0
  111. package/lib/Socket/messages-send.js.map +1 -0
  112. package/lib/Socket/mex.d.ts +3 -0
  113. package/lib/Socket/mex.d.ts.map +1 -0
  114. package/lib/Socket/mex.js +48 -0
  115. package/lib/Socket/mex.js.map +1 -0
  116. package/lib/Socket/newsletter.d.ts +177 -0
  117. package/lib/Socket/newsletter.d.ts.map +1 -0
  118. package/lib/Socket/newsletter.js +316 -0
  119. package/lib/Socket/newsletter.js.map +1 -0
  120. package/lib/Socket/socket.d.ts +55 -0
  121. package/lib/Socket/socket.d.ts.map +1 -0
  122. package/lib/Socket/socket.js +936 -0
  123. package/lib/Socket/socket.js.map +1 -0
  124. package/lib/Types/Auth.d.ts +116 -0
  125. package/lib/Types/Auth.d.ts.map +1 -0
  126. package/lib/Types/Auth.js +2 -0
  127. package/lib/Types/Auth.js.map +1 -0
  128. package/lib/Types/Bussines.d.ts +37 -0
  129. package/lib/Types/Bussines.d.ts.map +1 -0
  130. package/lib/Types/Bussines.js +2 -0
  131. package/lib/Types/Bussines.js.map +1 -0
  132. package/lib/Types/Call.d.ts +15 -0
  133. package/lib/Types/Call.d.ts.map +1 -0
  134. package/lib/Types/Call.js +2 -0
  135. package/lib/Types/Call.js.map +1 -0
  136. package/lib/Types/Chat.d.ts +123 -0
  137. package/lib/Types/Chat.d.ts.map +1 -0
  138. package/lib/Types/Chat.js +8 -0
  139. package/lib/Types/Chat.js.map +1 -0
  140. package/lib/Types/Contact.d.ts +24 -0
  141. package/lib/Types/Contact.d.ts.map +1 -0
  142. package/lib/Types/Contact.js +2 -0
  143. package/lib/Types/Contact.js.map +1 -0
  144. package/lib/Types/Events.d.ts +237 -0
  145. package/lib/Types/Events.d.ts.map +1 -0
  146. package/lib/Types/Events.js +2 -0
  147. package/lib/Types/Events.js.map +1 -0
  148. package/lib/Types/GroupMetadata.d.ts +68 -0
  149. package/lib/Types/GroupMetadata.d.ts.map +1 -0
  150. package/lib/Types/GroupMetadata.js +2 -0
  151. package/lib/Types/GroupMetadata.js.map +1 -0
  152. package/lib/Types/Label.d.ts +47 -0
  153. package/lib/Types/Label.d.ts.map +1 -0
  154. package/lib/Types/Label.js +25 -0
  155. package/lib/Types/Label.js.map +1 -0
  156. package/lib/Types/LabelAssociation.d.ts +30 -0
  157. package/lib/Types/LabelAssociation.d.ts.map +1 -0
  158. package/lib/Types/LabelAssociation.js +7 -0
  159. package/lib/Types/LabelAssociation.js.map +1 -0
  160. package/lib/Types/Message.d.ts +422 -0
  161. package/lib/Types/Message.d.ts.map +1 -0
  162. package/lib/Types/Message.js +11 -0
  163. package/lib/Types/Message.js.map +1 -0
  164. package/lib/Types/Newsletter.d.ts +135 -0
  165. package/lib/Types/Newsletter.d.ts.map +1 -0
  166. package/lib/Types/Newsletter.js +31 -0
  167. package/lib/Types/Newsletter.js.map +1 -0
  168. package/lib/Types/Product.d.ts +79 -0
  169. package/lib/Types/Product.d.ts.map +1 -0
  170. package/lib/Types/Product.js +2 -0
  171. package/lib/Types/Product.js.map +1 -0
  172. package/lib/Types/Signal.d.ts +76 -0
  173. package/lib/Types/Signal.d.ts.map +1 -0
  174. package/lib/Types/Signal.js +2 -0
  175. package/lib/Types/Signal.js.map +1 -0
  176. package/lib/Types/Socket.d.ts +158 -0
  177. package/lib/Types/Socket.d.ts.map +1 -0
  178. package/lib/Types/Socket.js +3 -0
  179. package/lib/Types/Socket.js.map +1 -0
  180. package/lib/Types/State.d.ts +39 -0
  181. package/lib/Types/State.d.ts.map +1 -0
  182. package/lib/Types/State.js +13 -0
  183. package/lib/Types/State.js.map +1 -0
  184. package/lib/Types/USync.d.ts +26 -0
  185. package/lib/Types/USync.d.ts.map +1 -0
  186. package/lib/Types/USync.js +2 -0
  187. package/lib/Types/USync.js.map +1 -0
  188. package/lib/Types/index.d.ts +66 -0
  189. package/lib/Types/index.d.ts.map +1 -0
  190. package/lib/Types/index.js +33 -0
  191. package/lib/Types/index.js.map +1 -0
  192. package/lib/Utils/auth-utils.d.ts +19 -0
  193. package/lib/Utils/auth-utils.d.ts.map +1 -0
  194. package/lib/Utils/auth-utils.js +290 -0
  195. package/lib/Utils/auth-utils.js.map +1 -0
  196. package/lib/Utils/browser-utils.d.ts +4 -0
  197. package/lib/Utils/browser-utils.d.ts.map +1 -0
  198. package/lib/Utils/browser-utils.js +28 -0
  199. package/lib/Utils/browser-utils.js.map +1 -0
  200. package/lib/Utils/business.d.ts +23 -0
  201. package/lib/Utils/business.d.ts.map +1 -0
  202. package/lib/Utils/business.js +231 -0
  203. package/lib/Utils/business.js.map +1 -0
  204. package/lib/Utils/chat-utils.d.ts +70 -0
  205. package/lib/Utils/chat-utils.d.ts.map +1 -0
  206. package/lib/Utils/chat-utils.js +812 -0
  207. package/lib/Utils/chat-utils.js.map +1 -0
  208. package/lib/Utils/crypto.d.ts +37 -0
  209. package/lib/Utils/crypto.d.ts.map +1 -0
  210. package/lib/Utils/crypto.js +118 -0
  211. package/lib/Utils/crypto.js.map +1 -0
  212. package/lib/Utils/decode-wa-message.d.ts +48 -0
  213. package/lib/Utils/decode-wa-message.d.ts.map +1 -0
  214. package/lib/Utils/decode-wa-message.js +283 -0
  215. package/lib/Utils/decode-wa-message.js.map +1 -0
  216. package/lib/Utils/event-buffer.d.ts +34 -0
  217. package/lib/Utils/event-buffer.d.ts.map +1 -0
  218. package/lib/Utils/event-buffer.js +574 -0
  219. package/lib/Utils/event-buffer.js.map +1 -0
  220. package/lib/Utils/generics.d.ts +91 -0
  221. package/lib/Utils/generics.d.ts.map +1 -0
  222. package/lib/Utils/generics.js +384 -0
  223. package/lib/Utils/generics.js.map +1 -0
  224. package/lib/Utils/history.d.ts +22 -0
  225. package/lib/Utils/history.d.ts.map +1 -0
  226. package/lib/Utils/history.js +131 -0
  227. package/lib/Utils/history.js.map +1 -0
  228. package/lib/Utils/identity-change-handler.d.ts +37 -0
  229. package/lib/Utils/identity-change-handler.d.ts.map +1 -0
  230. package/lib/Utils/identity-change-handler.js +49 -0
  231. package/lib/Utils/identity-change-handler.js.map +1 -0
  232. package/lib/Utils/index.d.ts +25 -0
  233. package/lib/Utils/index.d.ts.map +1 -0
  234. package/lib/Utils/index.js +24 -0
  235. package/lib/Utils/index.js.map +1 -0
  236. package/lib/Utils/kyy-features.d.ts +158 -0
  237. package/lib/Utils/kyy-features.js +365 -0
  238. package/lib/Utils/link-preview.d.ts +21 -0
  239. package/lib/Utils/link-preview.d.ts.map +1 -0
  240. package/lib/Utils/link-preview.js +85 -0
  241. package/lib/Utils/link-preview.js.map +1 -0
  242. package/lib/Utils/logger.d.ts +13 -0
  243. package/lib/Utils/logger.d.ts.map +1 -0
  244. package/lib/Utils/logger.js +3 -0
  245. package/lib/Utils/logger.js.map +1 -0
  246. package/lib/Utils/lt-hash.d.ts +8 -0
  247. package/lib/Utils/lt-hash.d.ts.map +1 -0
  248. package/lib/Utils/lt-hash.js +8 -0
  249. package/lib/Utils/lt-hash.js.map +1 -0
  250. package/lib/Utils/make-mutex.d.ts +9 -0
  251. package/lib/Utils/make-mutex.d.ts.map +1 -0
  252. package/lib/Utils/make-mutex.js +33 -0
  253. package/lib/Utils/make-mutex.js.map +1 -0
  254. package/lib/Utils/message-retry-manager.d.ts +110 -0
  255. package/lib/Utils/message-retry-manager.d.ts.map +1 -0
  256. package/lib/Utils/message-retry-manager.js +225 -0
  257. package/lib/Utils/message-retry-manager.js.map +1 -0
  258. package/lib/Utils/messages-media.d.ts +130 -0
  259. package/lib/Utils/messages-media.d.ts.map +1 -0
  260. package/lib/Utils/messages-media.js +782 -0
  261. package/lib/Utils/messages-media.js.map +1 -0
  262. package/lib/Utils/messages.d.ts +91 -0
  263. package/lib/Utils/messages.d.ts.map +1 -0
  264. package/lib/Utils/messages.js +1238 -0
  265. package/lib/Utils/messages.js.map +1 -0
  266. package/lib/Utils/noise-handler.d.ts +20 -0
  267. package/lib/Utils/noise-handler.d.ts.map +1 -0
  268. package/lib/Utils/noise-handler.js +201 -0
  269. package/lib/Utils/noise-handler.js.map +1 -0
  270. package/lib/Utils/offline-node-processor.d.ts +17 -0
  271. package/lib/Utils/offline-node-processor.d.ts.map +1 -0
  272. package/lib/Utils/offline-node-processor.js +40 -0
  273. package/lib/Utils/offline-node-processor.js.map +1 -0
  274. package/lib/Utils/pre-key-manager.d.ts +28 -0
  275. package/lib/Utils/pre-key-manager.d.ts.map +1 -0
  276. package/lib/Utils/pre-key-manager.js +106 -0
  277. package/lib/Utils/pre-key-manager.js.map +1 -0
  278. package/lib/Utils/process-message.d.ts +60 -0
  279. package/lib/Utils/process-message.d.ts.map +1 -0
  280. package/lib/Utils/process-message.js +528 -0
  281. package/lib/Utils/process-message.js.map +1 -0
  282. package/lib/Utils/reporting-utils.d.ts +11 -0
  283. package/lib/Utils/reporting-utils.d.ts.map +1 -0
  284. package/lib/Utils/reporting-utils.js +258 -0
  285. package/lib/Utils/reporting-utils.js.map +1 -0
  286. package/lib/Utils/rich-messages.d.ts +277 -0
  287. package/lib/Utils/rich-messages.d.ts.map +1 -0
  288. package/lib/Utils/rich-messages.js +1144 -0
  289. package/lib/Utils/rich-messages.js.map +1 -0
  290. package/lib/Utils/signal.d.ts +34 -0
  291. package/lib/Utils/signal.d.ts.map +1 -0
  292. package/lib/Utils/signal.js +159 -0
  293. package/lib/Utils/signal.js.map +1 -0
  294. package/lib/Utils/stanza-ack.d.ts +11 -0
  295. package/lib/Utils/stanza-ack.d.ts.map +1 -0
  296. package/lib/Utils/stanza-ack.js +38 -0
  297. package/lib/Utils/stanza-ack.js.map +1 -0
  298. package/lib/Utils/sticker-pack.d.ts +10 -0
  299. package/lib/Utils/sticker-pack.js +111 -0
  300. package/lib/Utils/sync-action-utils.d.ts +19 -0
  301. package/lib/Utils/sync-action-utils.d.ts.map +1 -0
  302. package/lib/Utils/sync-action-utils.js +48 -0
  303. package/lib/Utils/sync-action-utils.js.map +1 -0
  304. package/lib/Utils/tc-token-utils.d.ts +12 -0
  305. package/lib/Utils/tc-token-utils.d.ts.map +1 -0
  306. package/lib/Utils/tc-token-utils.js +18 -0
  307. package/lib/Utils/tc-token-utils.js.map +1 -0
  308. package/lib/Utils/use-multi-file-auth-state.d.ts +13 -0
  309. package/lib/Utils/use-multi-file-auth-state.d.ts.map +1 -0
  310. package/lib/Utils/use-multi-file-auth-state.js +121 -0
  311. package/lib/Utils/use-multi-file-auth-state.js.map +1 -0
  312. package/lib/Utils/validate-connection.d.ts +11 -0
  313. package/lib/Utils/validate-connection.d.ts.map +1 -0
  314. package/lib/Utils/validate-connection.js +200 -0
  315. package/lib/Utils/validate-connection.js.map +1 -0
  316. package/lib/WABinary/constants.d.ts +28 -0
  317. package/lib/WABinary/constants.d.ts.map +1 -0
  318. package/lib/WABinary/constants.js +1301 -0
  319. package/lib/WABinary/constants.js.map +1 -0
  320. package/lib/WABinary/decode.d.ts +7 -0
  321. package/lib/WABinary/decode.d.ts.map +1 -0
  322. package/lib/WABinary/decode.js +262 -0
  323. package/lib/WABinary/decode.js.map +1 -0
  324. package/lib/WABinary/encode.d.ts +3 -0
  325. package/lib/WABinary/encode.d.ts.map +1 -0
  326. package/lib/WABinary/encode.js +220 -0
  327. package/lib/WABinary/encode.js.map +1 -0
  328. package/lib/WABinary/generic-utils.d.ts +17 -0
  329. package/lib/WABinary/generic-utils.d.ts.map +1 -0
  330. package/lib/WABinary/generic-utils.js +191 -0
  331. package/lib/WABinary/generic-utils.js.map +1 -0
  332. package/lib/WABinary/index.d.ts +6 -0
  333. package/lib/WABinary/index.d.ts.map +1 -0
  334. package/lib/WABinary/index.js +6 -0
  335. package/lib/WABinary/index.js.map +1 -0
  336. package/lib/WABinary/jid-utils.d.ts +48 -0
  337. package/lib/WABinary/jid-utils.d.ts.map +1 -0
  338. package/lib/WABinary/jid-utils.js +96 -0
  339. package/lib/WABinary/jid-utils.js.map +1 -0
  340. package/lib/WABinary/types.d.ts +19 -0
  341. package/lib/WABinary/types.d.ts.map +1 -0
  342. package/lib/WABinary/types.js +2 -0
  343. package/lib/WABinary/types.js.map +1 -0
  344. package/lib/WAM/BinaryInfo.d.ts +9 -0
  345. package/lib/WAM/BinaryInfo.d.ts.map +1 -0
  346. package/lib/WAM/BinaryInfo.js +10 -0
  347. package/lib/WAM/BinaryInfo.js.map +1 -0
  348. package/lib/WAM/constants.d.ts +40 -0
  349. package/lib/WAM/constants.d.ts.map +1 -0
  350. package/lib/WAM/constants.js +22853 -0
  351. package/lib/WAM/constants.js.map +1 -0
  352. package/lib/WAM/encode.d.ts +3 -0
  353. package/lib/WAM/encode.d.ts.map +1 -0
  354. package/lib/WAM/encode.js +150 -0
  355. package/lib/WAM/encode.js.map +1 -0
  356. package/lib/WAM/index.d.ts +4 -0
  357. package/lib/WAM/index.d.ts.map +1 -0
  358. package/lib/WAM/index.js +4 -0
  359. package/lib/WAM/index.js.map +1 -0
  360. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +10 -0
  361. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts.map +1 -0
  362. package/lib/WAUSync/Protocols/USyncContactProtocol.js +29 -0
  363. package/lib/WAUSync/Protocols/USyncContactProtocol.js.map +1 -0
  364. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +23 -0
  365. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts.map +1 -0
  366. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +54 -0
  367. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js.map +1 -0
  368. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +13 -0
  369. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts.map +1 -0
  370. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +27 -0
  371. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js.map +1 -0
  372. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +13 -0
  373. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts.map +1 -0
  374. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +38 -0
  375. package/lib/WAUSync/Protocols/USyncStatusProtocol.js.map +1 -0
  376. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +26 -0
  377. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts.map +1 -0
  378. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +51 -0
  379. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js.map +1 -0
  380. package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +10 -0
  381. package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts.map +1 -0
  382. package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +29 -0
  383. package/lib/WAUSync/Protocols/UsyncLIDProtocol.js.map +1 -0
  384. package/lib/WAUSync/Protocols/index.d.ts +5 -0
  385. package/lib/WAUSync/Protocols/index.d.ts.map +1 -0
  386. package/lib/WAUSync/Protocols/index.js +5 -0
  387. package/lib/WAUSync/Protocols/index.js.map +1 -0
  388. package/lib/WAUSync/USyncQuery.d.ts +29 -0
  389. package/lib/WAUSync/USyncQuery.d.ts.map +1 -0
  390. package/lib/WAUSync/USyncQuery.js +94 -0
  391. package/lib/WAUSync/USyncQuery.js.map +1 -0
  392. package/lib/WAUSync/USyncUser.d.ts +13 -0
  393. package/lib/WAUSync/USyncUser.d.ts.map +1 -0
  394. package/lib/WAUSync/USyncUser.js +23 -0
  395. package/lib/WAUSync/USyncUser.js.map +1 -0
  396. package/lib/WAUSync/index.d.ts +4 -0
  397. package/lib/WAUSync/index.d.ts.map +1 -0
  398. package/lib/WAUSync/index.js +4 -0
  399. package/lib/WAUSync/index.js.map +1 -0
  400. package/lib/index.d.ts +13 -0
  401. package/lib/index.d.ts.map +1 -0
  402. package/lib/index.js +12 -0
  403. package/lib/index.js.map +1 -0
  404. package/package.json +69 -0
package/README.md ADDED
@@ -0,0 +1,1550 @@
1
+ <div align="center">
2
+
3
+ <img src="https://readme-typing-svg.demolab.com?font=Fira+Code&weight=700&size=15&duration=2500&pause=800&color=00B4D8&center=true&vCenter=true&width=750&lines=@kyyinfinite%2Fbaileys+%E2%80%94+v0.1.0;Interactive+Messages+%7C+Flow+Buttons+%7C+List+Menus;AI+Rich+Response+%7C+Table+%7C+Code+Block+%7C+Link;Album+Messages+%7C+Multi-media+Grouped+Delivery;ESM-only+%7C+TypeScript+%7C+Signal+Protocol;Drop-in+replacement+for+whiskeysockets%2Fbaileys" alt="Typing SVG" />
4
+
5
+ <br/>
6
+
7
+ [![npm version](https://img.shields.io/badge/npm-v0.1.0-CB3837?style=for-the-badge&logo=npm&logoColor=white)](https://www.npmjs.com/package/@kyyinfinite/baileys)
8
+ [![npm downloads](https://img.shields.io/badge/downloads-monthly-00B4D8?style=for-the-badge&logo=npm&logoColor=white)](https://www.npmjs.com/package/@kyyinfinite/baileys)
9
+ [![License](https://img.shields.io/badge/license-MIT-green?style=for-the-badge)](LICENSE)
10
+ [![Node.js](https://img.shields.io/badge/node-%3E%3D20.0.0-339933?style=for-the-badge&logo=nodedotjs&logoColor=white)](https://nodejs.org)
11
+ [![ESM Only](https://img.shields.io/badge/ESM-only-F7DF1E?style=for-the-badge&logo=javascript&logoColor=black)](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules)
12
+ [![TypeScript](https://img.shields.io/badge/TypeScript-ready-3178C6?style=for-the-badge&logo=typescript&logoColor=white)](https://www.typescriptlang.org)
13
+ [![GitHub](https://img.shields.io/badge/GitHub-kyyinfinite-181717?style=for-the-badge&logo=github&logoColor=white)](https://github.com/kyyinfinite/baileys)
14
+
15
+ <br/>
16
+
17
+ **A modded build of [WhiskeySockets/Baileys](https://github.com/WhiskeySockets/Baileys)**
18
+ with native support for **interactive messages**, **album messages**, **unified AI rich responses**,
19
+ **newsletter helpers**, **status mentions**, and additional **business / community utilities**.
20
+
21
+ <br/>
22
+
23
+ > [!IMPORTANT]
24
+ > **`@kyyinfinite/baileys`** is **ESM-only**. You must set `"type": "module"` in your `package.json`.
25
+ > CommonJS projects must migrate or use dynamic `import()` wrappers.
26
+
27
+ <br/>
28
+
29
+ </div>
30
+
31
+ ---
32
+
33
+ ## 📋 Table of Contents
34
+
35
+ - [✨ Features](#-features)
36
+ - [✅ Requirements](#-requirements)
37
+ - [📦 Installation](#-installation)
38
+ - [🚀 Quick Start](#-quick-start)
39
+ - [Project Setup](#1-project-setup)
40
+ - [Install Dependencies](#2-install-dependencies)
41
+ - [Create index.js](#3-create-indexjs)
42
+ - [QR Code Login](#4-run--qr-code-login)
43
+ - [Pairing Code Login](#5-pairing-code-login)
44
+ - [Auto Reconnect](#6-auto-reconnect)
45
+ - [💬 Message Examples](#-message-examples)
46
+ - [Text](#text)
47
+ - [Image](#image)
48
+ - [Video](#video)
49
+ - [Audio & PTT](#audio--ptt)
50
+ - [Sticker](#sticker)
51
+ - [Document](#document)
52
+ - [Location](#location)
53
+ - [Contact](#contact)
54
+ - [Poll](#poll)
55
+ - [Reaction](#reaction)
56
+ - [Delete & Edit](#delete--edit)
57
+ - [Forward & Quoted](#forward--quoted)
58
+ - [Mention](#mention)
59
+ - [⚡ Interactive Messages](#-interactive-messages)
60
+ - [Flow Buttons](#flow-buttons)
61
+ - [CTA URL Button](#cta-url-button)
62
+ - [Copy Button](#copy-button)
63
+ - [List Menu (single_select)](#list-menu-single_select)
64
+ - [Carousel](#carousel)
65
+ - [Native Interactive](#native-interactive)
66
+ - [🤖 AI Rich Response](#-ai-rich-response)
67
+ - [sendTable()](#sendtable)
68
+ - [sendList()](#sendlist)
69
+ - [sendCodeBlock()](#sendcodeblock)
70
+ - [sendLink()](#sendlink)
71
+ - [sendUnifiedResponse()](#sendunifiedresponse)
72
+ - [sendTableV2()](#sendtablev2)
73
+ - [sendCodeBlockV2()](#sendcodeblockv2)
74
+ - [sendLinkV2()](#sendlinkv2)
75
+ - [🎞️ Album Messages](#️-album-messages)
76
+ - [📰 Newsletter](#-newsletter)
77
+ - [👥 Group](#-group)
78
+ - [🏘️ Community](#️-community)
79
+ - [🏢 Business](#-business)
80
+ - [👤 Profile](#-profile)
81
+ - [💬 Chat](#-chat)
82
+ - [🔒 Privacy](#-privacy)
83
+ - [📡 Events](#-events)
84
+ - [🔧 Utility Exports](#-utility-exports)
85
+ - [📚 API Reference](#-api-reference)
86
+ - [❓ FAQ](#-faq)
87
+ - [📄 License](#-license)
88
+
89
+ ---
90
+
91
+ ## ✨ Features
92
+
93
+ | Feature | Description | Status |
94
+ |---|---|:---:|
95
+ | **Interactive Messages** | Native flow buttons, list/select menus, button wrappers, carousel support via Dugong | ✅ |
96
+ | **Flow Buttons** | `quick_reply`, `cta_url`, `cta_copy` and more button types | ✅ |
97
+ | **Native Button** | Native WhatsApp button structures | ✅ |
98
+ | **Carousel** | Multi-card carousel messages via Dugong | ✅ |
99
+ | **AI Rich Response** | `sendTable`, `sendList`, `sendCodeBlock`, `sendRichMessage`, `sendUnifiedResponse` | ✅ |
100
+ | **Album Messages** | Multi-image/video album relay with count metadata and grouped delivery | ✅ |
101
+ | **Link Messages** | Rich inline links with citations, proofs, and forwarded bot context | ✅ |
102
+ | **Table Message** | `sendTable()` / `sendTableV2()` styled as Meta AI tables | ✅ |
103
+ | **Code Block** | `sendCodeBlock()` / `sendCodeBlockV2()` with multi-language syntax support | ✅ |
104
+ | **Unified Response** | `sendUnifiedResponse()` unified sections | ✅ |
105
+ | **Newsletter** | URL resolve, metadata fetch, create/update, bulk follow, admin utilities, live updates | ✅ |
106
+ | **Communities** | Community CRUD, linked groups, invite workflows, join approval, labels | ✅ |
107
+ | **Business API** | Business profile update, catalog management, product CRUD | ✅ |
108
+ | **Catalog** | Fetch, create, update, delete product listings and cover photos | ✅ |
109
+ | **Payment** | Request payment messages with note/sticker support | ✅ |
110
+ | **Poll** | Send and receive poll messages with `selectableCount` | ✅ |
111
+ | **Event** | Event message builders and poll result snapshots | ✅ |
112
+ | **Status Mention** | `sendStatusMention()` to mention users/groups in status flows | ✅ |
113
+ | **LID Mapping** | Full LID↔PN mapping + session migration and retry helpers | ✅ |
114
+ | **Pairing Code** | Request pairing code or use custom 8-char code | ✅ |
115
+ | **QR Login** | Scan QR code via `connection.update` event | ✅ |
116
+ | **Media Upload** | Image, video, audio, sticker, document via URL or Buffer | ✅ |
117
+ | **TypeScript** | Included `.d.ts` declarations for all exported APIs | ✅ |
118
+ | **ESM** | Native ES Module — no CommonJS bundle | ✅ |
119
+
120
+ ---
121
+
122
+ ## ✅ Requirements
123
+
124
+ | Requirement | Version / Detail |
125
+ |---|---|
126
+ | **Node.js** | `>= 20.0.0` |
127
+ | **Module system** | ESM only — `"type": "module"` in `package.json` |
128
+ | **Auth store** | Persistent auth required for production use |
129
+
130
+ **Optional companion packages:**
131
+
132
+ | Package | Purpose |
133
+ |---|---|
134
+ | `pino` | Structured logging |
135
+ | `qrcode-terminal` | Render QR codes in terminal |
136
+ | `sharp` | Image processing for sticker/media utilities |
137
+ | `link-preview-js` | Generate link previews |
138
+ | `audio-decode` | Audio format decoding |
139
+
140
+ > [!NOTE]
141
+ > Peer dependencies like `sharp`, `jimp`, `audio-decode`, and `link-preview-js` are **optional**.
142
+ > Install only what your bot features actually need.
143
+
144
+ ---
145
+
146
+ ## 📦 Installation
147
+
148
+ **npm**
149
+ ```bash
150
+ npm install @kyyinfinite/baileys
151
+ ```
152
+
153
+ **pnpm**
154
+ ```bash
155
+ pnpm add @kyyinfinite/baileys
156
+ ```
157
+
158
+ **yarn**
159
+ ```bash
160
+ yarn add @kyyinfinite/baileys
161
+ ```
162
+
163
+ **bun**
164
+ ```bash
165
+ bun add @kyyinfinite/baileys
166
+ ```
167
+
168
+ **Recommended companion packages:**
169
+ ```bash
170
+ npm install pino qrcode-terminal
171
+ ```
172
+
173
+ > [!TIP]
174
+ > Always install `pino` and `qrcode-terminal` alongside `@kyyinfinite/baileys` for the best development experience — logger suppression and QR rendering are needed in almost every bot project.
175
+
176
+ ---
177
+
178
+ ## 🚀 Quick Start
179
+
180
+ ### 1. Project Setup
181
+
182
+ ```bash
183
+ mkdir my-bot && cd my-bot
184
+ npm init -y
185
+ ```
186
+
187
+ Open `package.json` and add `"type": "module"`:
188
+
189
+ ```json
190
+ {
191
+ "name": "my-bot",
192
+ "version": "1.0.0",
193
+ "type": "module",
194
+ "main": "index.js",
195
+ "scripts": {
196
+ "start": "node index.js"
197
+ }
198
+ }
199
+ ```
200
+
201
+ > [!IMPORTANT]
202
+ > **`"type": "module"` is required.** `@kyyinfinite/baileys` is ESM-only.
203
+ > Without this field, all imports will throw a syntax error.
204
+
205
+ ---
206
+
207
+ ### 2. Install Dependencies
208
+
209
+ ```bash
210
+ npm install @kyyinfinite/baileys pino qrcode-terminal
211
+ ```
212
+
213
+ ---
214
+
215
+ ### 3. Create index.js
216
+
217
+ ```js
218
+ import makeWASocket, {
219
+ useMultiFileAuthState,
220
+ DisconnectReason,
221
+ Browsers,
222
+ } from "@kyyinfinite/baileys";
223
+ import pino from "pino";
224
+ import qrcode from "qrcode-terminal";
225
+
226
+ const logger = pino({ level: "silent" });
227
+
228
+ async function startBot() {
229
+ const { state, saveCreds } = await useMultiFileAuthState("./session");
230
+
231
+ const sock = makeWASocket({
232
+ auth: state,
233
+ logger,
234
+ browser: Browsers.ubuntu("Chrome"),
235
+ syncFullHistory: false,
236
+ });
237
+
238
+ sock.ev.on("creds.update", saveCreds);
239
+
240
+ sock.ev.on("connection.update", ({ connection, lastDisconnect, qr }) => {
241
+ if (qr) {
242
+ qrcode.generate(qr, { small: true });
243
+ }
244
+
245
+ if (connection === "close") {
246
+ const shouldReconnect =
247
+ lastDisconnect?.error?.output?.statusCode !== DisconnectReason.loggedOut;
248
+ if (shouldReconnect) startBot();
249
+ }
250
+
251
+ if (connection === "open") {
252
+ console.log("✅ Connected!");
253
+ }
254
+ });
255
+
256
+ sock.ev.on("messages.upsert", async ({ messages }) => {
257
+ const msg = messages[0];
258
+ if (!msg?.message || msg.key.fromMe) return;
259
+
260
+ const text =
261
+ msg.message.conversation ||
262
+ msg.message.extendedTextMessage?.text ||
263
+ "";
264
+
265
+ if (text === ".ping") {
266
+ await sock.sendMessage(msg.key.remoteJid, { text: "🏓 Pong!" });
267
+ }
268
+ });
269
+ }
270
+
271
+ startBot();
272
+ ```
273
+
274
+ ---
275
+
276
+ ### 4. Run & QR Code Login
277
+
278
+ ```bash
279
+ node index.js
280
+ ```
281
+
282
+ Scan the QR code in your terminal using **WhatsApp → Linked Devices → Link a Device**.
283
+ Wait until the socket reaches `connection === "open"`, then send `.ping` to test.
284
+
285
+ ---
286
+
287
+ ### 5. Pairing Code Login
288
+
289
+ If you prefer pairing code authentication over QR:
290
+
291
+ ```js
292
+ import makeWASocket, {
293
+ useMultiFileAuthState,
294
+ Browsers,
295
+ } from "@kyyinfinite/baileys";
296
+ import pino from "pino";
297
+
298
+ const logger = pino({ level: "silent" });
299
+
300
+ async function startBot() {
301
+ const { state, saveCreds } = await useMultiFileAuthState("./session");
302
+
303
+ const sock = makeWASocket({
304
+ auth: state,
305
+ logger,
306
+ browser: Browsers.windows("Chrome"),
307
+ });
308
+
309
+ sock.ev.on("creds.update", saveCreds);
310
+
311
+ sock.ev.on("connection.update", async ({ connection }) => {
312
+ if (connection === "connecting") {
313
+ // Replace with your phone number (include country code, no +)
314
+ const code = await sock.requestPairingCode("6281234567890");
315
+ console.log("🔑 Pairing code:", code);
316
+ }
317
+
318
+ if (connection === "open") {
319
+ console.log("✅ Connected via pairing code!");
320
+ }
321
+ });
322
+ }
323
+
324
+ startBot();
325
+ ```
326
+
327
+ **Custom pairing code (exactly 8 characters):**
328
+
329
+ ```js
330
+ const code = await sock.requestPairingCode("6281234567890", "A1B2C3D4");
331
+ console.log("🔑 Custom pairing code:", code);
332
+ ```
333
+
334
+ > [!WARNING]
335
+ > Custom pairing codes **must be exactly 8 characters**. Any other length will be rejected by WhatsApp.
336
+
337
+ > [!NOTE]
338
+ > `printQRInTerminal` still exists in the type surface for compatibility, but it is deprecated in this build.
339
+ > Prefer handling the `qr` value from `connection.update` directly with `qrcode-terminal`.
340
+
341
+ ---
342
+
343
+ ### 6. Auto Reconnect
344
+
345
+ ```js
346
+ sock.ev.on("connection.update", ({ connection, lastDisconnect }) => {
347
+ if (connection === "close") {
348
+ const statusCode = lastDisconnect?.error?.output?.statusCode;
349
+ const shouldReconnect = statusCode !== DisconnectReason.loggedOut;
350
+
351
+ console.log(`Connection closed (code: ${statusCode}). Reconnecting: ${shouldReconnect}`);
352
+
353
+ if (shouldReconnect) {
354
+ startBot(); // call your startBot function again
355
+ } else {
356
+ console.log("Logged out. Delete ./session and restart.");
357
+ }
358
+ }
359
+ });
360
+ ```
361
+
362
+ > [!TIP]
363
+ > For production bots, use a process manager like **PM2** (`pm2 start index.js`) so your bot automatically restarts after crashes, not just reconnects after disconnects.
364
+
365
+ ---
366
+
367
+ ## 💬 Message Examples
368
+
369
+ ### Text
370
+
371
+ ```js
372
+ await sock.sendMessage(jid, { text: "Hello, World! 👋" });
373
+ ```
374
+
375
+ ### Image
376
+
377
+ ```js
378
+ // From URL
379
+ await sock.sendMessage(jid, {
380
+ image: { url: "https://example.com/photo.jpg" },
381
+ caption: "A beautiful photo 📸",
382
+ });
383
+
384
+ // From file path
385
+ await sock.sendMessage(jid, {
386
+ image: { url: "./photo.jpg" },
387
+ caption: "Local photo",
388
+ });
389
+
390
+ // From Buffer
391
+ import { readFileSync } from "fs";
392
+ await sock.sendMessage(jid, {
393
+ image: readFileSync("./photo.jpg"),
394
+ caption: "From buffer",
395
+ });
396
+ ```
397
+
398
+ ### Video
399
+
400
+ ```js
401
+ await sock.sendMessage(jid, {
402
+ video: { url: "./video.mp4" },
403
+ caption: "Check this out 🎬",
404
+ gifPlayback: false, // set true for GIF-style playback
405
+ });
406
+ ```
407
+
408
+ ### Audio & PTT
409
+
410
+ ```js
411
+ // Audio file
412
+ await sock.sendMessage(jid, {
413
+ audio: { url: "./audio.mp3" },
414
+ mimetype: "audio/mp4",
415
+ });
416
+
417
+ // Push-to-talk (voice note)
418
+ await sock.sendMessage(jid, {
419
+ audio: { url: "./voice.ogg" },
420
+ mimetype: "audio/ogg; codecs=opus",
421
+ ptt: true,
422
+ });
423
+ ```
424
+
425
+ ### Sticker
426
+
427
+ ```js
428
+ await sock.sendMessage(jid, {
429
+ sticker: { url: "./sticker.webp" },
430
+ });
431
+ ```
432
+
433
+ ### Document
434
+
435
+ ```js
436
+ await sock.sendMessage(jid, {
437
+ document: { url: "./report.pdf" },
438
+ fileName: "Monthly Report.pdf",
439
+ mimetype: "application/pdf",
440
+ caption: "Here is the report 📄",
441
+ });
442
+ ```
443
+
444
+ ### Location
445
+
446
+ ```js
447
+ await sock.sendMessage(jid, {
448
+ location: {
449
+ degreesLatitude: -6.2088,
450
+ degreesLongitude: 106.8456,
451
+ name: "Jakarta, Indonesia",
452
+ address: "Jakarta, Indonesia",
453
+ },
454
+ });
455
+ ```
456
+
457
+ ### Contact
458
+
459
+ ```js
460
+ await sock.sendMessage(jid, {
461
+ contacts: {
462
+ displayName: "John Doe",
463
+ contacts: [
464
+ {
465
+ vcard: `BEGIN:VCARD\nVERSION:3.0\nFN:John Doe\nTEL;type=CELL;type=VOICE;waid=6281234567890:+62 812-3456-7890\nEND:VCARD`,
466
+ },
467
+ ],
468
+ },
469
+ });
470
+ ```
471
+
472
+ ### Poll
473
+
474
+ ```js
475
+ await sock.sendMessage(jid, {
476
+ poll: {
477
+ name: "What's your favorite language?",
478
+ values: ["JavaScript", "TypeScript", "Python", "Go"],
479
+ selectableCount: 1, // 0 = allow multiple
480
+ },
481
+ });
482
+ ```
483
+
484
+ ### Reaction
485
+
486
+ ```js
487
+ await sock.sendMessage(jid, {
488
+ react: {
489
+ key: msg.key, // key of the message to react to
490
+ text: "👍", // use "" to remove reaction
491
+ },
492
+ });
493
+ ```
494
+
495
+ ### Delete & Edit
496
+
497
+ ```js
498
+ // Delete a message (for everyone)
499
+ await sock.sendMessage(jid, { delete: msg.key });
500
+
501
+ // Edit a sent message
502
+ await sock.sendMessage(jid, {
503
+ text: "This is the corrected text ✏️",
504
+ edit: msg.key,
505
+ });
506
+ ```
507
+
508
+ ### Forward & Quoted
509
+
510
+ ```js
511
+ // Forward a message
512
+ await sock.sendMessage(jid, { forward: msg });
513
+
514
+ // Reply (quoted message)
515
+ await sock.sendMessage(
516
+ jid,
517
+ { text: "This is a reply!" },
518
+ { quoted: msg }
519
+ );
520
+ ```
521
+
522
+ ### Mention
523
+
524
+ ```js
525
+ await sock.sendMessage(jid, {
526
+ text: "Hey @628111222333, how are you?",
527
+ mentions: ["628111222333@s.whatsapp.net"],
528
+ });
529
+ ```
530
+
531
+ ### Context Info
532
+
533
+ ```js
534
+ await sock.sendMessage(jid, {
535
+ text: "Message with custom context",
536
+ contextInfo: {
537
+ externalAdReply: {
538
+ title: "My Bot",
539
+ body: "Powered by @kyyinfinite/baileys",
540
+ thumbnail: readFileSync("./thumbnail.jpg"),
541
+ sourceUrl: "https://github.com/kyyinfinite/baileys",
542
+ mediaType: 1,
543
+ renderLargerThumbnail: true,
544
+ },
545
+ },
546
+ });
547
+ ```
548
+
549
+ ---
550
+
551
+ ## ⚡ Interactive Messages
552
+
553
+ > [!NOTE]
554
+ > Interactive messages are powered by the **Dugong** layer in `@kyyinfinite/baileys`.
555
+ > These are not available in the official WhiskeySockets/Baileys.
556
+
557
+ ### Flow Buttons
558
+
559
+ ```js
560
+ await sock.sendMessage(jid, {
561
+ interactiveMessage: {
562
+ title: "Welcome! 👋",
563
+ footer: "Powered by @kyyinfinite/baileys",
564
+ buttons: [
565
+ {
566
+ name: "quick_reply",
567
+ buttonParamsJson: JSON.stringify({
568
+ display_text: "📋 Menu",
569
+ id: "menu",
570
+ }),
571
+ },
572
+ ],
573
+ header: "Choose an option below",
574
+ },
575
+ });
576
+ ```
577
+
578
+ ### CTA URL Button
579
+
580
+ ```js
581
+ await sock.sendMessage(jid, {
582
+ interactiveMessage: {
583
+ title: "Visit our website",
584
+ footer: "Powered by @kyyinfinite/baileys",
585
+ buttons: [
586
+ {
587
+ name: "cta_url",
588
+ buttonParamsJson: JSON.stringify({
589
+ display_text: "🌐 Open Website",
590
+ url: "https://example.com",
591
+ merchant_url: "https://example.com",
592
+ }),
593
+ },
594
+ ],
595
+ header: "External Link",
596
+ },
597
+ });
598
+ ```
599
+
600
+ ### Copy Button
601
+
602
+ ```js
603
+ await sock.sendMessage(jid, {
604
+ interactiveMessage: {
605
+ title: "Your promo code",
606
+ footer: "Tap to copy",
607
+ buttons: [
608
+ {
609
+ name: "cta_copy",
610
+ buttonParamsJson: JSON.stringify({
611
+ display_text: "📋 Copy Code",
612
+ copy_code: "KYYBAILEYS2024",
613
+ }),
614
+ },
615
+ ],
616
+ header: "Promo Code",
617
+ },
618
+ });
619
+ ```
620
+
621
+ ### List Menu (single_select)
622
+
623
+ ```js
624
+ await sock.sendMessage(jid, {
625
+ interactiveMessage: {
626
+ title: "Select a Category",
627
+ footer: "Powered by @kyyinfinite/baileys",
628
+ buttons: [
629
+ {
630
+ name: "single_select",
631
+ buttonParamsJson: JSON.stringify({
632
+ title: "📋 Open Menu",
633
+ sections: [
634
+ {
635
+ title: "🛠️ Tools",
636
+ rows: [
637
+ { title: "🖼️ Sticker Maker", description: "Convert image to sticker", id: ".sticker" },
638
+ { title: "🗣️ Text to Speech", description: "Convert text to audio", id: ".tts" },
639
+ { title: "🔍 AI Search", description: "Ask the AI anything", id: ".ai" },
640
+ ],
641
+ },
642
+ {
643
+ title: "ℹ️ Info",
644
+ rows: [
645
+ { title: "📊 Bot Stats", description: "View bot statistics", id: ".stats" },
646
+ { title: "❓ Help", description: "How to use this bot", id: ".help" },
647
+ ],
648
+ },
649
+ ],
650
+ }),
651
+ },
652
+ ],
653
+ header: "🤖 Bot Menu",
654
+ },
655
+ });
656
+ ```
657
+
658
+ ### Carousel
659
+
660
+ ```js
661
+ import { Dugong } from "@kyyinfinite/baileys";
662
+
663
+ await sock.sendMessage(jid, {
664
+ interactiveMessage: Dugong.carousel({
665
+ cards: [
666
+ {
667
+ header: {
668
+ imageUrl: "https://example.com/card1.jpg",
669
+ },
670
+ title: "Card One",
671
+ body: "Description for the first card.",
672
+ buttons: [
673
+ {
674
+ name: "quick_reply",
675
+ buttonParamsJson: JSON.stringify({ display_text: "Select", id: "card_1" }),
676
+ },
677
+ ],
678
+ },
679
+ {
680
+ header: {
681
+ imageUrl: "https://example.com/card2.jpg",
682
+ },
683
+ title: "Card Two",
684
+ body: "Description for the second card.",
685
+ buttons: [
686
+ {
687
+ name: "quick_reply",
688
+ buttonParamsJson: JSON.stringify({ display_text: "Select", id: "card_2" }),
689
+ },
690
+ ],
691
+ },
692
+ ],
693
+ }),
694
+ });
695
+ ```
696
+
697
+ ### Native Interactive
698
+
699
+ Combine multiple button types in a single message:
700
+
701
+ ```js
702
+ await sock.sendMessage(jid, {
703
+ interactiveMessage: {
704
+ title: "🛍️ Product Details",
705
+ footer: "Free shipping above Rp 100.000",
706
+ buttons: [
707
+ {
708
+ name: "quick_reply",
709
+ buttonParamsJson: JSON.stringify({ display_text: "🛒 Buy Now", id: "buy_now" }),
710
+ },
711
+ {
712
+ name: "cta_url",
713
+ buttonParamsJson: JSON.stringify({
714
+ display_text: "📄 More Info",
715
+ url: "https://example.com/product",
716
+ }),
717
+ },
718
+ {
719
+ name: "cta_copy",
720
+ buttonParamsJson: JSON.stringify({
721
+ display_text: "📋 Copy Product ID",
722
+ copy_code: "PROD-12345",
723
+ }),
724
+ },
725
+ ],
726
+ header: "Premium Package",
727
+ image: { url: "https://example.com/product.jpg" },
728
+ },
729
+ });
730
+ ```
731
+
732
+ ---
733
+
734
+ ## 🤖 AI Rich Response
735
+
736
+ > [!NOTE]
737
+ > These message types are styled to match **Meta AI's** WhatsApp response format — tables, code blocks, and rich linked text.
738
+ > They are exclusive to `@kyyinfinite/baileys` and not available in official Baileys.
739
+
740
+ ### sendTable()
741
+
742
+ ```js
743
+ await sock.sendTable(
744
+ jid,
745
+ "Java vs JavaScript",
746
+ ["Feature", "Java", "JavaScript"],
747
+ [
748
+ ["Type", "Compiled", "Interpreted"],
749
+ ["Typing", "Static", "Dynamic"],
750
+ ["Runtime", "JVM", "V8 / Browser"],
751
+ ["Main Use", "Enterprise", "Web, Full-stack"],
752
+ ["Speed", "Faster", "Slightly Slower"],
753
+ ],
754
+ quoted,
755
+ {
756
+ headerText: "📊 Comparison Table:",
757
+ footer: "Hope this helps! 😊",
758
+ }
759
+ );
760
+ ```
761
+
762
+ ### sendList()
763
+
764
+ ```js
765
+ await sock.sendList(
766
+ jid,
767
+ "Bot Information",
768
+ [
769
+ ["Package", "@kyyinfinite/baileys"],
770
+ ["Version", "0.1.0"],
771
+ ["Developer", "kyyinfinite"],
772
+ ["License", "MIT"],
773
+ ["Node", ">= 20"],
774
+ ],
775
+ quoted,
776
+ { footer: "© 2026 kyyinfinite" }
777
+ );
778
+ ```
779
+
780
+ ### sendCodeBlock()
781
+
782
+ V1 supports: `javascript`, `typescript`, `python`
783
+
784
+ ```js
785
+ await sock.sendCodeBlock(
786
+ jid,
787
+ `import makeWASocket from "@kyyinfinite/baileys";\n\nconst sock = makeWASocket({ auth: state });`,
788
+ quoted,
789
+ {
790
+ language: "javascript",
791
+ title: "Quick Start",
792
+ footer: "Powered by @kyyinfinite/baileys",
793
+ }
794
+ );
795
+ ```
796
+
797
+ ### sendLink()
798
+
799
+ ```js
800
+ await sock.sendLink(
801
+ jid,
802
+ "Upload results:\n🔗 Click: {{IE_0}}download here{{/IE_0}}",
803
+ ["https://example.com/file.zip"],
804
+ quoted,
805
+ {
806
+ headerText: "📁 File Uploader",
807
+ footer: "✨ Upload complete!",
808
+ citations: [{ sourceTitle: "FileHost", citationNumber: 1 }],
809
+ }
810
+ );
811
+ ```
812
+
813
+ ### sendUnifiedResponse()
814
+
815
+ ```js
816
+ await sock.sendUnifiedResponse(
817
+ jid,
818
+ "Here is a unified response combining text and structured data.",
819
+ quoted,
820
+ {
821
+ headerText: "🤖 AI Response",
822
+ footer: "Powered by @kyyinfinite/baileys",
823
+ }
824
+ );
825
+ ```
826
+
827
+ ### sendTableV2()
828
+
829
+ ```js
830
+ await sock.sendTableV2(
831
+ jid,
832
+ "Framework Comparison",
833
+ ["Framework", "Language", "Use Case"],
834
+ [
835
+ ["Express", "JavaScript", "REST API"],
836
+ ["Fastify", "JavaScript", "High-perf API"],
837
+ ["Hono", "TypeScript", "Edge / Bun"],
838
+ ["Elysia", "TypeScript", "Bun Native"],
839
+ ],
840
+ quoted,
841
+ {
842
+ text: "Here's a framework comparison you requested:",
843
+ headerText: "📊 Frameworks",
844
+ footer: "Updated 2026",
845
+ }
846
+ );
847
+ ```
848
+
849
+ ### sendCodeBlockV2()
850
+
851
+ V2 supports: `javascript` / `js` / `typescript` / `ts`, `python` / `py`, `go` / `golang`, `lua`, `bash` / `sh` / `shell`
852
+
853
+ ```js
854
+ await sock.sendCodeBlockV2(
855
+ jid,
856
+ `func main() {\n fmt.Println("Hello, @kyyinfinite/baileys!")\n}`,
857
+ quoted,
858
+ {
859
+ language: "go",
860
+ title: "Go Example",
861
+ text: "Here is a Go snippet:",
862
+ footer: "Powered by @kyyinfinite/baileys",
863
+ }
864
+ );
865
+ ```
866
+
867
+ **All supported V2 languages:**
868
+
869
+ | Language Key | Aliases |
870
+ |---|---|
871
+ | `javascript` | `js`, `typescript`, `ts` |
872
+ | `python` | `py` |
873
+ | `go` | `golang` |
874
+ | `lua` | — |
875
+ | `bash` | `sh`, `shell` |
876
+
877
+ ### sendLinkV2()
878
+
879
+ ```js
880
+ await sock.sendLinkV2(
881
+ jid,
882
+ "Search results:\n- {{IE_0}}Official npm page{{/IE_0}}\n- {{IE_1}}GitHub repository{{/IE_1}}",
883
+ [
884
+ {
885
+ url: "https://www.npmjs.com/package/@kyyinfinite/baileys",
886
+ displayName: "Official npm page",
887
+ sourceDisplayName: "npmjs.com",
888
+ },
889
+ {
890
+ url: "https://github.com/kyyinfinite/baileys",
891
+ displayName: "GitHub repository",
892
+ sourceDisplayName: "github.com",
893
+ },
894
+ ],
895
+ quoted,
896
+ {
897
+ headerText: "@kyyinfinite/baileys",
898
+ footer: "Reference links",
899
+ searchEngine: "MAME",
900
+ }
901
+ );
902
+ ```
903
+
904
+ ---
905
+
906
+ ## 🎞️ Album Messages
907
+
908
+ Send multiple images and/or videos as a grouped album in a single message:
909
+
910
+ ```js
911
+ await sock.sendMessage(jid, {
912
+ albumMessage: [
913
+ { image: { url: "./photo1.jpg" }, caption: "First photo 🌅" },
914
+ { image: { url: "./photo2.jpg" }, caption: "Second photo 🌄" },
915
+ { image: { url: "https://example.com/photo3.jpg" }, caption: "Remote photo 🌃" },
916
+ { video: { url: "./clip.mp4" }, caption: "Bonus clip 🎬" },
917
+ ],
918
+ });
919
+ ```
920
+
921
+ > [!NOTE]
922
+ > Albums automatically compute and set `expectedImageCount` and `expectedVideoCount`
923
+ > based on the array content. You do not need to set these manually.
924
+
925
+ > [!TIP]
926
+ > You can mix images and videos freely inside an album. Albums support both local file paths and remote URLs.
927
+
928
+ ---
929
+
930
+ ## 📰 Newsletter
931
+
932
+ All newsletter methods are available directly on the socket:
933
+
934
+ ```js
935
+ // Follow a newsletter channel
936
+ await sock.newsletterFollow("123456789@newsletter");
937
+
938
+ // Unfollow a newsletter channel
939
+ await sock.newsletterUnfollow("123456789@newsletter");
940
+
941
+ // Create a new newsletter channel
942
+ await sock.newsletterCreate("My Channel", "Channel description");
943
+
944
+ // Update newsletter metadata
945
+ await sock.newsletterUpdate("123456789@newsletter", {
946
+ name: "Updated Channel Name",
947
+ description: "Updated description",
948
+ });
949
+
950
+ // React to a newsletter message
951
+ await sock.newsletterReactMessage("123456789@newsletter", serverId, "👍");
952
+
953
+ // Fetch recent newsletter messages
954
+ const msgs = await sock.newsletterFetchMessages("123456789@newsletter", 50, 0, 0);
955
+
956
+ // Fetch newsletter metadata
957
+ const meta = await sock.newsletterMetadata("123456789@newsletter");
958
+
959
+ // Admin: Mute/unmute newsletter
960
+ await sock.newsletterAdminMute("123456789@newsletter", true);
961
+
962
+ // Bulk follow multiple channels
963
+ await sock.newsletterBulkFollow([
964
+ "123456789@newsletter",
965
+ "987654321@newsletter",
966
+ ]);
967
+
968
+ // Resolve newsletter URL
969
+ const resolved = await sock.newsletterResolveUrl("https://whatsapp.com/channel/xxxxx");
970
+ ```
971
+
972
+ ---
973
+
974
+ ## 👥 Group
975
+
976
+ Complete group management API:
977
+
978
+ ```js
979
+ // Fetch group metadata
980
+ const meta = await sock.groupMetadata("groupid@g.us");
981
+ console.log(meta.subject, meta.participants);
982
+
983
+ // Create a new group
984
+ const group = await sock.groupCreate("My New Group", [
985
+ "628111@s.whatsapp.net",
986
+ "628222@s.whatsapp.net",
987
+ ]);
988
+
989
+ // Add / remove / promote / demote participants
990
+ await sock.groupParticipantsUpdate("groupid@g.us", ["628111@s.whatsapp.net"], "add");
991
+ await sock.groupParticipantsUpdate("groupid@g.us", ["628111@s.whatsapp.net"], "remove");
992
+ await sock.groupParticipantsUpdate("groupid@g.us", ["628111@s.whatsapp.net"], "promote");
993
+ await sock.groupParticipantsUpdate("groupid@g.us", ["628111@s.whatsapp.net"], "demote");
994
+
995
+ // Update group name / description
996
+ await sock.groupUpdateSubject("groupid@g.us", "New Group Name");
997
+ await sock.groupUpdateDescription("groupid@g.us", "New group description");
998
+
999
+ // Group settings
1000
+ await sock.groupSettingUpdate("groupid@g.us", "announcement"); // only admins send
1001
+ await sock.groupSettingUpdate("groupid@g.us", "not_announcement"); // everyone sends
1002
+
1003
+ // Toggle disappearing messages
1004
+ await sock.groupToggleEphemeral("groupid@g.us", 86400); // 24 hours; 0 to disable
1005
+
1006
+ // Get & reset invite link
1007
+ const code = await sock.groupInviteCode("groupid@g.us");
1008
+ await sock.groupRevokeInvite("groupid@g.us");
1009
+
1010
+ // Join via invite code
1011
+ await sock.groupAcceptInvite("INVITECODE");
1012
+
1013
+ // Leave a group
1014
+ await sock.groupLeave("groupid@g.us");
1015
+
1016
+ // Handle join requests
1017
+ await sock.groupRequestParticipantsList("groupid@g.us");
1018
+ await sock.groupRequestParticipantsUpdate("groupid@g.us", ["628xxx@s.whatsapp.net"], "approve");
1019
+ await sock.groupRequestParticipantsUpdate("groupid@g.us", ["628xxx@s.whatsapp.net"], "reject");
1020
+ ```
1021
+
1022
+ ---
1023
+
1024
+ ## 🏘️ Community
1025
+
1026
+ ```js
1027
+ // Create a community
1028
+ const community = await sock.communityCreate("Our Community", "Community description");
1029
+
1030
+ // Link an existing group to a community
1031
+ await sock.communityLinkGroup("groupid@g.us", "communityid@g.us");
1032
+
1033
+ // Unlink a group from a community
1034
+ await sock.communityUnlinkGroup("groupid@g.us", "communityid@g.us");
1035
+
1036
+ // Fetch all groups linked to a community
1037
+ const linked = await sock.communityFetchLinkedGroups("communityid@g.us");
1038
+ console.log(linked);
1039
+
1040
+ // Deactivate a community
1041
+ await sock.communityDeactivate("communityid@g.us");
1042
+ ```
1043
+
1044
+ ---
1045
+
1046
+ ## 🏢 Business
1047
+
1048
+ ```js
1049
+ // Fetch product catalog
1050
+ const { products } = await sock.getCatalog({
1051
+ jid: "628xxx@s.whatsapp.net",
1052
+ limit: 10,
1053
+ });
1054
+
1055
+ // Create a product
1056
+ const product = await sock.productCreate({
1057
+ name: "Premium Package",
1058
+ description: "Full-featured premium plan",
1059
+ price: 150000,
1060
+ currency: "IDR",
1061
+ originCountryCode: "ID",
1062
+ isHidden: false,
1063
+ images: [mediaUpload],
1064
+ });
1065
+
1066
+ // Update a product
1067
+ await sock.productUpdate(productId, {
1068
+ name: "Premium Package Pro",
1069
+ price: 200000,
1070
+ });
1071
+
1072
+ // Delete products
1073
+ await sock.productDelete([productId]);
1074
+
1075
+ // Update business profile
1076
+ await sock.updateBusinessProfile({
1077
+ address: "Jakarta, Indonesia",
1078
+ websites: ["https://example.com"],
1079
+ email: "hello@example.com",
1080
+ category: "Technology",
1081
+ description: "WhatsApp bot services",
1082
+ });
1083
+
1084
+ // Fetch business profile
1085
+ const profile = await sock.getBusinessProfile("628xxx@s.whatsapp.net");
1086
+ console.log(profile);
1087
+ ```
1088
+
1089
+ ---
1090
+
1091
+ ## 👤 Profile
1092
+
1093
+ ```js
1094
+ // Update profile picture
1095
+ await sock.updateProfilePicture(jid, {
1096
+ url: "./avatar.jpg",
1097
+ });
1098
+
1099
+ // Update display name
1100
+ await sock.updateProfileName("My New Name");
1101
+
1102
+ // Update status/about
1103
+ await sock.updateProfileStatus("🤖 Powered by @kyyinfinite/baileys");
1104
+
1105
+ // Fetch someone's profile picture
1106
+ const ppUrl = await sock.profilePictureUrl("628xxx@s.whatsapp.net", "image");
1107
+ console.log(ppUrl);
1108
+
1109
+ // Fetch your own profile
1110
+ const me = sock.user;
1111
+ console.log(me);
1112
+ ```
1113
+
1114
+ ---
1115
+
1116
+ ## 💬 Chat
1117
+
1118
+ ```js
1119
+ // Mark messages as read
1120
+ await sock.readMessages([msg.key]);
1121
+
1122
+ // Star / unstar messages
1123
+ await sock.star(jid, [{ id: msgId, fromMe: true }], true); // star
1124
+ await sock.star(jid, [{ id: msgId, fromMe: true }], false); // unstar
1125
+
1126
+ // Archive / unarchive chat
1127
+ await sock.chatModify({ archive: true, lastMessages: [msg] }, jid);
1128
+ await sock.chatModify({ archive: false, lastMessages: [msg] }, jid);
1129
+
1130
+ // Mute / unmute chat
1131
+ await sock.chatModify(
1132
+ { mute: 8 * 60 * 60 * 1000 }, // mute for 8 hours (in ms)
1133
+ jid
1134
+ );
1135
+ await sock.chatModify({ mute: null }, jid); // unmute
1136
+
1137
+ // Pin / unpin chat
1138
+ await sock.chatModify({ pin: true }, jid);
1139
+ await sock.chatModify({ pin: false }, jid);
1140
+
1141
+ // Delete chat
1142
+ await sock.chatModify({ delete: true, lastMessages: [msg] }, jid);
1143
+
1144
+ // Block / unblock a user
1145
+ await sock.updateBlockStatus(jid, "block");
1146
+ await sock.updateBlockStatus(jid, "unblock");
1147
+ ```
1148
+
1149
+ ---
1150
+
1151
+ ## 🔒 Privacy
1152
+
1153
+ ```js
1154
+ // Last seen visibility
1155
+ await sock.updateLastSeenPrivacy("all"); // 'all' | 'contacts' | 'nobody'
1156
+
1157
+ // Online status visibility
1158
+ await sock.updateOnlinePrivacy("all"); // 'all' | 'match_last_seen'
1159
+
1160
+ // Profile picture visibility
1161
+ await sock.updateProfilePicturePrivacy("contacts"); // 'all' | 'contacts' | 'nobody'
1162
+
1163
+ // Read receipts (blue ticks)
1164
+ await sock.updateReadReceiptsPrivacy("all"); // 'all' | 'none'
1165
+
1166
+ // Who can add you to groups
1167
+ await sock.updateGroupsAddPrivacy("all"); // 'all' | 'contacts' | 'contact_blacklist'
1168
+
1169
+ // Default disappearing message timer
1170
+ await sock.updateDefaultDisappearingMode(86400); // seconds; 0 to disable
1171
+ ```
1172
+
1173
+ ---
1174
+
1175
+ ## 📡 Events
1176
+
1177
+ Listen to all socket events via `sock.ev.on(...)`:
1178
+
1179
+ ```js
1180
+ // Connection state changes (open, close, connecting)
1181
+ sock.ev.on("connection.update", ({ connection, lastDisconnect, qr, isNewLogin }) => {});
1182
+
1183
+ // Credentials updated — always save
1184
+ sock.ev.on("creds.update", (update) => {});
1185
+
1186
+ // New / updated messages
1187
+ sock.ev.on("messages.upsert", ({ messages, type }) => {});
1188
+
1189
+ // Message edits / status updates
1190
+ sock.ev.on("messages.update", (updates) => {});
1191
+
1192
+ // Messages deleted
1193
+ sock.ev.on("messages.delete", (keys) => {});
1194
+
1195
+ // Reactions on messages
1196
+ sock.ev.on("messages.reaction", (reactions) => {});
1197
+
1198
+ // Group metadata updates (subject, description, settings)
1199
+ sock.ev.on("groups.update", (updates) => {});
1200
+
1201
+ // Participants added/removed/promoted/demoted
1202
+ sock.ev.on("group-participants.update", ({ id, participants, action }) => {});
1203
+
1204
+ // Join request received in a group
1205
+ sock.ev.on("group.join-request", (update) => {});
1206
+
1207
+ // New or updated chats
1208
+ sock.ev.on("chats.upsert", (chats) => {});
1209
+
1210
+ // Chat updates (archive, mute, pin, etc.)
1211
+ sock.ev.on("chats.update", (updates) => {});
1212
+
1213
+ // Chats deleted
1214
+ sock.ev.on("chats.delete", (ids) => {});
1215
+
1216
+ // Contacts synced or updated
1217
+ sock.ev.on("contacts.upsert", (contacts) => {});
1218
+ sock.ev.on("contacts.update", (contacts) => {});
1219
+
1220
+ // Incoming calls
1221
+ sock.ev.on("call", (calls) => {});
1222
+
1223
+ // Newsletter events
1224
+ sock.ev.on("newsletter.update", (updates) => {});
1225
+ sock.ev.on("newsletter.follow", (jid) => {});
1226
+
1227
+ // Privacy/settings updates
1228
+ sock.ev.on("settings.update", (settings) => {});
1229
+
1230
+ // Message history sync (on first connect)
1231
+ sock.ev.on("messaging-history.set", ({ chats, contacts, messages, isLatest }) => {});
1232
+
1233
+ // Blocklist updates
1234
+ sock.ev.on("blocklist.update", ({ blocklist, type }) => {});
1235
+ ```
1236
+
1237
+ ---
1238
+
1239
+ ## 🔧 Utility Exports
1240
+
1241
+ All named exports available from `@kyyinfinite/baileys`:
1242
+
1243
+ ```js
1244
+ import {
1245
+ //auth
1246
+ useMultiFileAuthState,
1247
+ makeCacheableSignalKeyStore,
1248
+ initAuthCreds,
1249
+ BufferJSON,
1250
+ fetchLatestBaileysVersion,
1251
+
1252
+ //rich message
1253
+ generateTableContent,
1254
+ generateTableContentV2,
1255
+ generateListContent,
1256
+ generateCodeBlockContent,
1257
+ generateCodeBlockContentV2,
1258
+ generateLinkContent,
1259
+ generateLinkContentV2,
1260
+ generateRichMessageContent,
1261
+ generateLatexContent,
1262
+ generateUnifiedResponseContent,
1263
+ captureUnifiedResponse,
1264
+
1265
+ buildRichContextInfo,
1266
+ buildBotForwardedMessage,
1267
+
1268
+
1269
+ tokenizeCode,
1270
+ tokenizeCodeV2,
1271
+ CodeHighlightType,
1272
+ RichSubMessageType,
1273
+
1274
+ //jid utils
1275
+ jidEncode,
1276
+ jidDecode,
1277
+ jidNormalizedUser,
1278
+ areJidsSameUser,
1279
+ isJidGroup,
1280
+ isJidNewsletter,
1281
+ isLidUser,
1282
+ isPnUser,
1283
+ isJidBot,
1284
+
1285
+ //consecution helper
1286
+ DisconnectReason,
1287
+ Browsers,
1288
+
1289
+ //advance
1290
+ Dugong,
1291
+
1292
+ } from "@kyyinfinite/baileys";
1293
+ ```
1294
+
1295
+ ---
1296
+
1297
+ ## 📚 API Reference
1298
+
1299
+ ### Socket Constructor Options
1300
+
1301
+ | Option | Type | Default | Description |
1302
+ |---|---|---|---|
1303
+ | `auth` | `AuthenticationState` | — | Auth state from `useMultiFileAuthState` |
1304
+ | `logger` | `Logger` | pino default | Logger instance (use `pino({ level: "silent" })`) |
1305
+ | `browser` | `WABrowserDescription` | — | Browser descriptor e.g. `Browsers.ubuntu("Chrome")` |
1306
+ | `version` | `WAVersion` | Latest | WhatsApp Web version tuple |
1307
+ | `connectTimeoutMs` | `number` | `20000` | Connection timeout in milliseconds |
1308
+ | `defaultQueryTimeoutMs` | `number` | `60000` | Default IQ query timeout |
1309
+ | `retryRequestDelayMs` | `number` | `250` | Delay between retries |
1310
+ | `maxMsgRetryCount` | `number` | `5` | Max message retry attempts |
1311
+ | `syncFullHistory` | `boolean` | `false` | Whether to sync full message history |
1312
+ | `enableAutoSessionRecreation` | `boolean` | `true` | Auto recreate session on failure |
1313
+ | `generateHighQualityLinkPreview` | `boolean` | `false` | Generate HQ link previews |
1314
+ | `qrTimeout` | `number` | `60000` | QR code expiry timeout in ms |
1315
+
1316
+ ---
1317
+
1318
+ ### Message Methods
1319
+
1320
+ | Method | Description | Returns |
1321
+ |---|---|---|
1322
+ | `sock.sendMessage(jid, content, opts?)` | Send any message type | `Promise<WAProto.WebMessageInfo>` |
1323
+ | `sock.sendTable(jid, title, headers, rows, quoted?, opts?)` | Send a styled table | `Promise<void>` |
1324
+ | `sock.sendTableV2(jid, title, headers, rows, quoted?, opts?)` | Send a V2 unified table | `Promise<void>` |
1325
+ | `sock.sendList(jid, title, rows, quoted?, opts?)` | Send a styled list | `Promise<void>` |
1326
+ | `sock.sendCodeBlock(jid, code, quoted?, opts?)` | Send V1 code block | `Promise<void>` |
1327
+ | `sock.sendCodeBlockV2(jid, code, quoted?, opts?)` | Send V2 unified code block | `Promise<void>` |
1328
+ | `sock.sendLink(jid, text, urls, quoted?, opts?)` | Send inline link message | `Promise<void>` |
1329
+ | `sock.sendLinkV2(jid, text, links, quoted?, opts?)` | Send V2 search-style links | `Promise<void>` |
1330
+ | `sock.sendUnifiedResponse(jid, text, quoted?, opts?)` | Send unified AI response | `Promise<void>` |
1331
+
1332
+ ---
1333
+
1334
+ ### Connection Methods
1335
+
1336
+ | Method | Description | Returns |
1337
+ |---|---|---|
1338
+ | `sock.requestPairingCode(phoneNumber, code?)` | Request or set pairing code | `Promise<string>` |
1339
+ | `sock.logout()` | Log out and invalidate session | `Promise<void>` |
1340
+ | `sock.end(error?)` | Close the socket connection | `void` |
1341
+ | `sock.waitForSocketOpen()` | Wait until socket is open | `Promise<void>` |
1342
+ | `sock.sendPresenceUpdate(presence, jid?)` | Set online/typing/recording status | `Promise<void>` |
1343
+
1344
+ ---
1345
+
1346
+ ### Group Methods
1347
+
1348
+ | Method | Description | Returns |
1349
+ |---|---|---|
1350
+ | `sock.groupMetadata(jid)` | Get group info | `Promise<GroupMetadata>` |
1351
+ | `sock.groupCreate(subject, participants)` | Create a new group | `Promise<GroupMetadata>` |
1352
+ | `sock.groupParticipantsUpdate(jid, participants, action)` | Add/remove/promote/demote | `Promise<ParticipantUpdate[]>` |
1353
+ | `sock.groupUpdateSubject(jid, subject)` | Change group name | `Promise<void>` |
1354
+ | `sock.groupUpdateDescription(jid, description)` | Change group description | `Promise<void>` |
1355
+ | `sock.groupSettingUpdate(jid, setting)` | Update group settings | `Promise<void>` |
1356
+ | `sock.groupToggleEphemeral(jid, expiration)` | Toggle disappearing messages | `Promise<void>` |
1357
+ | `sock.groupInviteCode(jid)` | Get invite link code | `Promise<string>` |
1358
+ | `sock.groupRevokeInvite(jid)` | Reset invite link | `Promise<string>` |
1359
+ | `sock.groupAcceptInvite(code)` | Join via invite code | `Promise<string>` |
1360
+ | `sock.groupLeave(jid)` | Leave a group | `Promise<void>` |
1361
+
1362
+ ---
1363
+
1364
+ ### Newsletter Methods
1365
+
1366
+ | Method | Description | Returns |
1367
+ |---|---|---|
1368
+ | `sock.newsletterFollow(jid)` | Follow a newsletter | `Promise<void>` |
1369
+ | `sock.newsletterUnfollow(jid)` | Unfollow a newsletter | `Promise<void>` |
1370
+ | `sock.newsletterCreate(name, desc)` | Create newsletter | `Promise<NewsletterMetadata>` |
1371
+ | `sock.newsletterUpdate(jid, metadata)` | Update newsletter info | `Promise<void>` |
1372
+ | `sock.newsletterReactMessage(jid, serverId, emoji)` | React to newsletter message | `Promise<void>` |
1373
+ | `sock.newsletterFetchMessages(jid, count, before, after)` | Fetch newsletter messages | `Promise<NewsletterMessage[]>` |
1374
+ | `sock.newsletterBulkFollow(jids)` | Follow multiple channels | `Promise<void>` |
1375
+ | `sock.newsletterMetadata(jid)` | Fetch channel metadata | `Promise<NewsletterMetadata>` |
1376
+
1377
+ ---
1378
+
1379
+ ## ❓ FAQ
1380
+
1381
+ <details>
1382
+ <summary><strong>Why is @kyyinfinite/baileys ESM-only?</strong></summary>
1383
+
1384
+ ESM (ECMAScript Modules) is the modern JavaScript standard. It enables tree-shaking, top-level `await`, better static analysis, and aligns with the Node.js ecosystem roadmap. CommonJS support is intentionally dropped to keep the codebase clean and forward-compatible.
1385
+
1386
+ If your project is still CommonJS, wrap the import dynamically:
1387
+
1388
+ ```js
1389
+ const { default: makeWASocket } = await import("@kyyinfinite/baileys");
1390
+ ```
1391
+
1392
+ Or better — migrate your project to ESM by adding `"type": "module"` to `package.json`.
1393
+
1394
+ </details>
1395
+
1396
+ <details>
1397
+ <summary><strong>How do I reconnect automatically?</strong></summary>
1398
+
1399
+ Listen to `connection.update` and call your `startBot()` function again if the disconnect reason is not `loggedOut`:
1400
+
1401
+ ```js
1402
+ sock.ev.on("connection.update", ({ connection, lastDisconnect }) => {
1403
+ if (connection === "close") {
1404
+ const code = lastDisconnect?.error?.output?.statusCode;
1405
+ if (code !== DisconnectReason.loggedOut) startBot();
1406
+ }
1407
+ });
1408
+ ```
1409
+
1410
+ For production, also use PM2 or Docker restart policies.
1411
+
1412
+ </details>
1413
+
1414
+ <details>
1415
+ <summary><strong>How do I use pairing code instead of QR?</strong></summary>
1416
+
1417
+ Call `sock.requestPairingCode(phoneNumber)` when the connection status is `"connecting"`.
1418
+ Phone number must include the country code without `+` (e.g. `6281234567890` for Indonesia).
1419
+
1420
+ See the [Pairing Code Login](#5-pairing-code-login) section for a complete example.
1421
+
1422
+ </details>
1423
+
1424
+ <details>
1425
+ <summary><strong>How do I persist authentication between restarts?</strong></summary>
1426
+
1427
+ Use `useMultiFileAuthState("./session")` and save on every `creds.update` event:
1428
+
1429
+ ```js
1430
+ const { state, saveCreds } = await useMultiFileAuthState("./session");
1431
+ sock.ev.on("creds.update", saveCreds);
1432
+ ```
1433
+
1434
+ For production, implement a custom auth store backed by Redis, MongoDB, or PostgreSQL instead of local files.
1435
+
1436
+ </details>
1437
+
1438
+ <details>
1439
+ <summary><strong>How do I deploy to a VPS or cloud?</strong></summary>
1440
+
1441
+ 1. Upload your project files (without `node_modules`)
1442
+ 2. Run `npm install` on the server
1443
+ 3. Use PM2 to keep the bot alive: `npm install -g pm2 && pm2 start index.js --name my-bot`
1444
+ 4. Enable PM2 auto-start: `pm2 startup && pm2 save`
1445
+
1446
+ > [!TIP]
1447
+ > Use `pm2 logs my-bot` to monitor your bot in production.
1448
+
1449
+ </details>
1450
+
1451
+ <details>
1452
+ <summary><strong>How do I handle multiple sessions / multi-device?</strong></summary>
1453
+
1454
+ Create a separate auth state directory for each session:
1455
+
1456
+ ```js
1457
+ const session1 = await useMultiFileAuthState("./sessions/bot1");
1458
+ const session2 = await useMultiFileAuthState("./sessions/bot2");
1459
+ ```
1460
+
1461
+ Then instantiate a separate `makeWASocket` for each session.
1462
+
1463
+ </details>
1464
+
1465
+ <details>
1466
+ <summary><strong>Interactive messages are not rendering. What's wrong?</strong></summary>
1467
+
1468
+ Interactive messages (flow buttons, carousels, list menus) require:
1469
+
1470
+ - A **WhatsApp Business API**-capable number, or
1471
+ - A number that has been granted access to the interactive message API by WhatsApp.
1472
+
1473
+ On regular personal numbers, interactive messages may silently fail or show as plain text.
1474
+
1475
+ </details>
1476
+
1477
+ <details>
1478
+ <summary><strong>What is the difference from official Baileys?</strong></summary>
1479
+
1480
+ | Area | Official Baileys | @kyyinfinite/baileys |
1481
+ |---|---|---|
1482
+ | Interactive messages | No native support | ✅ Full support via Dugong |
1483
+ | Album messages | Not supported | ✅ Multi-media albums |
1484
+ | AI Rich Response | Not available | ✅ Table, code block, rich text |
1485
+ | Table V2 | Not available | ✅ Unified response |
1486
+ | Code Block V2 | Not available | ✅ 6 languages |
1487
+ | Link Message | Not available | ✅ Inline embeds + citations |
1488
+ | Newsletter extras | Basic only | ✅ Bulk follow, URL resolve, admin |
1489
+ | Payment messages | Not supported | ✅ Full support |
1490
+ | Status mentions | Not available | ✅ `sendStatusMention()` |
1491
+ | LID support | Basic | ✅ Full LID↔PN mapping + migration |
1492
+
1493
+ </details>
1494
+
1495
+ ---
1496
+
1497
+ > [!TIP]
1498
+ > Use `browser: Browsers.ubuntu("Chrome")` for QR login and `Browsers.windows("Chrome")` for pairing code — this can affect compatibility with certain WhatsApp features.
1499
+
1500
+ > [!IMPORTANT]
1501
+ > Always call `sock.ev.on("creds.update", saveCreds)` — missing this will cause your session to expire on every restart.
1502
+
1503
+ > [!WARNING]
1504
+ > Do **not** share your `./session` folder publicly. It contains your authentication keys and allows full access to the linked WhatsApp account.
1505
+
1506
+ > [!NOTE]
1507
+ > `@kyyinfinite/baileys` follows the same Signal Protocol as official Baileys. End-to-end encryption is preserved for all messages.
1508
+
1509
+ > [!CAUTION]
1510
+ > This library is intended for **educational and personal automation** purposes. Ensure your usage complies with [WhatsApp's Terms of Service](https://www.whatsapp.com/legal/terms-of-service). Mass messaging, spam, or unauthorized data collection may result in permanent account bans.
1511
+
1512
+ ---
1513
+
1514
+ ## 📄 License
1515
+
1516
+ ```
1517
+ MIT License
1518
+
1519
+ Copyright (c) 2026 kyyinfinite
1520
+
1521
+ Permission is hereby granted, free of charge, to any person obtaining a copy
1522
+ of this software and associated documentation files (the "Software"), to deal
1523
+ in the Software without restriction, including without limitation the rights
1524
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1525
+ copies of the Software, and to permit persons to whom the Software is
1526
+ furnished to do so, subject to the following conditions:
1527
+
1528
+ The above copyright notice and this permission notice shall be included in all
1529
+ copies or substantial portions of the Software.
1530
+ ```
1531
+
1532
+ ---
1533
+
1534
+ <div align="center">
1535
+
1536
+ [![npm](https://img.shields.io/badge/npm-%40kyyinfinite%2Fbaileys-CB3837?style=for-the-badge&logo=npm&logoColor=white)](https://www.npmjs.com/package/@kyyinfinite/baileys)
1537
+ [![GitHub](https://img.shields.io/badge/GitHub-kyyinfinite%2Fbaileys-181717?style=for-the-badge&logo=github&logoColor=white)](https://github.com/kyyinfinite/baileys)
1538
+ [![Star on GitHub](https://img.shields.io/badge/⭐_Star_this_repo-yellow?style=for-the-badge)](https://github.com/kyyinfinite/baileys/stargazers)
1539
+
1540
+ <br/>
1541
+
1542
+ [🐛 Report Bug](https://github.com/kyyinfinite/baileys/issues/new?template=bug_report.md) · [💡 Request Feature](https://github.com/kyyinfinite/baileys/issues/new?template=feature_request.md) · [📦 npm Package](https://www.npmjs.com/package/@kyyinfinite/baileys)
1543
+
1544
+ <br/>
1545
+
1546
+ **© 2026 kyyinfinite — `@kyyinfinite/baileys` v0.1.0 • MIT License**
1547
+
1548
+ *Built on top of [WhiskeySockets/Baileys](https://github.com/WhiskeySockets/Baileys)*
1549
+
1550
+ </div>