Message Status Webhook
In this code snippet you learn how to receive message status updates using the message status webhook.
NOTE: We recommend using JWT-based auth as this allows you to configure your inbound and delivery receipt webhook URLs at the application-level. Otherwise, all callbacks from your different applications will be sent to your account-level webhook URLs.
NOTE: Messages API supports signed webhooks so you can verify a request is coming from Vonage and its payload has not been tampered with during transit.
Example
Ensure that your message status webhook is set in the Dashboard. As a minimum your handler must return a 200 status code to avoid unnecessary callback queuing. Make sure your webhook server is running before testing your Messages application.
Prerequisites
If you do not have an application you can create one. Make sure you also configure your webhooks.
Run your code
Save this file to your machine and run it:
Prerequisites
If you do not have an application you can create one. Make sure you also configure your webhooks.
Add the following to build.gradle:
implementation 'com.vonage:server-sdk-kotlin:2.1.1'
implementation 'io.ktor:ktor-server-netty'
implementation 'io.ktor:ktor-serialization-jackson'Write the code
Add the following to the main method of the MessageStatusWebhook class:
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:
apply plugin: 'application'
mainClassName = project.hasProperty('main') ? project.getProperty('main') : ''Run the following gradle command to execute your application, replacing com.vonage.quickstart.kt.messages with the package containing MessageStatusWebhook:
Prerequisites
If you do not have an application you can create one. Make sure you also configure your webhooks.
Add the following to build.gradle:
implementation 'com.vonage:server-sdk:9.3.1'
implementation 'com.sparkjava:spark-core:2.9.4'Write the code
Add the following to the main method of the MessageStatusWebhook class:
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:
apply plugin: 'application'
mainClassName = project.hasProperty('main') ? project.getProperty('main') : ''Run the following gradle command to execute your application, replacing com.vonage.quickstart.messages with the package containing MessageStatusWebhook:
Prerequisites
If you do not have an application you can create one. Make sure you also configure your webhooks.
Create a file named message-status.php and add the following code:
Run your code
Save this file to your machine and run it:
Prerequisites
If you do not have an application you can create one. Make sure you also configure your webhooks.
Run your code
Save this file to your machine and run it:
Prerequisites
If you do not have an application you can create one. Make sure you also configure your webhooks.
Run your code
Save this file to your machine and run it:
Try it out
The webhook is invoked on a change in status for an outbound message sent from Vonage. The message status is also printed to the console.
The format of the message status POST request can be found in the Message Status section of the API reference.