Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dialogflow v2 API + Actions v2 API: MalformedResponse 'final_response' must be set

I'm trying to start working on Google Actions v2 API together with Dialgoflow v2 API.

I have the following example (so far in Dialogflow -> Fulfillment Webhook) taken from official Google Actions Migration Guide , but unfortunately I keep getting MalformedResponse 'final_response' must be set error.

'use strict';

const functions = require('firebase-functions');
const { dialogflow } = require('actions-on-google');

const app = dialogflow();

app.intent('Default Welcome Intent', conv => {
  conv.ask('How are you?');
});

exports.dialogflowFirebaseFulfillment = functions.https.onRequest(app);

And response is:

{
  "responseMetadata": {
    "status": {
      "code": 13,
      "message": "Failed to parse Dialogflow response into AppResponse because of empty speech response",
      "details": [
        {
          "@type": "type.googleapis.com/google.protobuf.Value",
          "value": "{\"id\":\"542fe4a8-6017-429f-81c3-61ba568e3659\",\"timestamp\":\"2018-04-19T20:16:25.606Z\",\"lang\":\"en-us\",\"result\":{},\"status\":{\"code\":200,\"errorType\":\"success\"},\"sessionId\":\"1524168985362\"}"
        }
      ]
    }
  }
}

Please any idea why this can be happening?

like image 515
miro Avatar asked Apr 19 '18 20:04

miro


1 Answers

Change this line:

conv.ask('How are you?');

to this:

conv.close('How are you?');

the close method configures the required final_response field for you

like image 175
matthewayne Avatar answered Sep 18 '22 02:09

matthewayne