Get messages from a specific chat

GET /chat/{chat_jid}/messages

Retrieve messages from a specific chat conversation with filtering options

Path parameters

Query parameters

  • limit integer

    Maximum number of messages to return

    Maximum value is 100. Default value is 50.

  • offset integer

    Number of messages to skip (for pagination)

    Default value is 0.

  • start_time string(date-time)

    Filter messages from this timestamp (ISO 8601 format)

  • end_time string(date-time)

    Filter messages until this timestamp (ISO 8601 format)

  • media_only boolean

    Only return messages with media content

    Default value is false.

  • is_from_me boolean

    Filter messages by sender (true for messages sent by you, false for received messages). When both media_only=true and isFromMe=false are provided, media_only takes precedence and will return all media messages regardless of sender.

Responses

  • 200 application/json

    OK

    Hide response attributes Show response attributes object
    • code string
    • message string
    • results object
      Hide results attributes Show results attributes object
      • data array[object]
        Hide data attributes Show data attributes object
        • id string

          Message ID

        • chat_jid string

          Chat JID this message belongs to

        • sender_jid string

          Sender JID

        • content string

          Message text content

        • timestamp string(date-time)

          Message timestamp

        • is_from_me boolean

          Whether this message was sent by the current user

        • media_type string | null

          Type of media (image, video, audio, document, etc.)

        • filename string | null

          Original filename for media messages

        • url string | null

          Media file URL

        • file_length integer | null

          File size in bytes for media messages

        • created_at string(date-time)

          Record creation timestamp

        • updated_at string(date-time)

          Record last update timestamp

      • pagination object
        Hide pagination attributes Show pagination attributes object
        • limit integer
        • offset integer
        • total integer
      • chat_info object
        Hide chat_info attributes Show chat_info attributes object
        • jid string

          Chat JID identifier

        • name string

          Chat display name

        • last_message_time string(date-time)

          Timestamp of the last message

        • ephemeral_expiration integer

          Ephemeral message expiration time in seconds (0 = disabled)

        • created_at string(date-time)

          Chat creation timestamp

        • updated_at string(date-time)

          Chat last update timestamp

  • 400 application/json

    Bad Request

    Hide response attributes Show response attributes object
    • code string

      HTTP Status Code

    • message string

      Detail error message

    • results object

      additional data

  • 401 application/json

    Unauthorized

    Hide response attributes Show response attributes object
    • code string

      HTTP Status Code

    • message string

      Detail error message

    • results object

      additional data

  • 404 application/json

    Chat Not Found

    Hide response attributes Show response attributes object
    • code string

      HTTP Status Code

    • message string

      Detail error message

    • results object

      additional data

  • 500 application/json

    Internal Server Error

    Hide response attributes Show response attributes object
    • code string

      SYSTEM_CODE_ERROR

    • message string

      Detail error message

    • results object

      additional data

GET /chat/{chat_jid}/messages
curl \
 --request GET 'http://localhost:3000/chat/6289685028129@s.whatsapp.net/messages' \
 --user "username:password"
Response examples (200)
{
  "code": "SUCCESS",
  "message": "Success get chat messages",
  "results": {
    "data": [
      {
        "id": "3EB0B430B6F8F1D0E053AC120E0A9E5C",
        "chat_jid": "6289685028129@s.whatsapp.net",
        "sender_jid": "6289685028129@s.whatsapp.net",
        "content": "Hello, how are you?",
        "timestamp": "2024-01-15T10:30:00Z",
        "is_from_me": false,
        "media_type": "image",
        "filename": "photo.jpg",
        "url": "https://media.example.com/file.jpg",
        "file_length": 1024768,
        "created_at": "2024-01-15T10:30:00Z",
        "updated_at": "2024-01-15T10:30:00Z"
      }
    ],
    "pagination": {
      "limit": 50,
      "offset": 0,
      "total": 1250
    },
    "chat_info": {
      "jid": "6289685028129@s.whatsapp.net",
      "name": "John Doe",
      "last_message_time": "2024-01-15T10:30:00Z",
      "ephemeral_expiration": 0,
      "created_at": "2024-01-10T08:00:00Z",
      "updated_at": "2024-01-15T10:30:00Z"
    }
  }
}
Response examples (400)
{
  "code": 400,
  "message": "field cannot be blank",
  "results": {}
}
Response examples (401)
{
  "code": 401,
  "message": "Unauthorized access",
  "results": {}
}
Response examples (404)
{
  "code": 404,
  "message": "Chat not found",
  "results": {}
}
Response examples (500)
{
  "code": "INTERNAL_SERVER_ERROR",
  "message": "you are not loggin",
  "results": {}
}