Skip to main content

POST WhatsApp WDRs

This endpoint returns a paginated list of WhatsApp Delivery Records (WDRs) for your account. Use it to browse message history, filter by status or recipient, and sort results by any record field.

Configure the API Endpoint

https://api.betatel.com/api/v1/connect-hub/whatsapp/wdr
  • Method: POST

Set Up the Headers

ParamValueDescription
Content-typeapplication/jsonSpecifies the payload format.
x-api-key{{x-api-key}}API key for authorization.
x-account-id{{x-account-id}}User identifier for added security and tracking.

Craft the Request Body

Design the JSON payload to control pagination, sorting, and optional filtering.

Example of body
{
"page": 1,
"rows_per_page": 20,
"sort_by": "timestamp",
"sort_direction": "DESC",
"filter": {
"status": "DELIVERED"
}
}
FieldTypeRequiredDescription
pageintegerNoPage number to retrieve, starting from 1 (default: 1).
rows_per_pageintegerNoNumber of records per page, between 1 and 100 (default: 20).
sort_bystringNoField name to sort results by (e.g. "timestamp", "status", "to").
sort_directionstringNoSort order: "ASC" or "DESC".
filterobjectNoOptional filter criteria applied to the result set (e.g. filter by status or to).

Code Snippets

Example - cURL
curl --location 'https://api.betatel.com/api/v1/connect-hub/whatsapp/wdr' \
--header 'Content-Type: application/json' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'x-account-id: YOUR_ACCOUNT_ID' \
--data '{
"page": 1,
"rows_per_page": 20,
"sort_by": "timestamp",
"sort_direction": "DESC",
"filter": {
"status": "DELIVERED"
}
}'

Understanding the Response

The endpoint returns a paginated wrapper containing metadata and the list of WDR records for the current page.

JSON Schema:

{
"page": 1,
"rows_per_page": 20,
"sort_by": "timestamp",
"sort_direction": "DESC",
"total": 150,
"total_pages": 8,
"has_next_page": true,
"has_previous_page": false,
"list": [
{
"uuid": "01JV5V54KPYK9GB29265EQRZ2P",
"wam_id": "wamid.HBgLMzg3NjE0NDQ1NTUVAgARGBI",
"to": "38761444555",
"text": "482910",
"status": "DELIVERED",
"country": "Bosnia and Herzegovina",
"country_code": 387,
"network": "BH Telecom",
"timestamp": "2024-01-15T10:30:00.000Z",
"delivery_timestamp": "2024-01-15T10:30:02.000Z",
"delivery_time": 2143,
"response_time": 150,
"webhook_delivered": true
}
]
}

Pagination fields:

FieldTypeDescription
pageintegerThe current page number.
rows_per_pageintegerNumber of records returned per page.
sort_bystringThe field results are sorted by.
sort_directionstringThe sort direction (ASC or DESC).
totalintegerTotal number of records matching the filter.
total_pagesintegerTotal number of pages available.
has_next_pagebooleanWhether a next page exists.
has_previous_pagebooleanWhether a previous page exists.

WDR record fields:

FieldTypeDescription
uuidstringUnique identifier for the message.
wam_idstringWhatsApp platform message ID assigned by Meta.
tostringRecipient's phone number.
textstringMessage text that was sent.
statusstringCurrent delivery status (see table below).
countrystringDestination country name.
country_codeintegerDestination country dialing code.
networkstringRecipient's mobile network operator.
timestampstringISO 8601 timestamp of when the message was created.
delivery_timestampstringISO 8601 timestamp of delivery confirmation.
delivery_timeintegerMilliseconds between send and delivery.
response_timeintegerMilliseconds between request and send.
webhook_deliveredbooleanWhether the status update reached your webhook.

Message Status Values

StatusDescription
PENDINGMessage accepted and queued for delivery.
QUEUEDMessage is queued and waiting to be sent.
SENTMessage dispatched to the WhatsApp platform.
DELIVEREDMessage delivered to the recipient's device.
READRecipient has opened and read the message.
FAILEDMessage could not be delivered.
EXPIREDMessage expired before delivery was confirmed.
DELETEDMessage was deleted by the recipient.
UNKNOWNStatus could not be determined.

Error Handling

  • 400 - Bad Request: Invalid pagination parameters or malformed filter
  • 401 - Unauthorized: Authentication failed
  • 500 - Internal Server Error: An unexpected error occurred on the server