diff --git a/.env-example b/.env-example index 16f35d9..f0f52bb 100644 --- a/.env-example +++ b/.env-example @@ -1,7 +1,7 @@ -API_KEY=YOUR_API_KEY -API_SECRET=YOUR_API_SECRET -APPLICATION_ID=YOUR_APPLICATION_ID -PRIVATE_KEY=PATH_TO_YOUR_KEY_FILE +NEXMO_API_KEY=NEXMO_API_KEY +NEXMO_API_SECRET=NEXMO_API_SECRET +NEXMO_APPLICATION_ID=NEXMO_APPLICATION_ID +NEXMO_PRIVATE_KEY_PATH=NEXMO_PRIVATE_KEY_PATH NEXMO_NUMBER=YOUR_NEXMO_NUMBER TO_NUMBER=NUMBER_TO_CALL RECIPIENT_NUMBER=YOUR_RECIPIENTS_NUMBER diff --git a/README.md b/README.md index 444e90c..4575ccb 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ foreman run java -cp build/libs/nexmo-java-quickstart-with-dependencies.jar CLAS So to run the OutboundTextToSpeechExample class, you would run the following: ```sh -foreman run java -cp build/libs/nexmo-java-quickstart-with-dependencies.jar com.nexmo.quickstart.voice.OutboundTextToSpeech +foreman run java -cp build/libs/nexmo-java-code-snippets-with-dependencies.jar com.nexmo.quickstart.voice.OutboundTextToSpeech ``` If you set the environment variable `QUICKSTART_DEBUG` to any value, extra information diff --git a/build.gradle b/build.gradle index 5d8fbdf..bb360a8 100644 --- a/build.gradle +++ b/build.gradle @@ -14,8 +14,8 @@ repositories { dependencies { testCompile 'junit:junit:4.12' - - compile 'com.nexmo:client:5.1.0' + + compile 'com.nexmo:client:5.2.0' compile "com.sparkjava:spark-core:2.6.0" compile 'javax.xml.bind:jaxb-api:2.3.0' } diff --git a/src/main/java/com/nexmo/quickstart/verify/StartVerificationWithWorkflow.java b/src/main/java/com/nexmo/quickstart/verify/StartVerificationWithWorkflow.java new file mode 100644 index 0000000..b820fd8 --- /dev/null +++ b/src/main/java/com/nexmo/quickstart/verify/StartVerificationWithWorkflow.java @@ -0,0 +1,34 @@ +package com.nexmo.quickstart.verify; + +import com.nexmo.client.NexmoClient; +import com.nexmo.client.verify.VerifyResponse; +import com.nexmo.client.verify.VerifyStatus; +import com.nexmo.client.verify.VerifyRequest; + +import static com.nexmo.quickstart.Util.configureLogging; +import static com.nexmo.quickstart.Util.envVar; + +public class StartVerificationWithWorkflow { + public static void main(String[] args) throws Exception { + configureLogging(); + + String NEXMO_API_KEY = envVar("NEXMO_API_KEY"); + String NEXMO_API_SECRET = envVar("NEXMO_API_SECRET"); + + String RECIPIENT_NUMBER = envVar("RECIPIENT_NUMBER"); + String NEXMO_BRAND = envVar("BRAND_NAME"); + + VerifyRequest request = new VerifyRequest(RECIPIENT_NUMBER,NEXMO_BRAND); + + request.setWorkflow(VerifyRequest.Workflow.TTS_TTS); + + NexmoClient client = NexmoClient.builder().apiKey(NEXMO_API_KEY).apiSecret(NEXMO_API_SECRET).build(); + VerifyResponse response = client.getVerifyClient().verify(request); + + if (response.getStatus() == VerifyStatus.OK) { + System.out.printf("RequestID: %s", response.getRequestId()); + } else { + System.out.printf("ERROR! %s: %s", response.getStatus(), response.getErrorText()); + } + } +}