botkit-middleware-dialogflow icon indicating copy to clipboard operation
botkit-middleware-dialogflow copied to clipboard

Doesn't work action()

Open Ilchuk-Mihail opened this issue 6 years ago • 2 comments

DialogflowMiddleware.hears - works, but any trigger in action doesn't received.

Ilchuk-Mihail avatar Apr 23 '19 08:04 Ilchuk-Mihail

DialogflowMiddleware.hears - works, but any trigger in action doesn't received.

Can you provide an example please?

jschnurr avatar May 04 '19 22:05 jschnurr

I am getting the same issue.

facebook messenger: botkit v4.5

my-bot/features/dialogflow_action.js

const dialogflow = require('botkit-middleware-dialogflow')({
  keyFilename: './creds.json',  // service account private key file from Google Cloud Console
  structProtoToJson: true,
});
// action of the intent is: weather
module.exports = function(controller) {
  controller.hears('weather', 'direct_message,facebook_postback', dialogflow.action, async (bot, message) => {
    await bot.reply(message, 'action');    
  });
};

error:

(node:2984) UnhandledPromiseRejectionWarning: TypeError: data is not iterable
    at Object.exports.makeArrayOfRegex (c:\my-bot\node_modules\botkit-middleware-dialogflow\src\util.js:20:22)
    at Botkit.middleware.action (c:\my-bot\node_modules\botkit-middleware-dialogflow\src\botkit-middleware-dialogflow.js:64:32)
    at Botkit.<anonymous> (c:\my-bot\node_modules\botkit\lib\core.js:549:75)
    at Generator.next (<anonymous>)
    at fulfilled (c:\my-bot\node_modules\botkit\lib\core.js:4:58)
(node:2984) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)

jsalwen avatar Sep 30 '19 22:09 jsalwen