botkit icon indicating copy to clipboard operation
botkit copied to clipboard

Middleware error API.ai

Open Razvan-Miereanu opened this issue 10 years ago • 5 comments

Working on a facebook bot for few days now, and just wanted to try the api.ai middleware, but no luck so far. Anyone else getting this error using https://github.com/abeai/botkit-middleware-apiai ?

ERROR IN RECEIVE MIDDLEWARE: [TypeError: The header content contains invalid characters]

Here's my code:

var apiai = require('botkit-middleware-apiai')({
    token: <my_apiai_token>
});

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

controller.hears(['test middleware'],'mesage_received',apiai.hears,function(bot, message) {
    console.log(JSON.stringify(message));
    console.log('test middleware');
    bot.reply(message, 'middleware test passed!');
});

Thanks, Raz.

Razvan-Miereanu avatar Nov 07 '16 20:11 Razvan-Miereanu

It seems the error ERROR IN RECEIVE MIDDLEWARE: [TypeError: The header content contains invalid characters] went away. Still i don't get a reply from Api.ai. Any ideas why?

Razvan-Miereanu avatar Nov 08 '16 03:11 Razvan-Miereanu

Still trying to get the api.ai middleware work with my facebook bot but haven't had much success. I can connect fine with api.ai , messages are being delivered to the api.ai console but i can't find out how to reply back to the user via bot.reply. Any suggestions/ideas? I'm really stuck with this one...

Razvan-Miereanu avatar Nov 12 '16 01:11 Razvan-Miereanu

You may want to try asking the question on dev4slack as well!

peterswimm avatar Nov 12 '16 14:11 peterswimm

Done! Cheers for that.

Razvan-Miereanu avatar Nov 12 '16 16:11 Razvan-Miereanu

You might not be able to reply because you didn't give a valid intent name to controller.hears. See https://github.com/abeai/botkit-middleware-apiai/issues/4.

simpixelated avatar Nov 26 '16 16:11 simpixelated