Why the API.AI always return "Webhook call failed. Error: Webhook response was empty."

Why the API.AI always return "Webhook call failed. Error: Webhook response was empty."

当我在 google 项目和 API.AI 代理上创建操作时,我使用自己的服务作为 API.AI fulfillment webhook。我希望 API.AI 会调用我的 webhook。但是当我通过 google 上的动作模拟器对其进行测试时,API.AI 总是 return:

"message": "Unexpected apiai response format: Empty speech response",
"apiResponse": {
  "id": "905d5727-bea8-4630-8d3a-e6c173159a94",
  "timestamp": "2017-09-28T02:20:06.954Z",
  "lang": "en",
  "result": {},
  "status": {
    "code": 206,
    "errorType": "partial_content",
    "errorDetails": "Webhook call failed. Error: Webhook response was empty."
  },
  "sessionId": "1506565201634"
}

但是当我检查apache 的日志时,API.AI 没有调用我的webhook!当我将 webhook url 替换为 firebace 函数时,它工作成功。但是,如果我使用自己的服务 url 作为 API.AI webhook url,则 API.AI 无论如何都不会调用 webhook。我的服务使用 https.

好的,我解决了问题。原因是https的配置。它应该在 ssl 选项中添加 ca。详细解决方法见link: https://discuss.api.ai/t/webhook-does-not-work-with-https/6708/8

我也遇到了这个问题,我可以设法解决它。以下错误详细信息在某种程度上具有误导性

"status": {
    "code": 206,
    "errorType": "partial_content",
    "errorDetails": "Webhook call failed. Error: Webhook response was empty."
  }

实际问题是另外一回事。我正在添加输出上下文以响应 web-hook,并且上下文名称无效(名称中有一个 space)。这导致了上述错误消息。

一般来说,当来自 web-hook 的响应格式无效时,似乎会收到上述错误消息。

希望对以后的人有所帮助。

@dmulter 有时,如果您的帐户超出其配额限制,那么响应也会是 Webhook 失败。