3
votes

When I create the actions on google project and API.AI agent, I use my own service to be API.AI fulfillment webhook. I expect that API.AI will call my webhook. But when I test it by simulator of actions on google, the API.AI always 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"
}

But when I check the logs of apache, the API.AI did not call my webhook! When I replace the webhook url to firebace functions, it work success. But if I use my own service url to be API.AI webhook url, the API.AI do not call the webhook anyway. My service use https.

3
Can you clarify how your HTTPS service works? Does it listen for POST requests? Can you paste the JSON response from your service here? - Sachit Mishra
I use apache to listen for https requests, of course including POST requests. And whatever my service return any JSON, the API.AI does not request my service anyway. The logs of apache has nothing about the url that I setup to the API.AI webhook url. I am sure that the url can be requested. - 肖俊毅

3 Answers

6
votes

I also got this issue and I could manage to solve it. below error details were somehow misleading

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

Actual issue was something else. I was adding output context in response from web-hook and name of context was invalid (it had a space in name). This was causing above error message.

As a general rule, it looks like that above error message will be received when response from web-hook is in invalid format.

Hope it will help someone in future.

2
votes

OK, I solved the problem. The reason is the configuration of https. It should add ca in ssl options. The details of the solution see the link: https://discuss.api.ai/t/webhook-does-not-work-with-https/6708/8

0
votes

@dmulter Sometimes, if your account exceeds its quota limit then also response would be Webhook Failed. enter image description here