我正在尝试得到一个简单的webhook (用PHP编写),以便在google上使用对话流/操作。我有一个标记为"hello“的对话流意图,它链接到"google助手欢迎”和对话流“欢迎”事件。
它被设置为启用webhook,并且在对话流测试区域中一切正常工作。然而,当我在google助手中测试它时,我得到了以下错误:
"MalformedResponse无法将对话流响应解析为AppResponse。“
我不知道出了什么问题。下面是我的JSON响应:
{
"payload": {
"google": {
"expectUserResponse": false,
"richResponse": {
"items": {
"simpleResponse": {
"textToSpeech": "test speech"
}
}
}
}
},
"fulfillmentText": "fulfillment test"
}
谢谢!
发布于 2019-03-19 17:53:31
它在Dialogflow测试区中工作,因为它只测试响应的Dialogflow部分。它会忽略特定于平台的payload
区域下的所有内容。
您的有效负载包含一个小错误。richResponse
的items
属性应该是item对象的数组,即使您只发送一个对象。
因此,JSON的这一部分应该看起来更像:
"richResponse": {
"items": [
{
"simpleResponse": {
"textToSpeech": "test speech"
}
}
]
}
https://stackoverflow.com/questions/55224812
复制相似问题