UNPKG

@nguyennhuy/zalo-api

Version:

Unofficial Zalo API for JavaScript

31 lines (27 loc) 999 B
'use strict'; var ZaloApiError = require('../../Errors/ZaloApiError.cjs'); var utils = require('../../utils.cjs'); const getStickersSuggestionFactory = utils.apiFactory()((api, ctx, utils) => { const serviceURL = utils.makeURL(`${api.zpwServiceMap.sticker}/api/message/sticker/suggestion`); /** * Get stickers by keyword * * @param keyword Keyword to search for * @returns Sticker IDs * * @throws ZaloApiError */ return async function getStickersSuggestion() { const params = { emei: ctx.imei, }; const encryptedParams = utils.encodeAES(JSON.stringify(params)); if (!encryptedParams) throw new ZaloApiError.ZaloApiError("Failed to encrypt message"); const response = await utils.request(utils.makeURL(serviceURL, { params: encryptedParams, })); return utils.resolve(response); }; }); exports.getStickersSuggestionFactory = getStickersSuggestionFactory;