Skip to main content
GET
/
chat
/
Message
/
unread.json
curl -X GET \
-H "QB-Token: 1319b4991186601ccf4df2d0fa89565f68012bba" \
https://api.quickblox.com/chat/Message/unread.json
{
  "total": 15
}

Recipes

1

1. Set dialogs IDs.

Specify as many dialogs IDs as you need via comma.
curl -X GET \
-H "QB-Token: 1319b4991186601ccf4df2d0fa89565f68012bba" \
-d "chat_dialog_ids=5d753421a28f9a2596cb0f98,5d75393ba28f9a17e1cb0f9e,5d75327ba28f9a0f32cb0f99,5d7539bca28f9a2cb3cb0f99" \
https://api.quickblox.com/chat/Message/unread.json
2

2. As a result, the API returns a number of unread messages for each specified dialog.

curl -X GET \
-H "QB-Token: 1319b4991186601ccf4df2d0fa89565f68012bba" \
-d "chat_dialog_ids=5d753421a28f9a2596cb0f98,5d75393ba28f9a17e1cb0f9e,5d75327ba28f9a0f32cb0f99,5d7539bca28f9a2cb3cb0f99" \
https://api.quickblox.com/chat/Message/unread.json
1

1. Use 'Authorization' header to pass API key

curl -X GET \
-H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
-H "On-Behalf-Of: 123" \
-d "chat_dialog_ids=5d753421a28f9a2596cb0f98,5d75393ba28f9a17e1cb0f9e,5d75327ba28f9a0f32cb0f99,5d7539bca28f9a2cb3cb0f99" \
https://api.quickblox.com/chat/Message/unread.json
2

2. Use 'On-Behalf-Of' header to pass user id

To execute a request on behalf of a specific user
curl -X GET \
-H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
-H "On-Behalf-Of: 123" \
-d "chat_dialog_ids=5d753421a28f9a2596cb0f98,5d75393ba28f9a17e1cb0f9e,5d75327ba28f9a0f32cb0f99,5d7539bca28f9a2cb3cb0f99" \
https://api.quickblox.com/chat/Message/unread.json
3

3. Set dialogs IDs

Specify as many dialogs IDs as you need via comma.
curl -X GET \
-H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
-H "On-Behalf-Of: 123" \
-d "chat_dialog_ids=5d753421a28f9a2596cb0f98,5d75393ba28f9a17e1cb0f9e,5d75327ba28f9a0f32cb0f99,5d7539bca28f9a2cb3cb0f99" \
https://api.quickblox.com/chat/Message/unread.json
4

4. As a result, the API returns a number of unread messages for each specified dialog.

curl -X GET \
-H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
-H "On-Behalf-Of: 123" \
-d "chat_dialog_ids=5d753421a28f9a2596cb0f98,5d75393ba28f9a17e1cb0f9e,5d75327ba28f9a0f32cb0f99,5d7539bca28f9a2cb3cb0f99" \
https://api.quickblox.com/chat/Message/unread.json

Query Parameters

chat_dialog_ids
string
Array of dialogs IDs to get a count of unread messages for. You also can omit this parameter to receive just a total count of all unread messages.

Headers

QB-Token
string
required
A user or application session token. See Authentication page to learn more about session tokens. Must be used either QB-Token or Authorization.
Authorization
string
default:"ApiKey {your_api_key}"
API key from Dashboard. Expected format: ApiKey {your_api_key}. Must be used either QB-Token or Authorization.
On-Behalf-Of
string
User ID. The user ID of the user on whose behalf the request is being made.

Responses

A successful response
total
integer
An error response
errors
array of strings
curl -X GET \
-H "QB-Token: 1319b4991186601ccf4df2d0fa89565f68012bba" \
https://api.quickblox.com/chat/Message/unread.json
{
  "total": 15
}
I