News & Announcements User Community Developer Community

Welcome to the RingCentral Community

Please note the community is currently under maintenance and is read-only.

Search
Make sure to review our Terms of Use and Community Guidelines.
  Please note the community is currently under maintenance and is read-only.
Home » Developers
Validation Token is not set on webhook event anymore
Tags: webhooks
Jan 17, 2023 at 5:02am   •   6 replies  •  0 likes
Jordan Rynard

I have a subscription set up for a webhook to call a url on the Instant Message event (/restapi/v1.0/account/~/extension/~/message-store/instant?type=SMS).
When I first create the subscription, the webhook URL is called, and I can confirm at this time that a Validation Token is present, and I am able to establish the subscription.
If I check the Subscription list at this point, I see that my subscription/webhook is active.

When I send a text message to my number, the url is being called by the webhook (as expected), but there is no Validation Token present, so obviously I can't validate to continue the process and receive the POST data.

I have had a subscription / webhook active for this event for the last 1.5 years and it has worked without issue, until 7 days ago when it just stopped working. After investigating I was able to figure out the above (no Validation Token is present anymore).

I've tried removing and creating a new subscription, confirmed the permissions in the app in the developer portal, and I've also tried creating a new app in the developer portal.

If anyone might be able to shed some light on this issue that would be very appreciated. I've contacted Ring Central support, but haven't received any response.

on Jan 17, 2023 at 6:03am   •  0 likes

Hello Jordan, I want to add that since yesterday I'm unable to receive webhooks account presence events, others webhooks subscription works fine. All this is sandbox environment, production webhooks account presence events are working properly.

5 Answers
answered on Jun 21, 2023 at 5:02pm  

This is occurring in our Prod environment too. I can see that when we register the webhook (subscription) for the first time I can see "Validation-Token" in the header.
1687391736561.png
But, once set up is completed, the RingCentral invokes our prod endpoint without validation-token header.
1687391821638.png

This used to be working just fine few weeks back.

So, should we remove the logic that API's documentation recommends to send the validation-token in a request back in the response? Or what is the fix/workaround.

Thanks


 0
on Jun 21, 2023 at 5:24pm   •  0 likes

Validation token is sent only once when you create a new subscription. Check out our code sample in the dev guide to implement your webhook notification.

answered on Jan 21, 2023 at 11:47am  

This report is not outdated, and the issue still stands. I suggest you better understand the issue I'm having before reporting this as outdated.


 0
on Jan 21, 2023 at 9:47pm   •  0 likes

I agree that there is still issue. But this issue may not be related to validation-token. So it's kindly misleading. The real issue is you are receiving empty notifications.

on Jan 22, 2023 at 7:22am   •  0 likes

The API documentation states that there needs to be a Token Validation:

https://developers.ringcentral.com/guide/notifications/webhooks/receiving

"To ensure that the endpoints RingCentral interfaces with via webhooks are designed for RingCentral, "validation tokens" are transmitted amongst the HTTP request headers. It is the expectation of RingCentral that your webhook handler echo back this validation token in the response via an HTTP response header. "

I'm going to assume this is the primary problem, until I see otherwise from documentation provided by RingCentral, as this is the first step in the callback process.

on Jan 22, 2023 at 9:01am   •  0 likes

Unfortunately, the first sentence of that paragraph in dev guide is unclear and misleading.

"To ensure that the endpoints RingCentral interfaces with via webhooks are designed for RingCentral, "validation tokens" are transmitted amongst the HTTP request headers"

This is only for the validation of the Webhook url for the first time and only one time.

The second part is critical and that is exactly the expectation

"It is the expectation of RingCentral that your webhook handler echo back this validation token in the response via an HTTP response header. "

To ECHO back this validation header. So if the request header does not send, then ECHO none. Meaning that don't set the header in the response because the server did not send it in the request header.

I will check with the author to improve the documentation soon.

on Jan 22, 2023 at 11:04am   •  0 likes

There are two sections in this document that details this Validation Token. One section is called "Creating Webhooks", and the information your are providing is accurate to that.

The section I am referring to is called "Receiving Webhooks".



on Jan 22, 2023 at 12:17pm   •  0 likes

As I wrote, the dev guide is not precise. I will review the doc with the author and change it accordingly.

Meanwhile, I can confirm that the validation token is not required nor should be returned or set when receiving webhooks post for events. This is implemented in all of my apps and developers apps which I ever helped.

This is how I implement in my apps using Node JS.

if(req.headers.hasOwnProperty("validation-token")) {
        res.setHeader('Validation-Token', req.headers['validation-token']);
        res.statusCode = 200;
        res.end();
      } else {
        var body = []
        req.on('data', function(chunk) {
          body.push(chunk);
        }).on('end', function() {
          body = Buffer.concat(body).toString();
          var jsonObj = JSON.parse(body)
          console.log(body);
        });
        res.statusCode = 200;
        res.end();
      }
on Jan 22, 2023 at 12:41pm   •  0 likes

I have no problem with implementation. I guess I will create a new ticket regarding the empty body (no JSON data). So frustrating as it was working fine on our end for years and then just stopped working with no changes on our end two weeks ago.

on Jan 22, 2023 at 8:22pm   •  0 likes

Check this thread for a solution.

answered on Jan 19, 2023 at 4:01pm  

I confirm that it is an issue in production environment. RingCentral engineers have been noticed and they are working on it.

Next time, if it is urgent, please create a ticket here: https://developers.ringcentral.com/support/create-case

Update: by design, the spec never says that RingCentral provide a validation-token header for every message. We only provide the header for the very first message that when you try to setup the WebHook. If it is not present, you just ignore it.

Please clarify if you still have concerns regarding this.



 0
on Jan 20, 2023 at 9:28am   •  0 likes

Actually I am not sure that it is recent change. Are you sure that for every notification message, your could receive a validation-token before? Maybe by design it is optional, if it's not present, you simply ignore it.

on Jan 20, 2023 at 1:27pm   •  0 likes

Hi Tyler, I do ignore it. But along with there being no validation token, there is also no JSON data.

on Jan 20, 2023 at 6:33am   •  0 likes

I can confirm that today we are receiving the presence events (webhooks) of the account on sandbox environment.

on Jan 20, 2023 at 8:33am   •  0 likes

Thanks for confirming. I tested and it works normal too.

answered on Jan 19, 2023 at 6:06am  

Still no resolution on this, and STILL no response from Ring Central.
It was important we got this functional, so here is the solution I implemented for the time being (hopefully it's useful to someone else who encounters the same problem).

Because the callback is still being called by RingCentral on receiving an incoming message, we had to add to our script a pull of the new message /account/~/extension/~/message-store?direction=Inbound&readStatus=Unread&perPage=1 to then access the most recent message and pull the JSON data that way.

It was a lot simpler when we were receiving this information with the callback (after validating with the validation code that we are no longer receiving), but this works in the meantime.


 0
answered on Jan 17, 2023 at 7:29am  

I just run a quick test and I can confirm that Webhook notification subscription on sandbox works as expected. This means that the validation token is sent and required.

But @OK TAXI 101 is right. The presence event notification is not working right now on sandbox. I will report this to the team to investigate and fix it.


 1
on Jan 19, 2023 at 5:20am   •  0 likes

Hello @Phong Vu, news about this?. Still today not receiving presence events using sandbox environment.

on Jan 17, 2023 at 9:01am   •  0 likes

Thank you @Phong Vu, I hope the team can fix it soon, so we can continue testing.



A new Community is coming to RingCentral!

Posts are currently read-only as we transition into our new platform.

We thank you for your patience
during this downtime.

Try Workflow Builder

Did you know you can easily automate tasks like responding to SMS, team messages, and more? Plus it's included with RingCentral Video and RingEX plans!

Try RingCentral Workflow Builder

PRODUCTS
RingEX
Message
Video
Phone
OPEN ECOSYSTEM
Developer Platform
APIs
Integrated Apps
App Gallery
Developer support
Games and rewards

RESOURCES
Resource center
Blog
Product Releases
Accessibility
QUICK LINKS
App Download
RingCentral App login
Admin Portal Login
Contact Sales
© 1999-2024 RingCentral, Inc. All rights reserved. Legal Privacy Notice Site Map Contact Us