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 notification subscription delivery address change
Tags: rest api
Jun 1, 2021 at 1:20pm   •   4 replies  •  0 likes
Philip Mazza

Hello,

Can one App have multiple notification subscriptions for multiple delivery addresses by running the subscription request setup again for each new address? This can occur when an application changes environments (test, UAT, Production, etc.)

4 Answers
answered on Jun 7, 2021 at 8:28am  

Hi Phong - The link you sent is not helpful. Our webhook is working but is returning a 400 error in response to the subscription request.

The documentation link in the page you reference is no longer valid and the code link contains no useful code.

Are there recent working code examples or other documentation that I can review?

Thanks.


 0
on Jun 7, 2021 at 10:20am   •  0 likes

How about using the sample code here. And or try first in your local host using ngrok tunnel.

answered on Jun 4, 2021 at 1:10pm  

Hi Phong - I moved the code as you suggested but that did not resolve the issue.

Below is the full error. The error content does not provide any specific details. Does the subscription request actually call the deliveryMode.address endpoint or is this error coming from the RingCentral side? Please review the request details for any missing or incorrect data.

Thank you.


Response:

StatusCode: 400, ReasonPhrase: 'Bad Request', Version: 1.1, Content: System.Net.Http.HttpConnectionResponseContent, Headers:

{

Server: nginx

Date: Fri, 04 Jun 2021 19:45:54 GMT

Transfer-Encoding: chunked

Connection: keep-alive

LocalHostInfo: 10.28.28.28__1372@sjc11-c01-csg03.devtest.ringcentral.com

RCRequestId: 797aa190-c56d-11eb-856a-005056bbb10f

X-ERROR-ID: 797aa190-c56d-11eb-856a-005056bbb10f

X-Rate-Limit-Group: medium

X-Rate-Limit-Limit: 40

X-Rate-Limit-Remaining: 39

X-Rate-Limit-Window: 60

RoutingKey: SJC11P01

Content-Type: application/json; charset=UTF-8

}

Content: {"errorCode":"SUB-522","message":"WebHook responds with incorrect HTTP status. HTTP status is 400","errors":[{"errorCode":"SUB-522","message":"WebHook responds with incorrect HTTP status. HTTP status is 400","status":"400"}],"status":"400"}


Request:

Method: POST, RequestUri: 'https://platform.devtest.ringcentral.com/restapi/v1.0/subscription', Version: 1.1, Content: System.Net.Http.StringContent, Headers:

{

X-User-Agent: Unknown/0.0.1 RingCentral.Net/5.2.0

Authorization: Bearer U0pDMTFQMDFQQVMwMHxBQUQ5MEpzbGU0VHpUUDVGaG0wYWdnU0NrY3B1SjU5NHk3dzROQWFqME1OeEltYmNNbUhJZlAyMzZvSjhmRmY5ekxFalVuMEdOSTZ1d0F4d1JMRzZsaVU4dzRuR3ZyaEYtMnQ0NXhCUHZmcDFwQkRndmV3dGhqSU4wNUd3Ui1pQmR3cmtXSU4wOTZFQ1hhWFp5eDFMRWVyeUFuY1hXSmQzM2RXbUk3T0VEU19IbGNCcDdlYm1MTUNzeDlfcU03dmZSbDh8YVg4TVRnfERRODlXWmE2dm1zSzRLc1Z4aXBXcGd8QVE

Content-Type: application/json; charset=utf-8

Content-Length: 227

}

Content: {"eventFilters":["/restapi/v1.0/account/~/extension/~/fax?direction=Inbound"],"deliveryMode":{"transportType":"WebHook","address":"https://services-tst.americanportfolios.com/RingCentralAPI/fax/received"},"expiresIn":630720000}



 0
on Jun 4, 2021 at 3:18pm   •  0 likes
answered on Jun 3, 2021 at 2:28pm  

Thanks Phong for clarifying this.

We are having an issue subscribing to fax notifications. The error returned is not specific:

Content: {"errorCode":"SUB-522","message":"WebHook responds with incorrect HTTP status. HTTP status is 400","errors":[{"errorCode":"SUB-522","message":"WebHook responds with incorrect HTTP status. HTTP status is 400","status":"400"}],"status":"400"}

Our deliveryMode.address is on the internet and works when I post a payload from Postman but of course will return an error if there is no payload posted. We are getting and setting the Validation_Token in our API Controller.

Here is our webhook setup C# code that is throwing the error:

SubscriptionInfo subscriptionInfo = await restClient.Restapi().Subscription().Post(new CreateSubscriptionRequest

{

eventFilters = new[] { "/restapi/v1.0/account/~/extension/~/fax?direction=Inbound" },

expiresIn = 630720000, //20 years

deliveryMode = new NotificationDeliveryModeRequest

{

transportType = "WebHook",

address = "https://services-tst.americanportfolios.com/RingCentralAPI/fax/received", }

});


And Webhook C# API controller code that will receive the notifications:


[HttpPost("received")] //From RingCentral

public async Task GetFaxReceived([FromBody] dynamic eventPayload)

{

string str = HttpContext.Request.Headers["Validation_Token"];

await ringCentralProvider.GetFaxReceivedAsync(eventPayload); //just handles the payload

HttpContext.Response.Headers.Add("Validation_Token", str);

}


What are we doing wrong that you can see?

Thanks.


 0
on Jun 3, 2021 at 8:29pm   •  0 likes

Can you try moving up the code to return the validation token like this

[HttpPost("received")] //From RingCentral
public async Task GetFaxReceived([FromBody] dynamic eventPayload)
{
string str = HttpContext.Request.Headers["Validation_Token"];
HttpContext.Response.Headers.Add("Validation_Token", str);
await ringCentralProvider.GetFaxReceivedAsync(eventPayload); //just handles the payload
}
answered on Jun 1, 2021 at 3:10pm  

I don't know what you want to achieve. But you can specify one delivery address per subscription. You can subscribe max. 20 subscriptions and notifications will be sent to the delivery addresses as long as those subscriptions are active.


 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