question

Smit Shah avatar image
Smit Shah asked Yatin Gera Deactivated commented

I receive a CMN-101 error when creating a subscription

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

rest api
4 comments
1 |3000

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

Smit Shah avatar image Smit Shah commented ·

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"}]}

0 Likes 0 ·
Yatin Gera avatar image Yatin Gera ♦♦ commented ·

@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

0 Likes 0 ·
Smit Shah avatar image Smit Shah Yatin Gera ♦♦ commented ·

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.

0 Likes 0 ·
Yatin Gera avatar image Yatin Gera ♦♦ Smit Shah commented ·

Phong rightly pointed out the potential cause of this issue. Making those changes should help you resolve this error

0 Likes 0 ·

1 Answer

Phong Vu avatar image
Phong Vu answered

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.

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