SMS の送信

SMS を送信するには、以下の例の次の変数を置き換えます。

キー 説明
TO_NUMBER E.164 format での SMS の送信先番号。例: 447700900000
NEXMO_API_KEY アカウント概要でご確認ください
NEXMO_API_SECRET アカウント概要でご確認ください

Write the code

Add the following to send-sms.sh:

curl -X POST https://rest.nexmo.com/sms/json \
  -d "from=${SMS_SENDER_ID}" \
  -d "to=${SMS_TO_NUMBER}" \
  -d 'text=A text message sent using the Vonage SMS API' \
  -d "api_key=${VONAGE_API_KEY}" \
  -d "api_secret=${VONAGE_API_SECRET}"

View full source

Run your code

Save this file to your machine and run it:

sh send-sms.sh

試行手順

上記例を実行すると、指定した携帯電話番号にテキストメッセージが送信されます。

関連情報