-
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.
Merge pull request #4 from sinch/add-verification-start-sms-snippet
Adding Verification snippet
- Loading branch information
Showing
1 changed file
with
31 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,31 @@ | ||
package verification; | ||
|
||
import com.sinch.sdk.domains.verification.*; | ||
import com.sinch.sdk.domains.verification.models.*; | ||
import com.sinch.sdk.domains.verification.models.requests.*; | ||
import com.sinch.sdk.domains.verification.models.response.*; | ||
import java.util.logging.Logger; | ||
|
||
public class Snippet { | ||
|
||
private static final Logger LOGGER = Logger.getLogger(Snippet.class.getName()); | ||
|
||
static void execute(VerificationService verificationService) { | ||
|
||
// REMINDER: verification Service require to have set application key/secret | ||
// onto Sinch Client init | ||
VerificationsService verificationsService = verificationService.verifications(); | ||
|
||
String phoneNumber = "YOUR_phone_number"; | ||
|
||
LOGGER.info(String.format("Sending a SMS verification to '%s'", phoneNumber)); | ||
|
||
StartVerificationResponseSMS response = | ||
verificationsService.startSms( | ||
StartVerificationSMSRequestParameters.builder() | ||
.setIdentity(NumberIdentity.valueOf(phoneNumber)) | ||
.build()); | ||
|
||
LOGGER.info("Response: " + response); | ||
} | ||
} |