I am getting a CMN-101 error
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.16.0
Authorization: Bearer REMOVED
Content-Type: application/json; charset=utf-8
Content-Length: 343
}
Content:
Response:
StatusCode: 400, ReasonPhrase: 'Bad Request', Version: 1.1, Content: System.Net.Http.StreamContent, Headers:
{
Transfer-Encoding: chunked
Connection: keep-alive
LocalHostInfo: 10.28.28.28__13194@sjc11-c01-csg03.devtest.ringcentral.com
RCRequestId: b862145a-cc2a-11ec-ac48-005056bb9532
X-ERROR-ID: b862145a-cc2a-11ec-ac48-005056bb9532
X-Rate-Limit-Group: medium
X-Rate-Limit-Limit: 40
X-Rate-Limit-Remaining: 39
X-Rate-Limit-Window: 60
RoutingKey: SJC12P01
Date: Thu, 05 May 2022 04:20:39 GMT
Server: nginx
Content-Type: application/json
}
Content: {"errorCode":"InvalidParameter","message":"Parameter [deliveryMode.verificationToken] value is invalid","errors":[{"errorCode":"CMN-101","message":"Parameter [deliveryMode.verificationToken] value is invalid","parameterName":"deliveryMode.verificationToken"}],"parameterName":"deliveryMode.verificationToken"}
Based on the documentation provided at the URL below there is literally no information on what the value requirements are:
https://developers.ringcentral.com/api-reference/Subscriptions/createSubscription
If I remove the VerificationToken I am getting a SUB-520 Error
Content: {"errorCode":"SUB-520","message":"Validation Token is not returned","errors":[{"errorCode":"SUB-520","message":"Validation Token is not returned"}]}
@Smit Shah Could you also share the request body along with the question? The error messages suggest the issue was with the request, looking at the request body would be really helpful
P.S - The API reference is to see the API contract with some basic information. The developer guide has more details on things like use cases, what fields are used etc. Information on verification token, validation token and why they are used is mentioned here already https://developers.ringcentral.com/guide/notifications/webhooks/receiving
I am not sure how I can get a coyp of the raw request. Here is what My code looks like
{
NotificationDeliveryModeRequest nDM = new NotificationDeliveryModeRequest();
nDM.transportType = "WebHook";
nDM.address = "https://app.example.com/RCNotify.aspx"; // ?CID=" & oCustomer.CustomerId.ToString
nDM.encryption = false;
// nDM.verificationToken = "C" & oCustomer.CustomerId.ToString & "ID"
nDM.verificationToken = "C" + oCustomer.CustomerNumber + "ID";
// nDM.verificationToken = "C" & CleanAlphaNumericOnly(oCustomer.CustomerId.ToString) & "ID"
List EventFiltersList = new List();
EventFiltersList.Add("/restapi/v1.0/account/~/extension/~/message-store");
EventFiltersList.Add("/restapi/v1.0/account/~/telephony/sessions");
// EventFiltersList.Add("/restapi/v1.0/account/~/extension/~/")
// EventFiltersList.Add("/restapi/v1.0/account/~/extension/~/")
CreateSubscriptionRequest nSMSReq = new CreateSubscriptionRequest();
nSMSReq.deliveryMode = nDM;
nSMSReq.expiresIn = 630720000;
nSMSReq.eventFilters = EventFiltersList.ToArray();
var SubscriptionResult = RC.Restapi.Subscription.Post(nSMSReq).Result;
mylog.Debug(SubscriptionResult);
}
Where Customer ID is a GUID and CustomerNumber is 8 Alpha Numeric values.
Phong rightly pointed out the potential cause of this issue. Making those changes should help you resolve this error
In your original post, it shows the error message of verification token is invalid.
Then in your comment, after removing the verification token, you got a different error "validation token is not returned", this meant that RingCentral server tried to validate your Webhook endpoint by sending a validation token and it expects to receive the token back within 5 secs. But it did not receive it.
See this getting started example code for how to handle the return of validation token.
I am not sure how I can get a coyp of the raw request. Here is what My code looks like:
{
NotificationDeliveryModeRequest nDM = new NotificationDeliveryModeRequest();
nDM.transportType = "WebHook";
nDM.address = "https://app.example.com/RCNotify.aspx"; // ?CID=" & oCustomer.CustomerId.ToString
nDM.encryption = false;
// nDM.verificationToken = "C" & oCustomer.CustomerId.ToString & "ID"
nDM.verificationToken = "C" + oCustomer.CustomerNumber + "ID";
// nDM.verificationToken = "C" & CleanAlphaNumericOnly(oCustomer.CustomerId.ToString) & "ID"
List EventFiltersList = new List();
EventFiltersList.Add("/restapi/v1.0/account/~/extension/~/message-store");
EventFiltersList.Add("/restapi/v1.0/account/~/telephony/sessions");
// EventFiltersList.Add("/restapi/v1.0/account/~/extension/~/")
// EventFiltersList.Add("/restapi/v1.0/account/~/extension/~/")
CreateSubscriptionRequest nSMSReq = new CreateSubscriptionRequest();
nSMSReq.deliveryMode = nDM;
nSMSReq.expiresIn = 630720000;
nSMSReq.eventFilters = EventFiltersList.ToArray();
var SubscriptionResult = RC.Restapi.Subscription.Post(nSMSReq).Result;
mylog.Debug(SubscriptionResult);
}
Where Customer ID is a GUID and CustomerNumber is 8 Alpha Numeric values.
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