Closed techpet closed 1 year ago
You can now use the following functionality to remove a listener for a specific bot:
(async () => {
const bot = createBot('from', 'token');
await bot.startExpressServer({ webhookVerifyToken: 'xx' });
const subscriptionToken = bot.on('message', async (msg) => {
console.log(msg);
});
// to unsubscribe:
bot.unsubscribe(subscriptionToken);
})();
I am trying to accomplish a multibot configuration in which bots could be created and deleted dynamically. Is there a way to destroy a bot or even unregister its webhookPath?