Note:
For testing purposes, we recommend you first send a message using the Getting Started Guide. Alternatively, you can test this method using the provided code sample.
The getByPhoneNumber method retrieves a delivery report by phone number as well as batch ID.
const recipientPhoneNumber = response.to[0];
const requestData = {
batch_id: response.id,
recipient_msisdn: recipientPhoneNumber
};
sinchClient.sms.deliveryReports
.getByPhoneNumber(requestData)
.then((response) => console.log(response))
.catch((error) => console.error("There was an error!", error.response));When you run it, you should see an output like the following:
{
at: '2024-06-07T14:03:26.536Z',
batch_id: '01J06CY78GZ2F74YZNNH2VBWR6',
code: 401,
recipient: '447..3',
status: 'Dispatched',
type: 'recipient_delivery_report_sms'
}The response contains a number of useful fields:
atis a timestamp of when a delivery report was createdcodeis the delivery report status codestatusis the delivery status of a message
This information can help you ascertain whether a person successfully received a message, as well as allowing you to drill down into causes of failure.
See more delivery report tutorials
- Index Page
- Retrieve a delivery report for a batch
- Retrieve a delivery report for a specific recipient
- Retrieve a list of delivery reports