Skip to main content
Question

Send High Volume got "CMN-101","message":"Parameter [from] value is invalid.


  • New Participant
  • 1 reply

Hi there,

I'm using RingCentral SDK 2.4 to test the API to send High Volume SMS (HV SMS). My application has been approved and active on PROD environment.

I'm using the sample code as bellow:

    CreateSMSMessageBatchRequest parameters = new CreateSMSMessageBatchRequest();
    parameters.from = "+14082223XXX";
    parameters.text = "Hello Team, This is MOSO called High Volume APIs";
    String[] numbers = new String[] {"+14243325470", "+14243325455"};
    parameters.messages = new MessageCreateRequest[numbers.length];
    for (int i=0; i<numbers.length; i++) {
      MessageCreateRequest m = new MessageCreateRequest();
      m.to = new String[] {numbers[i]};
      parameters.messages[i] = m;
    }
    for (int i = 0; i < 2 ; i++ ) {
      MessageBatchInfo post = restClient.restapi().account().a2pSms().batches().post(parameters);
      System.out.println(post.from + " - " + post.id + " - " + post.creationTime +
              " - " + post.status + " - " + post.batchSize + " - " + post.processedCount);
    }


But i alway got this (404) error message:

status code: 400

Server: nginx
Date: Wed, 04 Jan 2023 10:18:32 GMT
Content-Type: application/json
Transfer-Encoding: chunked
Connection: keep-alive
RCRequestId: 23862f92-8c19-11ed-b66f-0050568ccada
X-Rate-Limit-Group: light
X-Rate-Limit-Limit: 50
X-Rate-Limit-Remaining: 49
X-Rate-Limit-Window: 60
RoutingKey: SJC01P17

{"errorCode":"CMN-101","message":"Parameter [from] value is invalid.","errors":[{"errorCode":"CMN-101","message":"Parameter [from] value is invalid."}]}

HTTP Request
============
HTTP POST https://platform.ringcentral.com/restapi/v1.0/account/~/a2p-sms/batches

Authorization: Bearer U0pDMDFQMTdQQVMwMHxBQURuU2lET2JsYTNhMDg2ejVLTmRfYl9jMS04ZjVQU3U5STR0THgwQTBQdlRZZ2hMTHhtRTREZF9idXktaElDQmI1ZkpmaFNfZnlUTENnUXBCSkdJMjZqYllibF9xdGJYZElybENlRjl6UlY5cmlsa2UtdnptTVhVwewewewewe4NmRZNm5FTHVuVXVsLUNWQlNvbFE3dVJJQ1VGRElDWkdzemhNWlRZZ0szTU1yZzRHY2VkNE9JN3hpS2lCaEo3OHgyaDNjZGpkSGlZRXxrMDZkNEF8bzVEN0hRZVF2aVg5NzBSSmFocWdxd3xBUXxBQXxBQUFBQU5FSC1hbw
X-User-Agent: RC-JAVA-SDK Java 1.8.0_221 Mac OS X


I'm pretty sure that the from number already correct.


I tried this website and my account work perfectly with this APIs:

https://www.sms-campaigns.com/standard

screenshot-2023-01-04-at-174745.png



2 replies

PhongVu
Community Manager
Forum|alt.badge.img
  • Community Manager
  • 2317 replies
  • January 4, 2023

Your code is not correct. Try this!

CreateSMSMessageBatchRequest parameters = new CreateSMSMessageBatchRequest();
parameters.from = "+14082223XXX";
parameters.text = "Hello Team, This is MOSO called High Volume APIs";
        
String[] numbers = new String[] {"+14243325470", "+14243325455"};
MessageCreateRequest[] messages = new MessageCreateRequest[numbers.length];
for (int i=0; i<numbers.length; i++) {
    MessageCreateRequest m = new MessageCreateRequest();
    m.to = new String[] {numbers[i]};
    messages[i] = m;
}
parameters.messages = messages;
        
var resp = restClient.restapi().account().a2psms().batch().post(parameters);
System.out.println(convertObjToString(resp));

  • Author
  • New Participant
  • 1 reply
  • January 5, 2023

Thanks for your response but your code is not valid in RC JDK v2.2.0 anymore. The system show CE

<dependency>
  <groupId>com.ringcentral</groupId>
  <artifactId>ringcentral</artifactId>
  <version>2.2.0</version>
</dependency>


for (int i = 0; i < 2 ; i++ ) {
  MessageBatchInfo post = restClient.restapi().account().a2psms().batch().post(parameters);

  System.out.println(post.from + " - " + post.id + " - " + post.creationTime +
          " - " + post.status + " - " + post.batchSize + " - " + post.processedCount);
  Thread.sleep(15000);
}


The correct one should be

restClient.restapi().account().a2pSms().batches().post(parameters);

a2pSms instead of a2psms in v2.2.0


Can you let us know which version of the code should be work? I tried and the system still show invalid from number (+14082223XXX)


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings