Skip to content
Last updated

Retrieving delivery reports with the Java SDK

Retrieve a delivery report for a specific recipient

getForNumber retrieves a delivery report by phone number as well as batch ID.

DeliveryReportRecipient response =
        client.sms().deliveryReports().getForNumber(batchId, phoneNumber);

When you run it, you should see an output like the following:

DeliveryReportRecipientSMS{} DeliveryReportRecipient{
at=2024-06-07T12:27:20.746Z, code='401', recipient='447...',
status=Dispatched, appliedOriginator='null', encoding='null',
numberOfMessageParts=null, operator='null', operatorStatusAt=null}
BaseDeliveryReport{batchId='01H...', clientReference='null'}

The response contains a number of useful fields:

  • at is a timestamp of when a delivery report was created
  • code is the delivery report error code
  • status is 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