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
"errorCode":"SUB-522" "message":"WebHook responds with incorrect HTTP status. HTTP status is 500" "status":"500"
Tags: rest api
Oct 19, 2020 at 4:43am   •   1 replies  •  0 likes
Aabid Khan

While creating webhook from salesforce apex callout or from postman. I am getting same error everytime.

{

"eventFilters": [

"/restapi/v1.0/account/~/extension/~/message-store?type=SMS&direction=Inbound"

],

"deliveryMode": {

"transportType": "WebHook",

"address": "https://aabidlwc-developer-edition.ap16.force.com/services/apexrest/ringcentralwebhook"

}

}


Please help me, I'm trouble with this.

1 Answer
answered on Oct 20, 2020 at 7:39am  

Where and how do you handle the validationToken?

Please read this dev guide to learn more how to useRingCentral WebHooks notification.


 1
on Oct 20, 2020 at 9:23pm   •  0 likes

I' sending the following parameter in header & body, If I'm wrong please correct me: -

In header

Accept : application/json

Authorization : Bearer MyAccessToken

Content-Type : application/json

In Body

Json Data =>

{

"eventFilters": [

"/restapi/v1.0/account/~/extension/~/message-store?type=SMS&direction=Inbound"

],

"deliveryMode": {

"transportType": "WebHook",

"address": "https://aabidlwc-developer-edition.ap16.force.com/services/apexrest/test/v1"

}

}


but it give me 500 error, if I miss something or doing any mistake please correct me.

Thank you

on Oct 21, 2020 at 6:38am   •  0 likes

That is the code you subscribe for webhooks notification. You still have to implement your code to handle the notifications where you must handle (return) the validation token. Read the dev guide carefully.

on Oct 22, 2020 at 6:01am   •  0 likes

can we please specify the mistake in returning validation token in apex.

I'm new in this platform that's why I'm facing lots of problem.

to handle Webhook I'm creating rest resources but not able to found correct way.

@RestResource(urlMapping='/test/v1/*')

global class ringcentralWebhook

{

@HttpPost

global static String doPost()

{

RestRequest req = RestContext.request;

RestResponse res = RestContext.response;

String JsonBody = req.requestBody.toString();

Map<String, Object> body = (Map<String, Object>)Json.deserializeUntyped(JsonBody);

String s = String.valueOf(body);

contact c = new contact(lastName = 'test ringcentral', description=s);

insert c;

String VToken = req.params.get('validation-token');

return VToken;

}

}

Thank you. @Phong Vu



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