Interface Sms77Client
Sms77Client -- The client for accessing the webservice.
This is the client for accessing the API of the sms77 paid webservice. You need an Api-Key. This client has a spring boot application.yaml included which will rely on certain environment variables to be set. These are:
- SMS77_API_URL
- (optional)The URI for the SMS77.io api. Normally there is no reason to give another URI than https://gateway.sms77.io. And that URI is the default when nothing else is specified./
- SMS77_API_KEY
- The API key from sms77.io. For development you should generate a sandbox api key to cut costs - but your mileage may vary.
For the time being the API does not throw any sms77 specific exceptions since the sms77 API always returns HTTP 200. You have to check the return objects of the calls to find out if there has something happened.
- Since:
- 3.0.0 2023-01-17
- Version:
- 4.0.0 2024-09-22
- Author:
- rlichti <rlichti@kaiserpfalz-edv.de>
-
Method Summary
Modifier and TypeMethodDescriptionbalance()
To check the current credits to use on this API you can call the balance and get the current credits.checkMultipleNumberFormats
(@NotBlank String numbersWithComma) Check if the given numbers are formatted correctly.checkNumberFormat
(@NotBlank String number) Checks the format of a single number.Sends the SMS.Sends the given text to the numbers specified.
-
Method Details
-
sendSMS
@Retry(name="sendSMS") @CircuitBreaker(name="sendSMS") @PostMapping(value="/sms", consumes="application/json", produces="application/json") SmsResult sendSMS(@NotNull @NotNull Sms sms) Sends the SMS.- Parameters:
sms
- The SMS to be sent. The same SMS can address multiple users.- Returns:
- The result of the SMS sending.
-
sendSMS
@Retry(name="sendSMS") @CircuitBreaker(name="sendSMS") @PostMapping(value="/sms", consumes="application/json", produces="application/json") SmsResult sendSMS(@Size(min=1,max=10) @RequestParam("to") @NotNull @Size(min=1,max=10) @NotNull Set<String> number, @Size(max=1520) @RequestParam("text") @NotNull @Size(max=1520) @NotNull String text) Sends the given text to the numbers specified.- Parameters:
number
- A set of destinations for the SMS.text
- The text of the SMS.- Returns:
-
balance
@Retry(name="balanceSMS") @CircuitBreaker(name="balanceSMS") @GetMapping(value="/balance", consumes="application/json", produces="application/json") Balance balance()To check the current credits to use on this API you can call the balance and get the current credits.- Returns:
- The current account balance of your sms77.io account.
-
checkMultipleNumberFormats
@Retry(name="lookupSMS") @CircuitBreaker(name="lookupSMS") @GetMapping(value="/lookup", consumes="application/json", produces="application/json") Set<NumberFormatCheckResult> checkMultipleNumberFormats(@RequestParam("number") @NotBlank @NotBlank String numbersWithComma) Check if the given numbers are formatted correctly. There will be no check, if the numbers are valid. This
check only validates the number format and not if the number is used or even active.
This is a very ugly API call since the numbers need to be formated as single string with a comma as delimiter.
Consider something as Set.of("49123231","124323131").join(",") ...
- Parameters:
numbersWithComma
- The numbers to check, delimited by a comma.- Returns:
- The format check result.
-
checkNumberFormat
@Retry(name="checkNumberFormatSMS") @CircuitBreaker(name="checkNumberFormatSMS") @GetMapping(value="/lookup", consumes="application/json", produces="application/json") NumberFormatCheckResult checkNumberFormat(@RequestParam("number") @NotBlank @NotBlank String number) Checks the format of a single number.
This function only checks, if the number format is correct. There is no check if the number is assigned or even activ.
- Parameters:
number
- the number which format should be checked.- Returns:
- The format check result.
-