watson-developer-cloud / botkit-middleware

A middleware to connect Watson Conversation Service to different chat channels using Botkit
https://www.npmjs.com/package/botkit-middleware-watson
Apache License 2.0
207 stars 257 forks source link

intent matching not working as intended on controller.hears #206

Closed AutomataVM closed 4 years ago

AutomataVM commented 4 years ago

Hello! I wanted to know what's the problem with the controller.hears option, as it seems it isn't matching to the conversation I made. In Watson I have the intent "explanation" that matches each time the user wants one. On the other hand, In botkit, the controller.hears that corresponds to this handle is :

controller.hears( ['explain'], ['direct_message', 'direct_mention', 'mention','message'], watsonMiddleware.hear, async function(bot, message) { console.log('entre por explain'); await bot.reply(message, message.watsonData.output.text.join('\n'));

    },);

I have to mention I am using websockets. What could be the problem here?

Naktibalda commented 4 years ago

When Watson Assistant is used, there is no need to match intents in Botkit. Send all messages to Watson and reply with Watson responses.

AutomataVM commented 4 years ago

I see, so using

controller.hears( ['.*'], 'message', async function(bot, message) { ... is the intended way right?

Naktibalda commented 4 years ago

Actually I don't use controller.hears at all, I use controller.on('message', async function(bot, message) { });

In Botkit 0.7, correct event was message_received, probably I copied that approach from botkit-starter-web.

AutomataVM commented 4 years ago

Gotcha. Thank you!