question

Catie Sessions avatar image
Catie Sessions asked ·

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

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.

subscriptionsphp sdk
1 comment
1 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1. Webhook URL is available on the Internet (via ngrok)

2. TLS/SSL enabled

3. response within 850 ms

4. Validation-Token header is present, value copied from that posted

0 Likes 0 · ·
Catie Sessions avatar image
Catie Sessions answered ·

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.

Share
1 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Phong Vu avatar image
Phong Vu answered ·

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

Share
1 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.