Dialogflow V2 API says my Webhook response was empty

877 Views Asked by At

I am trying to use the Dialogflow V2 API to add two numbers, to do this I have setup a web server with HTTPS access to complete the request. in the Diagnostic Info screen in the Dialogflow console I can see the Fulfilment Response from my remote server:

{
  "fulfillmentText": "the sum of 5 and 9 is 14",
  "fulfillmentMessages": [
    {
      "text": {
        "text": [
          "the sum of 5 and 9 is 14"
        ]
      }
    }
  ],
  "source": "-------.com",
  "payload": {
    "google": {
      "expectUserResponse": 1,
      "richResponse": {
        "items": [
          {
            "simpleResponse": {
              "textToSpeech": "the sum of 5 and 9 is 14"
            }
          }
        ]
      }
    },
    "facebook": {
      "text": "the sum of 5 and 9 is 14"
    },
    "slack": {
      "text": "the sum of 5 and 9 is 14"
    }
  },
  "outputContexts": [
    {
      "name": "-----892446d1-----",
      "lifespanCount": 1,
      "parameters": {
        "number": 5,
        "number1": 9
      }
    }
  ]
}

Which has been adapted from the example given in the docs: https://dialogflow.com/docs/intro/fulfillment but in the Raw API response I see:

"webhookStatus": {
    "code": 3,
    "message": "Webhook call failed. Error: Webhook response was empty."
  }

Clearly the response is not empty as it can be seen in the Diagnostic Info. Has anyone any ideas as to what is causing this?

Thanks

1

There are 1 best solutions below

0
On

We can find definition of the codes in google.rpc package error codes,

"code": 3

means "INVALID_ARGUMENT"

// The client specified an invalid argument. Note that this differs
// from FAILED_PRECONDITION. INVALID_ARGUMENT indicates arguments // that are problematic regardless of the state of the system // (e.g., a malformed file name).

For example according to request format "parameters" field in "outputContexts" should have format "param": "param value", in your request it looks like "param": param value.

Please check all arguments in your request.