zalo-api-sdk 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 (459) hide show
  1. package/.prettierrc +5 -0
  2. package/.tmp-cache/_update-notifier-last-checked +0 -0
  3. package/CODE_OF_CONDUCT.md +157 -0
  4. package/CONTRIBUTING.md +491 -0
  5. package/LICENSE +21 -0
  6. package/README.md +421 -0
  7. package/SECURITY.md +82 -0
  8. package/commit-push.sh +79 -0
  9. package/deploy.sh +172 -0
  10. package/dist/Errors/ZaloApiError.d.ts +4 -0
  11. package/dist/Errors/ZaloApiError.js +7 -0
  12. package/dist/Errors/index.d.ts +1 -0
  13. package/dist/Errors/index.js +1 -0
  14. package/dist/apis/acceptFriendRequest.d.ts +2 -0
  15. package/dist/apis/acceptFriendRequest.js +28 -0
  16. package/dist/apis/addGroupBlockedMember.d.ts +2 -0
  17. package/dist/apis/addGroupBlockedMember.js +28 -0
  18. package/dist/apis/addGroupDeputy.d.ts +2 -0
  19. package/dist/apis/addGroupDeputy.js +30 -0
  20. package/dist/apis/addQuickMessage.d.ts +11 -0
  21. package/dist/apis/addQuickMessage.js +60 -0
  22. package/dist/apis/addReaction.d.ts +18 -0
  23. package/dist/apis/addReaction.js +294 -0
  24. package/dist/apis/addUnreadMark.d.ts +8 -0
  25. package/dist/apis/addUnreadMark.js +52 -0
  26. package/dist/apis/addUserToGroup.d.ts +5 -0
  27. package/dist/apis/addUserToGroup.js +34 -0
  28. package/dist/apis/blockUser.d.ts +2 -0
  29. package/dist/apis/blockUser.js +28 -0
  30. package/dist/apis/blockViewFeed.d.ts +2 -0
  31. package/dist/apis/blockViewFeed.js +30 -0
  32. package/dist/apis/changeAccountAvatar.d.ts +3 -0
  33. package/dist/apis/changeAccountAvatar.js +52 -0
  34. package/dist/apis/changeFriendAlias.d.ts +2 -0
  35. package/dist/apis/changeFriendAlias.js +27 -0
  36. package/dist/apis/changeGroupAvatar.d.ts +3 -0
  37. package/dist/apis/changeGroupAvatar.js +44 -0
  38. package/dist/apis/changeGroupName.d.ts +4 -0
  39. package/dist/apis/changeGroupName.js +32 -0
  40. package/dist/apis/changeGroupOwner.d.ts +4 -0
  41. package/dist/apis/changeGroupOwner.js +30 -0
  42. package/dist/apis/createAutoReply.d.ts +14 -0
  43. package/dist/apis/createAutoReply.js +37 -0
  44. package/dist/apis/createCatalog.d.ts +7 -0
  45. package/dist/apis/createCatalog.js +29 -0
  46. package/dist/apis/createGroup.d.ts +28 -0
  47. package/dist/apis/createGroup.js +43 -0
  48. package/dist/apis/createNoteGroup.d.ts +7 -0
  49. package/dist/apis/createNoteGroup.js +47 -0
  50. package/dist/apis/createPoll.d.ts +57 -0
  51. package/dist/apis/createPoll.js +40 -0
  52. package/dist/apis/createProductCatalog.d.ts +23 -0
  53. package/dist/apis/createProductCatalog.js +50 -0
  54. package/dist/apis/createReminder.d.ts +10 -0
  55. package/dist/apis/createReminder.js +63 -0
  56. package/dist/apis/custom.d.ts +9 -0
  57. package/dist/apis/custom.js +15 -0
  58. package/dist/apis/deleteAutoReply.d.ts +5 -0
  59. package/dist/apis/deleteAutoReply.js +29 -0
  60. package/dist/apis/deleteAvatar.d.ts +9 -0
  61. package/dist/apis/deleteAvatar.js +27 -0
  62. package/dist/apis/deleteCatalog.d.ts +2 -0
  63. package/dist/apis/deleteCatalog.js +28 -0
  64. package/dist/apis/deleteChat.d.ts +19 -0
  65. package/dist/apis/deleteChat.js +50 -0
  66. package/dist/apis/deleteMessage.d.ts +14 -0
  67. package/dist/apis/deleteMessage.js +52 -0
  68. package/dist/apis/deleteProductCatalog.d.ts +10 -0
  69. package/dist/apis/deleteProductCatalog.js +31 -0
  70. package/dist/apis/disableGroupLink.d.ts +2 -0
  71. package/dist/apis/disableGroupLink.js +24 -0
  72. package/dist/apis/disperseGroup.d.ts +2 -0
  73. package/dist/apis/disperseGroup.js +28 -0
  74. package/dist/apis/editNoteGroup.d.ts +32 -0
  75. package/dist/apis/editNoteGroup.js +40 -0
  76. package/dist/apis/editReminder.d.ts +18 -0
  77. package/dist/apis/editReminder.js +61 -0
  78. package/dist/apis/enableGroupLink.d.ts +6 -0
  79. package/dist/apis/enableGroupLink.js +25 -0
  80. package/dist/apis/fetchAccountInfo.d.ts +34 -0
  81. package/dist/apis/fetchAccountInfo.js +10 -0
  82. package/dist/apis/findUser.d.ts +15 -0
  83. package/dist/apis/findUser.js +40 -0
  84. package/dist/apis/forwardMessage.d.ts +26 -0
  85. package/dist/apis/forwardMessage.js +99 -0
  86. package/dist/apis/getAliasList.d.ts +8 -0
  87. package/dist/apis/getAliasList.js +27 -0
  88. package/dist/apis/getAllFriends.d.ts +34 -0
  89. package/dist/apis/getAllFriends.js +32 -0
  90. package/dist/apis/getAllGroups.d.ts +7 -0
  91. package/dist/apis/getAllGroups.js +10 -0
  92. package/dist/apis/getArchivedChatList.d.ts +5 -0
  93. package/dist/apis/getArchivedChatList.js +23 -0
  94. package/dist/apis/getAutoDeleteChat.d.ts +9 -0
  95. package/dist/apis/getAutoDeleteChat.js +21 -0
  96. package/dist/apis/getAutoReplyList.d.ts +6 -0
  97. package/dist/apis/getAutoReplyList.js +24 -0
  98. package/dist/apis/getAvatarList.d.ts +12 -0
  99. package/dist/apis/getAvatarList.js +28 -0
  100. package/dist/apis/getBizAccount.d.ts +19 -0
  101. package/dist/apis/getBizAccount.js +27 -0
  102. package/dist/apis/getCatalogList.d.ts +12 -0
  103. package/dist/apis/getCatalogList.js +32 -0
  104. package/dist/apis/getContext.d.ts +1 -0
  105. package/dist/apis/getContext.js +4 -0
  106. package/dist/apis/getCookie.d.ts +1 -0
  107. package/dist/apis/getCookie.js +9 -0
  108. package/dist/apis/getFriendBoardList.d.ts +5 -0
  109. package/dist/apis/getFriendBoardList.js +26 -0
  110. package/dist/apis/getFriendRequestStatus.d.ts +8 -0
  111. package/dist/apis/getFriendRequestStatus.js +25 -0
  112. package/dist/apis/getGroupBlockedMember.d.ts +17 -0
  113. package/dist/apis/getGroupBlockedMember.js +29 -0
  114. package/dist/apis/getGroupInfo.d.ts +43 -0
  115. package/dist/apis/getGroupInfo.js +32 -0
  116. package/dist/apis/getGroupLinkDetail.d.ts +6 -0
  117. package/dist/apis/getGroupLinkDetail.js +25 -0
  118. package/dist/apis/getGroupLinkInfo.d.ts +31 -0
  119. package/dist/apis/getGroupLinkInfo.js +28 -0
  120. package/dist/apis/getGroupMembersInfo.d.ts +17 -0
  121. package/dist/apis/getGroupMembersInfo.js +24 -0
  122. package/dist/apis/getHiddenConversations.d.ts +11 -0
  123. package/dist/apis/getHiddenConversations.js +23 -0
  124. package/dist/apis/getLabels.d.ts +15 -0
  125. package/dist/apis/getLabels.js +28 -0
  126. package/dist/apis/getListBoard.d.ts +15 -0
  127. package/dist/apis/getListBoard.js +45 -0
  128. package/dist/apis/getListReminder.d.ts +22 -0
  129. package/dist/apis/getListReminder.js +47 -0
  130. package/dist/apis/getMute.d.ts +13 -0
  131. package/dist/apis/getMute.js +22 -0
  132. package/dist/apis/getOwnId.d.ts +1 -0
  133. package/dist/apis/getOwnId.js +4 -0
  134. package/dist/apis/getPendingGroupMembers.d.ts +10 -0
  135. package/dist/apis/getPendingGroupMembers.js +27 -0
  136. package/dist/apis/getPinConversations.d.ts +5 -0
  137. package/dist/apis/getPinConversations.js +22 -0
  138. package/dist/apis/getPollDetail.d.ts +3 -0
  139. package/dist/apis/getPollDetail.js +30 -0
  140. package/dist/apis/getProductCatalogList.d.ts +14 -0
  141. package/dist/apis/getProductCatalogList.js +33 -0
  142. package/dist/apis/getQR.d.ts +4 -0
  143. package/dist/apis/getQR.js +29 -0
  144. package/dist/apis/getQuickMessage.d.ts +7 -0
  145. package/dist/apis/getQuickMessage.js +24 -0
  146. package/dist/apis/getReceivedFriendRequests.d.ts +35 -0
  147. package/dist/apis/getReceivedFriendRequests.js +22 -0
  148. package/dist/apis/getReminder.d.ts +13 -0
  149. package/dist/apis/getReminder.js +25 -0
  150. package/dist/apis/getReminderResponses.d.ts +5 -0
  151. package/dist/apis/getReminderResponses.js +24 -0
  152. package/dist/apis/getSentFriendRequest.d.ts +17 -0
  153. package/dist/apis/getSentFriendRequest.js +24 -0
  154. package/dist/apis/getStickers.d.ts +1 -0
  155. package/dist/apis/getStickers.js +40 -0
  156. package/dist/apis/getStickersDetail.d.ts +24 -0
  157. package/dist/apis/getStickersDetail.js +40 -0
  158. package/dist/apis/getUnreadMark.d.ts +14 -0
  159. package/dist/apis/getUnreadMark.js +30 -0
  160. package/dist/apis/getUserInfo.d.ts +39 -0
  161. package/dist/apis/getUserInfo.js +42 -0
  162. package/dist/apis/inviteUserToGroups.d.ts +10 -0
  163. package/dist/apis/inviteUserToGroups.js +30 -0
  164. package/dist/apis/joinGroupLink.d.ts +2 -0
  165. package/dist/apis/joinGroupLink.js +27 -0
  166. package/dist/apis/keepAlive.d.ts +4 -0
  167. package/dist/apis/keepAlive.js +22 -0
  168. package/dist/apis/lastOnline.d.ts +7 -0
  169. package/dist/apis/lastOnline.js +26 -0
  170. package/dist/apis/leaveGroup.d.ts +4 -0
  171. package/dist/apis/leaveGroup.js +33 -0
  172. package/dist/apis/listen.d.ts +100 -0
  173. package/dist/apis/listen.js +424 -0
  174. package/dist/apis/lockPoll.d.ts +2 -0
  175. package/dist/apis/lockPoll.js +28 -0
  176. package/dist/apis/login.d.ts +3 -0
  177. package/dist/apis/login.js +96 -0
  178. package/dist/apis/loginQR.d.ts +70 -0
  179. package/dist/apis/loginQR.js +359 -0
  180. package/dist/apis/parseLink.d.ts +21 -0
  181. package/dist/apis/parseLink.js +27 -0
  182. package/dist/apis/removeFriend.d.ts +2 -0
  183. package/dist/apis/removeFriend.js +28 -0
  184. package/dist/apis/removeFriendAlias.d.ts +2 -0
  185. package/dist/apis/removeFriendAlias.js +24 -0
  186. package/dist/apis/removeGroupBlockedMember.d.ts +2 -0
  187. package/dist/apis/removeGroupBlockedMember.js +28 -0
  188. package/dist/apis/removeGroupDeputy.d.ts +2 -0
  189. package/dist/apis/removeGroupDeputy.js +30 -0
  190. package/dist/apis/removeQuickMessage.d.ts +5 -0
  191. package/dist/apis/removeQuickMessage.js +27 -0
  192. package/dist/apis/removeReminder.d.ts +3 -0
  193. package/dist/apis/removeReminder.js +40 -0
  194. package/dist/apis/removeUnreadMark.d.ts +8 -0
  195. package/dist/apis/removeUnreadMark.js +50 -0
  196. package/dist/apis/removeUserFromGroup.d.ts +4 -0
  197. package/dist/apis/removeUserFromGroup.js +34 -0
  198. package/dist/apis/resetHiddenConversPin.d.ts +2 -0
  199. package/dist/apis/resetHiddenConversPin.js +20 -0
  200. package/dist/apis/reuseAvatar.d.ts +2 -0
  201. package/dist/apis/reuseAvatar.js +26 -0
  202. package/dist/apis/reviewPendingMemberRequest.d.ts +6 -0
  203. package/dist/apis/reviewPendingMemberRequest.js +31 -0
  204. package/dist/apis/sendBankCard.d.ts +9 -0
  205. package/dist/apis/sendBankCard.js +39 -0
  206. package/dist/apis/sendCard.d.ts +10 -0
  207. package/dist/apis/sendCard.js +59 -0
  208. package/dist/apis/sendDeliveredEvent.d.ts +16 -0
  209. package/dist/apis/sendDeliveredEvent.js +55 -0
  210. package/dist/apis/sendFriendRequest.d.ts +2 -0
  211. package/dist/apis/sendFriendRequest.js +39 -0
  212. package/dist/apis/sendLink.d.ts +10 -0
  213. package/dist/apis/sendLink.js +61 -0
  214. package/dist/apis/sendMessage.d.ts +99 -0
  215. package/dist/apis/sendMessage.js +460 -0
  216. package/dist/apis/sendReport.d.ts +17 -0
  217. package/dist/apis/sendReport.js +53 -0
  218. package/dist/apis/sendSeenEvent.d.ts +16 -0
  219. package/dist/apis/sendSeenEvent.js +63 -0
  220. package/dist/apis/sendSticker.d.ts +6 -0
  221. package/dist/apis/sendSticker.js +56 -0
  222. package/dist/apis/sendTypingEvent.d.ts +5 -0
  223. package/dist/apis/sendTypingEvent.js +33 -0
  224. package/dist/apis/sendVideo.d.ts +35 -0
  225. package/dist/apis/sendVideo.js +118 -0
  226. package/dist/apis/sendVoice.d.ts +12 -0
  227. package/dist/apis/sendVoice.js +73 -0
  228. package/dist/apis/setHiddenConversations.d.ts +3 -0
  229. package/dist/apis/setHiddenConversations.js +37 -0
  230. package/dist/apis/setMute.d.ts +17 -0
  231. package/dist/apis/setMute.js +67 -0
  232. package/dist/apis/setPinnedConversations.d.ts +3 -0
  233. package/dist/apis/setPinnedConversations.js +34 -0
  234. package/dist/apis/unblockUser.d.ts +2 -0
  235. package/dist/apis/unblockUser.js +28 -0
  236. package/dist/apis/undo.d.ts +9 -0
  237. package/dist/apis/undo.js +42 -0
  238. package/dist/apis/undoFriendRequest.d.ts +2 -0
  239. package/dist/apis/undoFriendRequest.js +27 -0
  240. package/dist/apis/updateAutoDeleteChat.d.ts +9 -0
  241. package/dist/apis/updateAutoDeleteChat.js +40 -0
  242. package/dist/apis/updateAutoReply.d.ts +14 -0
  243. package/dist/apis/updateAutoReply.js +37 -0
  244. package/dist/apis/updateCatalog.d.ts +11 -0
  245. package/dist/apis/updateCatalog.js +30 -0
  246. package/dist/apis/updateGroupSettings.d.ts +40 -0
  247. package/dist/apis/updateGroupSettings.js +43 -0
  248. package/dist/apis/updateHiddenConversPin.d.ts +2 -0
  249. package/dist/apis/updateHiddenConversPin.js +30 -0
  250. package/dist/apis/updateLabels.d.ts +24 -0
  251. package/dist/apis/updateLabels.js +34 -0
  252. package/dist/apis/updateLang.d.ts +7 -0
  253. package/dist/apis/updateLang.js +32 -0
  254. package/dist/apis/updateProductCatalog.d.ts +25 -0
  255. package/dist/apis/updateProductCatalog.js +51 -0
  256. package/dist/apis/updateProfile.d.ts +13 -0
  257. package/dist/apis/updateProfile.js +42 -0
  258. package/dist/apis/updateQuickMessage.d.ts +11 -0
  259. package/dist/apis/updateQuickMessage.js +61 -0
  260. package/dist/apis/updateSettings.d.ts +3 -0
  261. package/dist/apis/updateSettings.js +23 -0
  262. package/dist/apis/uploadAttachment.d.ts +50 -0
  263. package/dist/apis/uploadAttachment.js +205 -0
  264. package/dist/apis/uploadProductPhoto.d.ts +14 -0
  265. package/dist/apis/uploadProductPhoto.js +50 -0
  266. package/dist/cjs/Errors/ZaloApiError.cjs +11 -0
  267. package/dist/cjs/apis/acceptFriendRequest.cjs +33 -0
  268. package/dist/cjs/apis/addGroupBlockedMember.cjs +33 -0
  269. package/dist/cjs/apis/addGroupDeputy.cjs +35 -0
  270. package/dist/cjs/apis/addQuickMessage.cjs +65 -0
  271. package/dist/cjs/apis/addReaction.cjs +304 -0
  272. package/dist/cjs/apis/addUnreadMark.cjs +62 -0
  273. package/dist/cjs/apis/addUserToGroup.cjs +39 -0
  274. package/dist/cjs/apis/blockUser.cjs +33 -0
  275. package/dist/cjs/apis/blockViewFeed.cjs +35 -0
  276. package/dist/cjs/apis/changeAccountAvatar.cjs +57 -0
  277. package/dist/cjs/apis/changeFriendAlias.cjs +32 -0
  278. package/dist/cjs/apis/changeGroupAvatar.cjs +49 -0
  279. package/dist/cjs/apis/changeGroupName.cjs +37 -0
  280. package/dist/cjs/apis/changeGroupOwner.cjs +35 -0
  281. package/dist/cjs/apis/createAutoReply.cjs +42 -0
  282. package/dist/cjs/apis/createCatalog.cjs +34 -0
  283. package/dist/cjs/apis/createGroup.cjs +48 -0
  284. package/dist/cjs/apis/createNoteGroup.cjs +52 -0
  285. package/dist/cjs/apis/createPoll.cjs +45 -0
  286. package/dist/cjs/apis/createProductCatalog.cjs +55 -0
  287. package/dist/cjs/apis/createReminder.cjs +73 -0
  288. package/dist/cjs/apis/custom.cjs +19 -0
  289. package/dist/cjs/apis/deleteAutoReply.cjs +34 -0
  290. package/dist/cjs/apis/deleteAvatar.cjs +32 -0
  291. package/dist/cjs/apis/deleteCatalog.cjs +33 -0
  292. package/dist/cjs/apis/deleteChat.cjs +60 -0
  293. package/dist/cjs/apis/deleteMessage.cjs +62 -0
  294. package/dist/cjs/apis/deleteProductCatalog.cjs +36 -0
  295. package/dist/cjs/apis/disableGroupLink.cjs +29 -0
  296. package/dist/cjs/apis/disperseGroup.cjs +33 -0
  297. package/dist/cjs/apis/editNoteGroup.cjs +45 -0
  298. package/dist/cjs/apis/editReminder.cjs +71 -0
  299. package/dist/cjs/apis/enableGroupLink.cjs +30 -0
  300. package/dist/cjs/apis/fetchAccountInfo.cjs +15 -0
  301. package/dist/cjs/apis/findUser.cjs +45 -0
  302. package/dist/cjs/apis/forwardMessage.cjs +109 -0
  303. package/dist/cjs/apis/getAliasList.cjs +32 -0
  304. package/dist/cjs/apis/getAllFriends.cjs +37 -0
  305. package/dist/cjs/apis/getAllGroups.cjs +15 -0
  306. package/dist/cjs/apis/getArchivedChatList.cjs +28 -0
  307. package/dist/cjs/apis/getAutoDeleteChat.cjs +26 -0
  308. package/dist/cjs/apis/getAutoReplyList.cjs +29 -0
  309. package/dist/cjs/apis/getAvatarList.cjs +33 -0
  310. package/dist/cjs/apis/getBizAccount.cjs +32 -0
  311. package/dist/cjs/apis/getCatalogList.cjs +37 -0
  312. package/dist/cjs/apis/getContext.cjs +9 -0
  313. package/dist/cjs/apis/getCookie.cjs +14 -0
  314. package/dist/cjs/apis/getFriendBoardList.cjs +31 -0
  315. package/dist/cjs/apis/getFriendRequestStatus.cjs +30 -0
  316. package/dist/cjs/apis/getGroupBlockedMember.cjs +34 -0
  317. package/dist/cjs/apis/getGroupInfo.cjs +37 -0
  318. package/dist/cjs/apis/getGroupLinkDetail.cjs +30 -0
  319. package/dist/cjs/apis/getGroupLinkInfo.cjs +33 -0
  320. package/dist/cjs/apis/getGroupMembersInfo.cjs +29 -0
  321. package/dist/cjs/apis/getHiddenConversations.cjs +28 -0
  322. package/dist/cjs/apis/getLabels.cjs +33 -0
  323. package/dist/cjs/apis/getListBoard.cjs +55 -0
  324. package/dist/cjs/apis/getListReminder.cjs +57 -0
  325. package/dist/cjs/apis/getMute.cjs +27 -0
  326. package/dist/cjs/apis/getOwnId.cjs +9 -0
  327. package/dist/cjs/apis/getPendingGroupMembers.cjs +32 -0
  328. package/dist/cjs/apis/getPinConversations.cjs +27 -0
  329. package/dist/cjs/apis/getPollDetail.cjs +35 -0
  330. package/dist/cjs/apis/getProductCatalogList.cjs +38 -0
  331. package/dist/cjs/apis/getQR.cjs +34 -0
  332. package/dist/cjs/apis/getQuickMessage.cjs +29 -0
  333. package/dist/cjs/apis/getReceivedFriendRequests.cjs +27 -0
  334. package/dist/cjs/apis/getReminder.cjs +30 -0
  335. package/dist/cjs/apis/getReminderResponses.cjs +29 -0
  336. package/dist/cjs/apis/getSentFriendRequest.cjs +29 -0
  337. package/dist/cjs/apis/getStickers.cjs +45 -0
  338. package/dist/cjs/apis/getStickersDetail.cjs +45 -0
  339. package/dist/cjs/apis/getUnreadMark.cjs +35 -0
  340. package/dist/cjs/apis/getUserInfo.cjs +47 -0
  341. package/dist/cjs/apis/inviteUserToGroups.cjs +35 -0
  342. package/dist/cjs/apis/joinGroupLink.cjs +32 -0
  343. package/dist/cjs/apis/keepAlive.cjs +27 -0
  344. package/dist/cjs/apis/lastOnline.cjs +31 -0
  345. package/dist/cjs/apis/leaveGroup.cjs +38 -0
  346. package/dist/cjs/apis/listen.cjs +435 -0
  347. package/dist/cjs/apis/lockPoll.cjs +33 -0
  348. package/dist/cjs/apis/login.cjs +102 -0
  349. package/dist/cjs/apis/loginQR.cjs +364 -0
  350. package/dist/cjs/apis/parseLink.cjs +32 -0
  351. package/dist/cjs/apis/removeFriend.cjs +33 -0
  352. package/dist/cjs/apis/removeFriendAlias.cjs +29 -0
  353. package/dist/cjs/apis/removeGroupBlockedMember.cjs +33 -0
  354. package/dist/cjs/apis/removeGroupDeputy.cjs +35 -0
  355. package/dist/cjs/apis/removeQuickMessage.cjs +32 -0
  356. package/dist/cjs/apis/removeReminder.cjs +50 -0
  357. package/dist/cjs/apis/removeUnreadMark.cjs +60 -0
  358. package/dist/cjs/apis/removeUserFromGroup.cjs +39 -0
  359. package/dist/cjs/apis/resetHiddenConversPin.cjs +25 -0
  360. package/dist/cjs/apis/reuseAvatar.cjs +31 -0
  361. package/dist/cjs/apis/reviewPendingMemberRequest.cjs +36 -0
  362. package/dist/cjs/apis/sendBankCard.cjs +49 -0
  363. package/dist/cjs/apis/sendCard.cjs +69 -0
  364. package/dist/cjs/apis/sendDeliveredEvent.cjs +65 -0
  365. package/dist/cjs/apis/sendFriendRequest.cjs +44 -0
  366. package/dist/cjs/apis/sendLink.cjs +71 -0
  367. package/dist/cjs/apis/sendMessage.cjs +469 -0
  368. package/dist/cjs/apis/sendReport.cjs +63 -0
  369. package/dist/cjs/apis/sendSeenEvent.cjs +73 -0
  370. package/dist/cjs/apis/sendSticker.cjs +66 -0
  371. package/dist/cjs/apis/sendTypingEvent.cjs +43 -0
  372. package/dist/cjs/apis/sendVideo.cjs +128 -0
  373. package/dist/cjs/apis/sendVoice.cjs +83 -0
  374. package/dist/cjs/apis/setHiddenConversations.cjs +47 -0
  375. package/dist/cjs/apis/setMute.cjs +77 -0
  376. package/dist/cjs/apis/setPinnedConversations.cjs +44 -0
  377. package/dist/cjs/apis/unblockUser.cjs +33 -0
  378. package/dist/cjs/apis/undo.cjs +52 -0
  379. package/dist/cjs/apis/undoFriendRequest.cjs +32 -0
  380. package/dist/cjs/apis/updateAutoDeleteChat.cjs +50 -0
  381. package/dist/cjs/apis/updateAutoReply.cjs +42 -0
  382. package/dist/cjs/apis/updateCatalog.cjs +35 -0
  383. package/dist/cjs/apis/updateGroupSettings.cjs +48 -0
  384. package/dist/cjs/apis/updateHiddenConversPin.cjs +35 -0
  385. package/dist/cjs/apis/updateLabels.cjs +39 -0
  386. package/dist/cjs/apis/updateLang.cjs +37 -0
  387. package/dist/cjs/apis/updateProductCatalog.cjs +56 -0
  388. package/dist/cjs/apis/updateProfile.cjs +47 -0
  389. package/dist/cjs/apis/updateQuickMessage.cjs +66 -0
  390. package/dist/cjs/apis/updateSettings.cjs +28 -0
  391. package/dist/cjs/apis/uploadAttachment.cjs +215 -0
  392. package/dist/cjs/apis/uploadProductPhoto.cjs +55 -0
  393. package/dist/cjs/context.cjs +34 -0
  394. package/dist/cjs/index.cjs +121 -0
  395. package/dist/cjs/models/AutoReply.cjs +9 -0
  396. package/dist/cjs/models/DeliveredMessage.cjs +23 -0
  397. package/dist/cjs/models/Enum.cjs +95 -0
  398. package/dist/cjs/models/FriendEvent.cjs +87 -0
  399. package/dist/cjs/models/GroupEvent.cjs +88 -0
  400. package/dist/cjs/models/Message.cjs +32 -0
  401. package/dist/cjs/models/Reaction.cjs +74 -0
  402. package/dist/cjs/models/SeenMessage.cjs +23 -0
  403. package/dist/cjs/models/Typing.cjs +23 -0
  404. package/dist/cjs/models/Undo.cjs +16 -0
  405. package/dist/cjs/models/ZBusiness.cjs +46 -0
  406. package/dist/cjs/update.cjs +27 -0
  407. package/dist/cjs/utils.cjs +732 -0
  408. package/dist/cjs/zalo.cjs +360 -0
  409. package/dist/context.d.ts +177 -0
  410. package/dist/context.js +28 -0
  411. package/dist/index.d.ts +130 -0
  412. package/dist/index.js +11 -0
  413. package/dist/models/Attachment.d.ts +9 -0
  414. package/dist/models/Attachment.js +1 -0
  415. package/dist/models/AutoReply.d.ts +20 -0
  416. package/dist/models/AutoReply.js +7 -0
  417. package/dist/models/Board.d.ts +54 -0
  418. package/dist/models/Board.js +1 -0
  419. package/dist/models/Catalog.d.ts +16 -0
  420. package/dist/models/Catalog.js +1 -0
  421. package/dist/models/DeliveredMessage.d.ts +27 -0
  422. package/dist/models/DeliveredMessage.js +17 -0
  423. package/dist/models/Enum.d.ts +87 -0
  424. package/dist/models/Enum.js +93 -0
  425. package/dist/models/FriendEvent.d.ts +107 -0
  426. package/dist/models/FriendEvent.js +83 -0
  427. package/dist/models/GroupEvent.d.ts +197 -0
  428. package/dist/models/GroupEvent.js +84 -0
  429. package/dist/models/Message.d.ts +91 -0
  430. package/dist/models/Message.js +26 -0
  431. package/dist/models/ProductCatalog.d.ts +17 -0
  432. package/dist/models/ProductCatalog.js +1 -0
  433. package/dist/models/QuickMessage.d.ts +25 -0
  434. package/dist/models/QuickMessage.js +1 -0
  435. package/dist/models/Reaction.d.ts +85 -0
  436. package/dist/models/Reaction.js +70 -0
  437. package/dist/models/Reminder.d.ts +35 -0
  438. package/dist/models/Reminder.js +1 -0
  439. package/dist/models/SeenMessage.d.ts +26 -0
  440. package/dist/models/SeenMessage.js +17 -0
  441. package/dist/models/Typing.d.ts +24 -0
  442. package/dist/models/Typing.js +17 -0
  443. package/dist/models/Undo.d.ts +34 -0
  444. package/dist/models/Undo.js +12 -0
  445. package/dist/models/ZBusiness.d.ts +29 -0
  446. package/dist/models/ZBusiness.js +42 -0
  447. package/dist/models/index.d.ts +17 -0
  448. package/dist/models/index.js +17 -0
  449. package/dist/update.d.ts +2 -0
  450. package/dist/update.js +22 -0
  451. package/dist/utils.d.ts +168 -0
  452. package/dist/utils.js +748 -0
  453. package/dist/zalo.d.ts +291 -0
  454. package/dist/zalo.js +354 -0
  455. package/eslint.config.js +21 -0
  456. package/index.d.ts +2 -0
  457. package/package.json +143 -0
  458. package/qr.png +0 -0
  459. package/rollup.config.js +28 -0
@@ -0,0 +1,40 @@
1
+ import { ZaloApiError } from "../Errors/ZaloApiError.js";
2
+ import { apiFactory } from "../utils.js";
3
+ export const createPollFactory = apiFactory()((api, ctx, utils) => {
4
+ const serviceURL = utils.makeURL(`${api.zpwServiceMap.group[0]}/api/poll/create`);
5
+ /**
6
+ * Create a poll in a group.
7
+ *
8
+ * @param options Poll options
9
+ * @param groupId Group ID to create poll from
10
+ *
11
+ * @throws ZaloApiError
12
+ */
13
+ return async function createPoll(options, groupId) {
14
+ var _a;
15
+ const params = {
16
+ group_id: groupId,
17
+ question: options.question,
18
+ options: options.options,
19
+ expired_time: (_a = options.expiredTime) !== null && _a !== void 0 ? _a : 0,
20
+ pinAct: false,
21
+ allow_multi_choices: !!options.allowMultiChoices,
22
+ allow_add_new_option: !!options.allowAddNewOption,
23
+ is_hide_vote_preview: !!options.hideVotePreview,
24
+ is_anonymous: !!options.isAnonymous,
25
+ poll_type: 0,
26
+ src: 1,
27
+ imei: ctx.imei,
28
+ };
29
+ const encryptedParams = utils.encodeAES(JSON.stringify(params));
30
+ if (!encryptedParams)
31
+ throw new ZaloApiError("Failed to encrypt params");
32
+ const response = await utils.request(serviceURL, {
33
+ method: "POST",
34
+ body: new URLSearchParams({
35
+ params: encryptedParams,
36
+ }),
37
+ });
38
+ return utils.resolve(response);
39
+ };
40
+ });
@@ -0,0 +1,23 @@
1
+ import type { AttachmentSource, ProductCatalogItem } from "../models/index.js";
2
+ export type CreateProductCatalogPayload = {
3
+ catalogId: string;
4
+ productName: string;
5
+ price: string;
6
+ description: string;
7
+ /**
8
+ * Upto 5 media files are allowed, will be ignored if product_photos is provided
9
+ */
10
+ files?: AttachmentSource[];
11
+ /**
12
+ * List of product photo URLs, upto 5
13
+ *
14
+ * You can manually get the URL using `uploadProductPhoto` api
15
+ */
16
+ product_photos?: string[];
17
+ };
18
+ export type CreateProductCatalogResponse = {
19
+ item: ProductCatalogItem;
20
+ version_ls_catalog: number;
21
+ version_catalog: number;
22
+ };
23
+ export declare const createProductCatalogFactory: (ctx: import("../context.js").ContextBase, api: import("../zalo.js").API) => (payload: CreateProductCatalogPayload) => Promise<CreateProductCatalogResponse>;
@@ -0,0 +1,50 @@
1
+ import { ZaloApiError } from "../Errors/ZaloApiError.js";
2
+ import { apiFactory } from "../utils.js";
3
+ export const createProductCatalogFactory = apiFactory()((api, _, utils) => {
4
+ const serviceURL = utils.makeURL(`${api.zpwServiceMap.catalog[0]}/api/prodcatalog/product/create`);
5
+ /**
6
+ * Create product catalog?
7
+ *
8
+ * @param payload payload
9
+ *
10
+ * @note this API is used for zBussiness - Maximum 5 media files are supported
11
+ * @throws ZaloApiError
12
+ */
13
+ return async function createProductCatalog(payload) {
14
+ const productPhoto = payload.product_photos || [];
15
+ if (payload.files && payload.files.length == 0) {
16
+ if (payload.files.length > 5) {
17
+ throw new ZaloApiError("Maximum 5 media files are allowed");
18
+ }
19
+ for (const mediaFile of payload.files) {
20
+ const uploadMedia = await api.uploadProductPhoto({
21
+ file: mediaFile,
22
+ });
23
+ const url = uploadMedia.normalUrl || uploadMedia.hdUrl;
24
+ productPhoto.push(url);
25
+ }
26
+ }
27
+ if (productPhoto.length > 5) {
28
+ throw new ZaloApiError("Maximum 5 media files are allowed");
29
+ }
30
+ const params = {
31
+ product_name: payload.productName,
32
+ price: payload.price,
33
+ description: payload.description,
34
+ product_photos: productPhoto,
35
+ catalog_id: payload.catalogId,
36
+ currency_unit: "₫", // $
37
+ create_time: Date.now(),
38
+ };
39
+ const encryptedParams = utils.encodeAES(JSON.stringify(params));
40
+ if (!encryptedParams)
41
+ throw new ZaloApiError("Failed to encrypt params");
42
+ const response = await utils.request(serviceURL, {
43
+ method: "POST",
44
+ body: new URLSearchParams({
45
+ params: encryptedParams,
46
+ }),
47
+ });
48
+ return utils.resolve(response);
49
+ };
50
+ });
@@ -0,0 +1,10 @@
1
+ import type { ReminderGroup, ReminderUser } from "../models/index.js";
2
+ import { ReminderRepeatMode, ThreadType } from "../models/index.js";
3
+ export type CreateReminderOptions = {
4
+ title: string;
5
+ emoji?: string;
6
+ startTime?: number;
7
+ repeat?: ReminderRepeatMode;
8
+ };
9
+ export type CreateReminderResponse = ReminderUser | ReminderGroup;
10
+ export declare const createReminderFactory: (ctx: import("../context.js").ContextBase, api: import("../zalo.js").API) => (options: CreateReminderOptions, threadId: string, type?: ThreadType) => Promise<CreateReminderResponse>;
@@ -0,0 +1,63 @@
1
+ import { ZaloApiError } from "../Errors/ZaloApiError.js";
2
+ import { ReminderRepeatMode, ThreadType } from "../models/index.js";
3
+ import { apiFactory } from "../utils.js";
4
+ export const createReminderFactory = apiFactory()((api, ctx, utils) => {
5
+ const serviceURL = {
6
+ [ThreadType.User]: utils.makeURL(`${api.zpwServiceMap.group_board[0]}/api/board/oneone/create`),
7
+ [ThreadType.Group]: utils.makeURL(`${api.zpwServiceMap.group_board[0]}/api/board/topic/createv2`),
8
+ };
9
+ /**
10
+ * Create a reminder in a group
11
+ *
12
+ * @param options reminder options
13
+ * @param threadId Group ID to create note from
14
+ * @param type Thread type (User or Group)
15
+ *
16
+ * @throws ZaloApiError
17
+ */
18
+ return async function createReminder(options, threadId, type = ThreadType.User) {
19
+ var _a, _b, _c, _d, _e, _f;
20
+ const params = type === ThreadType.User
21
+ ? {
22
+ objectData: JSON.stringify({
23
+ toUid: threadId,
24
+ type: 0,
25
+ color: -16245706,
26
+ emoji: (_a = options.emoji) !== null && _a !== void 0 ? _a : "⏰",
27
+ startTime: (_b = options.startTime) !== null && _b !== void 0 ? _b : Date.now(),
28
+ duration: -1,
29
+ params: { title: options.title },
30
+ needPin: false,
31
+ repeat: (_c = options.repeat) !== null && _c !== void 0 ? _c : ReminderRepeatMode.None,
32
+ creatorUid: ctx.uid, // Note: for some reason, you can put any valid UID here instead of your own and it still works, atleast for mobile
33
+ src: 1,
34
+ }),
35
+ imei: ctx.imei,
36
+ }
37
+ : {
38
+ grid: threadId,
39
+ type: 0,
40
+ color: -16245706,
41
+ emoji: (_d = options.emoji) !== null && _d !== void 0 ? _d : "⏰",
42
+ startTime: (_e = options.startTime) !== null && _e !== void 0 ? _e : Date.now(),
43
+ duration: -1,
44
+ params: JSON.stringify({
45
+ title: options.title,
46
+ }),
47
+ repeat: (_f = options.repeat) !== null && _f !== void 0 ? _f : ReminderRepeatMode.None,
48
+ src: 1,
49
+ imei: ctx.imei,
50
+ pinAct: 0,
51
+ };
52
+ const encryptedParams = utils.encodeAES(JSON.stringify(params));
53
+ if (!encryptedParams)
54
+ throw new ZaloApiError("Failed to encrypt params");
55
+ const response = await utils.request(serviceURL[type], {
56
+ method: "POST",
57
+ body: new URLSearchParams({
58
+ params: encryptedParams,
59
+ }),
60
+ });
61
+ return utils.resolve(response);
62
+ };
63
+ });
@@ -0,0 +1,9 @@
1
+ import { type ContextSession } from "../context.js";
2
+ import { type FactoryUtils } from "../utils.js";
3
+ export type CustomAPIProps<T, K> = {
4
+ ctx: ContextSession;
5
+ utils: FactoryUtils<T>;
6
+ props: K;
7
+ };
8
+ export type CustomAPICallback<T, K> = (props: CustomAPIProps<T, K>) => T | Promise<T>;
9
+ export declare const customFactory: (ctx: import("../context.js").ContextBase, api: import("../zalo.js").API) => <T, K = any>(name: string, callback: CustomAPICallback<T, K>) => void;
@@ -0,0 +1,15 @@
1
+ import {} from "../context.js";
2
+ import { apiFactory } from "../utils.js";
3
+ /* eslint-disable */
4
+ export const customFactory = apiFactory()((api, ctx, utils) => {
5
+ return function custom(name, callback) {
6
+ Object.defineProperty(api, name, {
7
+ value: function (props) {
8
+ return callback({ ctx, utils, props });
9
+ },
10
+ writable: false,
11
+ enumerable: false,
12
+ configurable: false,
13
+ });
14
+ };
15
+ });
@@ -0,0 +1,5 @@
1
+ export type DeleteAutoReplyResponse = {
2
+ item: number;
3
+ version: number;
4
+ };
5
+ export declare const deleteAutoReplyFactory: (ctx: import("../context.js").ContextBase, api: import("../zalo.js").API) => (id: number) => Promise<DeleteAutoReplyResponse>;
@@ -0,0 +1,29 @@
1
+ import { ZaloApiError } from "../Errors/ZaloApiError.js";
2
+ import { apiFactory } from "../utils.js";
3
+ export const deleteAutoReplyFactory = apiFactory()((api, ctx, utils) => {
4
+ const serviceURL = utils.makeURL(`${api.zpwServiceMap.auto_reply[0]}/api/autoreply/delete`);
5
+ /**
6
+ * Delete auto reply
7
+ *
8
+ * @param id id of auto reply
9
+ *
10
+ * @note this API used for zBusiness
11
+ * @throws ZaloApiError
12
+ */
13
+ return async function deleteAutoReply(id) {
14
+ const params = {
15
+ cliLang: ctx.language,
16
+ id: id,
17
+ };
18
+ const encryptedParams = utils.encodeAES(JSON.stringify(params));
19
+ if (!encryptedParams)
20
+ throw new ZaloApiError("Failed to encrypt params");
21
+ const response = await utils.request(serviceURL, {
22
+ method: "POST",
23
+ body: new URLSearchParams({
24
+ params: encryptedParams,
25
+ }),
26
+ });
27
+ return utils.resolve(response);
28
+ };
29
+ });
@@ -0,0 +1,9 @@
1
+ export type DeleteAvatarResponse = {
2
+ delPhotoIds: string[];
3
+ errMap: {
4
+ [key: string]: {
5
+ err: number;
6
+ };
7
+ };
8
+ };
9
+ export declare const deleteAvatarFactory: (ctx: import("../context.js").ContextBase, api: import("../zalo.js").API) => (photoId: string | string[]) => Promise<DeleteAvatarResponse>;
@@ -0,0 +1,27 @@
1
+ import { ZaloApiError } from "../Errors/ZaloApiError.js";
2
+ import { apiFactory } from "../utils.js";
3
+ export const deleteAvatarFactory = apiFactory()((api, ctx, utils) => {
4
+ const serviceURL = utils.makeURL(`${api.zpwServiceMap.profile[0]}/api/social/del-avatars`);
5
+ /**
6
+ * Delete avatar from avatar list
7
+ *
8
+ * @param photoId avatar photo ID(s) to delete - can be a single string or array of strings
9
+ *
10
+ * @throws ZaloApiError
11
+ */
12
+ return async function deleteAvatar(photoId) {
13
+ const photoIds = Array.isArray(photoId) ? photoId : [photoId];
14
+ const delPhotos = photoIds.map((id) => ({ photoId: id }));
15
+ const params = {
16
+ delPhotos: JSON.stringify(delPhotos),
17
+ imei: ctx.imei,
18
+ };
19
+ const encryptedParams = utils.encodeAES(JSON.stringify(params));
20
+ if (!encryptedParams)
21
+ throw new ZaloApiError("Failed to encrypt params");
22
+ const response = await utils.request(utils.makeURL(serviceURL, { params: encryptedParams }), {
23
+ method: "GET",
24
+ });
25
+ return utils.resolve(response);
26
+ };
27
+ });
@@ -0,0 +1,2 @@
1
+ export type DeleteCatalogResponse = "";
2
+ export declare const deleteCatalogFactory: (ctx: import("../context.js").ContextBase, api: import("../zalo.js").API) => (catalogId: string) => Promise<"">;
@@ -0,0 +1,28 @@
1
+ import { ZaloApiError } from "../Errors/ZaloApiError.js";
2
+ import { apiFactory } from "../utils.js";
3
+ export const deleteCatalogFactory = apiFactory()((api, _, utils) => {
4
+ const serviceURL = utils.makeURL(`${api.zpwServiceMap.catalog[0]}/api/prodcatalog/catalog/delete`);
5
+ /**
6
+ * Delete catalog?
7
+ *
8
+ * @param catalogId catalog id
9
+ *
10
+ * @note this API is used for zBusiness
11
+ * @throws ZaloApiError
12
+ */
13
+ return async function deleteCatalog(catalogId) {
14
+ const params = {
15
+ catalog_id: catalogId,
16
+ };
17
+ const encryptedParams = utils.encodeAES(JSON.stringify(params));
18
+ if (!encryptedParams)
19
+ throw new ZaloApiError("Failed to encrypt params");
20
+ const response = await utils.request(serviceURL, {
21
+ method: "POST",
22
+ body: new URLSearchParams({
23
+ params: encryptedParams,
24
+ }),
25
+ });
26
+ return utils.resolve(response);
27
+ };
28
+ });
@@ -0,0 +1,19 @@
1
+ import { ThreadType } from "../models/index.js";
2
+ export type DeleteChatResponse = {
3
+ status: number;
4
+ };
5
+ export type DeleteChatLastMessage = {
6
+ /**
7
+ * Last message owner ID to delete backwards
8
+ */
9
+ ownerId: string;
10
+ /**
11
+ * Last message client ID to delete backwards
12
+ */
13
+ cliMsgId: string;
14
+ /**
15
+ * Last message global ID to delete backwards
16
+ */
17
+ globalMsgId: string;
18
+ };
19
+ export declare const deleteChatFactory: (ctx: import("../context.js").ContextBase, api: import("../zalo.js").API) => (lastMessage: DeleteChatLastMessage, threadId: string, type?: ThreadType) => Promise<DeleteChatResponse>;
@@ -0,0 +1,50 @@
1
+ import { ZaloApiError } from "../Errors/ZaloApiError.js";
2
+ import { ThreadType } from "../models/index.js";
3
+ import { apiFactory } from "../utils.js";
4
+ export const deleteChatFactory = apiFactory()((api, ctx, utils) => {
5
+ const serviceURL = {
6
+ [ThreadType.User]: utils.makeURL(`${api.zpwServiceMap.chat[0]}/api/message/deleteconver`, {
7
+ nretry: 0,
8
+ }),
9
+ [ThreadType.Group]: utils.makeURL(`${api.zpwServiceMap.group[0]}/api/group/deleteconver`, {
10
+ nretry: 0,
11
+ }),
12
+ };
13
+ /**
14
+ * Delete chat
15
+ *
16
+ * @param lastMessage Last message info
17
+ * @param threadId Thread ID
18
+ * @param type Thread type
19
+ *
20
+ * @throws ZaloApiError
21
+ */
22
+ return async function deleteChat(lastMessage, threadId, type = ThreadType.User) {
23
+ const timestampString = Date.now().toString();
24
+ const params = type === ThreadType.User
25
+ ? {
26
+ toid: threadId,
27
+ cliMsgId: timestampString,
28
+ conver: lastMessage,
29
+ onlyMe: 1,
30
+ imei: ctx.imei,
31
+ }
32
+ : {
33
+ grid: threadId,
34
+ cliMsgId: timestampString,
35
+ conver: lastMessage,
36
+ onlyMe: 1,
37
+ imei: ctx.imei,
38
+ };
39
+ const encryptedParams = utils.encodeAES(JSON.stringify(params));
40
+ if (!encryptedParams)
41
+ throw new ZaloApiError("Failed to encrypt params");
42
+ const response = await utils.request(serviceURL[type], {
43
+ method: "POST",
44
+ body: new URLSearchParams({
45
+ params: encryptedParams,
46
+ }),
47
+ });
48
+ return utils.resolve(response);
49
+ };
50
+ });
@@ -0,0 +1,14 @@
1
+ import { ThreadType } from "../models/index.js";
2
+ export type DeleteMessageResponse = {
3
+ status: number;
4
+ };
5
+ export type DeleteMessageDestination = {
6
+ data: {
7
+ cliMsgId: string;
8
+ msgId: string;
9
+ uidFrom: string;
10
+ };
11
+ threadId: string;
12
+ type?: ThreadType;
13
+ };
14
+ export declare const deleteMessageFactory: (ctx: import("../context.js").ContextBase, api: import("../zalo.js").API) => (dest: DeleteMessageDestination, onlyMe?: boolean) => Promise<DeleteMessageResponse>;
@@ -0,0 +1,52 @@
1
+ import { ZaloApiError } from "../Errors/ZaloApiError.js";
2
+ import { ThreadType } from "../models/index.js";
3
+ import { apiFactory } from "../utils.js";
4
+ export const deleteMessageFactory = apiFactory()((api, ctx, utils) => {
5
+ const serviceURL = {
6
+ [ThreadType.User]: utils.makeURL(`${api.zpwServiceMap.chat[0]}/api/message/delete`),
7
+ [ThreadType.Group]: utils.makeURL(`${api.zpwServiceMap.group[0]}/api/group/deletemsg`),
8
+ };
9
+ /**
10
+ * Delete a message
11
+ *
12
+ * @param dest Delete target
13
+ * @param onlyMe Delete message for only you
14
+ *
15
+ * @throws ZaloApiError
16
+ */
17
+ return async function deleteMessage(dest, onlyMe = false) {
18
+ const { threadId, type = ThreadType.User, data } = dest;
19
+ const isGroup = type === ThreadType.Group;
20
+ const isSelf = ctx.uid == data.uidFrom;
21
+ if (isSelf && onlyMe === false)
22
+ throw new ZaloApiError("To delete your message for everyone, use undo api instead");
23
+ if (!isGroup && onlyMe === false)
24
+ throw new ZaloApiError("Can't delete message for everyone in a private chat");
25
+ const params = {
26
+ [isGroup ? "grid" : "toid"]: threadId,
27
+ cliMsgId: Date.now(),
28
+ msgs: [
29
+ {
30
+ cliMsgId: data.cliMsgId,
31
+ globalMsgId: data.msgId,
32
+ ownerId: data.uidFrom,
33
+ destId: threadId,
34
+ },
35
+ ],
36
+ onlyMe: onlyMe ? 1 : 0,
37
+ };
38
+ if (!isGroup) {
39
+ params.imei = ctx.imei;
40
+ }
41
+ const encryptedParams = utils.encodeAES(JSON.stringify(params));
42
+ if (!encryptedParams)
43
+ throw new ZaloApiError("Failed to encrypt message");
44
+ const response = await utils.request(serviceURL[type], {
45
+ method: "POST",
46
+ body: new URLSearchParams({
47
+ params: encryptedParams,
48
+ }),
49
+ });
50
+ return utils.resolve(response);
51
+ };
52
+ });
@@ -0,0 +1,10 @@
1
+ export type DeleteProductCatalogPayload = {
2
+ productIds: string | string[];
3
+ catalogId: string;
4
+ };
5
+ export type DeleteProductCatalogResponse = {
6
+ item: number[];
7
+ version_ls_catalog: number;
8
+ version_catalog: number;
9
+ };
10
+ export declare const deleteProductCatalogFactory: (ctx: import("../context.js").ContextBase, api: import("../zalo.js").API) => (payload: DeleteProductCatalogPayload) => Promise<DeleteProductCatalogResponse>;
@@ -0,0 +1,31 @@
1
+ import { ZaloApiError } from "../Errors/ZaloApiError.js";
2
+ import { apiFactory } from "../utils.js";
3
+ export const deleteProductCatalogFactory = apiFactory()((api, _, utils) => {
4
+ const serviceURL = utils.makeURL(`${api.zpwServiceMap.catalog[0]}/api/prodcatalog/product/mdelete`);
5
+ /**
6
+ * Delete product catalog?
7
+ *
8
+ * @param payload payload
9
+ *
10
+ * @note this API is used for zBusiness
11
+ * @throws ZaloApiError
12
+ */
13
+ return async function deleteProductCatalog(payload) {
14
+ if (!Array.isArray(payload.productIds))
15
+ payload.productIds = [payload.productIds];
16
+ const params = {
17
+ product_ids: payload.productIds,
18
+ catalog_id: payload.catalogId,
19
+ };
20
+ const encryptedParams = utils.encodeAES(JSON.stringify(params));
21
+ if (!encryptedParams)
22
+ throw new ZaloApiError("Failed to encrypt params");
23
+ const response = await utils.request(serviceURL, {
24
+ method: "POST",
25
+ body: new URLSearchParams({
26
+ params: encryptedParams,
27
+ }),
28
+ });
29
+ return utils.resolve(response);
30
+ };
31
+ });
@@ -0,0 +1,2 @@
1
+ export type DisableGroupLinkResponse = "";
2
+ export declare const disableGroupLinkFactory: (ctx: import("../context.js").ContextBase, api: import("../zalo.js").API) => (groupId: string) => Promise<"">;
@@ -0,0 +1,24 @@
1
+ import { ZaloApiError } from "../Errors/ZaloApiError.js";
2
+ import { apiFactory } from "../utils.js";
3
+ export const disableGroupLinkFactory = apiFactory()((api, _ctx, utils) => {
4
+ const serviceURL = utils.makeURL(`${api.zpwServiceMap.group[0]}/api/group/link/disable`);
5
+ /**
6
+ * Disable group link
7
+ *
8
+ * @param groupId The group id
9
+ *
10
+ * @throws ZaloApiError
11
+ */
12
+ return async function disableGroupLink(groupId) {
13
+ const params = {
14
+ grid: groupId,
15
+ };
16
+ const encryptedParams = utils.encodeAES(JSON.stringify(params));
17
+ if (!encryptedParams)
18
+ throw new ZaloApiError("Failed to encrypt params");
19
+ const response = await utils.request(utils.makeURL(serviceURL, { params: encryptedParams }), {
20
+ method: "GET",
21
+ });
22
+ return utils.resolve(response);
23
+ };
24
+ });
@@ -0,0 +1,2 @@
1
+ export type DisperseGroupResponse = "";
2
+ export declare const disperseGroupFactory: (ctx: import("../context.js").ContextBase, api: import("../zalo.js").API) => (groupId: string) => Promise<"">;
@@ -0,0 +1,28 @@
1
+ import { ZaloApiError } from "../Errors/ZaloApiError.js";
2
+ import { apiFactory } from "../utils.js";
3
+ export const disperseGroupFactory = apiFactory()((api, ctx, utils) => {
4
+ const serviceURL = utils.makeURL(`${api.zpwServiceMap.group[0]}/api/group/disperse`);
5
+ /**
6
+ * Disperse Group
7
+ *
8
+ * @param groupId Group ID to disperse Group from
9
+ *
10
+ * @throws ZaloApiError
11
+ */
12
+ return async function disperseGroup(groupId) {
13
+ const params = {
14
+ grid: groupId,
15
+ imei: ctx.imei,
16
+ };
17
+ const encryptedParams = utils.encodeAES(JSON.stringify(params));
18
+ if (!encryptedParams)
19
+ throw new ZaloApiError("Failed to encrypt params");
20
+ const response = await utils.request(serviceURL, {
21
+ method: "POST",
22
+ body: new URLSearchParams({
23
+ params: encryptedParams,
24
+ }),
25
+ });
26
+ return utils.resolve(response);
27
+ };
28
+ });
@@ -0,0 +1,32 @@
1
+ export type EditNoteGroupOptions = {
2
+ /**
3
+ * New note title
4
+ */
5
+ title: string;
6
+ /**
7
+ * Topic ID to edit note from
8
+ */
9
+ topicId: string;
10
+ /**
11
+ * Should the note be pinned?
12
+ */
13
+ pinAct?: boolean;
14
+ };
15
+ export type EditNoteGroupResponse = {
16
+ id: string;
17
+ type: number;
18
+ color: number;
19
+ emoji: string;
20
+ startTime: number;
21
+ duration: number;
22
+ params: {
23
+ title: string;
24
+ extra: string;
25
+ };
26
+ creatorId: string;
27
+ editorId: string;
28
+ createTime: number;
29
+ editTime: number;
30
+ repeat: number;
31
+ };
32
+ export declare const editNoteGroupFactory: (ctx: import("../context.js").ContextBase, api: import("../zalo.js").API) => (options: EditNoteGroupOptions, groupId: string) => Promise<EditNoteGroupResponse>;
@@ -0,0 +1,40 @@
1
+ import { ZaloApiError } from "../Errors/ZaloApiError.js";
2
+ import { apiFactory } from "../utils.js";
3
+ export const editNoteGroupFactory = apiFactory()((api, ctx, utils) => {
4
+ const serviceURL = utils.makeURL(`${api.zpwServiceMap.group_board[0]}/api/board/topic/updatev2`);
5
+ /**
6
+ * Edit an existing note in a group
7
+ *
8
+ * @param options Options for editing the note
9
+ * @param groupId Group ID to create note from
10
+ *
11
+ * @throws ZaloApiError
12
+ */
13
+ return async function editNoteGroup(options, groupId) {
14
+ const params = {
15
+ grid: groupId,
16
+ type: 0,
17
+ color: -16777216,
18
+ emoji: "",
19
+ startTime: -1,
20
+ duration: -1,
21
+ params: JSON.stringify({
22
+ title: options.title,
23
+ }),
24
+ topicId: options.topicId,
25
+ repeat: 0,
26
+ imei: ctx.imei,
27
+ pinAct: options.pinAct ? 1 : 2,
28
+ };
29
+ const encryptedParams = utils.encodeAES(JSON.stringify(params));
30
+ if (!encryptedParams)
31
+ throw new ZaloApiError("Failed to encrypt params");
32
+ const response = await utils.request(serviceURL, {
33
+ method: "POST",
34
+ body: new URLSearchParams({
35
+ params: encryptedParams,
36
+ }),
37
+ });
38
+ return utils.resolve(response);
39
+ };
40
+ });
@@ -0,0 +1,18 @@
1
+ import type { ReminderRepeatMode, ReminderGroup, ReminderUser } from "../models/index.js";
2
+ import { ThreadType } from "../models/index.js";
3
+ export type EditReminderOptions = {
4
+ title: string;
5
+ topicId: string;
6
+ emoji?: string;
7
+ startTime?: number;
8
+ repeat?: ReminderRepeatMode;
9
+ };
10
+ export type CreateReminderUser = ReminderUser;
11
+ export type CreateReminderGroup = ReminderGroup & {
12
+ groupId: string;
13
+ eventType: number;
14
+ repeatInfo: null;
15
+ repeatData: unknown[];
16
+ };
17
+ export type EditReminderResponse = CreateReminderUser | CreateReminderGroup;
18
+ export declare const editReminderFactory: (ctx: import("../context.js").ContextBase, api: import("../zalo.js").API) => (options: EditReminderOptions, threadId: string, type?: ThreadType) => Promise<EditReminderResponse>;