question

cole-bennington11862 avatar image
cole-bennington11862 asked Tyler Liu answered

Trouble creating a Webhook with API in C#

I am trying to create a Webhook to be notified when a message is sent back to my account that I use for my server app. I initially send out messages and the final goal is functionality for when they reply for my app to be able to trigger another message to be sent.


I am using a password flow for authorization because this is a server app with no UI. I make a CreateSubscriptionRequest object for the request of the POST and give it eventFilters and a NotificationDeliveryModeRequest object with transportType and address. I then navigate to the subscription endpoint where I call the POST method with the CreateSubscriptionRequest object as its parameter and when the code gets to this point it returns an error saying "Call failed with status code 400 (Bad Request) POST https://platform.devtest.ringcentral.com/restapi/v1.0/subscription".


I'm not sure what the problem with the request is or if its something else that I cant figure out. If anyone has any ideas or the same issue please let me know. Thanks!

sdk
1 |3000

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

Tyler Liu avatar image
Tyler Liu answered
Are you using  https://github.com/ringcentral/ringcentral-csharp-client#exception-handling  ?

You can catch the exception and print the error response:

string errorMessage = fhe.GetResponseString(); 
Console.WriteLine(errorMessage);
1 |3000

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

cole-bennington11862 avatar image
cole-bennington11862 answered
Thank you for your timely response. This is the error I seem to be getting

{"errorCode":"SUB-525","message":"WebHook server response is invalid","errors":[{"errorCode":"SUB-525","message":"WebHook server response is invalid"}]}
1 |3000

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

Tyler Liu avatar image
Tyler Liu answered
https://ringcentral-quickstart.readthedocs.io/en/latest/webhooks/

  1. is available on the Internet
  2. has a TLS / SSL enabled*
  3. can respond within 1000 milliseconds
  4. will respond with Validation-Token header on subscription

It might because the WebHook server doesn't respond with HTTP status code 200. Please check the log on your WebHook server.

1 |3000

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

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