SendZen API Documentation
Home
Getting StartedChangelog
Home
Getting StartedChangelog
Visit Website
Sign In
Create an account
  1. Activity Logs
  • Start Guide
    • Getting Started
    • API Reference
  • Messages
    • Template Messages
      • Send Text Message
      • Send Interactive Message
      • Send Media Message
    • Session Messages
      • Send Text Message
      • Send Image Message
      • Send Video Message
      • Send Audio Message
      • Send Document Message
      • Send Interactive Reply Message
    • Incoming Messages
      • Received Text Message
      • Received Message with Reaction
      • Received Media Message with Image
      • Received Callback from a Quick Reply Button Click
    • Other
      • Message Status & Typing Indicator
  • Template
    • List Templates
      GET
    • Create Template
      POST
    • Delete Template
      DELETE
    • Upload Media
      POST
  • Partner
    • Integration Guide
  • Project
    • Create Project
      POST
    • List Projects
      GET
    • Update Project
      PUT
    • Retrieve Project
      GET
  • WABA
    • List WABA
      GET
    • Retrieve WABA Details from Meta
      GET
    • Retrieve WhatsApp Business Profile Detail
      GET
    • Update WhatsApp Business Profile
      POST
    • Upload WhatsApp Business Profile
      POST
  • Activity Logs
    • All Event Logs
      GET
    • Incoming Message Logs
      GET
    • Message Status Logs
      GET
    • Other Event Logs
      GET
    • Multiple Event Types
      GET
  • Knowledge Base
    • Programming Languages
      • Python
      • Node.js
      • PHP
      • Laravel
      • Java
      • C# .NET
    • Product
      • Changelog
  • Schemas
    • Schemas
      • Template Message
      • 401/403 Message Response
      • AccountLoginRequest
      • APIKeyDto
      • ReadTypingIndicatorRequest
      • AccountRegisterRequest
      • TypingIndicator
      • PartnerConfigDto
      • LoginResponse
      • PartnerInfoDto
      • WABASignUp
      • OrderCheckoutDto
      • OrderDto
      • OrderStatusEnum
      • PaymentGatewayDto
    • Knowledge Base
    • Address
    • Account
    • CommonResponse
    • AccountDetailDto
    • CreateOrUpdateProjectRequest
    • Contact
    • Error
    • ContactName
    • Button
    • ErrorResponse
    • CarouselCard
    • Email
    • ClientData
    • Component
    • ProjectDetailDto
    • ProjectWABADetail
    • Interactive
    • WABADetail
    • InteractiveAction
    • WABADto
    • InteractiveBody
    • CreateTemplateRequest
    • InteractiveButton
    • InteractiveFooter
    • CreateWebhookConfigRequest
    • InteractiveHeader
    • InteractiveMedia
    • Example
    • InteractiveProductItem
    • InteractiveProductSection
    • InteractiveReply
    • InteractiveRow
    • InteractiveSection
    • Location
    • Media
    • MessageRequest
    • MessageResponse
    • MessageTemplate
    • Organization
    • LimitedTimeOffer
    • Phone
    • Reaction
    • Response
    • TemplateAction
    • NamedParameter
    • TemplateButtons
    • TemplateCarousel
    • TemplateComponent
    • TemplateCurrency
    • PaginatedWebhookLogsResponse
    • TemplateDateTime
    • PartnerClientSession
    • TemplateLimitedTimeOffer
    • PartnerClientSessionDto
    • TemplateMedia
    • TemplateParameter
    • TemplateProductItem
    • TemplateSection
    • TemplateTapTargetConfiguration
    • SupportedApp
    • Text
    • Url
    • WhatsAppBusinessProfile
    • UploadMedia
    • Webhook
    • WebhookConfigDto
    • WebhookLogDto
  1. Activity Logs

Incoming Message Logs

GET
https://api.sendzen.io/v1/logs

Overview#

This endpoint retrieves incoming text messages that have been received by your WhatsApp Business Account. These are the same payloads that would be sent to your configured webhook when an incoming message event occurs.
When a user sends a text message to your WhatsApp Business number, the system captures this event and stores it as a log entry. You can retrieve these logs using this endpoint to view all incoming messages within a specified time range.
Important: Logs are retained for the last 7 days only. You can only retrieve logs that fall within this 7-day window from the current date.

Request Parameters#

Required Parameters#

ParameterTypeDescription
eventTypesstringMust be Incoming%20Message (URL encoded)

Optional Parameters#

ParameterTypeDescription
fromDateintegerStart date in Ticks format (100-nanosecond intervals since January 1, 0001 UTC). If omitted, retrieves logs from the beginning of available data.
toDateintegerEnd date in Ticks format. If omitted, retrieves logs up to the current time.
phoneNumberIdstringFilter logs for a specific WhatsApp Business phone number ID
urlstringFilter logs for a specific webhook URL (must be URL encoded)
pageSizeintegerNumber of log entries to return per page. Default: 20, Maximum: 20
nextPageTokenstringToken for pagination to retrieve the next page of results. Use the next_page_token value from the previous response.

Date Format#

The fromDate and toDate parameters use Ticks format, which represents the number of 100-nanosecond intervals that have elapsed since January 1, 0001 at 00:00:00 UTC.
Example: 638000000000000000 represents a specific timestamp in this format.

Request Examples#

Basic Request#

Retrieve all incoming messages without date filters:
Or with date range:

Filter by Phone Number ID#

Filter by Webhook URL#

With Page Size#

Response Structure#

Success Response (200 OK)#

{
    "message": "Notification logs retrieved successfully",
    "data": {
        "logs": [
            {
                "project_id": "12345",
                "phone_number_id": "123456789012345",
                "event_type": "Incoming Message",
                "payload": "{\"object\":\"whatsapp_business_account\",\"entry\":[{\"id\":\"123456789012345\",\"changes\":[{\"field\":\"messages\",\"value\":{\"messaging_product\":\"whatsapp\",\"metadata\":{\"display_phone_number\":\"15551234567\",\"phone_number_id\":\"123456789012345\"},\"contacts\":[{\"wa_id\":\"1234567890\",\"profile\":{\"name\":\"John Doe\"}}],\"messages\":[{\"from\":\"1234567890\",\"id\":\"wamid.HBgMDEyMzQ1Njc4OTAFQIAEhgWM0VCMDI5NTg3MDU0MDIxQUVCMzA0RgA=\",\"timestamp\":\"1704067200\",\"type\":\"text\",\"text\":{\"body\":\"Hello, this is a test message\"}}]}}]}]}",
                "created_at": 638500000000000000,
                "direction": 1,
                "flyout_delivery_status": "-",
                "flyout_delivery_response": "-",
                "flyout_delivery_response_code": 0,
                "flyout_url": "-"
            },
            {
                "project_id": "12345",
                "phone_number_id": "123456789012345",
                "event_type": "Incoming Message",
                "payload": "{\"object\":\"whatsapp_business_account\",\"entry\":[{\"id\":\"123456789012345\",\"changes\":[{\"field\":\"messages\",\"value\":{\"messaging_product\":\"whatsapp\",\"metadata\":{\"display_phone_number\":\"15551234567\",\"phone_number_id\":\"123456789012345\"},\"contacts\":[{\"wa_id\":\"9876543210\",\"profile\":{\"name\":\"Jane Smith\"}}],\"messages\":[{\"from\":\"9876543210\",\"id\":\"wamid.HBgMDk4NzY1NDMyMTBFQIAEhgWM0VCMDM0NDk3MUE3RTJFNzA0MUJGMAA=\",\"timestamp\":\"1704067260\",\"type\":\"text\",\"text\":{\"body\":\"How can I help you today?\"}}]}}]}]}",
                "created_at": 638500000100000000,
                "direction": 1,
                "flyout_delivery_status": "-",
                "flyout_delivery_response": "-",
                "flyout_delivery_response_code": 0,
                "flyout_url": "-"
            }
        ],
        "next_page_token": "eyJQcm9qZWN0SWQiOnsiTiI6IjEyMzQ1In0sIkNyZWF0ZWRBdCI6eyJOOiI2Mzg1MDAwMDAwMDAwMDAwMCJ9fQ=="
    }
}

Response Fields#

FieldTypeDescription
messagestringSuccess message indicating the operation result
dataobjectContainer for the response data
data.logsarrayArray of log entries matching the query criteria
data.logs[].project_idstringThe project identifier
data.logs[].phone_number_idstringThe WhatsApp Business phone number ID that received the message
data.logs[].event_typestringType of event (e.g., "Incoming Message")
data.logs[].payloadstringJSON string containing the full webhook payload. This is the same payload structure that would be sent to your webhook endpoint.
data.logs[].created_atintegerTimestamp in Ticks format when the log entry was created
data.logs[].directionintegerMessage direction (1 = incoming)
data.logs[].flyout_delivery_statusstringDelivery status for flyout notifications
data.logs[].flyout_delivery_responsestringDelivery response for flyout notifications
data.logs[].flyout_delivery_response_codeintegerHTTP response code for flyout delivery
data.logs[].flyout_urlstringURL for flyout notifications
data.next_page_tokenstringToken for pagination. Use this token to retrieve the next page of results.

Webhook Payload Structure#

The payload field in each log entry contains a JSON string that matches the webhook payload structure sent by WhatsApp Business API. When parsed, it has the following structure:
{
    "object": "whatsapp_business_account",
    "entry": [
        {
            "id": "123456789012345",
            "changes": [
                {
                    "field": "messages",
                    "value": {
                        "messaging_product": "whatsapp",
                        "metadata": {
                            "display_phone_number": "15551234567",
                            "phone_number_id": "123456789012345"
                        },
                        "contacts": [
                            {
                                "wa_id": "1234567890",
                                "profile": {
                                    "name": "John Doe"
                                }
                            }
                        ],
                        "messages": [
                            {
                                "from": "1234567890",
                                "id": "wamid.HBgMDEyMzQ1Njc4OTAFQIAEhgWM0VCMDI5NTg3MDU0MDIxQUVCMzA0RgA=",
                                "timestamp": "1704067200",
                                "type": "text",
                                "text": {
                                    "body": "Hello, this is a test message"
                                }
                            }
                        ]
                    }
                }
            ]
        }
    ]
}

Webhook Payload Fields#

FieldTypeDescription
objectstringAlways "whatsapp_business_account" for WhatsApp Business API webhooks
entry[].idstringUnique identifier for the WhatsApp Business Account entry
entry[].changes[].fieldstringThe field that changed (typically "messages" for message events)
entry[].changes[].value.messaging_productstringAlways "whatsapp"
entry[].changes[].value.metadata.display_phone_numberstringThe phone number displayed to users
entry[].changes[].value.metadata.phone_number_idstringThe WhatsApp Business phone number ID
entry[].changes[].value.contacts[].wa_idstringWhatsApp ID of the sender
entry[].changes[].value.contacts[].profile.namestringDisplay name of the sender
entry[].changes[].value.messages[].fromstringWhatsApp ID of the message sender
entry[].changes[].value.messages[].idstringUnique message identifier
entry[].changes[].value.messages[].timestampstringUnix timestamp when the message was sent
entry[].changes[].value.messages[].typestringMessage type (e.g., "text")
entry[].changes[].value.messages[].text.bodystringThe text content of the message

Pagination#

When there are more results available, the response includes a next_page_token. To retrieve the next page, include the nextPageToken parameter in your request:
Continue this process until no next_page_token is returned in the response.

Error Responses#

400 Bad Request#

Invalid request parameters or malformed query string.
{
    "message": "Invalid request parameters",
    "data": null
}

401 Unauthorized#

Missing or invalid authentication token.
{
    "message": "Unauthorized"
}

403 Forbidden#

Valid token but insufficient permissions.
{
    "message": "Forbidden"
}

500 Internal Server Error#

Server error occurred while processing the request.
{
    "message": "Internal server error",
    "data": null
}

Use Cases#

1.
Retrieve Incoming Messages: Fetch all incoming text messages within a specific time range for your project
2.
Webhook Verification: Compare webhook payloads received with stored logs
3.
Message History: Build a message history interface for your application
4.
Analytics: Analyze incoming message patterns and volumes
5.
Debugging: Troubleshoot message delivery issues by reviewing stored payloads

Notes#

Log Retention: Logs are only available for the last 7 days. Any requests for logs older than 7 days will not return results.
The payload field is stored as a JSON string. You'll need to parse it to access the nested structure.
The direction field value of 1 indicates an incoming message.
Timestamps in the created_at field use Ticks format.
The eventTypes parameter should be URL encoded when used in the query string (e.g., Incoming%20Message for "Incoming Message").
This endpoint retrieves logs that match the webhook payloads sent to your configured webhook endpoints.

Example: Parsing the Payload#

Related Endpoints#

Retrieve All Event Logs - Get all event types without filtering
Retrieve Message Status Logs - Get message status updates only
Retrieve Other Event Logs - Get other event types only
Retrieve Multiple Event Types - Get specific multiple event types

Request

Authorization
Provide your bearer token in the
Authorization
header when making requests to protected resources.
Example:
Authorization: Bearer ********************
Query Params

Responses

🟢200Success
application/json
Body

Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request GET 'https://api.sendzen.io/v1/logs?fromDate=ticksTime&toDate=ticksTime&eventTypes=Incoming%20Message' \
--header 'Authorization: Bearer <token>'
Response Response Example
{
    "message": "string",
    "data": {
        "logs": [
            {
                "project_id": "string",
                "phone_number_id": "string",
                "event_type": "string",
                "payload": "string",
                "created_at": 0,
                "direction": 0,
                "flyout_delivery_status": "string",
                "flyout_delivery_response": "string",
                "flyout_delivery_response_code": 0,
                "flyout_url": "string"
            }
        ],
        "next_page_token": "string"
    }
}
Modified at 2025-11-18 10:00:46
Previous
All Event Logs
Next
Message Status Logs
Built with