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
Cannot subscribe WebHook, it always responds with "WebHook responds with incorrect http status."
Tags: webhooks
Aug 2, 2022 at 7:44am   •   2 replies  •  0 likes
Xavier Arana

Hello following this guide to subscribe a webhook: https://developers.ringcentral.com/guide/notifications/webhooks/quick-start#c#

When I try to run the two services, I always get the same error:

Content: {"errorCode":"SUB-522","message":"WebHook responds with incorrect HTTP

status. HTTP status is 502","errors":[{"errorCode":"SUB-522","message":"WebHook

responds with incorrect HTTP status. HTTP status is 502","status":"502"}],"statu

s":"502"}

This is my webhook server code: the same as the example,

1659451285460.png

and this is my webhook subscription code:

1659451366526.png


Seeing the message response, is my webhook server wrong, Do I need another step for it to work.

Here are the steps that I am using :

1. run webhookServer

2. run ngrok.

3. paste ngrok url into webhook subscription

4. run

2 Answers
answered on Aug 2, 2022 at 2:37pm  

Yes, thanks for your answer, that was the problem of that, but now the post subscription happens with a 200 code, and after that if I send a message, I should be able to see it in the console from the C# example right?

https://developers.ringcentral.com/guide/notifications/webhooks/quick-start#c#

But it always comes Null or "", do I am missing something, do I need to add more code, thanks for your time, here you can see that I was able to subscribe to the webhook.

1659476255559.png


 0
answered on Aug 2, 2022 at 2:27pm  

Check your ngrok port and the default port in your Webhook-server project. They should be the same port.


 0
on Aug 2, 2022 at 2:38pm   •  0 likes

Yes, thanks for your answer, that was the problem of that, but now the post subscription happens with a 200 code, and after that if I send a message, I should be able to see it in the console from the C# example right?

https://developers.ringcentral.com/guide/notifications/webhooks/quick-start#c#

But it always comes Null or "", do I am missing something, do I need to add more code, thanks for your time, here you can see that I was able to subscribe to the webhook.

1659476280344.png

on Aug 2, 2022 at 2:51pm   •  0 likes

Change this line. There is some change to the StreamReader lib.

var str = await reader.ReadToEndAsync();
Console.WriteLine(str);
on Aug 3, 2022 at 8:04am   •  0 likes

Hello, thanks again, I already have it like that

str = await reader.ReadToEndAsync();

Console.WriteLine(str);

or it is for me to change that line of code?

on Aug 3, 2022 at 8:34am   •  0 likes

That is the change I made compare to the old line ReadToEnd() and that ReadToEndAsync() works for me while the other one returns empty.

Remember when you test your app multiple times. Every time you subscribe for a new subscription, print out the subscription id and use it to delete the subscription before running a new test. Otherwise, you will soon end up in having too many active subscriptions and hit the limit.

To delete a subscription knowing the subscription id, call this endpoint

await restClient.Restapi().Subscription("subscription-id").Delete();
on Aug 3, 2022 at 8:54am   •  0 likes

You were right Phong, thank you for everything, now it is working as intended.

on Aug 3, 2022 at 10:42am   •  0 likes

If you don't mind, please accept the answer to help other members later one seeking for similar solution.

answered on Aug 2, 2022 at 7:49am  

Here is the API response:

1659451794095.png


 0



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