question

rishwanth-dev4412 avatar image
rishwanth-dev4412 asked Tyler Liu commented

Validation Token is not returned when creating a subscription webhook

            $filter = array(
                    '/restapi/v1.0/account/~/extension',                      );                                      $paramArray     = array(                      "eventFilters" => $filter,                      "deliveryMode" => array(                                          "transportType"   => "WebHook",                                          "encryption"        => "false",                                          "address"  => "https://abc.ngrok.io/test.php?auth_token=" .  $obj->GetAccessToken(),                                      ),                      );    Post Call return the following error.  WebHook URL working     {    "errorCode" : "SUB-520",    "message" : "Validation Token is not returned",    "errors" : [ {      "errorCode" : "SUB-520",      "message" : "Validation Token is not returned"    } ] 

}

getting started
1 |3000

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

benjamin-dean avatar image
benjamin-dean answered
The requirements for a webhook to be created include RingCentral servers executing a POST request to the "deliveryMode.address" you define (this is your webhook consumer, and the URI where the webhook event requests will POST).

As part of the subscription creation process, your webhook consumer must:

1. Be web-accessible
2. Accept HTTP POST requests from RingCentral
3. Respond to the "initialization" POST request within 1000ms
4. Include a header named "Validation-Token" in the response to the "intialization" POST
5. Set the value of the "Validation-Token" header in the response to the exact value presented in the "initialization" POST request's header "validation-token" 

The error you have presented in this post, indicates that your webhook consumer (the web server which accepts the HTTP POST requests), is NOT setting a header named "Validation-Token", or if it is setting that header, the value for "Validation-Token" DOES NOT match the precise value which was presented in the "initial" POST request header "validation-token".

Does this make sense?

If not, here is a tutorial about the basics of Push Notifications with Webhooks (built in JavaScript) which shows you how to handle things properly (the tutorial also has demo code which you can easily deploy to Heroku with a one-button deployment):  https://bdeanindy.github.io/ringcentral-webhook-basics/

If you run into issues or have any questions about the tutorial, please feel free to add them in the Github issue tracker here:  https://github.com/bdeanindy/ringcentral-webhook-basics/issues
1 |3000

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

rishwanth-dev4412 avatar image
rishwanth-dev4412 answered Tyler Liu commented
Yes. It is working now. The problem is that I did not pass validation-token to post request header. After passing validation-token to post request header and return response header with validation-token that was sent, worked properly and SubscriptionWebhook is Green now
3 comments
1 |3000

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

benjamin-dean avatar image benjamin-dean commented ·
Glad to hear that you are back in business and looking forward to seeing your application in production soon!
0 Likes 0 ·
robert-raj8062 avatar image robert-raj8062 commented ·
What should be come validation-token,whether it should access token or endpointid

0 Likes 0 ·
Tyler Liu avatar image Tyler Liu ♦ commented ·
validation-token is what the request header sends you, you just put it into response header as it is.
0 Likes 0 ·

Developer sandbox tools

Using the RingCentral Phone for Desktop, you can dial or receive test calls, send and receive test SMS or Fax messages in your sandbox environment.

Download RingCentral Phone for Desktop:

Tip: switch to the "sandbox mode" before logging in the app:

  • On MacOS: press "fn + command + f2" keys
  • On Windows: press "Ctrl + F2" keys