API.AI中间件与Botkit Facebook无响应

时间:2017-06-28 03:17:45

标签: node.js botkit

我正在尝试在Facebook Messenger上将API.AI中间件添加到我的Botkit。

但是,它不会从API.AI中返回任何内容。

有人用Botkit成功实现API.AI吗?

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

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

P.S。这是API.AI中间件https://github.com/abeai/botkit-middleware-apiai

1 个答案:

答案 0 :(得分: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.