Skip to content

Commit dcaaa9d

Browse files
Pull request #11: Feature/EOA-5906 SS Intellegence Cloude Api
Merge in SDK/node_telesign from feature/EOA-5906-SS-Intellegence-Cloude-Api to developer Squashed commit of the following: commit 1e473b82f3941ef1ed92daff8eaef1fbd6dc3baa Author: Juan Camilo Martinez <jmartinez@telesign.com> Date: Mon Jan 19 14:52:00 2026 -0500 Commit merge commit dbfcaa15e3babd9d7973a02b3c0274059e55920b Author: MousumiMohanty <@telesign.com> Date: Thu Dec 4 22:21:19 2025 +0530 revertback the detect endpoint commit d089c276f98d2a2ab2efd6a79c28903611e6c2e4 Author: MousumiMohanty <@telesign.com> Date: Thu Dec 4 21:59:51 2025 +0530 updated the comments commit 4753210b7fa188a4f397f1a2dc203e065191431f Author: MousumiMohanty <@telesign.com> Date: Thu Dec 4 16:40:07 2025 +0530 updated with the comments commit 758578296e317d1323f1f7a13ca02ceaa7861947 Author: MousumiMohanty <@telesign.com> Date: Wed Dec 3 16:48:38 2025 +0530 updated the comments commit 6e21a3dd45b71be9b2d8a9a20ec8b986dece977a Author: MousumiMohanty <@telesign.com> Date: Wed Dec 3 10:45:56 2025 +0530 added support for Intelligence Cloud in Node SDKs commit 045906f956749c1025b1a937a614008e16bdfc14 Author: MousumiMohanty <@telesign.com> Date: Tue Dec 2 19:16:35 2025 +0530 Initial PR
1 parent a490362 commit dcaaa9d

File tree

10 files changed

+216
-235
lines changed

10 files changed

+216
-235
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
2+
3+
- Added support for Intelligence Cloud to use new endpoint.
4+
15
3.0.4
26

37
- Added support for PATCH to the Telesign RestClient.

examples/intelligence/1_get_risk_score_and_related_insights.js

Lines changed: 0 additions & 43 deletions
This file was deleted.
Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,39 @@
1-
// note change this to the following if using npm package: require('telesignsdk);
21
const TeleSignSDK = require('../../src/TeleSign');
3-
//var TeleSignSDK = require('telesignsdk');
42

5-
const customerId = "customer_id"; // Todo: find in portal.telesign.com
6-
const apiKey = "dGVzdCBhcGkga2V5IGZvciBzZGsgZXhhbXBsZXM="; // Todo: find in portal.telesign.com
7-
const rest_endpoint = "https://rest-api.telesign.com"; // Todo: Enterprise customer, change this!
8-
const timeout = 10*1000; // 10 secs
3+
const customerId = "FFFFFFFF-EEEE-DDDD-1234-AB1234567890";
4+
const apiKey = "ABC12345yusumoN6BYsBVkh+yRJ5czgsnCehZaOYldPJdmFh6NeX8kunZ2zU1YWaUw/0wV6xfw==";
5+
const detectEndpoint = "https://detect.telesign.com";
6+
const timeout = 10*1000;
97

10-
const client = new TeleSignSDK( customerId,
11-
apiKey,
12-
rest_endpoint,
13-
timeout // optional
14-
// userAgent
15-
);
8+
const client = new TeleSignSDK(customerId, apiKey, detectEndpoint, timeout);
169

17-
const phoneNumber = "phone_number";
18-
const accountLifeCycleEvent = "create";
10+
const phoneNumber = "11234567890";
11+
const accountLifecycleEvent = "create";
1912

2013
console.log("## ScoreClient.score ##");
2114

2215
function score_callback(error, response_body) {
23-
if (error === null) {
24-
console.log(`Score response for phone number: ${phoneNumber}` +
25-
` => code: ${response_body['status']['code']}` +
26-
`, description: ${response_body['status']['description']}`);
27-
} else {
28-
console.error("Unable to get score. " + error);
16+
if (error === null) {
17+
console.log(`Score response for phone number: ${phoneNumber} => code: ${response_body['status']['code']}, description: ${response_body['status']['description']}`);
18+
19+
if (response_body['status']['code'] === 300) {
20+
const riskLevel = response_body.risk?.level || "unknown";
21+
const recommendation = response_body.risk?.recommendation || "no recommendation";
22+
console.log(`SUCCESS! Phone number ${phoneNumber} risk level: ${riskLevel}, recommendation: ${recommendation}`);
23+
24+
console.log("Full response:", JSON.stringify(response_body, null, 2));
25+
} else if (response_body['status']['code'] === 301) {
26+
console.log("PARTIAL SUCCESS - Some data available:", JSON.stringify(response_body, null, 2));
2927
}
28+
} else {
29+
console.error("Unable to get score. Error:", error);
30+
}
3031
}
3132

32-
client.score.score(score_callback, phoneNumber, accountLifeCycleEvent);
33+
client.score.score(score_callback, phoneNumber, accountLifecycleEvent, {
34+
accountId: "account-123",
35+
deviceId: "device-456",
36+
emailAddress: "user@example.com",
37+
externalId: "external-789",
38+
originatingIp: "192.0.2.1"
39+
});

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "telesignsdk",
3-
"version": "3.0.4",
4-
"description": "Official TeleSign SDK for Rest APIs including Messaging (SMS), Score, PhoneID, Voice, and AppVerify",
3+
"version": "4.0.0",
4+
"description": "Official TeleSign SDK for Rest APIs including Messaging (SMS), Intelligence Cloud, PhoneID, Voice, and AppVerify",
55
"repository": {
66
"type": "git",
77
"url": "https://github.com/TeleSign/node_telesign"

src/IntelligenceClient.js

Lines changed: 0 additions & 47 deletions
This file was deleted.

src/ScoreClient.js

Lines changed: 38 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,46 @@
11
const RestClient = require('./RestClient.js');
22

33
/***
4-
* Score provides risk information about a specified phone number.
4+
* ScoreClient for TeleSign Intelligence Cloud.
5+
* Supports POST /intelligence/phone endpoint(Cloud migration).
56
*/
67
class ScoreClient extends RestClient {
7-
constructor(requestWrapper,
8-
customerId,
9-
apiKey,
10-
restEndpoint = null,
11-
timeout = 15000,
12-
userAgent = null) {
8+
constructor(requestWrapper,
9+
customerId,
10+
apiKey,
11+
restEndpoint = "https://detect.telesign.com",
12+
timeout = 15000,
13+
userAgent = null) {
14+
super(requestWrapper, customerId, apiKey, restEndpoint, timeout, userAgent);
15+
this.scoreResource = "/intelligence/phone";
16+
this.setContentType("application/x-www-form-urlencoded");
17+
}
18+
/**
19+
* Obtain a risk recommendation for a phone number using Telesign Intelligence Cloud API.
20+
*
21+
* @param callback Callback handling the response
22+
* @param phoneNumber Phone number to check (digits-only E.164 format)
23+
* @param accountLifecycleEvent Required lifecycle event string: 'create', 'sign-in', etc.
24+
* @param options Optional object for additional parameters:
25+
* accountId, deviceId, emailAddress, externalId, originatingIp, etc.
26+
*/
27+
score(callback,
28+
phoneNumber,
29+
accountLifecycleEvent,
30+
options = {}) {
31+
const params = {
32+
phone_number: phoneNumber,
33+
account_lifecycle_event: accountLifecycleEvent,
34+
...(options.accountId && { account_id: options.accountId }),
35+
...(options.deviceId && { device_id: options.deviceId }),
36+
...(options.emailAddress && { email_address: options.emailAddress }),
37+
...(options.externalId && { external_id: options.externalId }),
38+
...(options.originatingIp && { originating_ip: options.originatingIp }),
39+
};
1340

14-
super(requestWrapper, customerId, apiKey, restEndpoint, timeout, userAgent);
15-
16-
this.scoreResource = "/v1/score/";
17-
}
18-
19-
/***
20-
* Score is an API that delivers reputation scoring based on phone number intelligence,
21-
* traffic patterns, machine learning, and a global data consortium.
22-
*
23-
* See https://developer.telesign.com/docs/score-api for detailed API documentation.
24-
*
25-
* @param callback: Callback method to handle response.
26-
* @param phoneNumber: Phone number for which to check score
27-
* @param accountLifecycleEvent: Indicate what phase of the lifecycle you are in when you
28-
* send a transaction.
29-
* @param originatingIP: (Optional) End user's IP address.
30-
* @param deviceId: (Optional) End user’s device identifier.
31-
* @param accountId: (Optional) End user’s account id
32-
* @param emailAddress: (Optional) End user’s email address
33-
* @param requestRiskInsights: (Optional) Boolean value of true, false or null for reason codes
34-
* ONLY SET IF Score 2.0 requests is enabled, confirm with your Telesign representative
35-
*/
36-
score(callback,
37-
phoneNumber,
38-
accountLifecycleEvent,
39-
originatingIP = null,
40-
deviceId = null,
41-
accountId = null,
42-
emailAddress = null,
43-
requestRiskInsights = null) {
44-
45-
var params = {
46-
account_lifecycle_event: accountLifecycleEvent
47-
};
48-
if (originatingIP != null) {
49-
params.originating_ip = originatingIP;
50-
}
51-
if (deviceId != null) {
52-
params.device_id = deviceId;
53-
}
54-
if (accountId != null) {
55-
params.account_id = accountId;
56-
}
57-
if (emailAddress != null) {
58-
params.email_address = emailAddress;
59-
}
60-
if (requestRiskInsights != null) {
61-
params.request_risk_insights = requestRiskInsights;
62-
}
63-
64-
this.execute(callback, "POST", this.scoreResource + encodeURI(phoneNumber), params);
65-
}
41+
this.execute(callback, "POST", this.scoreResource, params);
42+
}
43+
6644
}
67-
45+
6846
module.exports = ScoreClient;

src/TeleSign.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ const ScoreClient = require('./ScoreClient.js');
44
const PhoneIDClient = require('./PhoneIDClient.js');
55
const VoiceClient = require('./VoiceClient.js');
66
const AppVerifyClient = require('./AppVerifyClient.js');
7-
const IntelligenceClient = require('./IntelligenceClient.js');
8-
const { FetchRequestWrapper } = require('./RequestWrapper')
7+
const { FetchRequestWrapper } = require('./RequestWrapper');
8+
const detectEndpoint = "https://detect.telesign.com";
99

1010
module.exports = class TeleSign {
1111
constructor(customerId,
@@ -21,9 +21,8 @@ module.exports = class TeleSign {
2121
this.rest = new RestClient(requestWrapper, customerId, apiKey, restEndpoint, timeout, useragent, source, sdkVersionOrigin, sdkVersionDependency);
2222
this.sms = new MessagingClient(requestWrapper, customerId, apiKey, restEndpoint, timeout, useragent);
2323
this.voice = new VoiceClient(requestWrapper, customerId, apiKey, restEndpoint, timeout, useragent);
24-
this.score = new ScoreClient(requestWrapper, customerId, apiKey, restEndpoint, timeout, useragent);
24+
this.score = new ScoreClient(requestWrapper, customerId, apiKey, detectEndpoint, timeout, useragent);
2525
this.phoneid = new PhoneIDClient(requestWrapper, customerId, apiKey, restEndpoint, timeout, useragent);
2626
this.appverify = new AppVerifyClient(requestWrapper, customerId, apiKey, restEndpoint, timeout, useragent);
27-
this.intelligence = new IntelligenceClient(requestWrapper, customerId, apiKey, restEndpoint, timeout, useragent);
2827
}
2928
};

0 commit comments

Comments
 (0)