Skip to content

Commit

Permalink
Adding Verification snippet
Browse files Browse the repository at this point in the history
  • Loading branch information
JPPortier committed Jun 5, 2024
1 parent 5c88980 commit 3a1e40c
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions snippets/verification/start_sms/Snippet.java
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);
}
}

0 comments on commit 3a1e40c

Please sign in to comment.