Webhook 响应不起作用 api.ai:无法从 http_response 上的操作解析 SDKResponse Google

Webhook response not working api.ai:Failed to parse SDKResponse from http_response Actions On Google

我正在使用 api.ai webhook 在 Google 实施上执行操作。我遵循此处记录的请求和响应格式

我从 webhook 发回的响应是

{
    "speech": "Ok I am doing the stuff",
    "displayText": "Ok I am doing the stuff",
    "data": {
        "google": {
            "expect_user_response": false,
            "is_ssml": false,
            "permissions_request": {
                "opt_context": "",
                "permissions": []
            }
        }
    },
    "contextOut": []
}

当我在 Google 家的 Web 模拟器上测试它时,它说 "Your Agent is not responding right now. Try again soon" 并有以下响应 JSON

{
    "response": "Car Bot isn’t responding right now. Try again soon.\n",
    "audioResponse": "//NExAASW..."content_copy,
    "debugInfo": {
        "sharedDebugInfo": [
            {
                "name": "ExecutionResponse",
                "debugInfo": "Failed to..."
            }
        ]
    }
} 

响应中的调试信息是

"Failed to parse SDKResponse from http_response: 'HTTP/1.1 200 OK\r\nContent-Type: application/json;charset=UTF-8\r\nContent-Length: 218\r\nConnection: keep-alive\r\nDate: Sun, 08 Jan 2017 21:47:00 GMT\r\nServer: nginx/1.11.2\r\nAccess-Control-Allow-Credentials: true\r\nAssistant-Interaction-Error-Code: 1\r\nAssistant-Interaction-Error-Message: Empty speech response\r\nCache-control: no-cache=\"set-cookie\"\r\nSet-Cookie: AWSELB=9D5B4D210CCFFAF1BE1E0CD7C7E6FCBD7B46140CAA45DBF2953C1CA6A2C5B5AD15740DAC3D9FC21AE7E6356E101785BA33F8274D819A39085F4BDBBE52D3F44CD1BB461230;PATH=/\r\nX-Cache: Miss from cloudfront\r\nVia: 1.1 51c76241371dfc20d25094a51b4759eb.cloudfront.net (CloudFront)\r\nX-Amz-Cf-Id: bP2EaYL-00IkMABSCWhwbaDr5GU7sIgC02OB-31LGojecexWQayetQ==\r\n\r\n{\"message\":\"Empty speech response\",\"apiResponse\":{\"id\":\"ac3551e9-1f71-4f38-8ef7-efa8acff78aa\",\"timestamp\":\"2017-01-08T21:47:00.191Z\",\"result\":{},\"status\":{\"code\":200,\"errorType\":\"success\"},\"sessionId\":\"1483912013331\"}}'"

我没明白这里有什么问题。

更新:

我已将我的语音消息转换为 ASCII 字符,但现在主页正在响应以下消息。

I'll just need to get your from Google. Is that ok?

而不是我在附加到语音标签的响应中发送的内容。此外,模拟器中显示的 JSON 不是我从 webhook 返回的内容。

如您所知,您的第一个问题可能是因为您的文本中包含非 ASCII 字符。

随着更新,问题很可能是因为您指定了 permissions_request 但没有请求任何权限。如果您完全省略这部分,正常的对话流程应该会如您所愿继续。