0

Using my gmail account I created an actions project in google console -> then created the intents in the dialogflow agent-> then enabled the webhook for the intents, then I included the server path where my webservice(written in node.js) is hosted under the fulfillment button available in Dialog flow agent.

But the webservice hosted on my server is not at all getting called. If I call the same webservice from the browser its getting called.

I am getting this below log in actions console:

"Webhook call failed. Error: Webhook response was empty."

app.js - -

var express = require('express')
  , https = require('https')
  , fs = require('fs')
  , path = require('path');

var app = express();

var  bodyParser = require('body-parser');
const {actionssdk,Image,} = require('actions-on-google');
const app2 = actionssdk();

//to display in console
app.get('*' , function (req, res, next) {
    console.log('Request URL:', req.originalUrl)
    next();
});

//intents created in my dialogflow
app2.intent('favourite_Color',function (conv, {color})  {
    var luckyNumber = color.length;
    conv.close('This is our lucky number - ' + luckyNumber);
});

app2.intent('call',function (conv, {contacts})  {
    console.log(contacts);
    console.log("call intent is triggered");
   conv.close('You are trying depu to call this person - ' + contacts);

app.use(bodyParser.json(),app2).listen(3000);

var options = {
            key:fs.readFileSync(pathIncluded),
            cert:fs.readFileSync(pathIncluded)
};

//this is the port I am trying to listen
https.createServer(options, app).listen(xxx, function(){
    console.log('Express server listening on port ' + xxx);
});
  • As per the error is fulfillment seems to be empty, can you paste your code or more logic? What are you seeing in the browser? – Vinay P Jul 26 '18 at 11:56
  • What @VinayP said. If you can update your question to show the code you're using, including what libraries you're using to develop the code, and the request, response, and debug tabs in the simulator, or other illustration of how you're testing it, it will significantly help. – Prisoner Jul 26 '18 at 12:43
  • If you're using Dialogflow, you should be requiring `dialogflow` instead of `actionssdk`. – Nick Felker Jul 27 '18 at 19:03
  • I tested with both dialogflow and actionssdk . But its not working for both. //actions sdk const {actionssdk,Image,} = require('actions-on-google'); const app2 = actionssdk(); //dialogflow sdk For actioonssdk I decalred: const {dialogflow,Image,} = require('actions-on-google'); const app2 = dialogflow(); – Dedeepya Salla Jul 28 '18 at 09:51

0 Answers0