-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package sms; | ||
|
||
import com.sinch.sdk.domains.sms.*; | ||
import com.sinch.sdk.domains.sms.models.*; | ||
import com.sinch.sdk.domains.sms.models.requests.*; | ||
import java.util.Collection; | ||
import java.util.Collections; | ||
import java.util.logging.Logger; | ||
|
||
public class Snippet { | ||
|
||
private static final Logger LOGGER = Logger.getLogger(Snippet.class.getName()); | ||
|
||
static void execute(SMSService smsService) { | ||
|
||
BatchesService batchesService = smsService.batches(); | ||
|
||
String from = "YOUR_sinch_phone_number"; | ||
Collection<String> recipients = Collections.singletonList("YOUR_recipient_phone_number"); | ||
String body = "This is a test SMS message using the Sinch Java SDK."; | ||
|
||
LOGGER.info("Sending SMS Text"); | ||
BatchText value = | ||
batchesService.send( | ||
SendSmsBatchTextRequest.builder() | ||
.setTo(recipients) | ||
.setBody(body) | ||
.setFrom(from) | ||
.build()); | ||
|
||
LOGGER.info("Response: " + value); | ||
} | ||
} |