Skip to content

Commit 840d0f9

Browse files
authored
Merge pull request #62 from Nexmo/s_branch
Adding workflow verify sample - fixing env file
2 parents c432731 + 65dbeef commit 840d0f9

File tree

2 files changed

+36
-2
lines changed

2 files changed

+36
-2
lines changed

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ repositories {
1414

1515
dependencies {
1616
testCompile 'junit:junit:4.12'
17-
18-
compile 'com.nexmo:client:5.1.0'
17+
18+
compile 'com.nexmo:client:5.2.0'
1919
compile "com.sparkjava:spark-core:2.6.0"
2020
compile 'javax.xml.bind:jaxb-api:2.3.0'
2121
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package com.nexmo.quickstart.verify;
2+
3+
import com.nexmo.client.NexmoClient;
4+
import com.nexmo.client.verify.VerifyResponse;
5+
import com.nexmo.client.verify.VerifyStatus;
6+
import com.nexmo.client.verify.VerifyRequest;
7+
8+
import static com.nexmo.quickstart.Util.configureLogging;
9+
import static com.nexmo.quickstart.Util.envVar;
10+
11+
public class StartVerificationWithWorkflow {
12+
public static void main(String[] args) throws Exception {
13+
configureLogging();
14+
15+
String NEXMO_API_KEY = envVar("NEXMO_API_KEY");
16+
String NEXMO_API_SECRET = envVar("NEXMO_API_SECRET");
17+
18+
String RECIPIENT_NUMBER = envVar("RECIPIENT_NUMBER");
19+
String NEXMO_BRAND = envVar("BRAND_NAME");
20+
21+
VerifyRequest request = new VerifyRequest(RECIPIENT_NUMBER,NEXMO_BRAND);
22+
23+
request.setWorkflow(VerifyRequest.Workflow.TTS_TTS);
24+
25+
NexmoClient client = NexmoClient.builder().apiKey(NEXMO_API_KEY).apiSecret(NEXMO_API_SECRET).build();
26+
VerifyResponse response = client.getVerifyClient().verify(request);
27+
28+
if (response.getStatus() == VerifyStatus.OK) {
29+
System.out.printf("RequestID: %s", response.getRequestId());
30+
} else {
31+
System.out.printf("ERROR! %s: %s", response.getStatus(), response.getErrorText());
32+
}
33+
}
34+
}

0 commit comments

Comments
 (0)