File tree 1 file changed +30
-0
lines changed
1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change
1
+ require ( 'dotenv' ) . config ( { path : __dirname + '/../.env' } ) ;
2
+
3
+ const VONAGE_API_KEY = process . env . VONAGE_API_KEY ;
4
+ const VONAGE_API_SECRET = process . env . VONAGE_API_SECRET ;
5
+
6
+ // By default use the command line argument. Otherwise use the environment variable.
7
+ const INSIGHT_NUMBER = process . argv [ 2 ] || process . env . INSIGHT_NUMBER ;
8
+
9
+ const { NumberInsightV2, Insight } = require ( '@vonage/number-insight-v2' ) ;
10
+
11
+ const insight = new NumberInsightV2 ( {
12
+ apiKey : VONAGE_API_KEY ,
13
+ apiSecret : VONAGE_API_SECRET ,
14
+ } ) ;
15
+
16
+ async function run ( ) {
17
+ const resp = await insight . checkForFraud ( {
18
+ // This is requried for future proofing
19
+ type : 'phone' ,
20
+ phone : INSIGHT_NUMBER ,
21
+ insights : [
22
+ Insight . SIM_SWAP ,
23
+ Insight . FRAUD_SCORE ,
24
+ ] ,
25
+ } ) ;
26
+
27
+ console . log ( resp ) ;
28
+ }
29
+
30
+ run ( ) ;
You can’t perform that action at this time.
0 commit comments