-
Notifications
You must be signed in to change notification settings - Fork 252
Open
Description
I am trying to filter messages passed to the Watson. I followed the step to use the wrapper function.
const receiveMiddleware = (bot, message, next) => {
if (message.text && message.type == 'direct_message') {
watsonMiddleware.receive(bot, message, next);
} else {
next();
}
};
controller.middleware.receive.use(receiveMiddleware);
Receive function gets registered and it gets executed. Problem is that the following hears function doesn't get triggered. I made sure the intent is matching.
controller.hears(
async (message) => {
return message.watsonData && message.watsonData.intents.length > 0 && message.watsonData.intents[0].intent === 'General_Greetings'
},
'direct_message',
async function (bot, message) {
await bot.reply(message, message.watsonData.output.text.join('\n'));
}
);
Above mentioned hears function gets triggered fine with the following receive handler.
controller.middleware.receive.use(
watsonMiddleware.receive.bind(watsonMiddleware),
);
Metadata
Metadata
Assignees
Labels
No labels