add executeQuickReply to QR API

This commit is contained in:
LenAnderson 2023-12-28 01:28:28 +00:00
parent 03b80900d6
commit 8a3124e296
1 changed files with 15 additions and 0 deletions

View File

@ -66,6 +66,21 @@ export class QuickReplyApi {
}
}
/**
* Executes an existing quick reply.
*
* @param {String} setName name of the existing quick reply set
* @param {String} label label of the existing quick reply (text on the button)
* @param {Object} [args] optional arguments
*/
async executeQuickReply(setName, label, args = {}) {
const qr = this.getQrByLabel(setName, label);
if (!qr) {
throw new Error(`No quick reply with label "${label}" in set "${setName}" found.`);
}
return await qr.execute(args);
}
/**
* Adds or removes a quick reply set to the list of globally active quick reply sets.