0

I'm trying to add API.AI middleware to my Botkit on Facebook Messenger.

However, it doesn't return anything from API.AI.

Anyone had success implementing API.AI with Botkit?

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

controller.hears(['apiai'],'message_received',apiai.hears,function(bot, message) {
    console.log('APIAI: ', message)
});

P.S. Here's the API.AI middleware https://github.com/abeai/botkit-middleware-apiai

shawnl
  • 1,861
  • 1
  • 15
  • 17

1 Answers1

0

I had the same problem. Had to figure out, that the first argument of controller.heares (in your case 'apiai') has to exactly match the intent's name on your apiai agent. The other problem you may have is logging the message object to the console. I'd eighter stringify

JSON.stringify(message)

it or log message.intent to the console. Hope This helps.

ParrapbanzZ
  • 252
  • 2
  • 8