Question

"WebHook server response is invalid" when creating a new subscription

  • 16 December 2019
  • 2 replies
  • 1556 views

Using a sandbox app, PHP SDK. Trying to create a subscription, with the payload

Array
(
    [eventFilters] => Array
        (
            [0] => /restapi/v1.0/account/~/telephony/sessions
        )

    [deliveryMode] => Array
        (
            [transportType] => WebHook
            [address] => https://64979567.ngrok.io/index.php?m=integrations/webhooks&a=ringCentral
        )

    [expiresIn] => 630720000
)

This is what gets posted to my webhook address,

POST /index.php?m=integrations/webhooks&a=ringCentral HTTP/1.1
Validation-Token: d206fc96-ef23-4fe9-98c2-a087358446c7
Content-Type: application/json; charset=UTF-8
Accept: application/json
Accept-Encoding: UTF-8
User-Agent: RingCentral-WebHook/8.3
Content-Length: 0
Host: 64979567.ngrok.io
X-Forwarded-Proto: https
X-Forwarded-For: 192.209.29.132

This is what my webhook returns,

HTTP/1.1 200 OK
Cache-Control: no-store, no-cache, must-revalidate
Content-Type: application/json; charset=utf-8
Date: Mon, 16 Dec 2019 19:43:17 GMT
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Last-Modified: Mon, 16 Dec 2019 19:43:17 GMT
Pragma: no-cache
Server: nginx
Validation-Token: d206fc96-ef23-4fe9-98c2-a087358446c7
Vary: Accept-Encoding
Vary: Accept-Encoding
Content-Length: 0

And what I get back from the API is "WebHook server response is invalid". I'm not sure what's missing, here.


2 replies

Seems to be response time. It's just quick enough as reported by ngrok, but apparently just over 1000 ms by the time it gets out of the ngrok tunnel and back to RingCentral. I guess I'll work around it for devtest, it shouldn't be an issue in our faster production environment.

Userlevel 1

I got that response also when I was using some PHP web frameworks. But this quick start way works quite reliable.

Reply