Skip to content

Commit

Permalink
feat: adding number insight v2 sample (#144)
Browse files Browse the repository at this point in the history
  • Loading branch information
manchuck authored Aug 22, 2024
1 parent 8961317 commit 2618360
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions number_insight_v2/check-for-fraud.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
require('dotenv').config({ path: __dirname + '/../.env' });

const VONAGE_API_KEY = process.env.VONAGE_API_KEY;
const VONAGE_API_SECRET = process.env.VONAGE_API_SECRET;

// By default use the command line argument. Otherwise use the environment variable.
const INSIGHT_NUMBER = process.argv[2] || process.env.INSIGHT_NUMBER;

const { NumberInsightV2, Insight } = require('@vonage/number-insight-v2');

const insight = new NumberInsightV2({
apiKey: VONAGE_API_KEY,
apiSecret: VONAGE_API_SECRET,
});

async function run() {
const resp = await insight.checkForFraud({
// This is requried for future proofing
type: 'phone',
phone: INSIGHT_NUMBER,
insights: [
Insight.SIM_SWAP,
Insight.FRAUD_SCORE,
],
});

console.log(resp);
}

run();

0 comments on commit 2618360

Please sign in to comment.