Getting the Message Record with the Latest Delivery Status
There are many scenarios in which you may want to store Reports API data in your own database. This guide explains three different methods for retrieving the latest delivery status (delivered or undelivered) of messages sent using Vonage APIs.
It is important to note that the final delivery status for a given message is typically available within minutes. However, in rare cases, it may take up to 72 hours.
There are three different ways to get the message record with the latest delivery status. The first method is using the Reports API, which we recommend, and there are also two alternative methods that you may consider:
Using Reports API (recommended)
This method is the most efficient way to get the message record with the latest delivery status. It’s not only the easiest but also doesn’t require storing any data or IDs in your storage. Follow the steps below to execute it:
- Get records for a given time period using either the synchronous endpoint or the asynchronous endpoint, and store them in your storage (if necessary).
- For records that haven’t reached their final state, you can check their status by
id. - Update the records you stored in Step 1 using either the synchronous endpoint or the asynchronous endpoint with the actual status.
Using Store Message ID
This method is an alternative you can use. However, be aware that it may not be the best option for users with higher traffic. Follow the steps below to execute it:
- Store Message ID in your database.
- Call Reports API by
idfor every message to check the latest status.
Using Webhooks and Reports API
This is the second alternative method you can use. In this case, you need to be aware that it performs deliverability monitoring, but doesn't store the data with the actual state in the storage. Follow the steps below to execute it:
- Use a callback/webhook for the SMS API or for the Messages API to be notified when the status of each message is changed.
- Use the Reports API to cross-check and store data with the final status.