WhatsApp Business Account Message History API
Copy for LLM View as Markdown Version v23.0 API for retrieving WhatsApp Business Account message history and delivery status information. This endpoint allows businesses to retrieve comprehensive message history for their WhatsApp Business Account phone numbers, including message delivery status events, timestamps, and webhook update states.Base URL
| https://graph.facebook.com |Endpoints
| GET | ///message_history |GET ///message_history
Retrieve paginated message history for a WhatsApp Business Account phone number, including delivery status events, timestamps, and webhook update information. Use Cases: Track message delivery status and events Monitor webhook delivery and update states Retrieve historical message delivery information Debug message delivery issues and webhook failures Rate Limiting: Standard Graph API rate limits apply. Use appropriate retry logic with exponential backoff. Caching: Message history data can be cached for moderate periods, but delivery status events may change frequently. Implement appropriate cache invalidation strategies. Pagination: This endpoint supports cursor-based pagination. Use the after and before cursors from the response to navigate through results.Request Syntax
GET///message_history Select language cURLJavaScriptPythonUser-Agentstring The user agent string identifying the client software making the request. Authorizationstring·required Bearer token for API authentication. This should be a valid access token obtained through the appropriate OAuth flow or system user token. Path Parameters
Versionstring·required Graph API version to use for this request. Determines the API behavior and available features. Phone-Number-IDstring·required Your WhatsApp Business Account phone number ID. This ID is provided when you register the phone number and can be found in your WhatsApp Business Manager or through phone number APIs. Query Parameters
message_idstring Filter results by specific WhatsApp message ID (WAMID). When provided, only message history for this specific message will be returned. fieldsstring Comma-separated list of fields to include in the response. If not specified, default fields will be returned (id, message_id). Available fields: id, message_id, events limitinteger [min: 1, max: 100] Maximum number of message history entries to return per page. Default is 25, maximum is 100. afterstring Cursor for pagination. Use this to get the next page of results. This value comes from the paging.cursors.after field in previous responses. beforestring Cursor for pagination. Use this to get the previous page of results. This value comes from the paging.cursors.before field in previous responses. Responses
Retrieve paginated message history for a WhatsApp Business Account phone number, including delivery status events, timestamps, and webhook update information. Use Cases: Track message delivery status and events Monitor webhook delivery and update states Retrieve historical message delivery information Debug message delivery issues and webhook failures Rate Limiting: Standard Graph API rate limits apply. Use appropriate retry logic with exponential backoff. Caching: Message history data can be cached for moderate periods, but delivery status events may change frequently. Implement appropriate cache invalidation strategies. Pagination: This endpoint supports cursor-based pagination. Use the after and before cursors from the response to navigate through results. 200 Successfully retrieved WhatsApp Business Account message history Content Type: application/json Schema: MessageHistoryResponse Show child attributes
MessageHistoryResponse
dataarray of WhatsAppMessageHistory Array of message history entries Show child attributes
data[]WhatsAppMessageHistory WhatsApp message history entry with delivery status information Show child attributes
idstring·required Unique identifier for the message history entry
message_idstring·required WhatsApp message ID (WAMID) for the message
eventsobject Message delivery status events and occurrences Show child attributes
dataarray of MessageDeliveryStatusEvent Array of delivery status events Show child attributes
data[]MessageDeliveryStatusEvent Message delivery status event occurrence Show child attributes
idstring·required Unique identifier for the delivery status event
delivery_statusWhatsAppMessageDeliveryStatus Message delivery status
webhook_update_stateWebhookUpdateState State of webhook update delivery
timestampinteger (int64)·required Unix timestamp when the delivery status event occurred
applicationobject Application information for the event Show child attributes
idstring Application ID that processed the event
webhook_uristring (uri) Webhook URI where the event was delivered
error_descriptionstring Error description if the delivery failed
pagingPaginationInfo Pagination information for navigating through results Show child attributes
cursorsobject Pagination cursors for navigation Show child attributes
beforestring Cursor for the previous page of results
afterstring Cursor for the next page of results
previousstring (uri) URL for the previous page of results
nextstring (uri) URL for the next page of results
pagingPaginationInfo Pagination information for navigating through results Show child attributes
cursorsobject Pagination cursors for navigation Show child attributes
beforestring Cursor for the previous page of results
afterstring Cursor for the next page of results
previousstring (uri) URL for the previous page of results
nextstring (uri) URL for the next page of results 400 Bad Request - Invalid parameters or malformed request Content Type: application/json Schema: GraphAPIError Show child attributes
GraphAPIError
errorobject·required Show child attributes
messagestring·required Human-readable error message
typestring·required Error category type
codeinteger·required Numeric error code
error_subcodeinteger More specific error subcode when available
fbtrace_idstring Unique identifier for debugging and support requests with Meta
is_transientboolean Indicates whether this error is temporary and the request should be retried
error_user_titlestring User-friendly error title for display purposes
error_user_msgstring User-friendly error message for display purposes 401 Unauthorized - Invalid or missing access token Content Type: application/json Schema: GraphAPIError Show child attributes
GraphAPIError
errorobject·required Show child attributes
messagestring·required Human-readable error message
typestring·required Error category type
codeinteger·required Numeric error code
error_subcodeinteger More specific error subcode when available
fbtrace_idstring Unique identifier for debugging and support requests with Meta
is_transientboolean Indicates whether this error is temporary and the request should be retried
error_user_titlestring User-friendly error title for display purposes
error_user_msgstring User-friendly error message for display purposes 403 Forbidden - Insufficient permissions or access denied Content Type: application/json Schema: GraphAPIError Show child attributes
GraphAPIError
errorobject·required Show child attributes
messagestring·required Human-readable error message
typestring·required Error category type
codeinteger·required Numeric error code
error_subcodeinteger More specific error subcode when available
fbtrace_idstring Unique identifier for debugging and support requests with Meta
is_transientboolean Indicates whether this error is temporary and the request should be retried
error_user_titlestring User-friendly error title for display purposes
error_user_msgstring User-friendly error message for display purposes 404 Not Found - Phone number ID does not exist or is not accessible Content Type: application/json Schema: GraphAPIError Show child attributes
GraphAPIError
errorobject·required Show child attributes
messagestring·required Human-readable error message
typestring·required Error category type
codeinteger·required Numeric error code
error_subcodeinteger More specific error subcode when available
fbtrace_idstring Unique identifier for debugging and support requests with Meta
is_transientboolean Indicates whether this error is temporary and the request should be retried
error_user_titlestring User-friendly error title for display purposes
error_user_msgstring User-friendly error message for display purposes 422 Unprocessable Entity - Request parameters are valid but cannot be processed Content Type: application/json Schema: GraphAPIError Show child attributes
GraphAPIError
errorobject·required Show child attributes
messagestring·required Human-readable error message
typestring·required Error category type
codeinteger·required Numeric error code
error_subcodeinteger More specific error subcode when available
fbtrace_idstring Unique identifier for debugging and support requests with Meta
is_transientboolean Indicates whether this error is temporary and the request should be retried
error_user_titlestring User-friendly error title for display purposes
error_user_msgstring User-friendly error message for display purposes 429 Too Many Requests - Rate limit exceeded Content Type: application/json Schema: GraphAPIError Show child attributes
GraphAPIError
errorobject·required Show child attributes
messagestring·required Human-readable error message
typestring·required Error category type
codeinteger·required Numeric error code
error_subcodeinteger More specific error subcode when available
fbtrace_idstring Unique identifier for debugging and support requests with Meta
is_transientboolean Indicates whether this error is temporary and the request should be retried
error_user_titlestring User-friendly error title for display purposes
error_user_msgstring User-friendly error message for display purposes 500 Internal Server Error - Unexpected server error Content Type: application/json Schema: GraphAPIError Show child attributes
GraphAPIError
errorobject·required Show child attributes
messagestring·required Human-readable error message
typestring·required Error category type
codeinteger·required Numeric error code
error_subcodeinteger More specific error subcode when available
fbtrace_idstring Unique identifier for debugging and support requests with Meta
is_transientboolean Indicates whether this error is temporary and the request should be retried
error_user_titlestring User-friendly error title for display purposes
error_user_msgstring User-friendly error message for display purposes Select language cURLJavaScriptPython

