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,43 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var ZaloApiError = require('../Errors/ZaloApiError.cjs');
|
|
4
|
+
var Enum = require('../models/Enum.cjs');
|
|
5
|
+
require('../models/FriendEvent.cjs');
|
|
6
|
+
require('../models/GroupEvent.cjs');
|
|
7
|
+
require('../models/Reaction.cjs');
|
|
8
|
+
require('../models/ZBusiness.cjs');
|
|
9
|
+
require('../models/AutoReply.cjs');
|
|
10
|
+
var utils = require('../utils.cjs');
|
|
11
|
+
|
|
12
|
+
const sendTypingEventFactory = utils.apiFactory()((api, ctx, utils) => {
|
|
13
|
+
const serviceURL = {
|
|
14
|
+
[Enum.ThreadType.User]: utils.makeURL(`${api.zpwServiceMap.chat[0]}/api/message/typing`),
|
|
15
|
+
[Enum.ThreadType.Group]: utils.makeURL(`${api.zpwServiceMap.group[0]}/api/group/typing`),
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Send typing event
|
|
19
|
+
*
|
|
20
|
+
* @param threadId The ID of the User or Group to send the typing event to
|
|
21
|
+
* @param type The type of thread (User or Group)
|
|
22
|
+
* @param destType The destination type (User or Page), for User threads only, defaults to User
|
|
23
|
+
*
|
|
24
|
+
* @throws ZaloApiError
|
|
25
|
+
*/
|
|
26
|
+
return async function sendTypingEvent(threadId, type = Enum.ThreadType.User, destType = Enum.DestType.User) {
|
|
27
|
+
if (!threadId)
|
|
28
|
+
throw new ZaloApiError.ZaloApiError("Missing threadId");
|
|
29
|
+
const params = Object.assign(Object.assign({ [type === Enum.ThreadType.User ? "toid" : "grid"]: threadId }, (type === Enum.ThreadType.User ? { destType } : {})), { imei: ctx.imei });
|
|
30
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
31
|
+
if (!encryptedParams)
|
|
32
|
+
throw new ZaloApiError.ZaloApiError("Failed to encrypt params");
|
|
33
|
+
const response = await utils.request(serviceURL[type], {
|
|
34
|
+
method: "POST",
|
|
35
|
+
body: new URLSearchParams({
|
|
36
|
+
params: encryptedParams,
|
|
37
|
+
}),
|
|
38
|
+
});
|
|
39
|
+
return utils.resolve(response);
|
|
40
|
+
};
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
exports.sendTypingEventFactory = sendTypingEventFactory;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var ZaloApiError = require('../Errors/ZaloApiError.cjs');
|
|
4
|
+
var Enum = require('../models/Enum.cjs');
|
|
5
|
+
require('../models/FriendEvent.cjs');
|
|
6
|
+
require('../models/GroupEvent.cjs');
|
|
7
|
+
require('../models/Reaction.cjs');
|
|
8
|
+
require('../models/ZBusiness.cjs');
|
|
9
|
+
require('../models/AutoReply.cjs');
|
|
10
|
+
var utils = require('../utils.cjs');
|
|
11
|
+
|
|
12
|
+
const sendVideoFactory = utils.apiFactory()((api, ctx, utils) => {
|
|
13
|
+
const serviceURL = {
|
|
14
|
+
[Enum.ThreadType.User]: utils.makeURL(`${api.zpwServiceMap.file[0]}/api/message/forward`),
|
|
15
|
+
[Enum.ThreadType.Group]: utils.makeURL(`${api.zpwServiceMap.file[0]}/api/group/forward`),
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Send a video to a User - Group
|
|
19
|
+
*
|
|
20
|
+
* @param options send video options
|
|
21
|
+
* @param threadId ID of the user or group to send the video to
|
|
22
|
+
* @param type Type of thread (USER or GROUP)
|
|
23
|
+
*
|
|
24
|
+
* @throws ZaloApiError
|
|
25
|
+
*
|
|
26
|
+
* @examples Example Video Resolutions:
|
|
27
|
+
* - **Standard Videos**:
|
|
28
|
+
* - 3840x2160 (4K UHD): Width 3840px, Height 2160px.
|
|
29
|
+
* - 1920x1080 (Full HD): Width 1920px, Height 1080px.
|
|
30
|
+
* - 1280x720 (HD): Width 1280px, Height 720px.
|
|
31
|
+
* - **Document-Oriented Videos** (Portrait):
|
|
32
|
+
* - 3840x2160 (4K UHD): Width 3840px, Height 2160px.
|
|
33
|
+
* - 720x1280 (HD): Width 720px, Height 1280px.
|
|
34
|
+
* - 1440x2560 (2K): Width 1440px, Height 2560px.
|
|
35
|
+
*
|
|
36
|
+
*/
|
|
37
|
+
return async function sendVideo(options, threadId, type = Enum.ThreadType.User) {
|
|
38
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
39
|
+
let fileSize = 0;
|
|
40
|
+
const clientId = Date.now();
|
|
41
|
+
try {
|
|
42
|
+
const headResponse = await utils.request(options.videoUrl, { method: "HEAD" }, true);
|
|
43
|
+
if (headResponse.ok) {
|
|
44
|
+
fileSize = parseInt(headResponse.headers.get("content-length") || "0");
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
throw new ZaloApiError.ZaloApiError(`Unable to get video content: ${error instanceof Error ? error.message : String(error)}`);
|
|
49
|
+
}
|
|
50
|
+
const params = type === Enum.ThreadType.User
|
|
51
|
+
? {
|
|
52
|
+
toId: threadId,
|
|
53
|
+
clientId: String(clientId),
|
|
54
|
+
ttl: (_a = options.ttl) !== null && _a !== void 0 ? _a : 0,
|
|
55
|
+
zsource: 704,
|
|
56
|
+
msgType: 5,
|
|
57
|
+
msgInfo: JSON.stringify({
|
|
58
|
+
videoUrl: options.videoUrl,
|
|
59
|
+
thumbUrl: options.thumbnailUrl,
|
|
60
|
+
duration: (_b = options.duration) !== null && _b !== void 0 ? _b : 0,
|
|
61
|
+
width: (_c = options.width) !== null && _c !== void 0 ? _c : 1280,
|
|
62
|
+
height: (_d = options.height) !== null && _d !== void 0 ? _d : 720,
|
|
63
|
+
fileSize: fileSize,
|
|
64
|
+
properties: {
|
|
65
|
+
color: -1,
|
|
66
|
+
size: -1,
|
|
67
|
+
type: 1003,
|
|
68
|
+
subType: 0,
|
|
69
|
+
ext: {
|
|
70
|
+
sSrcType: -1,
|
|
71
|
+
sSrcStr: "",
|
|
72
|
+
msg_warning_type: 0,
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
title: (_e = options.msg) !== null && _e !== void 0 ? _e : "",
|
|
76
|
+
}),
|
|
77
|
+
imei: ctx.imei,
|
|
78
|
+
}
|
|
79
|
+
: {
|
|
80
|
+
grid: threadId,
|
|
81
|
+
visibility: 0,
|
|
82
|
+
clientId: String(clientId),
|
|
83
|
+
ttl: (_f = options.ttl) !== null && _f !== void 0 ? _f : 0,
|
|
84
|
+
zsource: 704,
|
|
85
|
+
msgType: 5,
|
|
86
|
+
msgInfo: JSON.stringify({
|
|
87
|
+
videoUrl: options.videoUrl,
|
|
88
|
+
thumbUrl: options.thumbnailUrl,
|
|
89
|
+
duration: (_g = options.duration) !== null && _g !== void 0 ? _g : 0,
|
|
90
|
+
width: (_h = options.width) !== null && _h !== void 0 ? _h : 1280,
|
|
91
|
+
height: (_j = options.height) !== null && _j !== void 0 ? _j : 720,
|
|
92
|
+
fileSize: fileSize,
|
|
93
|
+
properties: {
|
|
94
|
+
color: -1,
|
|
95
|
+
size: -1,
|
|
96
|
+
type: 1003,
|
|
97
|
+
subType: 0,
|
|
98
|
+
ext: {
|
|
99
|
+
sSrcType: -1,
|
|
100
|
+
sSrcStr: "",
|
|
101
|
+
msg_warning_type: 0,
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
title: (_k = options.msg) !== null && _k !== void 0 ? _k : "",
|
|
105
|
+
}),
|
|
106
|
+
imei: ctx.imei,
|
|
107
|
+
};
|
|
108
|
+
// @TODO: later
|
|
109
|
+
// if (typeof message !== "string" && message.mention) {
|
|
110
|
+
// params.mentionInfo = message.mention;
|
|
111
|
+
// }
|
|
112
|
+
if (type !== Enum.ThreadType.User && type !== Enum.ThreadType.Group) {
|
|
113
|
+
throw new ZaloApiError.ZaloApiError("Thread type is invalid");
|
|
114
|
+
}
|
|
115
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
116
|
+
if (!encryptedParams)
|
|
117
|
+
throw new ZaloApiError.ZaloApiError("Failed to encrypt params");
|
|
118
|
+
const response = await utils.request(serviceURL[type], {
|
|
119
|
+
method: "POST",
|
|
120
|
+
body: new URLSearchParams({
|
|
121
|
+
params: encryptedParams,
|
|
122
|
+
}),
|
|
123
|
+
});
|
|
124
|
+
return utils.resolve(response);
|
|
125
|
+
};
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
exports.sendVideoFactory = sendVideoFactory;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var ZaloApiError = require('../Errors/ZaloApiError.cjs');
|
|
4
|
+
var Enum = require('../models/Enum.cjs');
|
|
5
|
+
require('../models/FriendEvent.cjs');
|
|
6
|
+
require('../models/GroupEvent.cjs');
|
|
7
|
+
require('../models/Reaction.cjs');
|
|
8
|
+
require('../models/ZBusiness.cjs');
|
|
9
|
+
require('../models/AutoReply.cjs');
|
|
10
|
+
var utils = require('../utils.cjs');
|
|
11
|
+
|
|
12
|
+
const sendVoiceFactory = utils.apiFactory()((api, ctx, utils) => {
|
|
13
|
+
const serviceURL = {
|
|
14
|
+
[Enum.ThreadType.User]: utils.makeURL(`${api.zpwServiceMap.file[0]}/api/message/forward`),
|
|
15
|
+
[Enum.ThreadType.Group]: utils.makeURL(`${api.zpwServiceMap.file[0]}/api/group/forward`),
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Send a voice to a User - Group
|
|
19
|
+
*
|
|
20
|
+
* @param options voice options
|
|
21
|
+
* @param threadId ID of the user or group to send the voice to
|
|
22
|
+
* @param type Type of thread, default user
|
|
23
|
+
*
|
|
24
|
+
* @throws ZaloApiError
|
|
25
|
+
*/
|
|
26
|
+
return async function sendVoice(options, threadId, type = Enum.ThreadType.User) {
|
|
27
|
+
var _a, _b;
|
|
28
|
+
let fileSize = null;
|
|
29
|
+
const clientId = Date.now().toString();
|
|
30
|
+
try {
|
|
31
|
+
const headResponse = await utils.request(options.voiceUrl, { method: "HEAD" }, true);
|
|
32
|
+
if (headResponse.ok) {
|
|
33
|
+
fileSize = parseInt(headResponse.headers.get("content-length") || "0");
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
throw new ZaloApiError.ZaloApiError(`Unable to get voice content: ${error instanceof Error ? error.message : String(error)}`);
|
|
38
|
+
}
|
|
39
|
+
const params = type === Enum.ThreadType.User
|
|
40
|
+
? {
|
|
41
|
+
toId: threadId,
|
|
42
|
+
ttl: (_a = options.ttl) !== null && _a !== void 0 ? _a : 0,
|
|
43
|
+
zsource: -1,
|
|
44
|
+
msgType: 3,
|
|
45
|
+
clientId: clientId,
|
|
46
|
+
msgInfo: JSON.stringify({
|
|
47
|
+
voiceUrl: options.voiceUrl,
|
|
48
|
+
m4aUrl: options.voiceUrl,
|
|
49
|
+
fileSize: fileSize !== null && fileSize !== void 0 ? fileSize : 0,
|
|
50
|
+
}),
|
|
51
|
+
imei: ctx.imei,
|
|
52
|
+
}
|
|
53
|
+
: {
|
|
54
|
+
grid: threadId,
|
|
55
|
+
visibility: 0,
|
|
56
|
+
ttl: (_b = options.ttl) !== null && _b !== void 0 ? _b : 0,
|
|
57
|
+
zsource: -1,
|
|
58
|
+
msgType: 3,
|
|
59
|
+
clientId: clientId,
|
|
60
|
+
msgInfo: JSON.stringify({
|
|
61
|
+
voiceUrl: options.voiceUrl,
|
|
62
|
+
m4aUrl: options.voiceUrl,
|
|
63
|
+
fileSize: fileSize !== null && fileSize !== void 0 ? fileSize : 0,
|
|
64
|
+
}),
|
|
65
|
+
imei: ctx.imei,
|
|
66
|
+
};
|
|
67
|
+
if (type !== Enum.ThreadType.User && type !== Enum.ThreadType.Group) {
|
|
68
|
+
throw new ZaloApiError.ZaloApiError("Thread type is invalid");
|
|
69
|
+
}
|
|
70
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
71
|
+
if (!encryptedParams)
|
|
72
|
+
throw new ZaloApiError.ZaloApiError("Failed to encrypt params");
|
|
73
|
+
const response = await utils.request(serviceURL[type], {
|
|
74
|
+
method: "POST",
|
|
75
|
+
body: new URLSearchParams({
|
|
76
|
+
params: encryptedParams,
|
|
77
|
+
}),
|
|
78
|
+
});
|
|
79
|
+
return utils.resolve(response);
|
|
80
|
+
};
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
exports.sendVoiceFactory = sendVoiceFactory;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var ZaloApiError = require('../Errors/ZaloApiError.cjs');
|
|
4
|
+
var Enum = require('../models/Enum.cjs');
|
|
5
|
+
require('../models/FriendEvent.cjs');
|
|
6
|
+
require('../models/GroupEvent.cjs');
|
|
7
|
+
require('../models/Reaction.cjs');
|
|
8
|
+
require('../models/ZBusiness.cjs');
|
|
9
|
+
require('../models/AutoReply.cjs');
|
|
10
|
+
var utils = require('../utils.cjs');
|
|
11
|
+
|
|
12
|
+
const setHiddenConversationsFactory = utils.apiFactory()((api, ctx, utils) => {
|
|
13
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.conversation[0]}/api/hiddenconvers/add-remove`);
|
|
14
|
+
/**
|
|
15
|
+
* Set hidden conversation
|
|
16
|
+
*
|
|
17
|
+
* @param hidden - Whether to hide or unhide the conversation
|
|
18
|
+
* @param threadId Thread ID
|
|
19
|
+
* @param type Thread type (User/Group)
|
|
20
|
+
*
|
|
21
|
+
* @throws ZaloApiError
|
|
22
|
+
*/
|
|
23
|
+
return async function setHiddenConversations(hidden, threadId, type = Enum.ThreadType.User) {
|
|
24
|
+
const params = {
|
|
25
|
+
[hidden ? "add_threads" : "del_threads"]: JSON.stringify([
|
|
26
|
+
{
|
|
27
|
+
thread_id: threadId,
|
|
28
|
+
is_group: type === Enum.ThreadType.Group ? 1 : 0,
|
|
29
|
+
},
|
|
30
|
+
]),
|
|
31
|
+
[hidden ? "del_threads" : "add_threads"]: "[]",
|
|
32
|
+
imei: ctx.imei,
|
|
33
|
+
};
|
|
34
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
35
|
+
if (!encryptedParams)
|
|
36
|
+
throw new ZaloApiError.ZaloApiError("Failed to encrypt params");
|
|
37
|
+
const response = await utils.request(serviceURL, {
|
|
38
|
+
method: "POST",
|
|
39
|
+
body: new URLSearchParams({
|
|
40
|
+
params: encryptedParams,
|
|
41
|
+
}),
|
|
42
|
+
});
|
|
43
|
+
return utils.resolve(response);
|
|
44
|
+
};
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
exports.setHiddenConversationsFactory = setHiddenConversationsFactory;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var ZaloApiError = require('../Errors/ZaloApiError.cjs');
|
|
4
|
+
var Enum = require('../models/Enum.cjs');
|
|
5
|
+
require('../models/FriendEvent.cjs');
|
|
6
|
+
require('../models/GroupEvent.cjs');
|
|
7
|
+
require('../models/Reaction.cjs');
|
|
8
|
+
require('../models/ZBusiness.cjs');
|
|
9
|
+
require('../models/AutoReply.cjs');
|
|
10
|
+
var utils = require('../utils.cjs');
|
|
11
|
+
|
|
12
|
+
exports.MuteDuration = void 0;
|
|
13
|
+
(function (MuteDuration) {
|
|
14
|
+
MuteDuration[MuteDuration["ONE_HOUR"] = 3600] = "ONE_HOUR";
|
|
15
|
+
MuteDuration[MuteDuration["FOUR_HOURS"] = 14400] = "FOUR_HOURS";
|
|
16
|
+
MuteDuration[MuteDuration["FOREVER"] = -1] = "FOREVER";
|
|
17
|
+
MuteDuration["UNTIL_8AM"] = "until8AM";
|
|
18
|
+
})(exports.MuteDuration || (exports.MuteDuration = {}));
|
|
19
|
+
exports.MuteAction = void 0;
|
|
20
|
+
(function (MuteAction) {
|
|
21
|
+
MuteAction[MuteAction["MUTE"] = 1] = "MUTE";
|
|
22
|
+
MuteAction[MuteAction["UNMUTE"] = 3] = "UNMUTE";
|
|
23
|
+
})(exports.MuteAction || (exports.MuteAction = {}));
|
|
24
|
+
const setMuteFactory = utils.apiFactory()((api, ctx, utils) => {
|
|
25
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.profile[0]}/api/social/profile/setmute`);
|
|
26
|
+
/**
|
|
27
|
+
* Set mute
|
|
28
|
+
*
|
|
29
|
+
* @param params - Mute parameters
|
|
30
|
+
* @param threadID - ID of the thread to mute
|
|
31
|
+
* @param type - Type of thread (User or Group)
|
|
32
|
+
*
|
|
33
|
+
* @throws ZaloApiError
|
|
34
|
+
*/
|
|
35
|
+
return async function setMute(params = {}, threadID, type = Enum.ThreadType.User) {
|
|
36
|
+
const { duration = exports.MuteDuration.FOREVER, action = exports.MuteAction.MUTE } = params;
|
|
37
|
+
let muteDuration;
|
|
38
|
+
if (action === exports.MuteAction.UNMUTE) {
|
|
39
|
+
muteDuration = -1;
|
|
40
|
+
}
|
|
41
|
+
else if (duration === exports.MuteDuration.FOREVER) {
|
|
42
|
+
muteDuration = -1;
|
|
43
|
+
}
|
|
44
|
+
else if (duration === exports.MuteDuration.UNTIL_8AM) {
|
|
45
|
+
const now = new Date();
|
|
46
|
+
const next8AM = new Date(now);
|
|
47
|
+
next8AM.setHours(8, 0, 0, 0);
|
|
48
|
+
if (now.getHours() >= 8) {
|
|
49
|
+
next8AM.setDate(next8AM.getDate() + 1);
|
|
50
|
+
}
|
|
51
|
+
muteDuration = Math.floor((next8AM.getTime() - now.getTime()) / 1000);
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
muteDuration = duration;
|
|
55
|
+
}
|
|
56
|
+
const requestParams = {
|
|
57
|
+
toid: threadID,
|
|
58
|
+
duration: muteDuration,
|
|
59
|
+
action: action,
|
|
60
|
+
startTime: Math.floor(Date.now() / 1000),
|
|
61
|
+
muteType: type === Enum.ThreadType.User ? 1 : 2,
|
|
62
|
+
imei: ctx.imei,
|
|
63
|
+
};
|
|
64
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(requestParams));
|
|
65
|
+
if (!encryptedParams)
|
|
66
|
+
throw new ZaloApiError.ZaloApiError("Failed to encrypt params");
|
|
67
|
+
const response = await utils.request(serviceURL, {
|
|
68
|
+
method: "POST",
|
|
69
|
+
body: new URLSearchParams({
|
|
70
|
+
params: encryptedParams,
|
|
71
|
+
}),
|
|
72
|
+
});
|
|
73
|
+
return utils.resolve(response);
|
|
74
|
+
};
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
exports.setMuteFactory = setMuteFactory;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var ZaloApiError = require('../Errors/ZaloApiError.cjs');
|
|
4
|
+
var Enum = require('../models/Enum.cjs');
|
|
5
|
+
require('../models/FriendEvent.cjs');
|
|
6
|
+
require('../models/GroupEvent.cjs');
|
|
7
|
+
require('../models/Reaction.cjs');
|
|
8
|
+
require('../models/ZBusiness.cjs');
|
|
9
|
+
require('../models/AutoReply.cjs');
|
|
10
|
+
var utils = require('../utils.cjs');
|
|
11
|
+
|
|
12
|
+
const setPinnedConversationsFactory = utils.apiFactory()((api, _, utils) => {
|
|
13
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.conversation[0]}/api/pinconvers/updatev2`);
|
|
14
|
+
/**
|
|
15
|
+
* Pin and unpin conversations of threads)
|
|
16
|
+
*
|
|
17
|
+
* @param pinned Should pin conversations
|
|
18
|
+
* @param threadId The ID(s) of the thread
|
|
19
|
+
* @param type Type of thread, default User
|
|
20
|
+
*
|
|
21
|
+
* @throws ZaloApiError
|
|
22
|
+
*
|
|
23
|
+
*/
|
|
24
|
+
return async function setPinnedConversations(pinned, threadId, type = Enum.ThreadType.User) {
|
|
25
|
+
if (typeof threadId == "string")
|
|
26
|
+
threadId = [threadId];
|
|
27
|
+
const params = {
|
|
28
|
+
actionType: pinned ? 1 : 2,
|
|
29
|
+
conversations: type == Enum.ThreadType.Group ? threadId.map((id) => `g${id}`) : threadId.map((id) => `u${id}`),
|
|
30
|
+
};
|
|
31
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
32
|
+
if (!encryptedParams)
|
|
33
|
+
throw new ZaloApiError.ZaloApiError("Failed to encrypt params");
|
|
34
|
+
const response = await utils.request(serviceURL, {
|
|
35
|
+
method: "POST",
|
|
36
|
+
body: new URLSearchParams({
|
|
37
|
+
params: encryptedParams,
|
|
38
|
+
}),
|
|
39
|
+
});
|
|
40
|
+
return utils.resolve(response);
|
|
41
|
+
};
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
exports.setPinnedConversationsFactory = setPinnedConversationsFactory;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var ZaloApiError = require('../Errors/ZaloApiError.cjs');
|
|
4
|
+
var utils = require('../utils.cjs');
|
|
5
|
+
|
|
6
|
+
const unblockUserFactory = utils.apiFactory()((api, ctx, utils) => {
|
|
7
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.friend[0]}/api/friend/unblock`);
|
|
8
|
+
/**
|
|
9
|
+
* Unblock a User
|
|
10
|
+
*
|
|
11
|
+
* @param userId The ID of the User to unblock
|
|
12
|
+
*
|
|
13
|
+
* @throws ZaloApiError
|
|
14
|
+
*/
|
|
15
|
+
return async function unblockUser(userId) {
|
|
16
|
+
const params = {
|
|
17
|
+
fid: userId,
|
|
18
|
+
imei: ctx.imei,
|
|
19
|
+
};
|
|
20
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
21
|
+
if (!encryptedParams)
|
|
22
|
+
throw new ZaloApiError.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
|
+
});
|
|
32
|
+
|
|
33
|
+
exports.unblockUserFactory = unblockUserFactory;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var ZaloApiError = require('../Errors/ZaloApiError.cjs');
|
|
4
|
+
var Enum = require('../models/Enum.cjs');
|
|
5
|
+
require('../models/FriendEvent.cjs');
|
|
6
|
+
require('../models/GroupEvent.cjs');
|
|
7
|
+
require('../models/Reaction.cjs');
|
|
8
|
+
require('../models/ZBusiness.cjs');
|
|
9
|
+
require('../models/AutoReply.cjs');
|
|
10
|
+
var utils = require('../utils.cjs');
|
|
11
|
+
|
|
12
|
+
const undoFactory = utils.apiFactory()((api, ctx, utils) => {
|
|
13
|
+
const URLType = {
|
|
14
|
+
[Enum.ThreadType.User]: utils.makeURL(`${api.zpwServiceMap.chat[0]}/api/message/undo`),
|
|
15
|
+
[Enum.ThreadType.Group]: utils.makeURL(`${api.zpwServiceMap.group[0]}/api/group/undomsg`),
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Undo a message
|
|
19
|
+
*
|
|
20
|
+
* @param payload Undo payload containing message ID and client message ID
|
|
21
|
+
* @param threadId group or user id
|
|
22
|
+
* @param type Message type (User or Group), default is User
|
|
23
|
+
*
|
|
24
|
+
* @throws ZaloApiError
|
|
25
|
+
*/
|
|
26
|
+
return async function undo(payload, threadId, type = Enum.ThreadType.User) {
|
|
27
|
+
const params = {
|
|
28
|
+
msgId: payload.msgId,
|
|
29
|
+
clientId: Date.now(),
|
|
30
|
+
cliMsgIdUndo: payload.cliMsgId,
|
|
31
|
+
};
|
|
32
|
+
if (type == Enum.ThreadType.Group) {
|
|
33
|
+
params["grid"] = threadId;
|
|
34
|
+
params["visibility"] = 0;
|
|
35
|
+
params["imei"] = ctx.imei;
|
|
36
|
+
}
|
|
37
|
+
else
|
|
38
|
+
params["toid"] = threadId;
|
|
39
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
40
|
+
if (!encryptedParams)
|
|
41
|
+
throw new ZaloApiError.ZaloApiError("Failed to encrypt message");
|
|
42
|
+
const response = await utils.request(URLType[type], {
|
|
43
|
+
method: "POST",
|
|
44
|
+
body: new URLSearchParams({
|
|
45
|
+
params: encryptedParams,
|
|
46
|
+
}),
|
|
47
|
+
});
|
|
48
|
+
return utils.resolve(response);
|
|
49
|
+
};
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
exports.undoFactory = undoFactory;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var ZaloApiError = require('../Errors/ZaloApiError.cjs');
|
|
4
|
+
var utils = require('../utils.cjs');
|
|
5
|
+
|
|
6
|
+
const undoFriendRequestFactory = utils.apiFactory()((api, _ctx, utils) => {
|
|
7
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.friend[0]}/api/friend/undo`);
|
|
8
|
+
/**
|
|
9
|
+
* Undo send a friend request to a user.
|
|
10
|
+
*
|
|
11
|
+
* @param options
|
|
12
|
+
*
|
|
13
|
+
* @throws ZaloApiError
|
|
14
|
+
*/
|
|
15
|
+
return async function undoFriendRequest(friendId) {
|
|
16
|
+
const params = {
|
|
17
|
+
fid: friendId,
|
|
18
|
+
};
|
|
19
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
20
|
+
if (!encryptedParams)
|
|
21
|
+
throw new ZaloApiError.ZaloApiError("Failed to encrypt params");
|
|
22
|
+
const response = await utils.request(serviceURL, {
|
|
23
|
+
method: "POST",
|
|
24
|
+
body: new URLSearchParams({
|
|
25
|
+
params: encryptedParams,
|
|
26
|
+
}),
|
|
27
|
+
});
|
|
28
|
+
return utils.resolve(response);
|
|
29
|
+
};
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
exports.undoFriendRequestFactory = undoFriendRequestFactory;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var ZaloApiError = require('../Errors/ZaloApiError.cjs');
|
|
4
|
+
var Enum = require('../models/Enum.cjs');
|
|
5
|
+
require('../models/FriendEvent.cjs');
|
|
6
|
+
require('../models/GroupEvent.cjs');
|
|
7
|
+
require('../models/Reaction.cjs');
|
|
8
|
+
require('../models/ZBusiness.cjs');
|
|
9
|
+
require('../models/AutoReply.cjs');
|
|
10
|
+
var utils = require('../utils.cjs');
|
|
11
|
+
|
|
12
|
+
exports.ChatTTL = void 0;
|
|
13
|
+
(function (ChatTTL) {
|
|
14
|
+
ChatTTL[ChatTTL["NO_DELETE"] = 0] = "NO_DELETE";
|
|
15
|
+
ChatTTL[ChatTTL["ONE_DAY"] = 86400000] = "ONE_DAY";
|
|
16
|
+
ChatTTL[ChatTTL["SEVEN_DAYS"] = 604800000] = "SEVEN_DAYS";
|
|
17
|
+
ChatTTL[ChatTTL["FOURTEEN_DAYS"] = 1209600000] = "FOURTEEN_DAYS";
|
|
18
|
+
})(exports.ChatTTL || (exports.ChatTTL = {}));
|
|
19
|
+
const updateAutoDeleteChatFactory = utils.apiFactory()((api, ctx, utils) => {
|
|
20
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.conversation[0]}/api/conv/autodelete/updateConvers`);
|
|
21
|
+
/**
|
|
22
|
+
* Auto delete chat
|
|
23
|
+
*
|
|
24
|
+
* @param ttl The time to live of the chat
|
|
25
|
+
* @param threadId The thread ID to auto delete chat
|
|
26
|
+
* @param type Type of thread (User or Group)
|
|
27
|
+
*
|
|
28
|
+
* @throws ZaloApiError
|
|
29
|
+
*/
|
|
30
|
+
return async function updateAutoDeleteChat(ttl, threadId, type = Enum.ThreadType.User) {
|
|
31
|
+
const params = {
|
|
32
|
+
threadId: threadId,
|
|
33
|
+
isGroup: type === Enum.ThreadType.Group ? 1 : 0,
|
|
34
|
+
ttl: ttl,
|
|
35
|
+
clientLang: ctx.language,
|
|
36
|
+
};
|
|
37
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
38
|
+
if (!encryptedParams)
|
|
39
|
+
throw new ZaloApiError.ZaloApiError("Failed to encrypt params");
|
|
40
|
+
const response = await utils.request(serviceURL, {
|
|
41
|
+
method: "POST",
|
|
42
|
+
body: new URLSearchParams({
|
|
43
|
+
params: encryptedParams,
|
|
44
|
+
}),
|
|
45
|
+
});
|
|
46
|
+
return utils.resolve(response);
|
|
47
|
+
};
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
exports.updateAutoDeleteChatFactory = updateAutoDeleteChatFactory;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var ZaloApiError = require('../Errors/ZaloApiError.cjs');
|
|
4
|
+
var utils = require('../utils.cjs');
|
|
5
|
+
|
|
6
|
+
const updateAutoReplyFactory = utils.apiFactory()((api, ctx, utils) => {
|
|
7
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.auto_reply[0]}/api/autoreply/update`);
|
|
8
|
+
/**
|
|
9
|
+
* Update auto reply
|
|
10
|
+
*
|
|
11
|
+
* @param payload payload
|
|
12
|
+
*
|
|
13
|
+
* @note this API used for zBusiness
|
|
14
|
+
* @throws ZaloApiError
|
|
15
|
+
*/
|
|
16
|
+
return async function updateAutoReply(payload) {
|
|
17
|
+
const uids = Array.isArray(payload.uids) ? payload.uids : [payload.uids];
|
|
18
|
+
const resultUids = payload.scope === 2 || payload.scope === 3 ? uids : [];
|
|
19
|
+
const params = {
|
|
20
|
+
cliLang: ctx.language,
|
|
21
|
+
enable: payload.isEnable,
|
|
22
|
+
content: payload.content,
|
|
23
|
+
startTime: payload.startTime,
|
|
24
|
+
endTime: payload.endTime,
|
|
25
|
+
recurrence: ["RRULE:FREQ=DAILY;"],
|
|
26
|
+
scope: payload.scope,
|
|
27
|
+
uids: resultUids,
|
|
28
|
+
};
|
|
29
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
30
|
+
if (!encryptedParams)
|
|
31
|
+
throw new ZaloApiError.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
|
+
});
|
|
41
|
+
|
|
42
|
+
exports.updateAutoReplyFactory = updateAutoReplyFactory;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var ZaloApiError = require('../Errors/ZaloApiError.cjs');
|
|
4
|
+
var utils = require('../utils.cjs');
|
|
5
|
+
|
|
6
|
+
const updateCatalogFactory = utils.apiFactory()((api, _, utils) => {
|
|
7
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.catalog[0]}/api/prodcatalog/catalog/update`);
|
|
8
|
+
/**
|
|
9
|
+
* Update catalog?
|
|
10
|
+
*
|
|
11
|
+
* @param payload payload
|
|
12
|
+
*
|
|
13
|
+
* @note this API is used for zBusiness
|
|
14
|
+
* @throws ZaloApiError
|
|
15
|
+
*/
|
|
16
|
+
return async function updateCatalog(payload) {
|
|
17
|
+
const params = {
|
|
18
|
+
catalog_id: payload.catalogId,
|
|
19
|
+
catalog_name: payload.catalogName,
|
|
20
|
+
catalog_photo: "", // "" is defaut don't upload photo
|
|
21
|
+
};
|
|
22
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
23
|
+
if (!encryptedParams)
|
|
24
|
+
throw new ZaloApiError.ZaloApiError("Failed to encrypt params");
|
|
25
|
+
const response = await utils.request(serviceURL, {
|
|
26
|
+
method: "POST",
|
|
27
|
+
body: new URLSearchParams({
|
|
28
|
+
params: encryptedParams,
|
|
29
|
+
}),
|
|
30
|
+
});
|
|
31
|
+
return utils.resolve(response);
|
|
32
|
+
};
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
exports.updateCatalogFactory = updateCatalogFactory;
|