Numbersインサイトアドバンス
2027年2月4日をもって、VonageはVonage Number Insightsを終了いたします。継続的なサポートを確保し、よりスケーラブルで将来性のあるソリューションを提供するため、当社の強化されたソリューションへの移行をお勧めします: Vonage Identity Insights API.Vonage Identity Insight APIは、複数の電話番号関連データセットを1つの柔軟なAPIに統合し、電話番号に関するリアルタイムの情報を要求したり、番号のフォーマット、キャリアの詳細、SIMスワップ、加入者照合などのインサイトを1回の呼び出しで自由に組み合わせて取得できるようにします。
をご確認ください。 Numbersインサイト移行ガイドAPIの相違点、必要な変更点、スムーズな移行のためのベストプラクティスに関する詳細なガイダンスを提供しています。
Number Insight Advanced APIは、以下のすべてのデータを提供します。 Numbers Insight 標準 API 以下の追加情報とともに:
- Numbersが有効である可能性が高い場合
- ポート番号の場合
- 番号に到達可能な場合(米国では利用不可)
- 番号がローミングかどうか、ローミングの場合はキャリアと国名
この情報を使って、Numbersに関連するリスクを判断する。
なお、Advanced APIでは、固定電話に関する以下のような追加情報は提供されません。 Numbers Insight 標準 API.固定電話番号に関する洞察については、Standard APIをご利用ください。
このコード・スニペットは 非同期 をNumber Insight APIに呼び出す。 これがVonageの推奨するアプローチです。.オプションで、Number Insight Advanced APIを使用できます。 同期的にただし、同期的な使用はタイムアウトを引き起こす可能性があるので注意すること。
コード例を実行する前に、変数のプレースホルダーを置き換えてください:
| キー | 説明 |
|---|---|
VONAGE_API_KEY | Your Vonage API key (see it on your dashboard). |
VONAGE_API_SECRET | Your Vonage API secret (also available on your dashboard). |
INSIGHT_NUMBER | The number you want to retrieve insight information for. |
Write the code
Add the following to ni-advanced-async.sh:
curl "https://api.nexmo.com/ni/advanced/async/json?api_key=$VONAGE_API_KEY&api_secret=$VONAGE_API_SECRET&number=$INSIGHT_NUMBER&callback=$INSIGHT_CALLBACK_URL"
Run your code
Save this file to your machine and run it:
Prerequisites
npm install express body-parserWrite the code
Add the following to ni-advanced-async-client.js:
const app = require('express')();
const bodyParser = require('body-parser');
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({
extended: true,
}));
const handleInsight = (request, response) => {
console.log('params', Object.assign(request.query, request.body));
response.status(204).send();
};
app.post('/webhooks/insight', handleInsight);
app.listen(3000);Run your code
Save this file to your machine and run it:
Prerequisites
Add the following to build.gradle:
Create a class named AdvancedInsightAsync and add the following code to the main method:
Write the code
Add the following to the main method of the AdvancedInsightAsync class:
Run your code
We can use the アプリケーション plugin for Gradle to simplify the running of our application. Update your build.gradle with the following:
Run the following gradle command to execute your application, replacing com.vonage.quickstart.kt.numberinsight with the package containing AdvancedInsightAsync:
Prerequisites
Add the following to build.gradle:
Create a class named AdvancedInsightAsync and add the following code to the main method:
VonageClient client = VonageClient.builder()
.apiKey(VONAGE_API_KEY)
.apiSecret(VONAGE_API_SECRET)
.build();Write the code
Add the following to the main method of the AdvancedInsightAsync class:
var response = client.getInsightClient().getAdvancedAsyncNumberInsight(
AdvancedInsightAsyncRequest.builder()
.number(INSIGHT_NUMBER)
.callback(INSIGHT_CALLBACK_URL)
.build()
);Run your code
We can use the アプリケーション plugin for Gradle to simplify the running of our application. Update your build.gradle with the following:
Run the following gradle command to execute your application, replacing com.vonage.quickstart.insight with the package containing AdvancedInsightAsync:
Prerequisites
Install-Package VonageCreate a file named AdvancedAsync.cs and add the following code:
Add the following to AdvancedAsync.cs:
Prerequisites
composer require vonage/clientCreate a file named advanced-async-trigger.php and add the following code:
Run your code
Save this file to your machine and run it:
Prerequisites
pip install vonage python-dotenvRun your code
Save this file to your machine and run it:
Prerequisites
gem install vonageCreate a file named ni-advanced-async-client.rb and add the following code:
client = Vonage::Client.new(
api_key: VONAGE_API_KEY,
api_secret: VONAGE_API_SECRET
)Write the code
Add the following to ni-advanced-async-client.rb:
insight = client.number_insight.advanced(
number: INSIGHT_NUMBER,
callback: INSIGHT_CALLBACK_URL
)
puts insight.inspectRun your code
Save this file to your machine and run it:
APIは以下の情報をクライアントに返すことで、リクエストを承認する:
データが利用可能になると、指定したウェブフックに POST リクエストをご覧ください。を参照のこと。 Numbers Insight アドバンスド非同期コールバック のコード・スニペットで、Webhookハンドラのコーディング方法を学んでください。