waha icon indicating copy to clipboard operation
waha copied to clipboard

[Feature Request] Add profile picture object be included in the GET /api/{session}/chats endpoint response

Open tiarsagitar opened this issue 1 year ago • 2 comments

Is your feature request related to a problem? Please describe. I'm always frustrated when facing timeouts when trying to fetch profile pictures separately using the GET /api/contacts/profile-picture?contactId= endpoint in a loop.

** A clear and concise description of what the problem is. I would like to add a profile picture url object in the GET /api/{session}/chats endpoint response. For example:

[{
    "id": "[email protected]",
    "readOnly": false,
    "ephemeralExpiration": 0,
    "ephemeralSettingTimestamp": 0,
    "conversationTimestamp": 1726799908,
    "name": "Contoh",
    "profilePictureUrl": "....",
    ...
}]

tiarsagitar avatar Oct 01 '24 03:10 tiarsagitar

I believe it's for NOWEB engine, right?

patron:PRO

devlikepro avatar Oct 01 '24 10:10 devlikepro

I believe it's for NOWEB engine, right?

patron:PRO

Yes, that’s correct. I use the NOWEB engine.

tiarsagitar avatar Oct 01 '24 15:10 tiarsagitar

+1

huangzhong0406 avatar Oct 30 '24 11:10 huangzhong0406

Added in 2024.12.6 :rocket:

https://waha.devlike.pro/docs/how-to/chats/#get-chats-overview


Get chats overview

Get chats "overview" - the API that almost all Chat UI client needs!

GET /api/{session}/chats/overview?limit=20&offset=0

Response contains the main info you need to show in the chat list:

  1. id - chat id
  2. name - chat name (if any)
  3. picture - chat picture (if any)
  4. lastMessage - last message in the chat (if any).
  5. _chat - the structure depends on engine you're using

⚠️ lastMessage doesn't have media attachments, you need to [get message by id]({{< relref "#get-message-by-id" >}}) to get media attachments.

[
  {
    "id": "[email protected]",
    "name": "John Doe",
    "picture": "https://example.com/picture.jpg",
    "lastMessage": {
      "id": "[email protected]_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
      "timestamp": 1667561485,
      "from": "[email protected]",
      "fromMe": true,
      "to": "[email protected]",
      "body": "Hi there!",
      ...
    },
    "_chat": {
      ...
    }
  }
]

Pagination:

  • limit=100 - limit the number of chats to return
  • offset=0 - skip the number of chats from the start

patron:PRO

devlikepro avatar Dec 24 '24 10:12 devlikepro