Skip to content

Commit 6abe993

Browse files
committed
feat: add new insights to identity insights package
- Add reachability, roaming and device location - Update subscriber match insight - Update README file
1 parent 3a4f841 commit 6abe993

File tree

19 files changed

+423
-34
lines changed

19 files changed

+423
-34
lines changed

packages/identity-insights/README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,14 @@ const params = {
7777
const resp = await clientInsights.getIdentityInsights(params);
7878
```
7979

80+
## Debugging
81+
82+
Run your script as follows:
83+
84+
```bash
85+
DEBUG=vonage:server-client node your-script.js
86+
```
87+
8088
## Testing
8189

8290
Run:
@@ -85,5 +93,30 @@ Run:
8593
npm run test
8694
```
8795

96+
## Insights Release Status
97+
98+
The Identity Insights API supports different insights, and from time to time, we
99+
will add new channels or update the existing ones. Each insight follows our
100+
normal product development cycle, that is:
101+
102+
Developer Preview -> Alpha -> Beta -> GA
103+
104+
As a result, different insights within the API may be at different release
105+
stages at any given time. This table details the current release status of each
106+
insight implemented in this SDK:
107+
108+
| Insight | API Release Status |
109+
|-----------------------|:--------------------:|
110+
| Format | Beta |
111+
| SIM Swap | Beta |
112+
| Original Carrier | Beta |
113+
| Current Carrier | Beta |
114+
| Location Verification | Developer Preview |
115+
| Subscriber Match | Developer Preview |
116+
| Roaming | Developer Preview |
117+
| Reachability | Developer Preview |
118+
119+
> Note: All statuses prior to GA are subject to regular updates, which may include breaking changes.
120+
88121
[signup]: https://dashboard.nexmo.com/sign-up?utm_source=DEV_REL&utm_medium=github&utm_campaign=node-server-sdk
89122
[license]: ../../LICENSE.txt

packages/identity-insights/__tests__/__dataSets__/post.ts

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,22 @@ import {
33
IdentityInsightsResponse,
44
IdentityInsightsParameters,
55
IdentityInsightsType,
6+
NetworkType,
7+
Connectivity,
68
} from '../../lib';
79

810
const params = {
911
phoneNumber: '14040000000',
1012
purpose: 'FraudPreventionAndDetection',
1113
insights: {
1214
format: {},
15+
originalCarrier: {},
16+
currentCarrier: {},
1317
simSwap: {
1418
period: 240
1519
},
20+
roaming: {},
21+
reachability: {},
1622
},
1723
} as IdentityInsightsParameters;
1824

@@ -33,6 +39,26 @@ const identityInsights = {
3339
message: 'Success'
3440
}
3541
},
42+
originalCarrier: {
43+
name: 'Orange Espana, S.A. Unipersonal',
44+
networkType: NetworkType.MOBILE,
45+
countryCode: 'ES',
46+
networkCode: '21403',
47+
status: {
48+
code: Status.OK,
49+
message: 'Success'
50+
}
51+
},
52+
currentCarrier: {
53+
name: 'Orange Espana, S.A. Unipersonal',
54+
networkType: NetworkType.MOBILE,
55+
countryCode: 'ES',
56+
networkCode: '21403',
57+
status: {
58+
code: Status.OK,
59+
message: 'Success'
60+
}
61+
},
3662
simSwap: {
3763
latestSimSwapAt: '2024-07-08T09:30:27.504Z',
3864
isSwapped: true,
@@ -41,6 +67,24 @@ const identityInsights = {
4167
message: 'Success'
4268
}
4369
},
70+
roaming: {
71+
latestStatusAt: '2025-10-11T08:23:23.456',
72+
isRoaming: true,
73+
countryCodes : [ "ES" ],
74+
status: {
75+
code: Status.OK,
76+
message: 'Success'
77+
}
78+
},
79+
reachability: {
80+
latestStatusAt: '2025-10-11T08:23:23.456',
81+
isReachable: true,
82+
connectivity: [ Connectivity.DATA ],
83+
status: {
84+
code: Status.OK,
85+
message: 'Success'
86+
}
87+
},
4488
},
4589
} as IdentityInsightsType;
4690

@@ -69,6 +113,44 @@ const response = {
69113
message: 'Success'
70114
}
71115
},
116+
originalCarrier: {
117+
name: 'Orange Espana, S.A. Unipersonal',
118+
networkType: NetworkType.MOBILE,
119+
countryCode: 'ES',
120+
networkCode: '21403',
121+
status: {
122+
code: Status.OK,
123+
message: 'Success'
124+
}
125+
},
126+
currentCarrier: {
127+
name: 'Orange Espana, S.A. Unipersonal',
128+
networkType: NetworkType.MOBILE,
129+
countryCode: 'ES',
130+
networkCode: '21403',
131+
status: {
132+
code: Status.OK,
133+
message: 'Success'
134+
}
135+
},
136+
roaming: {
137+
latestStatusAt: '2025-10-11T08:23:23.456',
138+
isRoaming: true,
139+
countryCodes : [ "ES" ],
140+
status: {
141+
code: Status.OK,
142+
message: 'Success'
143+
}
144+
},
145+
reachability: {
146+
latestStatusAt: '2025-10-11T08:23:23.456',
147+
isReachable: true,
148+
connectivity: [ Connectivity.DATA ],
149+
status: {
150+
code: Status.OK,
151+
message: 'Success'
152+
}
153+
},
72154
},
73155
} as IdentityInsightsResponse;
74156

packages/identity-insights/lib/enums/codeStatus.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,22 @@ export enum Status {
4848
*/
4949
OK = 'ok',
5050
}
51+
52+
export enum SubscriberMatchStatus {
53+
54+
/**
55+
* Operator requires idDocument to match any other attributes.
56+
*/
57+
SUBSCRIBER_MATCH_ID_DOCUMENT_REQUIRED = 'subscriber_match.id_document_required',
58+
59+
/**
60+
* Operator cannot match idDocument which is required to match any other attibutes.
61+
*/
62+
SUBSCRIBER_MATCH_ID_DOCUMENT_MISMATCH = 'subscriber_match.id_document_mismatch',
63+
64+
/**
65+
* Indicated parameter combination is invalid.
66+
*/
67+
SUBSCRIBER_MATCH_INVALID_PARAM_COMBINATION = 'subscriber_match.invalid_param_combination',
68+
69+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/**
2+
* Enum representing the connectivty type
3+
*/
4+
export enum Connectivity {
5+
6+
/**
7+
* Device is connected to the newtork for data
8+
*/
9+
DATA = 'data',
10+
11+
/**
12+
* Device is connected to the newtork for sms
13+
*/
14+
SMS = 'sms',
15+
16+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
export * from './codeStatus.js';
22
export * from './networkType.js';
33
export * from './match.js';
4+
export * from './locationVerified.js';
5+
export * from './connectivity.js';
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/**
2+
* Enum representing the result of the location verification request
3+
*/
4+
export enum LocationVerified {
5+
6+
/**
7+
* The network locates the device within the requested area,
8+
*/
9+
TRUE = 'true',
10+
11+
/**
12+
* The requested area does not match the area where the network locates the device
13+
*/
14+
FALSE = 'false',
15+
16+
/**
17+
* The network cannot locate the device
18+
*/
19+
UNKNOWN = 'unknown',
20+
21+
/**
22+
* The requested area partially match the area where the network locates the device.
23+
*/
24+
PARTIAL = 'partial',
25+
26+
};

packages/identity-insights/lib/enums/match.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,12 @@ export enum Match {
3434
DATA_UNAVAILABLE = 'data_unavailable',
3535

3636
}
37+
38+
export enum MatchAddress {
39+
40+
/**
41+
* The value provided matches with part of the address
42+
*/
43+
INCLUDED_WITH_ADDRESS_MATCH = 'included_with_address_match',
44+
}
45+

packages/identity-insights/lib/types/format.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { StatusType } from './status.js';
22

33
/**
4-
* Represents the result of the current and original carrier insights.
4+
* Represents the result of the format insight.
55
*/
66
export type Format = {
77

packages/identity-insights/lib/types/insights.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ import { Format } from './format.js';
22
import { SimSwap } from './simSwap.js';
33
import { Carrier } from './carrier.js';
44
import { SubscriberMatch } from './subscriberMatch.js';
5+
import { LocationVerification } from './locationVerification.js';
6+
import { Roaming } from './roaming.js';
7+
import { Reachability } from './reachability.js';
58

69
/**
710
* Represents the insights object
@@ -34,4 +37,19 @@ export type Insights = {
3437
*/
3538
subscriberMatch?: SubscriberMatch;
3639

40+
/**
41+
* The result of the 'location_verification' insight operation (optional).
42+
*/
43+
locationVerification?: LocationVerification;
44+
45+
/**
46+
* The result of the 'roaming' insight operation (optional).
47+
*/
48+
roaming?: Roaming;
49+
50+
/**
51+
* The result of the 'reachability' insight operation (optional).
52+
*/
53+
reachability?: Reachability;
54+
3755
};
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import { StatusType } from './status.js';
2+
import { LocationVerified } from '../enums/locationVerified.js';
3+
4+
/**
5+
* Represents the result of the location verification insights.
6+
*/
7+
export type LocationVerification = {
8+
9+
/**
10+
* The status of the insight call.
11+
*/
12+
status: StatusType;
13+
14+
/**
15+
* Result of the verification request
16+
*/
17+
isVerified?: LocationVerified;
18+
19+
/**
20+
* Date and time of the last location
21+
* Example: "2025-10-07T12:34:56Z"
22+
*/
23+
latestLocationAt?: string;
24+
25+
/**
26+
* Estimation of the match rate between the area in the request, and
27+
* area where the network locates the device
28+
*/
29+
matchRate?: number;
30+
31+
};

0 commit comments

Comments
 (0)