question

Asfand Sajjad avatar image
Asfand Sajjad asked Phong Vu answered

High Volume SMS Support in Java sdk

Does Ring Central Java SDK have any methods to support

1) sending High Volume SMS.

2) reading High Volume SMS from message store

high-volume sms
1 |3000

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

1 Answer

Phong Vu avatar image
Phong Vu answered

We have not released a new Java SDK version to support High Volume SMS yet. Right now, you can use the current RingCentral Java SDK version this way.

public class Message {
    public String[] to;
    public String text = "";
}
public class A2PBody {
    public String from = "";
    public String text = "";
    public Message[] messages;
}
public class Filters {
    public String view = "";
    public String dateFrom = "";
    public String dateTo = "";
}
// if you want to broadcast a single message to multiple recipients
public void broadcast_a2p_sms() throws RestException, IOException{
    A2PBody body = new A2PBody();
    body.from = "Your-HighVolume-SMS-Number";
    body.text = "Hello High Volume SMS from Java";
    String[] recipients = new String[] {"+1650xxxxxxx", "+1408xxxxxxx"};
    Message[] messages = new Message[2];
    for (int i=0; i<messages.length; i++) {
        Message m = new Message();
        m.to = new String[] {recipients[i]};
        messages[i] = m;
    }
    body.messages = messages;
    ResponseBody resp = restClient.post("/restapi/v1.0/account/~/a2p-sms/batch", body);
    System.out.println(resp.string());
}
// if you want to send custom message to each recipient
public void send_a2p_sms() throws RestException, IOException{
    A2PBody body = new A2PBody();
    body.from = "Your-HighVolume-SMS-Number";
    body.text = "";
    String[] recipients = new String[] {"+1650xxxxxxx", "+1408xxxxxxx"};
    String[] names = new String[] {"John Smith", "Matthew Frank"};
    Message[] messages = new Message[2];
    for (int i=0; i<messages.length; i++) {
        Message m = new Message();
        m.text = "Hello " + names[i];
        m.to = new String[] {numbers[i]};
        messages[i] = m;
    }
    body.messages = message
    ResponseBody resp = restClient.post("/restapi/v1.0/account/~/a2p-sms/batch", body);
    System.out.println(resp.string());
}
// read the HV SMS message store
public void get_a2p_sms() throws RestException, IOException {
    var params = new Filters();
    params.view = "Detailed";
    params.dateFrom = "2021-01-01T00:00:00.000Z";
    params.dateTo = "2021-01-21T00:00:00.000Z";

    ResponseBody resp = restClient.get("/restapi/v1.0/account/~/a2p-sms/messages", params);
    System.out.println(resp.string());
}

Check out the Dev Guide for more details about reading the HV SMS message store.

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