0

I've created a FB chatbot with botkit and I'm trying to connect a dialogflow middleware.

For some reason, when I connect the middleware like so I don't get any response:

bot.js:

var dialogflowMiddleware = require('botkit-middleware-dialogflow')({
  token: process.env.dialogflow
});

controller.middleware.receive.use(dialogflowMiddleware.receive);

controller.hears('test', 'message_received', dialogflowMiddleware.hears, function(
    bot,
    message
) {
  console.log('MESSAGE:', message);
    bot.reply(message, 'Hello!');
});

Things I've done:

  • Use Dialogflow API v1
  • Use correct client access token
  • Corretly named my intent 'test'
  • Removed the middleware and tested it was working (to ensure problem is down to something else)
doctopus
  • 5,349
  • 8
  • 53
  • 105
  • Do you still facing this issue ? – Simon Franzen Jun 14 '18 at 12:18
  • 1
    Not anymore. I think the problem was that I was declaring the middleware after setting up the webserver : `var webserver = require(__dirname + '/components/express_webserver.js')(controller); ` – doctopus Jun 14 '18 at 14:41

0 Answers0