アカウントの設定

Webhookが使用するコールバックURLなど、アカウントの設定をプログラムで構成することができます。

この例では、Vonage番号がSMSを受信したときに呼び出されるURLを設定する方法を示します。

キー説明
VONAGE_API_KEY

Your Vonage API key (see it on your dashboard).

VONAGE_API_SECRET

Your Vonage API secret (also available on your dashboard).

SMS_CALLBACK_URL

The publicly-accessible URL that Vonage should send information to when your Vonage number receives an SMS

Write the code

Add the following to configure-account.sh:

curl -X POST "https://rest.nexmo.com/account/settings" -u "$VONAGE_API_KEY:$VONAGE_API_SECRET" \
    -d "moCallBackUrl=$ACCOUNT_SMS_CALLBACK_URL"

View full source

Run your code

Save this file to your machine and run it:

bash configure-account.sh

この例では、新しいURLに更新された後のアカウントの現在の設定を出力しています。