WasenderAPI

API Documentation

WasenderApi WhatsApp API

Get Message Logs

Sessions

GET/{whatsappSession}/message-logs

Retrieves a paginated list of message logs for a specific session.

Get Message Logs

This endpoint fetches a paginated history of messages sent using our API by the specified WhatsApp session. It is useful for auditing, analytics, or displaying message history in an application.

Important: Message logging must be enabled for each session individually in your settings. If logging is disabled, the content and the to field will benull.

The response is structured as a standard paginated object, which you can navigate using the optional page and per_page query parameters.

Parameters

NameTypeRequiredDescription
whatsappSessionstringYesThe unique identifier of the WhatsApp session.
pageintegerNoThe page number to retrieve. Defaults to 1.
per_pageintegerNoThe number of items to retrieve per page. Defaults to 10.

Code Examples

curl -X GET "https://www.wasenderapi.com/api/my-session-123/message-logs?page=1&per_page=20" 
  -H "Authorization: Bearer YOUR_API_KEY"

Response Examples

{
    "success": true,
    "data": {
        "current_page": 1,
        "data": [
            {
                "id": "1001",
                "whatsapp_session_id": "501",
                "to": "+155501001234",
                "content": "{\"text\":\"This is a sample message. Lorem ipsum dolor sit amet, consectetur adipiscing elit.\"}",
                "status": "sent",
                "failed_reason": null,
                "created_at": "2023-10-27 10:30:15",
                "updated_at": "2023-10-27 10:30:17"
            },
            {
                "id": "1002",
                "whatsapp_session_id": "502",
                "to": "+4455501005678",
                "content": "{\"text\":\"Hello! This is an example message sent to a user. How can we help you today?\"}",
                "status": "in_progress",
                "failed_reason": null,
                "created_at": "2023-10-27 10:32:45",
                "updated_at": "2023-10-27 10:32:48"
            },
            {
                "id": "1003",
                "whatsapp_session_id": "503",
                "to": "+5255501009876",
                "content": "{\"text\":\"Just a test message to verify the connection.\"}",
                "status": "failed",
                "failed_reason": "invalid WhatsApp number",
                "created_at": "2023-10-27 10:35:01",
                "updated_at": "2023-10-27 10:35:03"
            }
        ],
        "first_page_url": "/api/session-id-123/message-logs?page=1",
        "from": 1,
        "last_page": 5,
        "last_page_url": "/api/session-id-123/message-logs?page=5",
        "next_page_url": "/api/session-id-123/message-logs?page=2",
        "path": "/api/session-id-123/message-logs",
        "per_page": 3,
        "prev_page_url": null,
        "to": 3,
        "total": 15
    }
}