Recipes
Display total number of unread messages for each dialog
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. 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
Display total number of unread messages for each dialog with API key
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. 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. 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. 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
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.
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.
User ID. The user ID of the user on whose behalf the request is being made.
Responses
curl -X GET \
-H "QB-Token: 1319b4991186601ccf4df2d0fa89565f68012bba" \
https://api.quickblox.com/chat/Message/unread.json