Skip to content

Adding workflow verify sample #62

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .env-example
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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());
}
}
}