Class Sms


  • public class Sms
    extends java.lang.Object
    • Method Detail

      • async

        public AsyncSms async()
        Switches to the async SDK.
        Returns:
        The async SDK
      • getPrice

        public GetSmsPriceRequestBuilder getPrice()
        Check the price of SMS Messages



        Check the price of single or multiple SMS messages at the same time before sending them. You can pass a single SmsMessage object using GetSmsPriceRequestBody.of(SmsMessage) method (for single message) or List<SmsMessage> using GetSmsPriceRequestBody.of(List.of(SmsMessage,...)) method (for multiple messages).

        Each SmsMessage object has several properties, describing message parameters such as recipient phone number, content of the message, type, etc. Please use builder style:

        
         GetSmsPriceResponse res = sdk.outgoing().sms().getPrice()
            .request(req) // here pass GetSmsPriceRequestBody.of(...) object
            .call();
         

        The method will accept maximum 100 messages in one call.

        As a successful result a GetSmsPriceResponse object will be returned with prices property of type List<Price> containing a Price objects, one object per each single message. You should check the error property of each Price object to make sure which messages were priced successfully and which finished with an error. Successfully priced messages will have null value of error property.

        GetSmsPriceResponse object will include also headers property with X-Success-Count (a count of messages which were processed successfully) and X-Error-Count (count of messages which were rejected) elements.
        Returns:
        The call builder
      • getPrice

        public GetSmsPriceResponse getPrice​(GetSmsPriceRequestBody request)
                                     throws java.lang.Exception
        Check the price of SMS Messages



        Check the price of single or multiple SMS messages at the same time before sending them. You can pass a single SmsMessage object using GetSmsPriceRequestBody.of(SmsMessage) method (for single message) or List<SmsMessage> using GetSmsPriceRequestBody.of(List.of(SmsMessage,...)) method (for multiple messages).

        Each SmsMessage object has several properties, describing message parameters such as recipient phone number, content of the message, type, etc. Please use builder style:

        
         GetSmsPriceResponse res = sdk.outgoing().sms().getPrice()
            .request(req) // here pass GetSmsPriceRequestBody.of(...) object
            .call();
         

        The method will accept maximum 100 messages in one call.

        As a successful result a GetSmsPriceResponse object will be returned with prices property of type List<Price> containing a Price objects, one object per each single message. You should check the error property of each Price object to make sure which messages were priced successfully and which finished with an error. Successfully priced messages will have null value of error property.

        GetSmsPriceResponse object will include also headers property with X-Success-Count (a count of messages which were processed successfully) and X-Error-Count (count of messages which were rejected) elements.
        Parameters:
        request - The request object containing all the parameters for the API call.
        Returns:
        The response from the API call
        Throws:
        java.lang.Exception - if the API call fails
      • getPrice

        public GetSmsPriceResponse getPrice​(GetSmsPriceRequestBody request,
                                            java.util.Optional<Options> options)
                                     throws java.lang.Exception
        Check the price of SMS Messages



        Check the price of single or multiple SMS messages at the same time before sending them. You can pass a single SmsMessage object using GetSmsPriceRequestBody.of(SmsMessage) method (for single message) or List<SmsMessage> using GetSmsPriceRequestBody.of(List.of(SmsMessage,...)) method (for multiple messages).

        Each SmsMessage object has several properties, describing message parameters such as recipient phone number, content of the message, type, etc. Please use builder style:

        
         GetSmsPriceResponse res = sdk.outgoing().sms().getPrice()
            .request(req) // here pass GetSmsPriceRequestBody.of(...) object
            .call();
         

        The method will accept maximum 100 messages in one call.

        As a successful result a GetSmsPriceResponse object will be returned with prices property of type List<Price> containing a Price objects, one object per each single message. You should check the error property of each Price object to make sure which messages were priced successfully and which finished with an error. Successfully priced messages will have null value of error property.

        GetSmsPriceResponse object will include also headers property with X-Success-Count (a count of messages which were processed successfully) and X-Error-Count (count of messages which were rejected) elements.
        Parameters:
        request - The request object containing all the parameters for the API call.
        options - additional options
        Returns:
        The response from the API call
        Throws:
        java.lang.Exception - if the API call fails
      • send

        public SendSmsRequestBuilder send()
        Send SMS Messages



        Send single or multiple SMS messages at the same time. You can pass a single SmsMessage object using SendSmsRequestBody.of(SmsMessage) method (for single message) or List<SmsMessage> using SendSmsRequestBody.of(List.of(SmsMessage,...)) method (for multiple messages). Each SmsMessage object has several properties, describing message parameters such recipient phone number, content of the message, type or scheduled sending date, etc. Please use builder style:

        
         SendSmsResponse res = sdk.outgoing().sms().send()
            .request(req) // here pass GetSmsPriceRequestBody.of(...) object
            .call();
         

        This method will accept maximum 100 messages in one call.

        As a successful result a SendSmsResponse object will be returned with messages property of type List<Message> containing Message objects, one object per each single message. You should check the statusCode property of each Message object to make sure which messages were accepted by gateway (queued) and which were rejected. In case of rejection, statusDescription property will include a reason.

        SendSmsResponse will also include headers property with X-Success-Count (a count of messages which were processed successfully), X-Error-Count (count of messages which were rejected) and X-Sandbox (if a request was made in Sandbox or Production system) elements.
        Returns:
        The call builder
      • send

        public SendSmsResponse send​(SendSmsRequestBody request)
                             throws java.lang.Exception
        Send SMS Messages



        Send single or multiple SMS messages at the same time. You can pass a single SmsMessage object using SendSmsRequestBody.of(SmsMessage) method (for single message) or List<SmsMessage> using SendSmsRequestBody.of(List.of(SmsMessage,...)) method (for multiple messages). Each SmsMessage object has several properties, describing message parameters such recipient phone number, content of the message, type or scheduled sending date, etc. Please use builder style:

        
         SendSmsResponse res = sdk.outgoing().sms().send()
            .request(req) // here pass GetSmsPriceRequestBody.of(...) object
            .call();
         

        This method will accept maximum 100 messages in one call.

        As a successful result a SendSmsResponse object will be returned with messages property of type List<Message> containing Message objects, one object per each single message. You should check the statusCode property of each Message object to make sure which messages were accepted by gateway (queued) and which were rejected. In case of rejection, statusDescription property will include a reason.

        SendSmsResponse will also include headers property with X-Success-Count (a count of messages which were processed successfully), X-Error-Count (count of messages which were rejected) and X-Sandbox (if a request was made in Sandbox or Production system) elements.
        Parameters:
        request - The request object containing all the parameters for the API call.
        Returns:
        The response from the API call
        Throws:
        java.lang.Exception - if the API call fails
      • send

        public SendSmsResponse send​(SendSmsRequestBody request,
                                    java.util.Optional<Options> options)
                             throws java.lang.Exception
        Send SMS Messages



        Send single or multiple SMS messages at the same time. You can pass a single SmsMessage object using SendSmsRequestBody.of(SmsMessage) method (for single message) or List<SmsMessage> using SendSmsRequestBody.of(List.of(SmsMessage,...)) method (for multiple messages). Each SmsMessage object has several properties, describing message parameters such recipient phone number, content of the message, type or scheduled sending date, etc. Please use builder style:

        
         SendSmsResponse res = sdk.outgoing().sms().send()
            .request(req) // here pass GetSmsPriceRequestBody.of(...) object
            .call();
         

        This method will accept maximum 100 messages in one call.

        As a successful result a SendSmsResponse object will be returned with messages property of type List<Message> containing Message objects, one object per each single message. You should check the statusCode property of each Message object to make sure which messages were accepted by gateway (queued) and which were rejected. In case of rejection, statusDescription property will include a reason.

        SendSmsResponse will also include headers property with X-Success-Count (a count of messages which were processed successfully), X-Error-Count (count of messages which were rejected) and X-Sandbox (if a request was made in Sandbox or Production system) elements.
        Parameters:
        request - The request object containing all the parameters for the API call.
        options - additional options
        Returns:
        The response from the API call
        Throws:
        java.lang.Exception - if the API call fails