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

你说的曾经没有我的故事 提交于 2019-12-18 06:09:05

问题


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?


回答1:


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



来源:https://stackoverflow.com/questions/49929656/dialogflow-v2-api-actions-v2-api-malformedresponse-final-response-must-be-s

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!