botkit-middleware-dialogflow
botkit-middleware-dialogflow copied to clipboard
Problem accessing dialogflow intent with Botkit v4.0.1
Hello,
Awesome plugin. Worked great with Botkit 0.7.x. However, I am having trouble integrating with Botkit 4.x.x. I can't seem to access message.intent
when using the controller.hears
function. See below:
controller.on('message', async(bot, message) => {
console.log(message) // message contains message.intent
});
controller.hears('hello', 'message', async(bot, message) => {
console.log(message) // message does not contain message.intent
});
I am not sure what I could be messing. Hopefully you can help me out?
node: 8.11.2 botkit-middleware-dialogflow: 2.1.0 botkit: 4.0.1
I realized that if I change this:
controller.middleware.receive.use(dialogflowMiddleware.receive)
to:
controller.middleware.ingest.use(dialogflowMiddleware.receive)
Then my message.intent property is available. Are there any drawbacks of using ingest as opposed to receive?
Now there some issues with middleware pipeline in botkit, but using ingest is a good workaround. The biggest drawbacks is tha you are going to send ALL messages that you receive, even convos and for now I don't know how to handle it