Get list of chats

GET /chats

Retrieve a list of chat conversations with their basic information

Query parameters

  • limit integer

    Maximum number of chats to return

    Maximum value is 100. Default value is 25.

  • offset integer

    Number of chats to skip (for pagination)

    Default value is 0.

  • has_media boolean

    Filter chats that contain media messages

    Default value is false.

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
        • 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

      • pagination object
        Hide pagination attributes Show pagination attributes object
        • limit integer
        • offset integer
        • total integer
  • 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

  • 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

  • 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

GET /chats
curl \
 --request GET 'http://localhost:3000/chats' \
 --user "username:password"
Response examples (200)
{
  "code": "SUCCESS",
  "message": "Success get chat list",
  "results": {
    "data": [
      {
        "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"
      }
    ],
    "pagination": {
      "limit": 25,
      "offset": 0,
      "total": 150
    }
  }
}
Response examples (400)
{
  "code": 400,
  "message": "field cannot be blank",
  "results": {}
}
Response examples (500)
{
  "code": "INTERNAL_SERVER_ERROR",
  "message": "you are not loggin",
  "results": {}
}
Response examples (401)
{
  "code": 401,
  "message": "Unauthorized access",
  "results": {}
}