What does “Failed to parse Dialogflow response into AppResponse.” mean in Actions on Google

不羁的心 提交于 2019-12-11 17:56:21

问题


I am trying to get a simple webhook (written in PHP) to work with dialogflow/actions on google. I have a dialog flow intent labled "hello" which is linked to the "google assistant welcome" and dialog flow "welcome" events.

it is set to enable webhook, and everything works correctly in the dialog flow test area. when i test it in google assistant, however, i get the following error:

"MalformedResponse Failed to parse Dialogflow response into AppResponse."

I have no clue what is wrong. Here is what my JSON response looks like:

{
  "payload": {
    "google": {
      "expectUserResponse": false,
      "richResponse": {
        "items": {
          "simpleResponse": {
            "textToSpeech": "test speech"
          }
        }
      }
    }
  },
  "fulfillmentText": "fulfillment test"
}

Thanks!


回答1:


It works in the Dialogflow test area because that just tests the Dialogflow portion of the response. It ignores anything under the platform-specific payload area.

Your payload contains a small error. The items property of the richResponse should be an array of item objects, even if you're only sending one.

So that part of your JSON should look more like:

  "richResponse": {
    "items": [
      {
        "simpleResponse": {
          "textToSpeech": "test speech"
        }
      }
    ]
  }


来源:https://stackoverflow.com/questions/55224812/what-does-failed-to-parse-dialogflow-response-into-appresponse-mean-in-action

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