Skip to content

Commit c821802

Browse files
Pull request #14: feature/EOA-5901-SS-Intellegence-Cloud-Api
Merge in SDK/java_telesign from feature/EOA-5901-SS-Intellegence-Cloud-Api to developer Squashed commit of the following: commit 6f9e7a7c7c273b55ababe26a5f5a73d3d9ff2583 Author: MousumiMohanty <@telesign.com> Date: Mon Nov 3 18:47:23 2025 +0530 Added support for Intelligence Cloud to use new endpoint
1 parent 33b2a09 commit c821802

File tree

5 files changed

+35
-32
lines changed

5 files changed

+35
-32
lines changed

RELEASE.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## [4.0.0](http://central.maven.org/maven2/com/telesign/telesign/4.0.0) - 2025-11-4
2+
- 2025-11-4
3+
- Added support for Intelligence Cloud to use new endpoint.
4+
15
## [3.0.1](http://central.maven.org/maven2/com/telesign/telesign/3.0.1) - 2025-09-18
26
- 2025-09-18
37
- Updated SDK install instructions on GitHub to default to latest version for Telesign SDK

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ plugins {
99
}
1010

1111
group 'com.telesign'
12-
version '3.0.1'
12+
version '4.0.0'
1313

1414
sourceCompatibility = JavaVersion.VERSION_1_8
1515
targetCompatibility = JavaVersion.VERSION_1_8
@@ -138,7 +138,7 @@ if (System.getenv('TRAVIS') == null) {
138138

139139
groupId = 'com.telesign'
140140
artifactId = 'telesign'
141-
version = '3.0.1'
141+
version = '4.0.0'
142142

143143
pom {
144144
name = 'Telesign SDK'

src/main/java/com/telesign/ScoreClient.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@
1111
*/
1212
public class ScoreClient extends RestClient {
1313

14-
private static final String SCORE_RESOURCE = "/v1/score/%s";
14+
private static final String INTELLIGENCE_SCORE_RESOURCE = "/intelligence/phone";
15+
16+
private static final String DETECT_REST_ENDPOINT = "https://detect.telesign.com";
1517

1618
public ScoreClient(String customerId, String apiKey) {
17-
super(customerId, apiKey);
19+
super(customerId, apiKey, DETECT_REST_ENDPOINT);
1820
}
1921

2022
public ScoreClient(String customerId, String apiKey, String restEndpoint, String source, String sdkVersionOrigin, String sdkVersionDependency) {
@@ -41,19 +43,18 @@ public ScoreClient(String customerId,
4143
}
4244

4345
/**
44-
* Score is an API that delivers reputation scoring based on phone number intelligence, traffic patterns, machine
45-
* learning, and a global data consortium.
46+
*Obtain a risk recommendation for this phone number, as well as other relevant information using Telesign Cloud API.
4647
* <p>
47-
* See https://developer.telesign.com/docs/score-api for detailed API documentation.
48+
* See https://developer.telesign.com/enterprise/reference/submitphonenumberforintelligencecloud for detailed API documentation.
4849
*/
4950
public TelesignResponse score(String phoneNumber, String accountLifecycleEvent, Map<String, String> params) throws IOException, GeneralSecurityException {
50-
5151
if (params == null) {
5252
params = new HashMap<>();
5353
}
54-
54+
55+
params.put("phone_number", phoneNumber);
5556
params.put("account_lifecycle_event", accountLifecycleEvent);
5657

57-
return this.post(String.format(SCORE_RESOURCE, phoneNumber), params);
58+
return this.post(INTELLIGENCE_SCORE_RESOURCE, params);
5859
}
5960
}

src/test/java/com/telesign/ScoreClientTest.java

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import okhttp3.mockwebserver.MockWebServer;
66
import okhttp3.mockwebserver.RecordedRequest;
77

8-
import java.text.SimpleDateFormat;
98
import java.util.HashMap;
109
import java.util.concurrent.TimeUnit;
1110

@@ -16,14 +15,11 @@ public class ScoreClientTest extends TestCase {
1615
private String customerId;
1716
private String apiKey;
1817

19-
private SimpleDateFormat rfc2616 = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss 'GMT'");
20-
21-
2218
public void setUp() throws Exception {
2319
super.setUp();
2420

2521
customerId = "FFFFFFFF-EEEE-DDDD-1234-AB1234567890";
26-
apiKey = "EXAMPLE----TE8sTgg45yusumoN6BYsBVkh+yRJ5czgsnCehZaOYldPJdmFh6NeX8kunZ2zU1YWaUw/0wV6xfw==";
22+
apiKey = "ABC12345yusumoN6BYsBVkh+yRJ5czgsnCehZaOYldPJdmFh6NeX8kunZ2zU1YWaUw/0wV6xfw==";
2723

2824
mockServer = new MockWebServer();
2925
mockServer.start();
@@ -40,7 +36,6 @@ public void testScoreClientConstructorMinimal() throws Exception {
4036
assertNotNull(client);
4137
}
4238

43-
4439
public void testScoreClientConstructorFull() throws Exception {
4540
ScoreClient client = new ScoreClient(customerId,
4641
apiKey,
@@ -58,7 +53,6 @@ public void testScoreClientConstructorFull() throws Exception {
5853
}
5954

6055
public void testScoreWithParams() throws Exception {
61-
6256
HashMap<String, String> params = new HashMap<String, String>() {{
6357
put("originating_ip", "127.0.0.1");
6458
put("account_lifecycle_event", "create");
@@ -70,24 +64,25 @@ public void testScoreWithParams() throws Exception {
7064
this.apiKey,
7165
this.mockServer.url("").toString().replaceAll("/$", ""), null, null, null);
7266

73-
client.score("18005555555", "create", params);
67+
client.score("11234567890", "create", params);
7468

7569
RecordedRequest request = this.mockServer.takeRequest(1, TimeUnit.SECONDS);
7670

7771
assertEquals("method is not as expected", "POST", request.getMethod());
78-
assertEquals("path is not as expected", "/v1/score/18005555555", request.getPath());
79-
assertEquals("body is not as expected", "originating_ip=127.0.0.1&account_lifecycle_event=create",
80-
request.getBody().readUtf8());
72+
assertEquals("path is not as expected", "/intelligence/phone", request.getPath());
73+
74+
String body = request.getBody().readUtf8();
75+
assertTrue("body does not contain phone_number", body.contains("phone_number=11234567890"));
76+
assertTrue("body does not contain originating_ip", body.contains("originating_ip=127.0.0.1"));
77+
assertTrue("body does not contain account_lifecycle_event", body.contains("account_lifecycle_event=create"));
78+
8179
assertEquals("Content-Type header is not as expected", "application/x-www-form-urlencoded",
8280
request.getHeader("Content-Type"));
8381
assertEquals("x-ts-auth-method header is not as expected", "HMAC-SHA256",
8482
request.getHeader("x-ts-auth-method"));
8583
}
8684

8785
public void testScore() throws Exception {
88-
89-
HashMap<String, Object> params = new HashMap<String, Object>();
90-
9186
this.mockServer.enqueue(new MockResponse().setBody("{}"));
9287

9388
ScoreClient client = new ScoreClient(this.customerId,
@@ -99,15 +94,15 @@ public void testScore() throws Exception {
9994
RecordedRequest request = this.mockServer.takeRequest(1, TimeUnit.SECONDS);
10095

10196
assertEquals("method is not as expected", "POST", request.getMethod());
102-
assertEquals("path is not as expected", "/v1/score/18005555555", request.getPath());
103-
assertEquals("body is not as expected", "account_lifecycle_event=create",
104-
request.getBody().readUtf8());
97+
assertEquals("path is not as expected", "/intelligence/phone", request.getPath());
98+
99+
String body = request.getBody().readUtf8();
100+
assertTrue("body does not contain phone_number", body.contains("phone_number=18005555555"));
101+
assertTrue("body contains account_lifecycle_event", body.contains("account_lifecycle_event=create"));
102+
105103
assertEquals("Content-Type header is not as expected", "application/x-www-form-urlencoded",
106104
request.getHeader("Content-Type"));
107105
assertEquals("x-ts-auth-method header is not as expected", "HMAC-SHA256",
108106
request.getHeader("x-ts-auth-method"));
109107
}
110-
111-
}
112-
113-
108+
}

src/test/java/com/telesign/example/score/CheckPhoneNumberRiskLevel.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ public class CheckPhoneNumberRiskLevel {
88
public static void main(String[] args) {
99

1010
String customerId = "FFFFFFFF-EEEE-DDDD-1234-AB1234567890";
11-
String apiKey = "EXAMPLE----TE8sTgg45yusumoN6BYsBVkh+yRJ5czgsnCehZaOYldPJdmFh6NeX8kunZ2zU1YWaUw/0wV6xfw==";
11+
String apiKey = "ABC12345yusumoN6BYsBVkh+yRJ5czgsnCehZaOYldPJdmFh6NeX8kunZ2zU1YWaUw/0wV6xfw==";
1212

1313
String phoneNumber = "phone_number";
1414
String accountLifecycleEvent = "create";
@@ -22,6 +22,9 @@ public static void main(String[] args) {
2222
phoneNumber,
2323
telesignResponse.json.getAsJsonObject("risk").get("level").getAsString(),
2424
telesignResponse.json.getAsJsonObject("risk").get("recommendation").getAsString()));
25+
}
26+
else {
27+
System.out.println("Request failed with status: " + telesignResponse.statusCode);
2528
}
2629
} catch (Exception e) {
2730
e.printStackTrace();

0 commit comments

Comments
 (0)