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
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));
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)
I have no time to update the SDK but there could be some change in the params package. But your code to post in a for loop is incorrect. A2P SMS is sent in a batch and you don't send one by one because you already provide all the recipients in the "messages": [{"to":["recipient 1]}, {"to":["recipient 2]}, {"to":["recipient n]}]
However, having a closer look to your number and the screenshot. Your number 408 222 3xxx is not a HV SMS number. Therefore, you cannot use the A2P SMS API to send message. Use the /sms endpoint instead.
The loops just only for testing. I know exactly that A2psms API work that not cause my problem i'm facing
The number im using can send the HV SMS campaign in your site https://www.sms-campaigns.com/standard.
Why you know which number is A2P SMS and which is not? How can we know that in our site?
My from number is: "from":"+14082223222"
If you don't have time to help, please assign someone to help us. Please. We are got stuck on this and could not continues in our site
Why you debate with me that the number is a HV SMS number. Look at the app title "Enhanced Business SMS". That means that the number is a standard SMS number, NOT a HV SMS number.
What app named "Enhanced Business SMS"? Can you give me the link? My question is: How can i know which number is HV SMS and which is not. We (the client) dont know the way to detect.
One more. Your code in the tutorial is not work. The root cause is my number not HV SMS.
If my number is not HV SMS number. How can i convert it to HV SMS number? And the HV SMS number can't send normal SMS.
Please answer me.
This is what you posted.
It's really hard for me or anyone to help you when you post something like this "Your code in the tutorial is not work". First, if something does not work, describe what happened and what was the error. Second, the code is tested and the same code was used in my app.
Out of the box, a number is a standard SMS number. What made you think that you have a high volume SMS number that you started using the high volume SMS API?
A client does not need to know what type of number because they can just use the number with any RC available app. But developers should know and start with documentation.
https://developers.ringcentral.com/guide/messaging/sms/high-volume
Thanks for your reply. I just sumbited a ticket to add the feature A2PSMSSender to 2 of our extension. What we should do to enable that feature in our end? We want the extension to send HV SMS and normal SMS also.
First, double check to see if the numbers have been provision correctly for HV SMS by login the SMS Campaign app with the user who owns the numbers. If the number is a HV SMS number, you should see a screen like the screenshot attached. If the user does not own any number or just a standard SMS number, then you will see the screen as you see before. If the user does not own any number, then there will be a text message notifying the situation.
Once the number is provisioned for HV SMS, use my code (change it if you use the later JAVA SDK version) to send HV SMS messages.
My bad. I misunderstand about that. Thank you a lot for your help. I just submitted a form here to request HV SMS feature. The system show that i need 2-5 business day to got an approve.
Again, thank you. Hope you have a nice day.
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