認証コードを送信する

ユーザーの電話番号を収集したら、認証プロセスを開始します。 Verifyリクエスト をVerify APIに追加します。

を返します。 request_id.を作成するときなど、その後の 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).

RECIPIENT_NUMBER

The phone number to verify

BRAND_NAME

Included in the message to explain who is confirming the phone number

Write the code

Add the following to send-verification-code.sh:

curl GET "https://api.nexmo.com/verify/json?api_key=$VONAGE_API_KEY&api_secret=$VONAGE_API_SECRET&number=$VERIFY_NUMBER&brand=AcmeInc"

View full source

Run your code

Save this file to your machine and run it:

sh send-verification-code.sh

:エラーコード15が表示された場合: The destination number is not in a supported network対象ネットワークがプラットフォームの不正防止システムによってブロックされている可能性があります。参照 ベロシティ・ルール.