dialogflow / dialogflow-nodejs-client

Node.js SDK for Dialogflow
Apache License 2.0
659 stars 287 forks source link

After triggering eventRequest successfully, i do get proper response but my bot(Google assistant) doesnt say anything #98

Open mike1011 opened 6 years ago

mike1011 commented 6 years ago

i am adding a small logic of delay of 10 seconds and then triggering my event so that it can trigger my newly added intent to show updated message to the user.I am testing this will Google assistant and Nodejs SDK - api.

Below is my response after calling app.eventRequest(provided in the samples folder)


{ id: '9333180c-bb2e-4305-9a78-04ba89325936',
  timestamp: '2017-11-22T07:24:21.244Z',
  lang: 'en',
  result: 
   { source: 'agent',
     resolvedQuery: 'SHOW_RESULT',
     action: '',
     actionIncomplete: false,
     parameters: { name: [ 'Anand' ], state: [ 'Dispacthed' ] },
     contexts: 
      [ { name: 'location',
          parameters: 
           { 'name.original': '',
             date: '2017-11-23',
             'geo_city.original': 'Mountain View',
             'date.original': 'tomorrow',
             'state.original': '',
             name: [ 'Anand' ],
             geo_city: 'Mountain View',
             state: [ 'Dispacthed' ] },
          lifespan: 4 } ],
     metadata: 
      { intentId: '66b05cca-09de-4864-9685-37ea4ce6cb58',
        webhookUsed: 'false',
        webhookForSlotFillingUsed: 'false',
        intentName: 'result' },
     fulfillment: 
      { speech: 'Hi Anand, the status of the order is Dispacthed',
        messages: 
         [ { type: 'simple_response',
             platform: 'google',
             textToSpeech: 'Hi Anand, the status of the order is Dispacthed' },
           { type: 0,
             speech: 'Hi Anand, the status of the order is Dispacthed' } ] },
     score: 1 },
  status: { code: 200, errorType: 'success', webhookTimedOut: false },
  sessionId: '1511334800328' }

EventRequest code that triggers the above response.


var new_event = {

      "name":"SHOW_RESULT",
      "data":{
         "name":"Anand",
         "state":"Dispacthed"
      }

};

var options2 = {
    sessionId: sessionId
};

var request = api.eventRequest(new_event, options2);

request.on('response', function(response) {
    console.log(util.inspect(response, false, null));
});

request.on('error', function(error) {
    console.log(error);
});

request.end();

i can see the speech added but why this speech is not spoken or displayed on the Google Assistant.Everything is being displayed and spoken but not this eventRequest response.

Any help?