GetUnreadCounts

[POST] .../v1/chat/getunreadcounts

Returns aggregated unread message counters for the current user by named filters. Use this method to calculate several unread chat badges in one call, for example pinned chats, client chats or channel tabs. The request body is required and count_filters must contain named filter definitions; optional participant_entity_type and participant_entity_id fields provide participant scoping. The response returns one ChatUnreadCountByKey item per requested key and access is scoped to chats visible to the current request user. Missing body, missing count_filters, invalid filters, inaccessible linked entity scopes and database or unread-cache failures are returned as HTTP 200 ErrorResult business errors.

Request Parameters

Name Type Required Description
count_filters Array of ChatUnreadCountsFilter Required Named filters for counter calculation.

Request Example

{
  "count_filters": [
    {
      "key": "pinned",
      "pinned": true
    },
    {
      "key": "client",
      "participant_entity_type": "Client",
      "participant_entity_id": 1201
    }
  ]
}

Response Parameters

Name Type Description
ok Boolean Indicates whether the request completed successfully.
result Array of ChatUnreadCountByKey Result array.

Response Example

{
  "ok": true,
  "result": [
    {
      "key": "pinned",
      "unread_count": 3
    },
    {
      "key": "client",
      "unread_count": 1
    }
  ]
}