受信確認
通信会社に受信確認をリクエストすることにより、Nexmo の SMS 用 API を使って送信したメッセージが顧客に届いたことを確認できます。
受信確認にアクセスする要件は以下のとおりです。
- 以下のサンプルコードのいずれかを使って Web フックエンドポイントを作成します
- Nexmo Dashboard で Web フックエンドポイントを設定します
注: メッセージの送信後に受信確認を受け取るまでタイムラグがある場合があります。
Prerequisites
Run your code
Save this file to your machine and run it:
Prerequisites
Add the following to build.gradle:
Run your code
We can use the application 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.sms with the package containing ReceiveSmsDlr:
Prerequisites
Add the following to build.gradle:
Run your code
We can use the application 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.sms with the package containing ReceiveDLR:
Prerequisites
Create a file named SmsController.cs and add the following code:
Prerequisites
Create a file named index.php and add the following code:
use \Psr\Http\Message\ServerRequestInterface as Request;
use \Psr\Http\Message\ResponseInterface as Response;Add the following to index.php:
$app = new \Slim\App;Write the code
Add the following to index.php:
$handler = function (Request $request, Response $response) {
$receipt = \Vonage\SMS\Webhook\Factory::createFromRequest($request);
error_log(print_r($receipt, true));
return $response->withStatus(204);
};
$app->map(['GET', 'POST'], '/webhooks/delivery-receipt', $handler);
$app->run();Run your code
Save this file to your machine and run it:
Prerequisites
Run your code
Save this file to your machine and run it:
Prerequisites
Create a file named delivery_receipt.rb and add the following code:
Run your code
Save this file to your machine and run it:
Nexmo Dashboard で Web フックエンドポイントを設定します
Nexmo が Web フックにアクセスできるようにするには、Nexmo アカウントでアクセス方法を設定する必要があります。
Web フックはコードスニペットの /webhooks/delivery-receipt にあります。Ngrok を使用している場合、Nexmo Dashboard の API 設定ページで設定が必要な Web フックは「https://demo.ngrok.io/webhooks/delivery-receipt」フォームを取ります。「demo」部分を Ngrok から提供されるサブドメインに置き換えて、 受信確認用 Web フックの URL というラベルが付いたフィールドにエンドポイントを入力します。

試行手順
携帯電話番号にメッセージを送信すると、ネットワークがサポートしている場合は、次の形式で受信確認を受領します。
注: メッセージの送信後に受信確認を受け取るまでタイムラグがある場合があります。