@trungdlp/zca-js 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/CODE_OF_CONDUCT.md +163 -0
- package/CONTRIBUTING.md +470 -0
- package/LICENSE +21 -0
- package/README.md +225 -0
- package/SECURITY.md +83 -0
- package/dist/Errors/ZaloApiError.d.ts +4 -0
- package/dist/Errors/ZaloApiError.js +7 -0
- package/dist/Errors/ZaloApiLoginQRAborted.d.ts +4 -0
- package/dist/Errors/ZaloApiLoginQRAborted.js +7 -0
- package/dist/Errors/ZaloApiLoginQRDeclined.d.ts +4 -0
- package/dist/Errors/ZaloApiLoginQRDeclined.js +7 -0
- package/dist/Errors/ZaloApiMissingImageMetadataGetter.d.ts +4 -0
- package/dist/Errors/ZaloApiMissingImageMetadataGetter.js +7 -0
- package/dist/Errors/index.d.ts +4 -0
- package/dist/Errors/index.js +4 -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/addPollOptions.d.ts +14 -0
- package/dist/apis/addPollOptions.js +26 -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/createNote.d.ts +7 -0
- package/dist/apis/createNote.js +47 -0
- package/dist/apis/createPoll.d.ts +36 -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 +12 -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/deleteGroupInviteBox.d.ts +9 -0
- package/dist/apis/deleteGroupInviteBox.js +27 -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/editNote.d.ts +17 -0
- package/dist/apis/editNote.js +46 -0
- package/dist/apis/editReminder.d.ts +13 -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 +3 -0
- package/dist/apis/fetchAccountInfo.js +10 -0
- package/dist/apis/findUser.d.ts +3 -0
- package/dist/apis/findUser.js +41 -0
- package/dist/apis/findUserByUsername.d.ts +3 -0
- package/dist/apis/findUserByUsername.js +26 -0
- package/dist/apis/forwardMessage.d.ts +24 -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 +3 -0
- package/dist/apis/getAllFriends.js +33 -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/getAvatarUrlProfile.d.ts +6 -0
- package/dist/apis/getAvatarUrlProfile.js +29 -0
- package/dist/apis/getBizAccount.d.ts +24 -0
- package/dist/apis/getBizAccount.js +27 -0
- package/dist/apis/getCatalogList.d.ts +18 -0
- package/dist/apis/getCatalogList.js +32 -0
- package/dist/apis/getCloseFriends.d.ts +3 -0
- package/dist/apis/getCloseFriends.js +20 -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/getFriendOnlines.d.ts +10 -0
- package/dist/apis/getFriendOnlines.js +35 -0
- package/dist/apis/getFriendRecommendations.d.ts +42 -0
- package/dist/apis/getFriendRecommendations.js +27 -0
- package/dist/apis/getFriendRequestStatus.d.ts +8 -0
- package/dist/apis/getFriendRequestStatus.js +25 -0
- package/dist/apis/getFullAvatar.d.ts +5 -0
- package/dist/apis/getFullAvatar.js +25 -0
- package/dist/apis/getGroupBlockedMember.d.ts +23 -0
- package/dist/apis/getGroupBlockedMember.js +29 -0
- package/dist/apis/getGroupChatHistory.d.ts +8 -0
- package/dist/apis/getGroupChatHistory.js +36 -0
- package/dist/apis/getGroupInfo.d.ts +16 -0
- package/dist/apis/getGroupInfo.js +32 -0
- package/dist/apis/getGroupInviteBoxInfo.d.ts +32 -0
- package/dist/apis/getGroupInviteBoxInfo.js +38 -0
- package/dist/apis/getGroupInviteBoxList.d.ts +38 -0
- package/dist/apis/getGroupInviteBoxList.js +31 -0
- package/dist/apis/getGroupLinkDetail.d.ts +9 -0
- package/dist/apis/getGroupLinkDetail.js +25 -0
- package/dist/apis/getGroupLinkInfo.d.ts +34 -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 +7 -0
- package/dist/apis/getLabels.js +28 -0
- package/dist/apis/getListBoard.d.ts +21 -0
- package/dist/apis/getListBoard.js +45 -0
- package/dist/apis/getListReminder.d.ts +28 -0
- package/dist/apis/getListReminder.js +47 -0
- package/dist/apis/getMultiUsersByPhone.d.ts +5 -0
- package/dist/apis/getMultiUsersByPhone.js +38 -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 +11 -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 +20 -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/getQuickMessageList.d.ts +7 -0
- package/dist/apis/getQuickMessageList.js +24 -0
- package/dist/apis/getRelatedFriendGroup.d.ts +6 -0
- package/dist/apis/getRelatedFriendGroup.js +30 -0
- package/dist/apis/getReminder.d.ts +3 -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/getSearchSticker.d.ts +3 -0
- package/dist/apis/getSearchSticker.js +28 -0
- package/dist/apis/getSentFriendRequest.d.ts +18 -0
- package/dist/apis/getSentFriendRequest.js +24 -0
- package/dist/apis/getSettings.d.ts +3 -0
- package/dist/apis/getSettings.js +20 -0
- package/dist/apis/getStickerCategoryDetail.d.ts +3 -0
- package/dist/apis/getStickerCategoryDetail.js +24 -0
- package/dist/apis/getStickers.d.ts +1 -0
- package/dist/apis/getStickers.js +40 -0
- package/dist/apis/getStickersDetail.d.ts +3 -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 +8 -0
- package/dist/apis/getUserInfo.js +43 -0
- package/dist/apis/inviteUserToGroups.d.ts +10 -0
- package/dist/apis/inviteUserToGroups.js +30 -0
- package/dist/apis/joinGroupInviteBox.d.ts +2 -0
- package/dist/apis/joinGroupInviteBox.js +25 -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 +102 -0
- package/dist/apis/listen.js +425 -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 +365 -0
- package/dist/apis/parseLink.d.ts +21 -0
- package/dist/apis/parseLink.js +27 -0
- package/dist/apis/rejectFriendRequest.d.ts +2 -0
- package/dist/apis/rejectFriendRequest.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 +14 -0
- package/dist/apis/reviewPendingMemberRequest.js +38 -0
- package/dist/apis/sendBankCard.d.ts +9 -0
- package/dist/apis/sendBankCard.js +37 -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 +451 -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 +10 -0
- package/dist/apis/sendSticker.js +57 -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/setArchivedConversations.d.ts +10 -0
- package/dist/apis/setArchivedConversations.js +34 -0
- package/dist/apis/setHiddenConversations.d.ts +3 -0
- package/dist/apis/setHiddenConversations.js +39 -0
- package/dist/apis/setMute.d.ts +20 -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/sharePoll.d.ts +2 -0
- package/dist/apis/sharePoll.js +28 -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/updateActiveStatus.d.ts +4 -0
- package/dist/apis/updateActiveStatus.js +27 -0
- package/dist/apis/updateAutoDeleteChat.d.ts +9 -0
- package/dist/apis/updateAutoDeleteChat.js +40 -0
- package/dist/apis/updateAutoReply.d.ts +15 -0
- package/dist/apis/updateAutoReply.js +38 -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 +15 -0
- package/dist/apis/updateLabels.js +34 -0
- package/dist/apis/updateLang.d.ts +6 -0
- package/dist/apis/updateLang.js +30 -0
- package/dist/apis/updateProductCatalog.d.ts +25 -0
- package/dist/apis/updateProductCatalog.js +51 -0
- package/dist/apis/updateProfile.d.ts +20 -0
- package/dist/apis/updateProfile.js +43 -0
- package/dist/apis/updateQuickMessage.d.ts +11 -0
- package/dist/apis/updateQuickMessage.js +61 -0
- package/dist/apis/updateSettings.d.ts +16 -0
- package/dist/apis/updateSettings.js +90 -0
- package/dist/apis/updateStatus.d.ts +2 -0
- package/dist/apis/updateStatus.js +27 -0
- package/dist/apis/upgradeGroupCommunity.d.ts +2 -0
- package/dist/apis/upgradeGroupCommunity.js +27 -0
- package/dist/apis/uploadAttachment.d.ts +50 -0
- package/dist/apis/uploadAttachment.js +196 -0
- package/dist/apis/uploadProductPhoto.d.ts +14 -0
- package/dist/apis/uploadProductPhoto.js +50 -0
- package/dist/apis/votePoll.d.ts +5 -0
- package/dist/apis/votePoll.js +29 -0
- package/dist/apis.d.ts +299 -0
- package/dist/apis.js +299 -0
- package/dist/cjs/Errors/ZaloApiError.cjs +11 -0
- package/dist/cjs/Errors/ZaloApiLoginQRAborted.cjs +12 -0
- package/dist/cjs/Errors/ZaloApiLoginQRDeclined.cjs +12 -0
- package/dist/cjs/Errors/ZaloApiMissingImageMetadataGetter.cjs +12 -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/addPollOptions.cjs +31 -0
- package/dist/cjs/apis/addQuickMessage.cjs +65 -0
- package/dist/cjs/apis/addReaction.cjs +307 -0
- package/dist/cjs/apis/addUnreadMark.cjs +65 -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/createNote.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 +76 -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 +63 -0
- package/dist/cjs/apis/deleteGroupInviteBox.cjs +32 -0
- package/dist/cjs/apis/deleteMessage.cjs +65 -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/editNote.cjs +51 -0
- package/dist/cjs/apis/editReminder.cjs +74 -0
- package/dist/cjs/apis/enableGroupLink.cjs +30 -0
- package/dist/cjs/apis/fetchAccountInfo.cjs +15 -0
- package/dist/cjs/apis/findUser.cjs +46 -0
- package/dist/cjs/apis/findUserByUsername.cjs +31 -0
- package/dist/cjs/apis/forwardMessage.cjs +112 -0
- package/dist/cjs/apis/getAliasList.cjs +32 -0
- package/dist/cjs/apis/getAllFriends.cjs +38 -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/getAvatarUrlProfile.cjs +34 -0
- package/dist/cjs/apis/getBizAccount.cjs +32 -0
- package/dist/cjs/apis/getCatalogList.cjs +37 -0
- package/dist/cjs/apis/getCloseFriends.cjs +25 -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/getFriendOnlines.cjs +40 -0
- package/dist/cjs/apis/getFriendRecommendations.cjs +32 -0
- package/dist/cjs/apis/getFriendRequestStatus.cjs +30 -0
- package/dist/cjs/apis/getFullAvatar.cjs +30 -0
- package/dist/cjs/apis/getGroupBlockedMember.cjs +34 -0
- package/dist/cjs/apis/getGroupChatHistory.cjs +50 -0
- package/dist/cjs/apis/getGroupInfo.cjs +37 -0
- package/dist/cjs/apis/getGroupInviteBoxInfo.cjs +43 -0
- package/dist/cjs/apis/getGroupInviteBoxList.cjs +36 -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 +58 -0
- package/dist/cjs/apis/getListReminder.cjs +60 -0
- package/dist/cjs/apis/getMultiUsersByPhone.cjs +43 -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/getQuickMessageList.cjs +29 -0
- package/dist/cjs/apis/getRelatedFriendGroup.cjs +35 -0
- package/dist/cjs/apis/getReminder.cjs +30 -0
- package/dist/cjs/apis/getReminderResponses.cjs +29 -0
- package/dist/cjs/apis/getSearchSticker.cjs +33 -0
- package/dist/cjs/apis/getSentFriendRequest.cjs +29 -0
- package/dist/cjs/apis/getSettings.cjs +25 -0
- package/dist/cjs/apis/getStickerCategoryDetail.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 +48 -0
- package/dist/cjs/apis/inviteUserToGroups.cjs +35 -0
- package/dist/cjs/apis/joinGroupInviteBox.cjs +30 -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 +439 -0
- package/dist/cjs/apis/lockPoll.cjs +33 -0
- package/dist/cjs/apis/login.cjs +102 -0
- package/dist/cjs/apis/loginQR.cjs +370 -0
- package/dist/cjs/apis/parseLink.cjs +32 -0
- package/dist/cjs/apis/rejectFriendRequest.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 +53 -0
- package/dist/cjs/apis/removeUnreadMark.cjs +63 -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 +43 -0
- package/dist/cjs/apis/sendBankCard.cjs +50 -0
- package/dist/cjs/apis/sendCard.cjs +72 -0
- package/dist/cjs/apis/sendDeliveredEvent.cjs +68 -0
- package/dist/cjs/apis/sendFriendRequest.cjs +44 -0
- package/dist/cjs/apis/sendLink.cjs +74 -0
- package/dist/cjs/apis/sendMessage.cjs +464 -0
- package/dist/cjs/apis/sendReport.cjs +66 -0
- package/dist/cjs/apis/sendSeenEvent.cjs +76 -0
- package/dist/cjs/apis/sendSticker.cjs +70 -0
- package/dist/cjs/apis/sendTypingEvent.cjs +46 -0
- package/dist/cjs/apis/sendVideo.cjs +131 -0
- package/dist/cjs/apis/sendVoice.cjs +86 -0
- package/dist/cjs/apis/setArchivedConversations.cjs +39 -0
- package/dist/cjs/apis/setHiddenConversations.cjs +52 -0
- package/dist/cjs/apis/setMute.cjs +80 -0
- package/dist/cjs/apis/setPinnedConversations.cjs +47 -0
- package/dist/cjs/apis/sharePoll.cjs +33 -0
- package/dist/cjs/apis/unblockUser.cjs +33 -0
- package/dist/cjs/apis/undo.cjs +55 -0
- package/dist/cjs/apis/undoFriendRequest.cjs +32 -0
- package/dist/cjs/apis/updateActiveStatus.cjs +32 -0
- package/dist/cjs/apis/updateAutoDeleteChat.cjs +53 -0
- package/dist/cjs/apis/updateAutoReply.cjs +43 -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 +35 -0
- package/dist/cjs/apis/updateProductCatalog.cjs +56 -0
- package/dist/cjs/apis/updateProfile.cjs +48 -0
- package/dist/cjs/apis/updateQuickMessage.cjs +66 -0
- package/dist/cjs/apis/updateSettings.cjs +95 -0
- package/dist/cjs/apis/updateStatus.cjs +32 -0
- package/dist/cjs/apis/upgradeGroupCommunity.cjs +32 -0
- package/dist/cjs/apis/uploadAttachment.cjs +209 -0
- package/dist/cjs/apis/uploadProductPhoto.cjs +55 -0
- package/dist/cjs/apis/votePoll.cjs +34 -0
- package/dist/cjs/apis.cjs +304 -0
- package/dist/cjs/context.cjs +34 -0
- package/dist/cjs/index.cjs +149 -0
- package/dist/cjs/models/AutoReply.cjs +9 -0
- package/dist/cjs/models/Board.cjs +8 -0
- package/dist/cjs/models/DeliveredMessage.cjs +23 -0
- package/dist/cjs/models/Enum.cjs +253 -0
- package/dist/cjs/models/FriendEvent.cjs +87 -0
- package/dist/cjs/models/Group.cjs +13 -0
- package/dist/cjs/models/GroupEvent.cjs +94 -0
- package/dist/cjs/models/Message.cjs +35 -0
- package/dist/cjs/models/Reaction.cjs +74 -0
- package/dist/cjs/models/Reminder.cjs +9 -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 +39 -0
- package/dist/cjs/update.cjs +34 -0
- package/dist/cjs/utils.cjs +680 -0
- package/dist/cjs/zalo.cjs +112 -0
- package/dist/context.d.ts +179 -0
- package/dist/context.js +28 -0
- package/dist/index.d.ts +156 -0
- package/dist/index.js +13 -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 +60 -0
- package/dist/models/Board.js +6 -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 +247 -0
- package/dist/models/Enum.js +251 -0
- package/dist/models/FriendEvent.d.ts +107 -0
- package/dist/models/FriendEvent.js +83 -0
- package/dist/models/Group.d.ts +125 -0
- package/dist/models/Group.js +11 -0
- package/dist/models/GroupEvent.d.ts +178 -0
- package/dist/models/GroupEvent.js +90 -0
- package/dist/models/Label.d.ts +10 -0
- package/dist/models/Label.js +1 -0
- package/dist/models/Message.d.ts +91 -0
- package/dist/models/Message.js +29 -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 +51 -0
- package/dist/models/Reminder.js +7 -0
- package/dist/models/SeenMessage.d.ts +26 -0
- package/dist/models/SeenMessage.js +17 -0
- package/dist/models/Sticker.d.ts +27 -0
- package/dist/models/Sticker.js +1 -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/User.d.ts +62 -0
- package/dist/models/User.js +1 -0
- package/dist/models/ZBusiness.d.ts +22 -0
- package/dist/models/ZBusiness.js +35 -0
- package/dist/models/index.d.ts +21 -0
- package/dist/models/index.js +21 -0
- package/dist/update.d.ts +2 -0
- package/dist/update.js +29 -0
- package/dist/utils.d.ts +166 -0
- package/dist/utils.js +697 -0
- package/dist/zalo.d.ts +41 -0
- package/dist/zalo.js +107 -0
- package/eslint.config.js +21 -0
- package/index.d.ts +2 -0
- package/package.json +78 -0
- package/rollup.config.js +28 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ThreadType } from "../models/index.js";
|
|
2
|
+
export type RemoveUnreadMarkResponse = {
|
|
3
|
+
data: {
|
|
4
|
+
updateId: number;
|
|
5
|
+
};
|
|
6
|
+
status: number;
|
|
7
|
+
};
|
|
8
|
+
export declare const removeUnreadMarkFactory: (ctx: import("../context.js").ContextBase, api: import("../apis.js").API) => (threadId: string, type?: ThreadType) => Promise<RemoveUnreadMarkResponse>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { ZaloApiError } from "../Errors/ZaloApiError.js";
|
|
2
|
+
import { ThreadType } from "../models/index.js";
|
|
3
|
+
import { apiFactory } from "../utils.js";
|
|
4
|
+
export const removeUnreadMarkFactory = apiFactory()((api, ctx, utils) => {
|
|
5
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.conversation[0]}/api/conv/removeUnreadMark`);
|
|
6
|
+
/**
|
|
7
|
+
* Remove unread mark from conversation
|
|
8
|
+
*
|
|
9
|
+
* @param threadId Thread ID
|
|
10
|
+
* @param type Thread type (User/Group)
|
|
11
|
+
*
|
|
12
|
+
* @throws {ZaloApiError}
|
|
13
|
+
*/
|
|
14
|
+
return async function removeUnreadMark(threadId, type = ThreadType.User) {
|
|
15
|
+
const timestamp = Date.now();
|
|
16
|
+
const isGroup = type === ThreadType.Group;
|
|
17
|
+
const requestParams = {
|
|
18
|
+
param: JSON.stringify({
|
|
19
|
+
[isGroup ? "convsGroup" : "convsUser"]: [threadId],
|
|
20
|
+
[isGroup ? "convsUser" : "convsGroup"]: [],
|
|
21
|
+
[isGroup ? "convsGroupData" : "convsUserData"]: [
|
|
22
|
+
{
|
|
23
|
+
id: threadId,
|
|
24
|
+
ts: timestamp,
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
[isGroup ? "convsUserData" : "convsGroupData"]: [],
|
|
28
|
+
}),
|
|
29
|
+
};
|
|
30
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(requestParams));
|
|
31
|
+
if (!encryptedParams)
|
|
32
|
+
throw new ZaloApiError("Failed to encrypt params");
|
|
33
|
+
const response = await utils.request(serviceURL, {
|
|
34
|
+
method: "POST",
|
|
35
|
+
body: new URLSearchParams({
|
|
36
|
+
params: encryptedParams,
|
|
37
|
+
}),
|
|
38
|
+
});
|
|
39
|
+
return utils.resolve(response, (result) => {
|
|
40
|
+
const data = result.data;
|
|
41
|
+
if (typeof data.data === "string") {
|
|
42
|
+
return {
|
|
43
|
+
data: JSON.parse(data.data),
|
|
44
|
+
status: data.status,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
return result.data;
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
});
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export type RemoveUserFromGroupResponse = {
|
|
2
|
+
errorMembers: string[];
|
|
3
|
+
};
|
|
4
|
+
export declare const removeUserFromGroupFactory: (ctx: import("../context.js").ContextBase, api: import("../apis.js").API) => (memberId: string | string[], groupId: string) => Promise<RemoveUserFromGroupResponse>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ZaloApiError } from "../Errors/ZaloApiError.js";
|
|
2
|
+
import { apiFactory } from "../utils.js";
|
|
3
|
+
export const removeUserFromGroupFactory = apiFactory()((api, ctx, utils) => {
|
|
4
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.group[0]}/api/group/kickout`);
|
|
5
|
+
/**
|
|
6
|
+
* Remove user from existing group
|
|
7
|
+
*
|
|
8
|
+
* @param memberId User ID or list of user IDs to remove
|
|
9
|
+
* @param groupId Group ID
|
|
10
|
+
*
|
|
11
|
+
* @note Zalo might throw an error with code 165 if the user is not in the group, 166 if you don't have enough permissions or is not in the group
|
|
12
|
+
*
|
|
13
|
+
* @throws {ZaloApiError}
|
|
14
|
+
*/
|
|
15
|
+
return async function removeUserFromGroup(memberId, groupId) {
|
|
16
|
+
if (!Array.isArray(memberId))
|
|
17
|
+
memberId = [memberId];
|
|
18
|
+
const params = {
|
|
19
|
+
grid: groupId,
|
|
20
|
+
members: memberId,
|
|
21
|
+
imei: ctx.imei,
|
|
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,20 @@
|
|
|
1
|
+
import { ZaloApiError } from "../Errors/ZaloApiError.js";
|
|
2
|
+
import { apiFactory } from "../utils.js";
|
|
3
|
+
export const resetHiddenConversPinFactory = apiFactory()((api, _ctx, utils) => {
|
|
4
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.conversation[0]}/api/hiddenconvers/reset`);
|
|
5
|
+
/**
|
|
6
|
+
* Reset hidden conversation pin
|
|
7
|
+
*
|
|
8
|
+
* @throws {ZaloApiError}
|
|
9
|
+
*/
|
|
10
|
+
return async function resetHiddenConversPin() {
|
|
11
|
+
const params = {};
|
|
12
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
13
|
+
if (!encryptedParams)
|
|
14
|
+
throw new ZaloApiError("Failed to encrypt params");
|
|
15
|
+
const response = await utils.request(utils.makeURL(serviceURL, { params: encryptedParams }), {
|
|
16
|
+
method: "GET",
|
|
17
|
+
});
|
|
18
|
+
return utils.resolve(response);
|
|
19
|
+
};
|
|
20
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ZaloApiError } from "../Errors/ZaloApiError.js";
|
|
2
|
+
import { apiFactory } from "../utils.js";
|
|
3
|
+
export const reuseAvatarFactory = apiFactory()((api, ctx, utils) => {
|
|
4
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.profile[0]}/api/social/reuse-avatar`);
|
|
5
|
+
/**
|
|
6
|
+
* Reuse avatar
|
|
7
|
+
*
|
|
8
|
+
* @param photoId photo id from getAvatarList api
|
|
9
|
+
*
|
|
10
|
+
* @throws {ZaloApiError}
|
|
11
|
+
*/
|
|
12
|
+
return async function reuseAvatar(photoId) {
|
|
13
|
+
const params = {
|
|
14
|
+
photoId: photoId,
|
|
15
|
+
isPostSocial: 0,
|
|
16
|
+
imei: ctx.imei,
|
|
17
|
+
};
|
|
18
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
19
|
+
if (!encryptedParams)
|
|
20
|
+
throw new ZaloApiError("Failed to encrypt params");
|
|
21
|
+
const response = await utils.request(utils.makeURL(serviceURL, { params: encryptedParams }), {
|
|
22
|
+
method: "GET",
|
|
23
|
+
});
|
|
24
|
+
return utils.resolve(response);
|
|
25
|
+
};
|
|
26
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type ReviewPendingMemberRequestPayload = {
|
|
2
|
+
members: string | string[];
|
|
3
|
+
isApprove: boolean;
|
|
4
|
+
};
|
|
5
|
+
export declare enum ReviewPendingMemberRequestStatus {
|
|
6
|
+
SUCCESS = 0,
|
|
7
|
+
NOT_IN_PENDING_LIST = 170,
|
|
8
|
+
ALREADY_IN_GROUP = 178,
|
|
9
|
+
INSUFFICIENT_PERMISSION = 166
|
|
10
|
+
}
|
|
11
|
+
export type ReviewPendingMemberRequestResponse = {
|
|
12
|
+
[memberId: string]: ReviewPendingMemberRequestStatus;
|
|
13
|
+
};
|
|
14
|
+
export declare const reviewPendingMemberRequestFactory: (ctx: import("../context.js").ContextBase, api: import("../apis.js").API) => (payload: ReviewPendingMemberRequestPayload, groupId: string) => Promise<ReviewPendingMemberRequestResponse>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ZaloApiError } from "../Errors/ZaloApiError.js";
|
|
2
|
+
import { apiFactory } from "../utils.js";
|
|
3
|
+
export var ReviewPendingMemberRequestStatus;
|
|
4
|
+
(function (ReviewPendingMemberRequestStatus) {
|
|
5
|
+
ReviewPendingMemberRequestStatus[ReviewPendingMemberRequestStatus["SUCCESS"] = 0] = "SUCCESS";
|
|
6
|
+
ReviewPendingMemberRequestStatus[ReviewPendingMemberRequestStatus["NOT_IN_PENDING_LIST"] = 170] = "NOT_IN_PENDING_LIST";
|
|
7
|
+
ReviewPendingMemberRequestStatus[ReviewPendingMemberRequestStatus["ALREADY_IN_GROUP"] = 178] = "ALREADY_IN_GROUP";
|
|
8
|
+
ReviewPendingMemberRequestStatus[ReviewPendingMemberRequestStatus["INSUFFICIENT_PERMISSION"] = 166] = "INSUFFICIENT_PERMISSION";
|
|
9
|
+
})(ReviewPendingMemberRequestStatus || (ReviewPendingMemberRequestStatus = {}));
|
|
10
|
+
export const reviewPendingMemberRequestFactory = apiFactory()((api, _, utils) => {
|
|
11
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.group[0]}/api/group/pending-mems/review`);
|
|
12
|
+
/**
|
|
13
|
+
* Review pending member(s) request
|
|
14
|
+
*
|
|
15
|
+
* @param payload - The payload containing data to review the pending member(s) request
|
|
16
|
+
* @param groupId - The id of the group to review the pending member(s) request
|
|
17
|
+
*
|
|
18
|
+
* @note Only the group leader and deputy group leader can review
|
|
19
|
+
*
|
|
20
|
+
* @throws {ZaloApiError}
|
|
21
|
+
*/
|
|
22
|
+
return async function reviewPendingMemberRequest(payload, groupId) {
|
|
23
|
+
if (!Array.isArray(payload.members))
|
|
24
|
+
payload.members = [payload.members];
|
|
25
|
+
const params = {
|
|
26
|
+
grid: groupId,
|
|
27
|
+
members: payload.members,
|
|
28
|
+
isApprove: payload.isApprove ? 1 : 0, // 1: approve, 0: reject
|
|
29
|
+
};
|
|
30
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
31
|
+
if (!encryptedParams)
|
|
32
|
+
throw new ZaloApiError("Failed to encrypt params");
|
|
33
|
+
const response = await utils.request(utils.makeURL(serviceURL, { params: encryptedParams }), {
|
|
34
|
+
method: "GET",
|
|
35
|
+
});
|
|
36
|
+
return utils.resolve(response);
|
|
37
|
+
};
|
|
38
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { BinBankCard } from "../models/index.js";
|
|
2
|
+
import { ThreadType } from "../models/index.js";
|
|
3
|
+
export type SendBankCardPayload = {
|
|
4
|
+
binBank: BinBankCard;
|
|
5
|
+
numAccBank: string;
|
|
6
|
+
nameAccBank?: string;
|
|
7
|
+
};
|
|
8
|
+
export type SendBankCardResponse = "";
|
|
9
|
+
export declare const sendBankCardFactory: (ctx: import("../context.js").ContextBase, api: import("../apis.js").API) => (payload: SendBankCardPayload, 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 sendBankCardFactory = apiFactory()((api, ctx, utils) => {
|
|
5
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.zimsg[0]}/api/transfer/card`);
|
|
6
|
+
/**
|
|
7
|
+
* Send bank card
|
|
8
|
+
*
|
|
9
|
+
* @param payload The payload containing the bank card information
|
|
10
|
+
* @param threadId The ID of the thread to send the bank card to
|
|
11
|
+
* @param type The type of thread to send the bank card to
|
|
12
|
+
*
|
|
13
|
+
* @throws {ZaloApiError}
|
|
14
|
+
*/
|
|
15
|
+
return async function sendBankCard(payload, threadId, type = ThreadType.User) {
|
|
16
|
+
var _a;
|
|
17
|
+
const params = {
|
|
18
|
+
binBank: payload.binBank,
|
|
19
|
+
numAccBank: payload.numAccBank,
|
|
20
|
+
nameAccBank: ((_a = payload.nameAccBank) === null || _a === void 0 ? void 0 : _a.toUpperCase()) || "---",
|
|
21
|
+
cliMsgId: Date.now().toString(),
|
|
22
|
+
tsMsg: Date.now(),
|
|
23
|
+
destUid: threadId,
|
|
24
|
+
destType: type === ThreadType.Group ? 1 : 0,
|
|
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,10 @@
|
|
|
1
|
+
import { ThreadType } from "../models/index.js";
|
|
2
|
+
export type SendCardOptions = {
|
|
3
|
+
userId: string;
|
|
4
|
+
phoneNumber?: string;
|
|
5
|
+
ttl?: number;
|
|
6
|
+
};
|
|
7
|
+
export type SendCardResponse = {
|
|
8
|
+
msgId: number;
|
|
9
|
+
};
|
|
10
|
+
export declare const sendCardFactory: (ctx: import("../context.js").ContextBase, api: import("../apis.js").API) => (options: SendCardOptions, threadId: string, type?: ThreadType) => Promise<SendCardResponse>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { ZaloApiError } from "../Errors/ZaloApiError.js";
|
|
2
|
+
import { ThreadType } from "../models/index.js";
|
|
3
|
+
import { apiFactory } from "../utils.js";
|
|
4
|
+
export const sendCardFactory = 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 card to a User - Group
|
|
11
|
+
*
|
|
12
|
+
* @param userId Unique ID for Card
|
|
13
|
+
* @param phoneNumber Optional phone number for sending card to a User
|
|
14
|
+
* @param ttl Time to live in milliseconds (default: 0)
|
|
15
|
+
* @param threadId ID of the conversation
|
|
16
|
+
* @param type Message type (User or GroupMessage)
|
|
17
|
+
*
|
|
18
|
+
* @throws {ZaloApiError}
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
21
|
+
return async function sendCard(options, threadId, type = ThreadType.User) {
|
|
22
|
+
var _a;
|
|
23
|
+
const data = await api.getQR(options.userId);
|
|
24
|
+
const QRCodeURL = data[options.userId];
|
|
25
|
+
const clientId = Date.now().toString();
|
|
26
|
+
const params = {
|
|
27
|
+
ttl: (_a = options.ttl) !== null && _a !== void 0 ? _a : 0,
|
|
28
|
+
msgType: 6,
|
|
29
|
+
clientId: clientId,
|
|
30
|
+
msgInfo: {
|
|
31
|
+
contactUid: options.userId,
|
|
32
|
+
qrCodeUrl: QRCodeURL,
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
if (options.phoneNumber) {
|
|
36
|
+
params.msgInfo.phone = options.phoneNumber;
|
|
37
|
+
}
|
|
38
|
+
if (type == ThreadType.Group) {
|
|
39
|
+
params.visibility = 0;
|
|
40
|
+
params.grid = threadId;
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
params.toId = threadId;
|
|
44
|
+
params.imei = ctx.imei;
|
|
45
|
+
}
|
|
46
|
+
const msgInfoStringified = JSON.stringify(params.msgInfo);
|
|
47
|
+
params.msgInfo = msgInfoStringified;
|
|
48
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
49
|
+
if (!encryptedParams)
|
|
50
|
+
throw new ZaloApiError("Failed to encrypt params");
|
|
51
|
+
const response = await utils.request(serviceURL[type], {
|
|
52
|
+
method: "POST",
|
|
53
|
+
body: new URLSearchParams({
|
|
54
|
+
params: encryptedParams,
|
|
55
|
+
}),
|
|
56
|
+
});
|
|
57
|
+
return utils.resolve(response);
|
|
58
|
+
};
|
|
59
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ThreadType } from "../models/index.js";
|
|
2
|
+
export type SendDeliveredEventResponse = "" | {
|
|
3
|
+
status: number;
|
|
4
|
+
};
|
|
5
|
+
export type SendDeliveredEventMessageParams = {
|
|
6
|
+
msgId: string;
|
|
7
|
+
cliMsgId: string;
|
|
8
|
+
uidFrom: string;
|
|
9
|
+
idTo: string;
|
|
10
|
+
msgType: string;
|
|
11
|
+
st: number;
|
|
12
|
+
at: number;
|
|
13
|
+
cmd: number;
|
|
14
|
+
ts: string | number;
|
|
15
|
+
};
|
|
16
|
+
export declare const sendDeliveredEventFactory: (ctx: import("../context.js").ContextBase, api: import("../apis.js").API) => (isSeen: boolean, messages: SendDeliveredEventMessageParams | SendDeliveredEventMessageParams[], type?: ThreadType) => Promise<SendDeliveredEventResponse>;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { ZaloApiError } from "../Errors/ZaloApiError.js";
|
|
2
|
+
import { MAX_MESSAGES_PER_SEND } from "../context.js";
|
|
3
|
+
import { ThreadType } from "../models/index.js";
|
|
4
|
+
import { apiFactory } from "../utils.js";
|
|
5
|
+
export const sendDeliveredEventFactory = apiFactory()((api, ctx, utils) => {
|
|
6
|
+
const serviceURL = {
|
|
7
|
+
[ThreadType.User]: utils.makeURL(`${api.zpwServiceMap.chat[0]}/api/message/deliveredv2`),
|
|
8
|
+
[ThreadType.Group]: utils.makeURL(`${api.zpwServiceMap.group[0]}/api/group/deliveredv2`),
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Send message delivered event
|
|
12
|
+
*
|
|
13
|
+
* @param isSeen Whether the message is seen or not
|
|
14
|
+
* @param messages List of messages to send delivered event
|
|
15
|
+
* @param type Messages type (User or Group), defaults to User
|
|
16
|
+
*
|
|
17
|
+
* @throws {ZaloApiError}
|
|
18
|
+
*/
|
|
19
|
+
return async function sendDeliveredEvent(isSeen, messages, type = ThreadType.User) {
|
|
20
|
+
if (!messages)
|
|
21
|
+
throw new ZaloApiError("messages are missing or not in a valid array format.");
|
|
22
|
+
if (!Array.isArray(messages))
|
|
23
|
+
messages = [messages];
|
|
24
|
+
if (messages.length === 0 || messages.length > MAX_MESSAGES_PER_SEND)
|
|
25
|
+
throw new ZaloApiError("messages must contain between 1 and 50 messages.");
|
|
26
|
+
// 27/02/2025
|
|
27
|
+
// This can send messages from multiple groups, but to prevent potential issues,
|
|
28
|
+
// we will restrict it to sending messages only within the same group.
|
|
29
|
+
const idTo = messages[0].idTo;
|
|
30
|
+
if (type === ThreadType.Group && !messages.every((msg) => msg.idTo === idTo))
|
|
31
|
+
throw new ZaloApiError("All messages must have the same idTo for Group thread");
|
|
32
|
+
const msgInfos = Object.assign({ seen: isSeen ? 1 : 0, data: messages.map((msg) => ({
|
|
33
|
+
cmi: msg.cliMsgId,
|
|
34
|
+
gmi: msg.msgId,
|
|
35
|
+
si: msg.uidFrom,
|
|
36
|
+
di: msg.idTo === ctx.uid ? "0" : msg.idTo,
|
|
37
|
+
mt: msg.msgType,
|
|
38
|
+
st: msg.st || 0 === msg.st ? 0 : -1,
|
|
39
|
+
at: msg.at || 0 === msg.at ? 0 : -1,
|
|
40
|
+
cmd: msg.cmd || 0 === msg.cmd ? 0 : -1,
|
|
41
|
+
ts: parseInt(`${msg.ts}`) || 0 === parseInt(`${msg.ts}`) ? 0 : -1,
|
|
42
|
+
})) }, (type === ThreadType.User ? {} : { grid: idTo }));
|
|
43
|
+
const params = Object.assign({ msgInfos: JSON.stringify(msgInfos) }, (type === ThreadType.User ? {} : { imei: ctx.imei }));
|
|
44
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
45
|
+
if (!encryptedParams)
|
|
46
|
+
throw new ZaloApiError("Failed to encrypt params");
|
|
47
|
+
const response = await utils.request(serviceURL[type], {
|
|
48
|
+
method: "POST",
|
|
49
|
+
body: new URLSearchParams({
|
|
50
|
+
params: encryptedParams,
|
|
51
|
+
}),
|
|
52
|
+
});
|
|
53
|
+
return utils.resolve(response);
|
|
54
|
+
};
|
|
55
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ZaloApiError } from "../Errors/ZaloApiError.js";
|
|
2
|
+
import { apiFactory } from "../utils.js";
|
|
3
|
+
export const sendFriendRequestFactory = apiFactory()((api, ctx, utils) => {
|
|
4
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.friend[0]}/api/friend/sendreq`);
|
|
5
|
+
/**
|
|
6
|
+
* Send a friend request to a user.
|
|
7
|
+
*
|
|
8
|
+
* @param msg message sent with friend request
|
|
9
|
+
* @param userId User ID to send friend request to
|
|
10
|
+
*
|
|
11
|
+
* @note Zalo might throw an error with code 225 if the user is already friends with you,
|
|
12
|
+
* 215 if the user might have blocked you,
|
|
13
|
+
* 222 if user has already sent you a friend request, your request will be treated as acceptance instead.
|
|
14
|
+
*
|
|
15
|
+
* @throws {ZaloApiError}
|
|
16
|
+
*/
|
|
17
|
+
return async function sendFriendRequest(msg, userId) {
|
|
18
|
+
const params = {
|
|
19
|
+
toid: userId,
|
|
20
|
+
msg: msg,
|
|
21
|
+
reqsrc: 30,
|
|
22
|
+
imei: ctx.imei,
|
|
23
|
+
language: ctx.language,
|
|
24
|
+
srcParams: JSON.stringify({
|
|
25
|
+
uidTo: userId,
|
|
26
|
+
}),
|
|
27
|
+
};
|
|
28
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
29
|
+
if (!encryptedParams)
|
|
30
|
+
throw new ZaloApiError("Failed to encrypt params");
|
|
31
|
+
const response = await utils.request(serviceURL, {
|
|
32
|
+
method: "POST",
|
|
33
|
+
body: new URLSearchParams({
|
|
34
|
+
params: encryptedParams,
|
|
35
|
+
}),
|
|
36
|
+
});
|
|
37
|
+
return utils.resolve(response);
|
|
38
|
+
};
|
|
39
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ThreadType } from "../models/index.js";
|
|
2
|
+
export type SendLinkOptions = {
|
|
3
|
+
msg?: string;
|
|
4
|
+
link: string;
|
|
5
|
+
ttl?: number;
|
|
6
|
+
};
|
|
7
|
+
export type SendLinkResponse = {
|
|
8
|
+
msgId: string;
|
|
9
|
+
};
|
|
10
|
+
export declare const sendLinkFactory: (ctx: import("../context.js").ContextBase, api: import("../apis.js").API) => (options: SendLinkOptions, threadId: string, type?: ThreadType) => Promise<SendLinkResponse>;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { ZaloApiError } from "../Errors/ZaloApiError.js";
|
|
2
|
+
import { ThreadType } from "../models/index.js";
|
|
3
|
+
import { apiFactory } from "../utils.js";
|
|
4
|
+
export const sendLinkFactory = apiFactory()((api, ctx, utils) => {
|
|
5
|
+
const serviceURL = {
|
|
6
|
+
[ThreadType.User]: utils.makeURL(`${api.zpwServiceMap.chat[0]}/api/message/link`, {
|
|
7
|
+
nretry: 0,
|
|
8
|
+
}),
|
|
9
|
+
[ThreadType.Group]: utils.makeURL(`${api.zpwServiceMap.group[0]}/api/group/sendlink`, {
|
|
10
|
+
nretry: 0,
|
|
11
|
+
}),
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Send link
|
|
15
|
+
*
|
|
16
|
+
* @param options Link and ttl
|
|
17
|
+
* @param threadId Thread ID
|
|
18
|
+
* @param type Thread type
|
|
19
|
+
*
|
|
20
|
+
* @throws {ZaloApiError}
|
|
21
|
+
*/
|
|
22
|
+
return async function sendLink(options, threadId, type = ThreadType.User) {
|
|
23
|
+
var _a;
|
|
24
|
+
const res = await api.parseLink(options.link);
|
|
25
|
+
const params = {
|
|
26
|
+
msg: options.msg && options.msg.trim()
|
|
27
|
+
? options.msg.includes(options.link)
|
|
28
|
+
? options.msg
|
|
29
|
+
: options.msg + " " + options.link
|
|
30
|
+
: options.link,
|
|
31
|
+
href: res.data.href,
|
|
32
|
+
src: res.data.src,
|
|
33
|
+
title: res.data.title,
|
|
34
|
+
desc: res.data.desc,
|
|
35
|
+
thumb: res.data.thumb,
|
|
36
|
+
type: 2, // 0
|
|
37
|
+
media: JSON.stringify(res.data.media),
|
|
38
|
+
ttl: (_a = options.ttl) !== null && _a !== void 0 ? _a : 0,
|
|
39
|
+
clientId: Date.now(),
|
|
40
|
+
};
|
|
41
|
+
if (type == ThreadType.Group) {
|
|
42
|
+
params.grid = threadId;
|
|
43
|
+
params.imei = ctx.imei;
|
|
44
|
+
// params.mentionInfo = "[]"; @TODO: implement this
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
params.toId = threadId;
|
|
48
|
+
params.mentionInfo = "";
|
|
49
|
+
}
|
|
50
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
51
|
+
if (!encryptedParams)
|
|
52
|
+
throw new ZaloApiError("Failed to encrypt params");
|
|
53
|
+
const response = await utils.request(serviceURL[type], {
|
|
54
|
+
method: "POST",
|
|
55
|
+
body: new URLSearchParams({
|
|
56
|
+
params: encryptedParams,
|
|
57
|
+
}),
|
|
58
|
+
});
|
|
59
|
+
return utils.resolve(response);
|
|
60
|
+
};
|
|
61
|
+
});
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { ThreadType, type TMessage, type AttachmentSource } from "../models/index.js";
|
|
2
|
+
export type SendMessageResult = {
|
|
3
|
+
msgId: number;
|
|
4
|
+
};
|
|
5
|
+
export type SendMessageResponse = {
|
|
6
|
+
message: SendMessageResult | null;
|
|
7
|
+
attachment: SendMessageResult[];
|
|
8
|
+
};
|
|
9
|
+
export type SendMessageQuote = {
|
|
10
|
+
content: TMessage["content"];
|
|
11
|
+
msgType: TMessage["msgType"];
|
|
12
|
+
propertyExt: TMessage["propertyExt"];
|
|
13
|
+
uidFrom: TMessage["uidFrom"];
|
|
14
|
+
msgId: TMessage["msgId"];
|
|
15
|
+
cliMsgId: TMessage["cliMsgId"];
|
|
16
|
+
ts: TMessage["ts"];
|
|
17
|
+
ttl: TMessage["ttl"];
|
|
18
|
+
};
|
|
19
|
+
export declare enum TextStyle {
|
|
20
|
+
Bold = "b",
|
|
21
|
+
Italic = "i",
|
|
22
|
+
Underline = "u",
|
|
23
|
+
StrikeThrough = "s",
|
|
24
|
+
Red = "c_db342e",
|
|
25
|
+
Orange = "c_f27806",
|
|
26
|
+
Yellow = "c_f7b503",
|
|
27
|
+
Green = "c_15a85f",
|
|
28
|
+
Small = "f_13",
|
|
29
|
+
Big = "f_18",
|
|
30
|
+
UnorderedList = "lst_1",
|
|
31
|
+
OrderedList = "lst_2",
|
|
32
|
+
Indent = "ind_$"
|
|
33
|
+
}
|
|
34
|
+
export type Style = {
|
|
35
|
+
start: number;
|
|
36
|
+
len: number;
|
|
37
|
+
st: Exclude<TextStyle, TextStyle.Indent>;
|
|
38
|
+
} | {
|
|
39
|
+
start: number;
|
|
40
|
+
len: number;
|
|
41
|
+
st: TextStyle.Indent;
|
|
42
|
+
/**
|
|
43
|
+
* Number of spaces used for indentation.
|
|
44
|
+
*/
|
|
45
|
+
indentSize?: number;
|
|
46
|
+
};
|
|
47
|
+
export declare enum Urgency {
|
|
48
|
+
Default = 0,
|
|
49
|
+
Important = 1,
|
|
50
|
+
Urgent = 2
|
|
51
|
+
}
|
|
52
|
+
export type Mention = {
|
|
53
|
+
/**
|
|
54
|
+
* mention position
|
|
55
|
+
*/
|
|
56
|
+
pos: number;
|
|
57
|
+
/**
|
|
58
|
+
* id of the mentioned user
|
|
59
|
+
*/
|
|
60
|
+
uid: string;
|
|
61
|
+
/**
|
|
62
|
+
* length of the mention
|
|
63
|
+
*/
|
|
64
|
+
len: number;
|
|
65
|
+
};
|
|
66
|
+
export type MessageContent = {
|
|
67
|
+
/**
|
|
68
|
+
* Text content of the message
|
|
69
|
+
*/
|
|
70
|
+
msg: string;
|
|
71
|
+
/**
|
|
72
|
+
* Text styles
|
|
73
|
+
*/
|
|
74
|
+
styles?: Style[];
|
|
75
|
+
/**
|
|
76
|
+
* Urgency of the message
|
|
77
|
+
*/
|
|
78
|
+
urgency?: Urgency;
|
|
79
|
+
/**
|
|
80
|
+
* Quoted message (optional)
|
|
81
|
+
*/
|
|
82
|
+
quote?: SendMessageQuote;
|
|
83
|
+
/**
|
|
84
|
+
* Mentions in the message (optional)
|
|
85
|
+
*/
|
|
86
|
+
mentions?: Mention[];
|
|
87
|
+
/**
|
|
88
|
+
* Attachments in the message (optional)
|
|
89
|
+
*/
|
|
90
|
+
attachments?: AttachmentSource | AttachmentSource[];
|
|
91
|
+
/**
|
|
92
|
+
* Time to live in milliseconds
|
|
93
|
+
*/
|
|
94
|
+
ttl?: number;
|
|
95
|
+
};
|
|
96
|
+
export declare const sendMessageFactory: (ctx: import("../context.js").ContextBase, api: import("../apis.js").API) => (message: MessageContent | string, threadId: string, type?: ThreadType) => Promise<{
|
|
97
|
+
message: SendMessageResult | null;
|
|
98
|
+
attachment: SendMessageResult[];
|
|
99
|
+
}>;
|