问题
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