Charles
Charles

Reputation: 1

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

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!

Upvotes: 0

Views: 333

Answers (1)

Prisoner
Prisoner

Reputation: 50731

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"
        }
      }
    ]
  }

Upvotes: 2

Related Questions