Message history

    5 min read
    ·
    357 views
    ·
    Updated 10/22/2026

    GET /v1/messages

    Retrieve a channel's message history with pagination and filtering by contact.

    URL

    GET https://api.wazzabee.com/api-gateway/v1/messages?channelId=...&chatId=...&limit=50&offset=0

    Headers

    Authorization: Bearer YOUR_API_KEY

    Query string parameters

    ParameterTypeRequiredDefaultDescription
    channelIdstring (UUID)✅ Yes-Channel ID. Get it via GET /v1/channels
    chatIdstringNo-Filter by contact: a phone number or a chat_id. If omitted, all messages of the channel are returned
    limitintegerNo50Number of messages per page. Maximum: 200
    offsetintegerNo0Pagination offset (how many messages to skip)
    campaignIdstringNo-Only messages of the campaign with this label (campaignId from the send)

    Request examples

    All messages of a channel (the latest 50)

    curl -X GET "https://api.wazzabee.com/api-gateway/v1/messages?channelId=550e8400-e29b-41d4-a716-446655440000" \
      -H "Authorization: Bearer YOUR_API_KEY"

    Messages of a specific contact

    curl -X GET "https://api.wazzabee.com/api-gateway/v1/messages?channelId=550e8400-e29b-41d4-a716-446655440000&chatId=77001234567" \
      -H "Authorization: Bearer YOUR_API_KEY"

    Pagination: the second page of 20 messages

    curl -X GET "https://api.wazzabee.com/api-gateway/v1/messages?channelId=550e8400-e29b-41d4-a716-446655440000&limit=20&offset=20" \
      -H "Authorization: Bearer YOUR_API_KEY"

    Successful response (200 OK)

    {
      "success": true,
      "messages": [
        {
          "id": "msg-uuid-1",
          "conversationId": "conv-uuid-1",
          "contactId": "contact-uuid-1",
          "direction": "incoming",
          "type": "text",
          "text": "Hello, when will my order be ready?",
          "mediaUrl": null,
          "createdAt": "2026-03-12T10:30:00.000Z"
        },
        {
          "id": "msg-uuid-2",
          "conversationId": "conv-uuid-1",
          "contactId": "contact-uuid-1",
          "direction": "outgoing",
          "type": "text",
          "text": "Good afternoon! Your order will be ready tomorrow.",
          "mediaUrl": null,
          "createdAt": "2026-03-12T10:31:00.000Z"
        }
      ],
      "total": 156,
      "limit": 50,
      "offset": 0
    }

    Response fields

    FieldTypeDescription
    messagesarrayAn array of messages, sorted from newest to oldest
    messages[].idstring (UUID)Unique message ID
    messages[].conversationIdstring (UUID)ID of the conversation the message belongs to
    messages[].contactIdstring (UUID)Contact ID
    messages[].directionstringincoming: inbound, outgoing: outbound
    messages[].typestringMessage type: text, image, video, document, audio
    messages[].textstring | nullMessage text (null for media without a caption)
    messages[].mediaUrlstring | nullURL of the media file (null for text messages)
    messages[].createdAtstring (ISO 8601)Date and time the message was created
    messages[].queueIdstring | nullOutgoing only: queueId from the send response
    messages[].campaignIdstring | nullOutgoing only: campaign label
    messages[].statusstringOutgoing only: pending, sent, delivered, read, failed
    messages[].sentAt, deliveredAt, readAtstring | nullOutgoing only: time sent, delivered and read
    messages[].errorobject | nullUndelivered only: {"code": 131026, "description": "..."}
    totalintegerTotal number of messages (for pagination)
    limitintegerCurrent page limit
    offsetintegerCurrent offset

    Pagination

    Messages are sorted from newest to oldest (by createdAt DESC). Use offset and limit to page through them.

    💡 Pagination example:
    • Page 1: ?limit=20&offset=0
    • Page 2: ?limit=20&offset=20
    • Page 3: ?limit=20&offset=40
    • Check total to know whether there are more pages

    Filtering by chatId

    If chatId is provided, the API looks up the contact by phone number or external_id and returns only that contact's messages. If no contact with such a chatId is found, an empty array is returned (not an error).

    Possible errors

    CodeErrorReason
    400The channelId parameter is requiredchannelId is missing from the query string
    403The channel is not linked to this integrationThe channel is not among those allowed for this API key
    404Channel not found or access deniedThe channel does not exist or belongs to another user