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.
- package/.prettierrc +5 -0
- package/.tmp-cache/_update-notifier-last-checked +0 -0
- package/CODE_OF_CONDUCT.md +157 -0
- package/CONTRIBUTING.md +491 -0
- package/LICENSE +21 -0
- package/README.md +421 -0
- package/SECURITY.md +82 -0
- package/commit-push.sh +79 -0
- package/deploy.sh +172 -0
- package/dist/Errors/ZaloApiError.d.ts +4 -0
- package/dist/Errors/ZaloApiError.js +7 -0
- package/dist/Errors/index.d.ts +1 -0
- package/dist/Errors/index.js +1 -0
- package/dist/apis/acceptFriendRequest.d.ts +2 -0
- package/dist/apis/acceptFriendRequest.js +28 -0
- package/dist/apis/addGroupBlockedMember.d.ts +2 -0
- package/dist/apis/addGroupBlockedMember.js +28 -0
- package/dist/apis/addGroupDeputy.d.ts +2 -0
- package/dist/apis/addGroupDeputy.js +30 -0
- package/dist/apis/addQuickMessage.d.ts +11 -0
- package/dist/apis/addQuickMessage.js +60 -0
- package/dist/apis/addReaction.d.ts +18 -0
- package/dist/apis/addReaction.js +294 -0
- package/dist/apis/addUnreadMark.d.ts +8 -0
- package/dist/apis/addUnreadMark.js +52 -0
- package/dist/apis/addUserToGroup.d.ts +5 -0
- package/dist/apis/addUserToGroup.js +34 -0
- package/dist/apis/blockUser.d.ts +2 -0
- package/dist/apis/blockUser.js +28 -0
- package/dist/apis/blockViewFeed.d.ts +2 -0
- package/dist/apis/blockViewFeed.js +30 -0
- package/dist/apis/changeAccountAvatar.d.ts +3 -0
- package/dist/apis/changeAccountAvatar.js +52 -0
- package/dist/apis/changeFriendAlias.d.ts +2 -0
- package/dist/apis/changeFriendAlias.js +27 -0
- package/dist/apis/changeGroupAvatar.d.ts +3 -0
- package/dist/apis/changeGroupAvatar.js +44 -0
- package/dist/apis/changeGroupName.d.ts +4 -0
- package/dist/apis/changeGroupName.js +32 -0
- package/dist/apis/changeGroupOwner.d.ts +4 -0
- package/dist/apis/changeGroupOwner.js +30 -0
- package/dist/apis/createAutoReply.d.ts +14 -0
- package/dist/apis/createAutoReply.js +37 -0
- package/dist/apis/createCatalog.d.ts +7 -0
- package/dist/apis/createCatalog.js +29 -0
- package/dist/apis/createGroup.d.ts +28 -0
- package/dist/apis/createGroup.js +43 -0
- package/dist/apis/createNoteGroup.d.ts +7 -0
- package/dist/apis/createNoteGroup.js +47 -0
- package/dist/apis/createPoll.d.ts +57 -0
- package/dist/apis/createPoll.js +40 -0
- package/dist/apis/createProductCatalog.d.ts +23 -0
- package/dist/apis/createProductCatalog.js +50 -0
- package/dist/apis/createReminder.d.ts +10 -0
- package/dist/apis/createReminder.js +63 -0
- package/dist/apis/custom.d.ts +9 -0
- package/dist/apis/custom.js +15 -0
- package/dist/apis/deleteAutoReply.d.ts +5 -0
- package/dist/apis/deleteAutoReply.js +29 -0
- package/dist/apis/deleteAvatar.d.ts +9 -0
- package/dist/apis/deleteAvatar.js +27 -0
- package/dist/apis/deleteCatalog.d.ts +2 -0
- package/dist/apis/deleteCatalog.js +28 -0
- package/dist/apis/deleteChat.d.ts +19 -0
- package/dist/apis/deleteChat.js +50 -0
- package/dist/apis/deleteMessage.d.ts +14 -0
- package/dist/apis/deleteMessage.js +52 -0
- package/dist/apis/deleteProductCatalog.d.ts +10 -0
- package/dist/apis/deleteProductCatalog.js +31 -0
- package/dist/apis/disableGroupLink.d.ts +2 -0
- package/dist/apis/disableGroupLink.js +24 -0
- package/dist/apis/disperseGroup.d.ts +2 -0
- package/dist/apis/disperseGroup.js +28 -0
- package/dist/apis/editNoteGroup.d.ts +32 -0
- package/dist/apis/editNoteGroup.js +40 -0
- package/dist/apis/editReminder.d.ts +18 -0
- package/dist/apis/editReminder.js +61 -0
- package/dist/apis/enableGroupLink.d.ts +6 -0
- package/dist/apis/enableGroupLink.js +25 -0
- package/dist/apis/fetchAccountInfo.d.ts +34 -0
- package/dist/apis/fetchAccountInfo.js +10 -0
- package/dist/apis/findUser.d.ts +15 -0
- package/dist/apis/findUser.js +40 -0
- package/dist/apis/forwardMessage.d.ts +26 -0
- package/dist/apis/forwardMessage.js +99 -0
- package/dist/apis/getAliasList.d.ts +8 -0
- package/dist/apis/getAliasList.js +27 -0
- package/dist/apis/getAllFriends.d.ts +34 -0
- package/dist/apis/getAllFriends.js +32 -0
- package/dist/apis/getAllGroups.d.ts +7 -0
- package/dist/apis/getAllGroups.js +10 -0
- package/dist/apis/getArchivedChatList.d.ts +5 -0
- package/dist/apis/getArchivedChatList.js +23 -0
- package/dist/apis/getAutoDeleteChat.d.ts +9 -0
- package/dist/apis/getAutoDeleteChat.js +21 -0
- package/dist/apis/getAutoReplyList.d.ts +6 -0
- package/dist/apis/getAutoReplyList.js +24 -0
- package/dist/apis/getAvatarList.d.ts +12 -0
- package/dist/apis/getAvatarList.js +28 -0
- package/dist/apis/getBizAccount.d.ts +19 -0
- package/dist/apis/getBizAccount.js +27 -0
- package/dist/apis/getCatalogList.d.ts +12 -0
- package/dist/apis/getCatalogList.js +32 -0
- package/dist/apis/getContext.d.ts +1 -0
- package/dist/apis/getContext.js +4 -0
- package/dist/apis/getCookie.d.ts +1 -0
- package/dist/apis/getCookie.js +9 -0
- package/dist/apis/getFriendBoardList.d.ts +5 -0
- package/dist/apis/getFriendBoardList.js +26 -0
- package/dist/apis/getFriendRequestStatus.d.ts +8 -0
- package/dist/apis/getFriendRequestStatus.js +25 -0
- package/dist/apis/getGroupBlockedMember.d.ts +17 -0
- package/dist/apis/getGroupBlockedMember.js +29 -0
- package/dist/apis/getGroupInfo.d.ts +43 -0
- package/dist/apis/getGroupInfo.js +32 -0
- package/dist/apis/getGroupLinkDetail.d.ts +6 -0
- package/dist/apis/getGroupLinkDetail.js +25 -0
- package/dist/apis/getGroupLinkInfo.d.ts +31 -0
- package/dist/apis/getGroupLinkInfo.js +28 -0
- package/dist/apis/getGroupMembersInfo.d.ts +17 -0
- package/dist/apis/getGroupMembersInfo.js +24 -0
- package/dist/apis/getHiddenConversations.d.ts +11 -0
- package/dist/apis/getHiddenConversations.js +23 -0
- package/dist/apis/getLabels.d.ts +15 -0
- package/dist/apis/getLabels.js +28 -0
- package/dist/apis/getListBoard.d.ts +15 -0
- package/dist/apis/getListBoard.js +45 -0
- package/dist/apis/getListReminder.d.ts +22 -0
- package/dist/apis/getListReminder.js +47 -0
- package/dist/apis/getMute.d.ts +13 -0
- package/dist/apis/getMute.js +22 -0
- package/dist/apis/getOwnId.d.ts +1 -0
- package/dist/apis/getOwnId.js +4 -0
- package/dist/apis/getPendingGroupMembers.d.ts +10 -0
- package/dist/apis/getPendingGroupMembers.js +27 -0
- package/dist/apis/getPinConversations.d.ts +5 -0
- package/dist/apis/getPinConversations.js +22 -0
- package/dist/apis/getPollDetail.d.ts +3 -0
- package/dist/apis/getPollDetail.js +30 -0
- package/dist/apis/getProductCatalogList.d.ts +14 -0
- package/dist/apis/getProductCatalogList.js +33 -0
- package/dist/apis/getQR.d.ts +4 -0
- package/dist/apis/getQR.js +29 -0
- package/dist/apis/getQuickMessage.d.ts +7 -0
- package/dist/apis/getQuickMessage.js +24 -0
- package/dist/apis/getReceivedFriendRequests.d.ts +35 -0
- package/dist/apis/getReceivedFriendRequests.js +22 -0
- package/dist/apis/getReminder.d.ts +13 -0
- package/dist/apis/getReminder.js +25 -0
- package/dist/apis/getReminderResponses.d.ts +5 -0
- package/dist/apis/getReminderResponses.js +24 -0
- package/dist/apis/getSentFriendRequest.d.ts +17 -0
- package/dist/apis/getSentFriendRequest.js +24 -0
- package/dist/apis/getStickers.d.ts +1 -0
- package/dist/apis/getStickers.js +40 -0
- package/dist/apis/getStickersDetail.d.ts +24 -0
- package/dist/apis/getStickersDetail.js +40 -0
- package/dist/apis/getUnreadMark.d.ts +14 -0
- package/dist/apis/getUnreadMark.js +30 -0
- package/dist/apis/getUserInfo.d.ts +39 -0
- package/dist/apis/getUserInfo.js +42 -0
- package/dist/apis/inviteUserToGroups.d.ts +10 -0
- package/dist/apis/inviteUserToGroups.js +30 -0
- package/dist/apis/joinGroupLink.d.ts +2 -0
- package/dist/apis/joinGroupLink.js +27 -0
- package/dist/apis/keepAlive.d.ts +4 -0
- package/dist/apis/keepAlive.js +22 -0
- package/dist/apis/lastOnline.d.ts +7 -0
- package/dist/apis/lastOnline.js +26 -0
- package/dist/apis/leaveGroup.d.ts +4 -0
- package/dist/apis/leaveGroup.js +33 -0
- package/dist/apis/listen.d.ts +100 -0
- package/dist/apis/listen.js +424 -0
- package/dist/apis/lockPoll.d.ts +2 -0
- package/dist/apis/lockPoll.js +28 -0
- package/dist/apis/login.d.ts +3 -0
- package/dist/apis/login.js +96 -0
- package/dist/apis/loginQR.d.ts +70 -0
- package/dist/apis/loginQR.js +359 -0
- package/dist/apis/parseLink.d.ts +21 -0
- package/dist/apis/parseLink.js +27 -0
- package/dist/apis/removeFriend.d.ts +2 -0
- package/dist/apis/removeFriend.js +28 -0
- package/dist/apis/removeFriendAlias.d.ts +2 -0
- package/dist/apis/removeFriendAlias.js +24 -0
- package/dist/apis/removeGroupBlockedMember.d.ts +2 -0
- package/dist/apis/removeGroupBlockedMember.js +28 -0
- package/dist/apis/removeGroupDeputy.d.ts +2 -0
- package/dist/apis/removeGroupDeputy.js +30 -0
- package/dist/apis/removeQuickMessage.d.ts +5 -0
- package/dist/apis/removeQuickMessage.js +27 -0
- package/dist/apis/removeReminder.d.ts +3 -0
- package/dist/apis/removeReminder.js +40 -0
- package/dist/apis/removeUnreadMark.d.ts +8 -0
- package/dist/apis/removeUnreadMark.js +50 -0
- package/dist/apis/removeUserFromGroup.d.ts +4 -0
- package/dist/apis/removeUserFromGroup.js +34 -0
- package/dist/apis/resetHiddenConversPin.d.ts +2 -0
- package/dist/apis/resetHiddenConversPin.js +20 -0
- package/dist/apis/reuseAvatar.d.ts +2 -0
- package/dist/apis/reuseAvatar.js +26 -0
- package/dist/apis/reviewPendingMemberRequest.d.ts +6 -0
- package/dist/apis/reviewPendingMemberRequest.js +31 -0
- package/dist/apis/sendBankCard.d.ts +9 -0
- package/dist/apis/sendBankCard.js +39 -0
- package/dist/apis/sendCard.d.ts +10 -0
- package/dist/apis/sendCard.js +59 -0
- package/dist/apis/sendDeliveredEvent.d.ts +16 -0
- package/dist/apis/sendDeliveredEvent.js +55 -0
- package/dist/apis/sendFriendRequest.d.ts +2 -0
- package/dist/apis/sendFriendRequest.js +39 -0
- package/dist/apis/sendLink.d.ts +10 -0
- package/dist/apis/sendLink.js +61 -0
- package/dist/apis/sendMessage.d.ts +99 -0
- package/dist/apis/sendMessage.js +460 -0
- package/dist/apis/sendReport.d.ts +17 -0
- package/dist/apis/sendReport.js +53 -0
- package/dist/apis/sendSeenEvent.d.ts +16 -0
- package/dist/apis/sendSeenEvent.js +63 -0
- package/dist/apis/sendSticker.d.ts +6 -0
- package/dist/apis/sendSticker.js +56 -0
- package/dist/apis/sendTypingEvent.d.ts +5 -0
- package/dist/apis/sendTypingEvent.js +33 -0
- package/dist/apis/sendVideo.d.ts +35 -0
- package/dist/apis/sendVideo.js +118 -0
- package/dist/apis/sendVoice.d.ts +12 -0
- package/dist/apis/sendVoice.js +73 -0
- package/dist/apis/setHiddenConversations.d.ts +3 -0
- package/dist/apis/setHiddenConversations.js +37 -0
- package/dist/apis/setMute.d.ts +17 -0
- package/dist/apis/setMute.js +67 -0
- package/dist/apis/setPinnedConversations.d.ts +3 -0
- package/dist/apis/setPinnedConversations.js +34 -0
- package/dist/apis/unblockUser.d.ts +2 -0
- package/dist/apis/unblockUser.js +28 -0
- package/dist/apis/undo.d.ts +9 -0
- package/dist/apis/undo.js +42 -0
- package/dist/apis/undoFriendRequest.d.ts +2 -0
- package/dist/apis/undoFriendRequest.js +27 -0
- package/dist/apis/updateAutoDeleteChat.d.ts +9 -0
- package/dist/apis/updateAutoDeleteChat.js +40 -0
- package/dist/apis/updateAutoReply.d.ts +14 -0
- package/dist/apis/updateAutoReply.js +37 -0
- package/dist/apis/updateCatalog.d.ts +11 -0
- package/dist/apis/updateCatalog.js +30 -0
- package/dist/apis/updateGroupSettings.d.ts +40 -0
- package/dist/apis/updateGroupSettings.js +43 -0
- package/dist/apis/updateHiddenConversPin.d.ts +2 -0
- package/dist/apis/updateHiddenConversPin.js +30 -0
- package/dist/apis/updateLabels.d.ts +24 -0
- package/dist/apis/updateLabels.js +34 -0
- package/dist/apis/updateLang.d.ts +7 -0
- package/dist/apis/updateLang.js +32 -0
- package/dist/apis/updateProductCatalog.d.ts +25 -0
- package/dist/apis/updateProductCatalog.js +51 -0
- package/dist/apis/updateProfile.d.ts +13 -0
- package/dist/apis/updateProfile.js +42 -0
- package/dist/apis/updateQuickMessage.d.ts +11 -0
- package/dist/apis/updateQuickMessage.js +61 -0
- package/dist/apis/updateSettings.d.ts +3 -0
- package/dist/apis/updateSettings.js +23 -0
- package/dist/apis/uploadAttachment.d.ts +50 -0
- package/dist/apis/uploadAttachment.js +205 -0
- package/dist/apis/uploadProductPhoto.d.ts +14 -0
- package/dist/apis/uploadProductPhoto.js +50 -0
- package/dist/cjs/Errors/ZaloApiError.cjs +11 -0
- package/dist/cjs/apis/acceptFriendRequest.cjs +33 -0
- package/dist/cjs/apis/addGroupBlockedMember.cjs +33 -0
- package/dist/cjs/apis/addGroupDeputy.cjs +35 -0
- package/dist/cjs/apis/addQuickMessage.cjs +65 -0
- package/dist/cjs/apis/addReaction.cjs +304 -0
- package/dist/cjs/apis/addUnreadMark.cjs +62 -0
- package/dist/cjs/apis/addUserToGroup.cjs +39 -0
- package/dist/cjs/apis/blockUser.cjs +33 -0
- package/dist/cjs/apis/blockViewFeed.cjs +35 -0
- package/dist/cjs/apis/changeAccountAvatar.cjs +57 -0
- package/dist/cjs/apis/changeFriendAlias.cjs +32 -0
- package/dist/cjs/apis/changeGroupAvatar.cjs +49 -0
- package/dist/cjs/apis/changeGroupName.cjs +37 -0
- package/dist/cjs/apis/changeGroupOwner.cjs +35 -0
- package/dist/cjs/apis/createAutoReply.cjs +42 -0
- package/dist/cjs/apis/createCatalog.cjs +34 -0
- package/dist/cjs/apis/createGroup.cjs +48 -0
- package/dist/cjs/apis/createNoteGroup.cjs +52 -0
- package/dist/cjs/apis/createPoll.cjs +45 -0
- package/dist/cjs/apis/createProductCatalog.cjs +55 -0
- package/dist/cjs/apis/createReminder.cjs +73 -0
- package/dist/cjs/apis/custom.cjs +19 -0
- package/dist/cjs/apis/deleteAutoReply.cjs +34 -0
- package/dist/cjs/apis/deleteAvatar.cjs +32 -0
- package/dist/cjs/apis/deleteCatalog.cjs +33 -0
- package/dist/cjs/apis/deleteChat.cjs +60 -0
- package/dist/cjs/apis/deleteMessage.cjs +62 -0
- package/dist/cjs/apis/deleteProductCatalog.cjs +36 -0
- package/dist/cjs/apis/disableGroupLink.cjs +29 -0
- package/dist/cjs/apis/disperseGroup.cjs +33 -0
- package/dist/cjs/apis/editNoteGroup.cjs +45 -0
- package/dist/cjs/apis/editReminder.cjs +71 -0
- package/dist/cjs/apis/enableGroupLink.cjs +30 -0
- package/dist/cjs/apis/fetchAccountInfo.cjs +15 -0
- package/dist/cjs/apis/findUser.cjs +45 -0
- package/dist/cjs/apis/forwardMessage.cjs +109 -0
- package/dist/cjs/apis/getAliasList.cjs +32 -0
- package/dist/cjs/apis/getAllFriends.cjs +37 -0
- package/dist/cjs/apis/getAllGroups.cjs +15 -0
- package/dist/cjs/apis/getArchivedChatList.cjs +28 -0
- package/dist/cjs/apis/getAutoDeleteChat.cjs +26 -0
- package/dist/cjs/apis/getAutoReplyList.cjs +29 -0
- package/dist/cjs/apis/getAvatarList.cjs +33 -0
- package/dist/cjs/apis/getBizAccount.cjs +32 -0
- package/dist/cjs/apis/getCatalogList.cjs +37 -0
- package/dist/cjs/apis/getContext.cjs +9 -0
- package/dist/cjs/apis/getCookie.cjs +14 -0
- package/dist/cjs/apis/getFriendBoardList.cjs +31 -0
- package/dist/cjs/apis/getFriendRequestStatus.cjs +30 -0
- package/dist/cjs/apis/getGroupBlockedMember.cjs +34 -0
- package/dist/cjs/apis/getGroupInfo.cjs +37 -0
- package/dist/cjs/apis/getGroupLinkDetail.cjs +30 -0
- package/dist/cjs/apis/getGroupLinkInfo.cjs +33 -0
- package/dist/cjs/apis/getGroupMembersInfo.cjs +29 -0
- package/dist/cjs/apis/getHiddenConversations.cjs +28 -0
- package/dist/cjs/apis/getLabels.cjs +33 -0
- package/dist/cjs/apis/getListBoard.cjs +55 -0
- package/dist/cjs/apis/getListReminder.cjs +57 -0
- package/dist/cjs/apis/getMute.cjs +27 -0
- package/dist/cjs/apis/getOwnId.cjs +9 -0
- package/dist/cjs/apis/getPendingGroupMembers.cjs +32 -0
- package/dist/cjs/apis/getPinConversations.cjs +27 -0
- package/dist/cjs/apis/getPollDetail.cjs +35 -0
- package/dist/cjs/apis/getProductCatalogList.cjs +38 -0
- package/dist/cjs/apis/getQR.cjs +34 -0
- package/dist/cjs/apis/getQuickMessage.cjs +29 -0
- package/dist/cjs/apis/getReceivedFriendRequests.cjs +27 -0
- package/dist/cjs/apis/getReminder.cjs +30 -0
- package/dist/cjs/apis/getReminderResponses.cjs +29 -0
- package/dist/cjs/apis/getSentFriendRequest.cjs +29 -0
- package/dist/cjs/apis/getStickers.cjs +45 -0
- package/dist/cjs/apis/getStickersDetail.cjs +45 -0
- package/dist/cjs/apis/getUnreadMark.cjs +35 -0
- package/dist/cjs/apis/getUserInfo.cjs +47 -0
- package/dist/cjs/apis/inviteUserToGroups.cjs +35 -0
- package/dist/cjs/apis/joinGroupLink.cjs +32 -0
- package/dist/cjs/apis/keepAlive.cjs +27 -0
- package/dist/cjs/apis/lastOnline.cjs +31 -0
- package/dist/cjs/apis/leaveGroup.cjs +38 -0
- package/dist/cjs/apis/listen.cjs +435 -0
- package/dist/cjs/apis/lockPoll.cjs +33 -0
- package/dist/cjs/apis/login.cjs +102 -0
- package/dist/cjs/apis/loginQR.cjs +364 -0
- package/dist/cjs/apis/parseLink.cjs +32 -0
- package/dist/cjs/apis/removeFriend.cjs +33 -0
- package/dist/cjs/apis/removeFriendAlias.cjs +29 -0
- package/dist/cjs/apis/removeGroupBlockedMember.cjs +33 -0
- package/dist/cjs/apis/removeGroupDeputy.cjs +35 -0
- package/dist/cjs/apis/removeQuickMessage.cjs +32 -0
- package/dist/cjs/apis/removeReminder.cjs +50 -0
- package/dist/cjs/apis/removeUnreadMark.cjs +60 -0
- package/dist/cjs/apis/removeUserFromGroup.cjs +39 -0
- package/dist/cjs/apis/resetHiddenConversPin.cjs +25 -0
- package/dist/cjs/apis/reuseAvatar.cjs +31 -0
- package/dist/cjs/apis/reviewPendingMemberRequest.cjs +36 -0
- package/dist/cjs/apis/sendBankCard.cjs +49 -0
- package/dist/cjs/apis/sendCard.cjs +69 -0
- package/dist/cjs/apis/sendDeliveredEvent.cjs +65 -0
- package/dist/cjs/apis/sendFriendRequest.cjs +44 -0
- package/dist/cjs/apis/sendLink.cjs +71 -0
- package/dist/cjs/apis/sendMessage.cjs +469 -0
- package/dist/cjs/apis/sendReport.cjs +63 -0
- package/dist/cjs/apis/sendSeenEvent.cjs +73 -0
- package/dist/cjs/apis/sendSticker.cjs +66 -0
- package/dist/cjs/apis/sendTypingEvent.cjs +43 -0
- package/dist/cjs/apis/sendVideo.cjs +128 -0
- package/dist/cjs/apis/sendVoice.cjs +83 -0
- package/dist/cjs/apis/setHiddenConversations.cjs +47 -0
- package/dist/cjs/apis/setMute.cjs +77 -0
- package/dist/cjs/apis/setPinnedConversations.cjs +44 -0
- package/dist/cjs/apis/unblockUser.cjs +33 -0
- package/dist/cjs/apis/undo.cjs +52 -0
- package/dist/cjs/apis/undoFriendRequest.cjs +32 -0
- package/dist/cjs/apis/updateAutoDeleteChat.cjs +50 -0
- package/dist/cjs/apis/updateAutoReply.cjs +42 -0
- package/dist/cjs/apis/updateCatalog.cjs +35 -0
- package/dist/cjs/apis/updateGroupSettings.cjs +48 -0
- package/dist/cjs/apis/updateHiddenConversPin.cjs +35 -0
- package/dist/cjs/apis/updateLabels.cjs +39 -0
- package/dist/cjs/apis/updateLang.cjs +37 -0
- package/dist/cjs/apis/updateProductCatalog.cjs +56 -0
- package/dist/cjs/apis/updateProfile.cjs +47 -0
- package/dist/cjs/apis/updateQuickMessage.cjs +66 -0
- package/dist/cjs/apis/updateSettings.cjs +28 -0
- package/dist/cjs/apis/uploadAttachment.cjs +215 -0
- package/dist/cjs/apis/uploadProductPhoto.cjs +55 -0
- package/dist/cjs/context.cjs +34 -0
- package/dist/cjs/index.cjs +121 -0
- package/dist/cjs/models/AutoReply.cjs +9 -0
- package/dist/cjs/models/DeliveredMessage.cjs +23 -0
- package/dist/cjs/models/Enum.cjs +95 -0
- package/dist/cjs/models/FriendEvent.cjs +87 -0
- package/dist/cjs/models/GroupEvent.cjs +88 -0
- package/dist/cjs/models/Message.cjs +32 -0
- package/dist/cjs/models/Reaction.cjs +74 -0
- package/dist/cjs/models/SeenMessage.cjs +23 -0
- package/dist/cjs/models/Typing.cjs +23 -0
- package/dist/cjs/models/Undo.cjs +16 -0
- package/dist/cjs/models/ZBusiness.cjs +46 -0
- package/dist/cjs/update.cjs +27 -0
- package/dist/cjs/utils.cjs +732 -0
- package/dist/cjs/zalo.cjs +360 -0
- package/dist/context.d.ts +177 -0
- package/dist/context.js +28 -0
- package/dist/index.d.ts +130 -0
- package/dist/index.js +11 -0
- package/dist/models/Attachment.d.ts +9 -0
- package/dist/models/Attachment.js +1 -0
- package/dist/models/AutoReply.d.ts +20 -0
- package/dist/models/AutoReply.js +7 -0
- package/dist/models/Board.d.ts +54 -0
- package/dist/models/Board.js +1 -0
- package/dist/models/Catalog.d.ts +16 -0
- package/dist/models/Catalog.js +1 -0
- package/dist/models/DeliveredMessage.d.ts +27 -0
- package/dist/models/DeliveredMessage.js +17 -0
- package/dist/models/Enum.d.ts +87 -0
- package/dist/models/Enum.js +93 -0
- package/dist/models/FriendEvent.d.ts +107 -0
- package/dist/models/FriendEvent.js +83 -0
- package/dist/models/GroupEvent.d.ts +197 -0
- package/dist/models/GroupEvent.js +84 -0
- package/dist/models/Message.d.ts +91 -0
- package/dist/models/Message.js +26 -0
- package/dist/models/ProductCatalog.d.ts +17 -0
- package/dist/models/ProductCatalog.js +1 -0
- package/dist/models/QuickMessage.d.ts +25 -0
- package/dist/models/QuickMessage.js +1 -0
- package/dist/models/Reaction.d.ts +85 -0
- package/dist/models/Reaction.js +70 -0
- package/dist/models/Reminder.d.ts +35 -0
- package/dist/models/Reminder.js +1 -0
- package/dist/models/SeenMessage.d.ts +26 -0
- package/dist/models/SeenMessage.js +17 -0
- package/dist/models/Typing.d.ts +24 -0
- package/dist/models/Typing.js +17 -0
- package/dist/models/Undo.d.ts +34 -0
- package/dist/models/Undo.js +12 -0
- package/dist/models/ZBusiness.d.ts +29 -0
- package/dist/models/ZBusiness.js +42 -0
- package/dist/models/index.d.ts +17 -0
- package/dist/models/index.js +17 -0
- package/dist/update.d.ts +2 -0
- package/dist/update.js +22 -0
- package/dist/utils.d.ts +168 -0
- package/dist/utils.js +748 -0
- package/dist/zalo.d.ts +291 -0
- package/dist/zalo.js +354 -0
- package/eslint.config.js +21 -0
- package/index.d.ts +2 -0
- package/package.json +143 -0
- package/qr.png +0 -0
- package/rollup.config.js +28 -0
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { DestType, ThreadType } from "../models/index.js";
|
|
2
|
+
export type SendTypingEventResponse = {
|
|
3
|
+
status: number;
|
|
4
|
+
};
|
|
5
|
+
export declare const sendTypingEventFactory: (ctx: import("../context.js").ContextBase, api: import("../zalo.js").API) => (threadId: string, type?: ThreadType, destType?: DestType) => Promise<SendTypingEventResponse>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ZaloApiError } from "../Errors/ZaloApiError.js";
|
|
2
|
+
import { DestType, ThreadType } from "../models/index.js";
|
|
3
|
+
import { apiFactory } from "../utils.js";
|
|
4
|
+
export const sendTypingEventFactory = apiFactory()((api, ctx, utils) => {
|
|
5
|
+
const serviceURL = {
|
|
6
|
+
[ThreadType.User]: utils.makeURL(`${api.zpwServiceMap.chat[0]}/api/message/typing`),
|
|
7
|
+
[ThreadType.Group]: utils.makeURL(`${api.zpwServiceMap.group[0]}/api/group/typing`),
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Send typing event
|
|
11
|
+
*
|
|
12
|
+
* @param threadId The ID of the User or Group to send the typing event to
|
|
13
|
+
* @param type The type of thread (User or Group)
|
|
14
|
+
* @param destType The destination type (User or Page), for User threads only, defaults to User
|
|
15
|
+
*
|
|
16
|
+
* @throws ZaloApiError
|
|
17
|
+
*/
|
|
18
|
+
return async function sendTypingEvent(threadId, type = ThreadType.User, destType = DestType.User) {
|
|
19
|
+
if (!threadId)
|
|
20
|
+
throw new ZaloApiError("Missing threadId");
|
|
21
|
+
const params = Object.assign(Object.assign({ [type === ThreadType.User ? "toid" : "grid"]: threadId }, (type === ThreadType.User ? { destType } : {})), { imei: ctx.imei });
|
|
22
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
23
|
+
if (!encryptedParams)
|
|
24
|
+
throw new ZaloApiError("Failed to encrypt params");
|
|
25
|
+
const response = await utils.request(serviceURL[type], {
|
|
26
|
+
method: "POST",
|
|
27
|
+
body: new URLSearchParams({
|
|
28
|
+
params: encryptedParams,
|
|
29
|
+
}),
|
|
30
|
+
});
|
|
31
|
+
return utils.resolve(response);
|
|
32
|
+
};
|
|
33
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ThreadType } from "../models/index.js";
|
|
2
|
+
export type SendVideoOptions = {
|
|
3
|
+
/**
|
|
4
|
+
* Optional message to send along with the video
|
|
5
|
+
*/
|
|
6
|
+
msg?: string;
|
|
7
|
+
/**
|
|
8
|
+
* URL of the video
|
|
9
|
+
*/
|
|
10
|
+
videoUrl: string;
|
|
11
|
+
/**
|
|
12
|
+
* URL of the thumbnail
|
|
13
|
+
*/
|
|
14
|
+
thumbnailUrl: string;
|
|
15
|
+
/**
|
|
16
|
+
* Video duration in milliseconds || Eg: video duration: 5.5s => 5.5 * 1000 = 5500
|
|
17
|
+
*/
|
|
18
|
+
duration?: number;
|
|
19
|
+
/**
|
|
20
|
+
* Width of the video
|
|
21
|
+
*/
|
|
22
|
+
width?: number;
|
|
23
|
+
/**
|
|
24
|
+
* Height of the video
|
|
25
|
+
*/
|
|
26
|
+
height?: number;
|
|
27
|
+
/**
|
|
28
|
+
* Time to live in miliseconds (default: 0)
|
|
29
|
+
*/
|
|
30
|
+
ttl?: number;
|
|
31
|
+
};
|
|
32
|
+
export type SendVideoResponse = {
|
|
33
|
+
msgId: number;
|
|
34
|
+
};
|
|
35
|
+
export declare const sendVideoFactory: (ctx: import("../context.js").ContextBase, api: import("../zalo.js").API) => (options: SendVideoOptions, threadId: string, type?: ThreadType) => Promise<SendVideoResponse>;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { ZaloApiError } from "../Errors/ZaloApiError.js";
|
|
2
|
+
import { ThreadType } from "../models/index.js";
|
|
3
|
+
import { apiFactory } from "../utils.js";
|
|
4
|
+
export const sendVideoFactory = apiFactory()((api, ctx, utils) => {
|
|
5
|
+
const serviceURL = {
|
|
6
|
+
[ThreadType.User]: utils.makeURL(`${api.zpwServiceMap.file[0]}/api/message/forward`),
|
|
7
|
+
[ThreadType.Group]: utils.makeURL(`${api.zpwServiceMap.file[0]}/api/group/forward`),
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Send a video to a User - Group
|
|
11
|
+
*
|
|
12
|
+
* @param options send video options
|
|
13
|
+
* @param threadId ID of the user or group to send the video to
|
|
14
|
+
* @param type Type of thread (USER or GROUP)
|
|
15
|
+
*
|
|
16
|
+
* @throws ZaloApiError
|
|
17
|
+
*
|
|
18
|
+
* @examples Example Video Resolutions:
|
|
19
|
+
* - **Standard Videos**:
|
|
20
|
+
* - 3840x2160 (4K UHD): Width 3840px, Height 2160px.
|
|
21
|
+
* - 1920x1080 (Full HD): Width 1920px, Height 1080px.
|
|
22
|
+
* - 1280x720 (HD): Width 1280px, Height 720px.
|
|
23
|
+
* - **Document-Oriented Videos** (Portrait):
|
|
24
|
+
* - 3840x2160 (4K UHD): Width 3840px, Height 2160px.
|
|
25
|
+
* - 720x1280 (HD): Width 720px, Height 1280px.
|
|
26
|
+
* - 1440x2560 (2K): Width 1440px, Height 2560px.
|
|
27
|
+
*
|
|
28
|
+
*/
|
|
29
|
+
return async function sendVideo(options, threadId, type = ThreadType.User) {
|
|
30
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
31
|
+
let fileSize = 0;
|
|
32
|
+
const clientId = Date.now();
|
|
33
|
+
try {
|
|
34
|
+
const headResponse = await utils.request(options.videoUrl, { method: "HEAD" }, true);
|
|
35
|
+
if (headResponse.ok) {
|
|
36
|
+
fileSize = parseInt(headResponse.headers.get("content-length") || "0");
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
throw new ZaloApiError(`Unable to get video content: ${error instanceof Error ? error.message : String(error)}`);
|
|
41
|
+
}
|
|
42
|
+
const params = type === ThreadType.User
|
|
43
|
+
? {
|
|
44
|
+
toId: threadId,
|
|
45
|
+
clientId: String(clientId),
|
|
46
|
+
ttl: (_a = options.ttl) !== null && _a !== void 0 ? _a : 0,
|
|
47
|
+
zsource: 704,
|
|
48
|
+
msgType: 5,
|
|
49
|
+
msgInfo: JSON.stringify({
|
|
50
|
+
videoUrl: options.videoUrl,
|
|
51
|
+
thumbUrl: options.thumbnailUrl,
|
|
52
|
+
duration: (_b = options.duration) !== null && _b !== void 0 ? _b : 0,
|
|
53
|
+
width: (_c = options.width) !== null && _c !== void 0 ? _c : 1280,
|
|
54
|
+
height: (_d = options.height) !== null && _d !== void 0 ? _d : 720,
|
|
55
|
+
fileSize: fileSize,
|
|
56
|
+
properties: {
|
|
57
|
+
color: -1,
|
|
58
|
+
size: -1,
|
|
59
|
+
type: 1003,
|
|
60
|
+
subType: 0,
|
|
61
|
+
ext: {
|
|
62
|
+
sSrcType: -1,
|
|
63
|
+
sSrcStr: "",
|
|
64
|
+
msg_warning_type: 0,
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
title: (_e = options.msg) !== null && _e !== void 0 ? _e : "",
|
|
68
|
+
}),
|
|
69
|
+
imei: ctx.imei,
|
|
70
|
+
}
|
|
71
|
+
: {
|
|
72
|
+
grid: threadId,
|
|
73
|
+
visibility: 0,
|
|
74
|
+
clientId: String(clientId),
|
|
75
|
+
ttl: (_f = options.ttl) !== null && _f !== void 0 ? _f : 0,
|
|
76
|
+
zsource: 704,
|
|
77
|
+
msgType: 5,
|
|
78
|
+
msgInfo: JSON.stringify({
|
|
79
|
+
videoUrl: options.videoUrl,
|
|
80
|
+
thumbUrl: options.thumbnailUrl,
|
|
81
|
+
duration: (_g = options.duration) !== null && _g !== void 0 ? _g : 0,
|
|
82
|
+
width: (_h = options.width) !== null && _h !== void 0 ? _h : 1280,
|
|
83
|
+
height: (_j = options.height) !== null && _j !== void 0 ? _j : 720,
|
|
84
|
+
fileSize: fileSize,
|
|
85
|
+
properties: {
|
|
86
|
+
color: -1,
|
|
87
|
+
size: -1,
|
|
88
|
+
type: 1003,
|
|
89
|
+
subType: 0,
|
|
90
|
+
ext: {
|
|
91
|
+
sSrcType: -1,
|
|
92
|
+
sSrcStr: "",
|
|
93
|
+
msg_warning_type: 0,
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
title: (_k = options.msg) !== null && _k !== void 0 ? _k : "",
|
|
97
|
+
}),
|
|
98
|
+
imei: ctx.imei,
|
|
99
|
+
};
|
|
100
|
+
// @TODO: later
|
|
101
|
+
// if (typeof message !== "string" && message.mention) {
|
|
102
|
+
// params.mentionInfo = message.mention;
|
|
103
|
+
// }
|
|
104
|
+
if (type !== ThreadType.User && type !== ThreadType.Group) {
|
|
105
|
+
throw new ZaloApiError("Thread type is invalid");
|
|
106
|
+
}
|
|
107
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
108
|
+
if (!encryptedParams)
|
|
109
|
+
throw new ZaloApiError("Failed to encrypt params");
|
|
110
|
+
const response = await utils.request(serviceURL[type], {
|
|
111
|
+
method: "POST",
|
|
112
|
+
body: new URLSearchParams({
|
|
113
|
+
params: encryptedParams,
|
|
114
|
+
}),
|
|
115
|
+
});
|
|
116
|
+
return utils.resolve(response);
|
|
117
|
+
};
|
|
118
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ThreadType } from "../models/index.js";
|
|
2
|
+
export type SendVoiceOptions = {
|
|
3
|
+
voiceUrl: string;
|
|
4
|
+
/**
|
|
5
|
+
* Time to live in miliseconds (default: 0)
|
|
6
|
+
*/
|
|
7
|
+
ttl?: number;
|
|
8
|
+
};
|
|
9
|
+
export type SendVoiceResponse = {
|
|
10
|
+
msgId: string;
|
|
11
|
+
};
|
|
12
|
+
export declare const sendVoiceFactory: (ctx: import("../context.js").ContextBase, api: import("../zalo.js").API) => (options: SendVoiceOptions, threadId: string, type?: ThreadType) => Promise<SendVoiceResponse>;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { ZaloApiError } from "../Errors/ZaloApiError.js";
|
|
2
|
+
import { ThreadType } from "../models/index.js";
|
|
3
|
+
import { apiFactory } from "../utils.js";
|
|
4
|
+
export const sendVoiceFactory = apiFactory()((api, ctx, utils) => {
|
|
5
|
+
const serviceURL = {
|
|
6
|
+
[ThreadType.User]: utils.makeURL(`${api.zpwServiceMap.file[0]}/api/message/forward`),
|
|
7
|
+
[ThreadType.Group]: utils.makeURL(`${api.zpwServiceMap.file[0]}/api/group/forward`),
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Send a voice to a User - Group
|
|
11
|
+
*
|
|
12
|
+
* @param options voice options
|
|
13
|
+
* @param threadId ID of the user or group to send the voice to
|
|
14
|
+
* @param type Type of thread, default user
|
|
15
|
+
*
|
|
16
|
+
* @throws ZaloApiError
|
|
17
|
+
*/
|
|
18
|
+
return async function sendVoice(options, threadId, type = ThreadType.User) {
|
|
19
|
+
var _a, _b;
|
|
20
|
+
let fileSize = null;
|
|
21
|
+
const clientId = Date.now().toString();
|
|
22
|
+
try {
|
|
23
|
+
const headResponse = await utils.request(options.voiceUrl, { method: "HEAD" }, true);
|
|
24
|
+
if (headResponse.ok) {
|
|
25
|
+
fileSize = parseInt(headResponse.headers.get("content-length") || "0");
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
throw new ZaloApiError(`Unable to get voice content: ${error instanceof Error ? error.message : String(error)}`);
|
|
30
|
+
}
|
|
31
|
+
const params = type === ThreadType.User
|
|
32
|
+
? {
|
|
33
|
+
toId: threadId,
|
|
34
|
+
ttl: (_a = options.ttl) !== null && _a !== void 0 ? _a : 0,
|
|
35
|
+
zsource: -1,
|
|
36
|
+
msgType: 3,
|
|
37
|
+
clientId: clientId,
|
|
38
|
+
msgInfo: JSON.stringify({
|
|
39
|
+
voiceUrl: options.voiceUrl,
|
|
40
|
+
m4aUrl: options.voiceUrl,
|
|
41
|
+
fileSize: fileSize !== null && fileSize !== void 0 ? fileSize : 0,
|
|
42
|
+
}),
|
|
43
|
+
imei: ctx.imei,
|
|
44
|
+
}
|
|
45
|
+
: {
|
|
46
|
+
grid: threadId,
|
|
47
|
+
visibility: 0,
|
|
48
|
+
ttl: (_b = options.ttl) !== null && _b !== void 0 ? _b : 0,
|
|
49
|
+
zsource: -1,
|
|
50
|
+
msgType: 3,
|
|
51
|
+
clientId: clientId,
|
|
52
|
+
msgInfo: JSON.stringify({
|
|
53
|
+
voiceUrl: options.voiceUrl,
|
|
54
|
+
m4aUrl: options.voiceUrl,
|
|
55
|
+
fileSize: fileSize !== null && fileSize !== void 0 ? fileSize : 0,
|
|
56
|
+
}),
|
|
57
|
+
imei: ctx.imei,
|
|
58
|
+
};
|
|
59
|
+
if (type !== ThreadType.User && type !== ThreadType.Group) {
|
|
60
|
+
throw new ZaloApiError("Thread type is invalid");
|
|
61
|
+
}
|
|
62
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
63
|
+
if (!encryptedParams)
|
|
64
|
+
throw new ZaloApiError("Failed to encrypt params");
|
|
65
|
+
const response = await utils.request(serviceURL[type], {
|
|
66
|
+
method: "POST",
|
|
67
|
+
body: new URLSearchParams({
|
|
68
|
+
params: encryptedParams,
|
|
69
|
+
}),
|
|
70
|
+
});
|
|
71
|
+
return utils.resolve(response);
|
|
72
|
+
};
|
|
73
|
+
});
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { ThreadType } from "../models/index.js";
|
|
2
|
+
export type SetHiddenConversationsResponse = "";
|
|
3
|
+
export declare const setHiddenConversationsFactory: (ctx: import("../context.js").ContextBase, api: import("../zalo.js").API) => (hidden: boolean, threadId: string, type?: ThreadType) => Promise<"">;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { ZaloApiError } from "../Errors/ZaloApiError.js";
|
|
2
|
+
import { ThreadType } from "../models/index.js";
|
|
3
|
+
import { apiFactory } from "../utils.js";
|
|
4
|
+
export const setHiddenConversationsFactory = apiFactory()((api, ctx, utils) => {
|
|
5
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.conversation[0]}/api/hiddenconvers/add-remove`);
|
|
6
|
+
/**
|
|
7
|
+
* Set hidden conversation
|
|
8
|
+
*
|
|
9
|
+
* @param hidden - Whether to hide or unhide the conversation
|
|
10
|
+
* @param threadId Thread ID
|
|
11
|
+
* @param type Thread type (User/Group)
|
|
12
|
+
*
|
|
13
|
+
* @throws ZaloApiError
|
|
14
|
+
*/
|
|
15
|
+
return async function setHiddenConversations(hidden, threadId, type = ThreadType.User) {
|
|
16
|
+
const params = {
|
|
17
|
+
[hidden ? "add_threads" : "del_threads"]: JSON.stringify([
|
|
18
|
+
{
|
|
19
|
+
thread_id: threadId,
|
|
20
|
+
is_group: type === ThreadType.Group ? 1 : 0,
|
|
21
|
+
},
|
|
22
|
+
]),
|
|
23
|
+
[hidden ? "del_threads" : "add_threads"]: "[]",
|
|
24
|
+
imei: ctx.imei,
|
|
25
|
+
};
|
|
26
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
27
|
+
if (!encryptedParams)
|
|
28
|
+
throw new ZaloApiError("Failed to encrypt params");
|
|
29
|
+
const response = await utils.request(serviceURL, {
|
|
30
|
+
method: "POST",
|
|
31
|
+
body: new URLSearchParams({
|
|
32
|
+
params: encryptedParams,
|
|
33
|
+
}),
|
|
34
|
+
});
|
|
35
|
+
return utils.resolve(response);
|
|
36
|
+
};
|
|
37
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ThreadType } from "../models/index.js";
|
|
2
|
+
export type SetMuteParams = {
|
|
3
|
+
duration?: MuteDuration | number;
|
|
4
|
+
action?: MuteAction;
|
|
5
|
+
};
|
|
6
|
+
export type SetMuteResponse = "";
|
|
7
|
+
export declare const enum MuteDuration {
|
|
8
|
+
ONE_HOUR = 3600,
|
|
9
|
+
FOUR_HOURS = 14400,
|
|
10
|
+
FOREVER = -1,
|
|
11
|
+
UNTIL_8AM = "until8AM"
|
|
12
|
+
}
|
|
13
|
+
export declare const enum MuteAction {
|
|
14
|
+
MUTE = 1,
|
|
15
|
+
UNMUTE = 3
|
|
16
|
+
}
|
|
17
|
+
export declare const setMuteFactory: (ctx: import("../context.js").ContextBase, api: import("../zalo.js").API) => (params: SetMuteParams | undefined, threadID: string, type?: ThreadType) => Promise<"">;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { ZaloApiError } from "../Errors/ZaloApiError.js";
|
|
2
|
+
import { ThreadType } from "../models/index.js";
|
|
3
|
+
import { apiFactory } from "../utils.js";
|
|
4
|
+
export var MuteDuration;
|
|
5
|
+
(function (MuteDuration) {
|
|
6
|
+
MuteDuration[MuteDuration["ONE_HOUR"] = 3600] = "ONE_HOUR";
|
|
7
|
+
MuteDuration[MuteDuration["FOUR_HOURS"] = 14400] = "FOUR_HOURS";
|
|
8
|
+
MuteDuration[MuteDuration["FOREVER"] = -1] = "FOREVER";
|
|
9
|
+
MuteDuration["UNTIL_8AM"] = "until8AM";
|
|
10
|
+
})(MuteDuration || (MuteDuration = {}));
|
|
11
|
+
export var MuteAction;
|
|
12
|
+
(function (MuteAction) {
|
|
13
|
+
MuteAction[MuteAction["MUTE"] = 1] = "MUTE";
|
|
14
|
+
MuteAction[MuteAction["UNMUTE"] = 3] = "UNMUTE";
|
|
15
|
+
})(MuteAction || (MuteAction = {}));
|
|
16
|
+
export const setMuteFactory = apiFactory()((api, ctx, utils) => {
|
|
17
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.profile[0]}/api/social/profile/setmute`);
|
|
18
|
+
/**
|
|
19
|
+
* Set mute
|
|
20
|
+
*
|
|
21
|
+
* @param params - Mute parameters
|
|
22
|
+
* @param threadID - ID of the thread to mute
|
|
23
|
+
* @param type - Type of thread (User or Group)
|
|
24
|
+
*
|
|
25
|
+
* @throws ZaloApiError
|
|
26
|
+
*/
|
|
27
|
+
return async function setMute(params = {}, threadID, type = ThreadType.User) {
|
|
28
|
+
const { duration = MuteDuration.FOREVER, action = MuteAction.MUTE } = params;
|
|
29
|
+
let muteDuration;
|
|
30
|
+
if (action === MuteAction.UNMUTE) {
|
|
31
|
+
muteDuration = -1;
|
|
32
|
+
}
|
|
33
|
+
else if (duration === MuteDuration.FOREVER) {
|
|
34
|
+
muteDuration = -1;
|
|
35
|
+
}
|
|
36
|
+
else if (duration === MuteDuration.UNTIL_8AM) {
|
|
37
|
+
const now = new Date();
|
|
38
|
+
const next8AM = new Date(now);
|
|
39
|
+
next8AM.setHours(8, 0, 0, 0);
|
|
40
|
+
if (now.getHours() >= 8) {
|
|
41
|
+
next8AM.setDate(next8AM.getDate() + 1);
|
|
42
|
+
}
|
|
43
|
+
muteDuration = Math.floor((next8AM.getTime() - now.getTime()) / 1000);
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
muteDuration = duration;
|
|
47
|
+
}
|
|
48
|
+
const requestParams = {
|
|
49
|
+
toid: threadID,
|
|
50
|
+
duration: muteDuration,
|
|
51
|
+
action: action,
|
|
52
|
+
startTime: Math.floor(Date.now() / 1000),
|
|
53
|
+
muteType: type === ThreadType.User ? 1 : 2,
|
|
54
|
+
imei: ctx.imei,
|
|
55
|
+
};
|
|
56
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(requestParams));
|
|
57
|
+
if (!encryptedParams)
|
|
58
|
+
throw new ZaloApiError("Failed to encrypt params");
|
|
59
|
+
const response = await utils.request(serviceURL, {
|
|
60
|
+
method: "POST",
|
|
61
|
+
body: new URLSearchParams({
|
|
62
|
+
params: encryptedParams,
|
|
63
|
+
}),
|
|
64
|
+
});
|
|
65
|
+
return utils.resolve(response);
|
|
66
|
+
};
|
|
67
|
+
});
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { ThreadType } from "../models/index.js";
|
|
2
|
+
export type SetPinnedConversationsResponse = "";
|
|
3
|
+
export declare const setPinnedConversationsFactory: (ctx: import("../context.js").ContextBase, api: import("../zalo.js").API) => (pinned: boolean, threadId: string | string[], type?: ThreadType) => Promise<"">;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ZaloApiError } from "../Errors/ZaloApiError.js";
|
|
2
|
+
import { ThreadType } from "../models/index.js";
|
|
3
|
+
import { apiFactory } from "../utils.js";
|
|
4
|
+
export const setPinnedConversationsFactory = apiFactory()((api, _, utils) => {
|
|
5
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.conversation[0]}/api/pinconvers/updatev2`);
|
|
6
|
+
/**
|
|
7
|
+
* Pin and unpin conversations of threads)
|
|
8
|
+
*
|
|
9
|
+
* @param pinned Should pin conversations
|
|
10
|
+
* @param threadId The ID(s) of the thread
|
|
11
|
+
* @param type Type of thread, default User
|
|
12
|
+
*
|
|
13
|
+
* @throws ZaloApiError
|
|
14
|
+
*
|
|
15
|
+
*/
|
|
16
|
+
return async function setPinnedConversations(pinned, threadId, type = ThreadType.User) {
|
|
17
|
+
if (typeof threadId == "string")
|
|
18
|
+
threadId = [threadId];
|
|
19
|
+
const params = {
|
|
20
|
+
actionType: pinned ? 1 : 2,
|
|
21
|
+
conversations: type == ThreadType.Group ? threadId.map((id) => `g${id}`) : threadId.map((id) => `u${id}`),
|
|
22
|
+
};
|
|
23
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
24
|
+
if (!encryptedParams)
|
|
25
|
+
throw new ZaloApiError("Failed to encrypt params");
|
|
26
|
+
const response = await utils.request(serviceURL, {
|
|
27
|
+
method: "POST",
|
|
28
|
+
body: new URLSearchParams({
|
|
29
|
+
params: encryptedParams,
|
|
30
|
+
}),
|
|
31
|
+
});
|
|
32
|
+
return utils.resolve(response);
|
|
33
|
+
};
|
|
34
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ZaloApiError } from "../Errors/ZaloApiError.js";
|
|
2
|
+
import { apiFactory } from "../utils.js";
|
|
3
|
+
export const unblockUserFactory = apiFactory()((api, ctx, utils) => {
|
|
4
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.friend[0]}/api/friend/unblock`);
|
|
5
|
+
/**
|
|
6
|
+
* Unblock a User
|
|
7
|
+
*
|
|
8
|
+
* @param userId The ID of the User to unblock
|
|
9
|
+
*
|
|
10
|
+
* @throws ZaloApiError
|
|
11
|
+
*/
|
|
12
|
+
return async function unblockUser(userId) {
|
|
13
|
+
const params = {
|
|
14
|
+
fid: userId,
|
|
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,9 @@
|
|
|
1
|
+
import { ThreadType } from "../models/index.js";
|
|
2
|
+
export type UndoPayload = {
|
|
3
|
+
msgId: string | number;
|
|
4
|
+
cliMsgId: string | number;
|
|
5
|
+
};
|
|
6
|
+
export type UndoResponse = {
|
|
7
|
+
status: number;
|
|
8
|
+
};
|
|
9
|
+
export declare const undoFactory: (ctx: import("../context.js").ContextBase, api: import("../zalo.js").API) => (payload: UndoPayload, threadId: string, type?: ThreadType) => Promise<UndoResponse>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { ZaloApiError } from "../Errors/ZaloApiError.js";
|
|
2
|
+
import { ThreadType } from "../models/index.js";
|
|
3
|
+
import { apiFactory } from "../utils.js";
|
|
4
|
+
export const undoFactory = apiFactory()((api, ctx, utils) => {
|
|
5
|
+
const URLType = {
|
|
6
|
+
[ThreadType.User]: utils.makeURL(`${api.zpwServiceMap.chat[0]}/api/message/undo`),
|
|
7
|
+
[ThreadType.Group]: utils.makeURL(`${api.zpwServiceMap.group[0]}/api/group/undomsg`),
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Undo a message
|
|
11
|
+
*
|
|
12
|
+
* @param payload Undo payload containing message ID and client message ID
|
|
13
|
+
* @param threadId group or user id
|
|
14
|
+
* @param type Message type (User or Group), default is User
|
|
15
|
+
*
|
|
16
|
+
* @throws ZaloApiError
|
|
17
|
+
*/
|
|
18
|
+
return async function undo(payload, threadId, type = ThreadType.User) {
|
|
19
|
+
const params = {
|
|
20
|
+
msgId: payload.msgId,
|
|
21
|
+
clientId: Date.now(),
|
|
22
|
+
cliMsgIdUndo: payload.cliMsgId,
|
|
23
|
+
};
|
|
24
|
+
if (type == ThreadType.Group) {
|
|
25
|
+
params["grid"] = threadId;
|
|
26
|
+
params["visibility"] = 0;
|
|
27
|
+
params["imei"] = ctx.imei;
|
|
28
|
+
}
|
|
29
|
+
else
|
|
30
|
+
params["toid"] = threadId;
|
|
31
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
32
|
+
if (!encryptedParams)
|
|
33
|
+
throw new ZaloApiError("Failed to encrypt message");
|
|
34
|
+
const response = await utils.request(URLType[type], {
|
|
35
|
+
method: "POST",
|
|
36
|
+
body: new URLSearchParams({
|
|
37
|
+
params: encryptedParams,
|
|
38
|
+
}),
|
|
39
|
+
});
|
|
40
|
+
return utils.resolve(response);
|
|
41
|
+
};
|
|
42
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ZaloApiError } from "../Errors/ZaloApiError.js";
|
|
2
|
+
import { apiFactory } from "../utils.js";
|
|
3
|
+
export const undoFriendRequestFactory = apiFactory()((api, _ctx, utils) => {
|
|
4
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.friend[0]}/api/friend/undo`);
|
|
5
|
+
/**
|
|
6
|
+
* Undo send a friend request to a user.
|
|
7
|
+
*
|
|
8
|
+
* @param options
|
|
9
|
+
*
|
|
10
|
+
* @throws ZaloApiError
|
|
11
|
+
*/
|
|
12
|
+
return async function undoFriendRequest(friendId) {
|
|
13
|
+
const params = {
|
|
14
|
+
fid: friendId,
|
|
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(serviceURL, {
|
|
20
|
+
method: "POST",
|
|
21
|
+
body: new URLSearchParams({
|
|
22
|
+
params: encryptedParams,
|
|
23
|
+
}),
|
|
24
|
+
});
|
|
25
|
+
return utils.resolve(response);
|
|
26
|
+
};
|
|
27
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ThreadType } from "../models/index.js";
|
|
2
|
+
export declare enum ChatTTL {
|
|
3
|
+
NO_DELETE = 0,
|
|
4
|
+
ONE_DAY = 86400000,
|
|
5
|
+
SEVEN_DAYS = 604800000,
|
|
6
|
+
FOURTEEN_DAYS = 1209600000
|
|
7
|
+
}
|
|
8
|
+
export type UpdateAutoDeleteChatResponse = "";
|
|
9
|
+
export declare const updateAutoDeleteChatFactory: (ctx: import("../context.js").ContextBase, api: import("../zalo.js").API) => (ttl: ChatTTL, threadId: string, type?: ThreadType) => Promise<"">;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ZaloApiError } from "../Errors/ZaloApiError.js";
|
|
2
|
+
import { ThreadType } from "../models/index.js";
|
|
3
|
+
import { apiFactory } from "../utils.js";
|
|
4
|
+
export var ChatTTL;
|
|
5
|
+
(function (ChatTTL) {
|
|
6
|
+
ChatTTL[ChatTTL["NO_DELETE"] = 0] = "NO_DELETE";
|
|
7
|
+
ChatTTL[ChatTTL["ONE_DAY"] = 86400000] = "ONE_DAY";
|
|
8
|
+
ChatTTL[ChatTTL["SEVEN_DAYS"] = 604800000] = "SEVEN_DAYS";
|
|
9
|
+
ChatTTL[ChatTTL["FOURTEEN_DAYS"] = 1209600000] = "FOURTEEN_DAYS";
|
|
10
|
+
})(ChatTTL || (ChatTTL = {}));
|
|
11
|
+
export const updateAutoDeleteChatFactory = apiFactory()((api, ctx, utils) => {
|
|
12
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.conversation[0]}/api/conv/autodelete/updateConvers`);
|
|
13
|
+
/**
|
|
14
|
+
* Auto delete chat
|
|
15
|
+
*
|
|
16
|
+
* @param ttl The time to live of the chat
|
|
17
|
+
* @param threadId The thread ID to auto delete chat
|
|
18
|
+
* @param type Type of thread (User or Group)
|
|
19
|
+
*
|
|
20
|
+
* @throws ZaloApiError
|
|
21
|
+
*/
|
|
22
|
+
return async function updateAutoDeleteChat(ttl, threadId, type = ThreadType.User) {
|
|
23
|
+
const params = {
|
|
24
|
+
threadId: threadId,
|
|
25
|
+
isGroup: type === ThreadType.Group ? 1 : 0,
|
|
26
|
+
ttl: ttl,
|
|
27
|
+
clientLang: ctx.language,
|
|
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,14 @@
|
|
|
1
|
+
import type { AutoReplyItem, AutoReplyScope } from "../models/index.js";
|
|
2
|
+
export type UpdateAutoReplyPayload = {
|
|
3
|
+
content: string;
|
|
4
|
+
isEnable: boolean;
|
|
5
|
+
startTime: number;
|
|
6
|
+
endTime: number;
|
|
7
|
+
scope: AutoReplyScope;
|
|
8
|
+
uids?: string | string[];
|
|
9
|
+
};
|
|
10
|
+
export type UpdateAutoReplyResponse = {
|
|
11
|
+
item: AutoReplyItem;
|
|
12
|
+
version: number;
|
|
13
|
+
};
|
|
14
|
+
export declare const updateAutoReplyFactory: (ctx: import("../context.js").ContextBase, api: import("../zalo.js").API) => (payload: UpdateAutoReplyPayload) => Promise<UpdateAutoReplyResponse>;
|