question

Bob Mulvey avatar image
Bob Mulvey asked Phong Vu answered

Get A2P SMS - get delivery status from message ID in Java

Is there a way for me, in Java, to get the delivery status of an SMS by ID? I am using the 1.6.1 java client that was just released about a week ago. Looking at the doc (https://github.com/ringcentral/ringcentral-java/blob/master/samples.md ) I can’t tell because Send A2P SMS and Get A2P SMS both seem to refer “restRequestConfig” which has no explanation yet that I see. Perhaps it does not yet exist for Java? I would really like to subscript a get notification if that was possible in the Java interface?

rest api
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

Please hold on to use the Java SDK with A2P methods directly as we are updating the specs which may cause code breaks later.

For now, I recommended to use the post() and get() method directly with specified endpoint and params.

public ResponseBody get(String endpoint, Object queryParameters) throws IOException, RestException {
    return request(HttpMethod.GET, endpoint, queryParameters, null);
}
public ResponseBody post(String endpoint, Object object) throws IOException, RestException {
    return request(HttpMethod.POST, endpoint, null, object, ContentType.JSON);
}

E.g.

public class Filters {
        public String view = "";
        public String dateFrom = "";
        public String dateTo = "";
}
/*
Other valid filters
    perPage: integer
    batchId: string
    direction: Array
    phoneNumber: Array
*/

public void read_a2p_message_store() {
    var params = new Filters();
    params.view = "Detailed";
    params.dateFrom = "2020-11-20T00:00:00.000Z";
    params.dateTo = "2020-11-30T00:00:00.000Z";

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

We will update the SDK as soon as we can.

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