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
Webhook Subscriptions
Tags: rest api
May 24, 2021 at 2:45pm   •   3 replies  •  0 likes
Philip Mazza

Hello,

I need to create fax received Webhook Subscriptions for several environments our API (containing the DELIVERY_ADDRESS) is running in. I have the following questions.

When using a C# console application do these subscriptions only need to be executed one time for each environment?

What is the default "expiresIn" value if this value is omitted?

What is the maximum value "expiresIn" can be set to?

Will the notification payload received be sent directly to our API endpoint DELIVERY_ADDRESS or do we have add code to our Startup file to handle it?

Thank you.

3 Answers
answered on May 25, 2021 at 2:51pm  

Thanks Phong.

Please confirm that I execute this code in my C# API controller instead of in the Startup file.


 0
answered on May 25, 2021 at 7:33am  

Yes, the DELIVERY_ADDRESS is your web address. If you run it on your local machine, you can use ngrok tunnel to make it accessible from outside.

The default value of "expiresIn" is 7 days (in seconds). The max value can be up to 20 years (in seconds)

The notification events (with payload) will be sent to your DELIVERY_ADDRESS, be it at the place you run the code to start the subscription or somewhere remotely. The most important thing is to return a verification-token within 5 secs after you subscribe for a notification. See the quick start example.


 0
answered on May 25, 2021 at 11:59am  

Hi Phong,

Thanks for the response. Can you clarify what you mean by "return a verification-token within 5 secs after you subscribe for a notification".

The SubscriptionInfo returned from posting a CreateSubscriptionRequest doesn't return a verification-token. The NotificationDeliveryModeRequest accepts a verificationToken. Do I need to set this token with the token returned from the restClient.Authorize method before making the request?


 0
on May 25, 2021 at 2:43pm   •  0 likes
app.Run( async (context) =>
{
  context.Request.Headers.TryGetValue("Validation-Token", out StringValues validationToken);
  context.Response.Headers.Add("Validation-Token", validationToken);
  if (context.Request.Path == "/webhook" && context.Request.Method == "POST")
  {
    using (StreamReader reader = new StreamReader(context.Request.Body, Encoding.UTF8))
    {
      var str = reader.ReadToEnd();
      Console.WriteLine(str);
    }
  }
});

In the quick start example, there are 2 processes, the "Startup.cs" server is running and listening on a local machine on port 5000. The other process "Program.cs" is run once to subscribe for notification. You can run the 2 processes from different machines, e.g. run the "Program.cs" in your local machine and the "Startup.cs" on your remote server. The "Startup" process return the validation-token in the header as highlighted above. The 5 secs is the period of time between the "Program" process starts subscribing for notifications and the "Startup" process receives and sets the validation-token.



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