curl -X GET \
-H "QB-Token: d23b555a6f9b6db4e3ebfd5e02a8e238e5012bba" \
https://api.quickblox.com/chat/Message.json?chat_dialog_id=5d75393ba28f9a17e1cb0f9e
{
"skip": 0,
"limit": 100,
"items": [
{
"_id": "5d755856a0eb47411e0b72a9",
"attachments": [],
"chat_dialog_id": "5d75393ba28f9a17e1cb0f9e",
"created_at": "2019-09-08T19:36:54Z",
"date_sent": 1567971414,
"delivered_ids": [
96753878
],
"message": "Hi guys",
"read_ids": [
96753878
],
"recipient_id": 0,
"sender_id": 96753878,
"updated_at": "2019-09-08T19:36:54Z",
"read": 0
},
{
"_id": "5d76a618a28f9a1edfcb0f9b",
"age": "25",
"attachments": [
{
"type": "image",
"id": "47863"
},
{
"type": "image",
"id": "47863"
}
],
"chat_dialog_id": "5d75393ba28f9a17e1cb0f9e",
"created_at": "2019-09-09T19:20:56Z",
"date_sent": 1568056856,
"delivered_ids": [
96753878
],
"message": "Hi guys!",
"read_ids": [
96753878
],
"recipient_id": 343,
"sender_id": 96753878,
"updated_at": "2019-09-09T19:20:56Z",
"read": 0
}
]
}
{
"errors": [
"You don't have appropriate permissions to perform this operation"
]
}
{
"errors": [
"The resource wasn't found"
]
}
List Messages
Retrieve all chat messages within a particular dialog.
curl -X GET \
-H "QB-Token: d23b555a6f9b6db4e3ebfd5e02a8e238e5012bba" \
https://api.quickblox.com/chat/Message.json?chat_dialog_id=5d75393ba28f9a17e1cb0f9e
{
"skip": 0,
"limit": 100,
"items": [
{
"_id": "5d755856a0eb47411e0b72a9",
"attachments": [],
"chat_dialog_id": "5d75393ba28f9a17e1cb0f9e",
"created_at": "2019-09-08T19:36:54Z",
"date_sent": 1567971414,
"delivered_ids": [
96753878
],
"message": "Hi guys",
"read_ids": [
96753878
],
"recipient_id": 0,
"sender_id": 96753878,
"updated_at": "2019-09-08T19:36:54Z",
"read": 0
},
{
"_id": "5d76a618a28f9a1edfcb0f9b",
"age": "25",
"attachments": [
{
"type": "image",
"id": "47863"
},
{
"type": "image",
"id": "47863"
}
],
"chat_dialog_id": "5d75393ba28f9a17e1cb0f9e",
"created_at": "2019-09-09T19:20:56Z",
"date_sent": 1568056856,
"delivered_ids": [
96753878
],
"message": "Hi guys!",
"read_ids": [
96753878
],
"recipient_id": 343,
"sender_id": 96753878,
"updated_at": "2019-09-09T19:20:56Z",
"read": 0
}
]
}
{
"errors": [
"You don't have appropriate permissions to perform this operation"
]
}
{
"errors": [
"The resource wasn't found"
]
}
Recipes
Filter messages by word
Filter messages by word
1. Set the ID of the dialog
chat_dialog_id to refer to a specific dialog.curl -X GET \
-H "QB-Token: d23b555a6f9b6db4e3ebfd5e02a8e238e5012bba" \
https://api.quickblox.com/chat/Message.json?chat_dialog_id=5d75393ba28f9a17e1cb0f9e&message[ctn]=guys
2. Set a search operator for a field
ctn operator is applied to a message field with the guys value.curl -X GET \
-H "QB-Token: d23b555a6f9b6db4e3ebfd5e02a8e238e5012bba" \
https://api.quickblox.com/chat/Message.json?chat_dialog_id=5d75393ba28f9a17e1cb0f9e&message[ctn]=guys
3. As a result, the API will return messages satisfying the specified criteria.
curl -X GET \
-H "QB-Token: d23b555a6f9b6db4e3ebfd5e02a8e238e5012bba" \
https://api.quickblox.com/chat/Message.json?chat_dialog_id=5d75393ba28f9a17e1cb0f9e&message[ctn]=guys
Filter and sort messages
Filter and sort messages
1. Set the ID of the dialog
chat_dialog_id to refer to a specific dialog.curl -X GET \
-H "QB-Token: d23b555a6f9b6db4e3ebfd5e02a8e238e5012bba" \
https://api.quickblox.com/chat/Message.json?chat_dialog_id=5d75393ba28f9a17e1cb0f9e&date_sent[lt]=1568057349&sort_desc=date_sent
2. Set a search operator for a field
lt operator is applied to a date_sent field.curl -X GET \
-H "QB-Token: d23b555a6f9b6db4e3ebfd5e02a8e238e5012bba" \
https://api.quickblox.com/chat/Message.json?chat_dialog_id=5d75393ba28f9a17e1cb0f9e&date_sent[lt]=1568057349&sort_desc=date_sent
3. Set a sort operator for a field
sort_desc operator is applied to the date_sent field.curl -X GET \
-H "QB-Token: d23b555a6f9b6db4e3ebfd5e02a8e238e5012bba" \
https://api.quickblox.com/chat/Message.json?chat_dialog_id=5d75393ba28f9a17e1cb0f9e&date_sent[lt]=1568057349&sort_desc=date_sent
4. As a result, the API returns messages filtered and sorted upon the request.
curl -X GET \
-H "QB-Token: d23b555a6f9b6db4e3ebfd5e02a8e238e5012bba" \
https://api.quickblox.com/chat/Message.json?chat_dialog_id=5d75393ba28f9a17e1cb0f9e&date_sent[lt]=1568057349&sort_desc=date_sent
Get message by its ID
Get message by its ID
1. Set the ID of the dialog
chat_dialog_id to refer to a specific dialog.curl -X GET \
-H "QB-Token: d23b555a6f9b6db4e3ebfd5e02a8e238e5012bba" \
https://api.quickblox.com/chat/Message.json?chat_dialog_id=5d75393ba28f9a17e1cb0f9e&_id=5d76a618a28f9a1edfcb0f9b
2. Set the ID of the message
_id parameter to refer to a particular message.curl -X GET \
-H "QB-Token: d23b555a6f9b6db4e3ebfd5e02a8e238e5012bba" \
https://api.quickblox.com/chat/Message.json?chat_dialog_id=5d75393ba28f9a17e1cb0f9e&_id=5d76a618a28f9a1edfcb0f9b
3. As a result, the API returns a specified message.
curl -X GET \
-H "QB-Token: d23b555a6f9b6db4e3ebfd5e02a8e238e5012bba" \
https://api.quickblox.com/chat/Message.json?chat_dialog_id=5d75393ba28f9a17e1cb0f9e&_id=5d76a618a28f9a1edfcb0f9b
Get messages with reactions (added in v2.58.0)
Get messages with reactions (added in v2.58.0)
1. Set the ID of the dialog
chat_dialog_id to refer to a specific dialog.curl -X GET \
-H "QB-Token: d23b555a6f9b6db4e3ebfd5e02a8e238e5012bba" \
https://api.quickblox.com/chat/Message.json?chat_dialog_id=5d75393ba28f9a17e1cb0f9e&include_reactions=1
2. Set the `include_reactions` query parameter
include_reactions=1 query parameter.curl -X GET \
-H "QB-Token: d23b555a6f9b6db4e3ebfd5e02a8e238e5012bba" \
https://api.quickblox.com/chat/Message.json?chat_dialog_id=5d75393ba28f9a17e1cb0f9e&include_reactions=1
3. As a result, the API returns messages with reactions.
curl -X GET \
-H "QB-Token: d23b555a6f9b6db4e3ebfd5e02a8e238e5012bba" \
https://api.quickblox.com/chat/Message.json?chat_dialog_id=5d75393ba28f9a17e1cb0f9e&include_reactions=1
Get message by its ID with API key
Get message by its ID with API key
1. Use 'Authorization' header to pass API key
curl -X GET \
-H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
-H "On-Behalf-Of: 123" \
https://api.quickblox.com/chat/Message.json?chat_dialog_id=5d75393ba28f9a17e1cb0f9e&_id=5d76a618a28f9a1edfcb0f9b
2. Use 'On-Behalf-Of' header to pass user id
curl -X GET \
-H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
-H "On-Behalf-Of: 123" \
https://api.quickblox.com/chat/Message.json?chat_dialog_id=5d75393ba28f9a17e1cb0f9e&_id=5d76a618a28f9a1edfcb0f9b
3. Set the ID of the dialog
chat_dialog_id to refer to a specific dialog.curl -X GET \
-H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
-H "On-Behalf-Of: 123" \
https://api.quickblox.com/chat/Message.json?chat_dialog_id=5d75393ba28f9a17e1cb0f9e&_id=5d76a618a28f9a1edfcb0f9b
4. Set the ID of the message
_id parameter to refer to a particular message.curl -X GET \
-H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
-H "On-Behalf-Of: 123" \
https://api.quickblox.com/chat/Message.json?chat_dialog_id=5d75393ba28f9a17e1cb0f9e&_id=5d76a618a28f9a1edfcb0f9b
5. As a result, the API returns a specified message.
curl -X GET \
-H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
-H "On-Behalf-Of: 123" \
https://api.quickblox.com/chat/Message.json?chat_dialog_id=5d75393ba28f9a17e1cb0f9e&_id=5d76a618a28f9a1edfcb0f9b
Get message with reactions using API key (added in v2.58.0)
Get message with reactions using API key (added in v2.58.0)
1. Use 'Authorization' header to pass API key
curl -X GET \
-H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
-H "On-Behalf-Of: 123" \
https://api.quickblox.com/chat/Message.json?chat_dialog_id=5d75393ba28f9a17e1cb0f9e&include_reactions=1
2. Use 'On-Behalf-Of' header to pass user id
curl -X GET \
-H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
-H "On-Behalf-Of: 123" \
https://api.quickblox.com/chat/Message.json?chat_dialog_id=5d75393ba28f9a17e1cb0f9e&include_reactions=1
3. Set the ID of the dialog
chat_dialog_id to refer to a specific dialog.curl -X GET \
-H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
-H "On-Behalf-Of: 123" \
https://api.quickblox.com/chat/Message.json?chat_dialog_id=5d75393ba28f9a17e1cb0f9e&include_reactions=1
4. Set the `include_reactions` query parameter
include_reactions=1 query parameter.curl -X GET \
-H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
-H "On-Behalf-Of: 123" \
https://api.quickblox.com/chat/Message.json?chat_dialog_id=5d75393ba28f9a17e1cb0f9e&include_reactions=1
5. As a result, the API returns messages with reactions.
curl -X GET \
-H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
-H "On-Behalf-Of: 123" \
https://api.quickblox.com/chat/Message.json?chat_dialog_id=5d75393ba28f9a17e1cb0f9e&include_reactions=1
Filter messages by word with API key
Filter messages by word with API key
1. Use 'Authorization' header to pass API key
curl -X GET \
-H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
-H "On-Behalf-Of: 123" \
https://api.quickblox.com/chat/Message.json?chat_dialog_id=5d75393ba28f9a17e1cb0f9e&message[ctn]=guys
2. Use 'On-Behalf-Of' header to pass user id
curl -X GET \
-H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
-H "On-Behalf-Of: 123" \
https://api.quickblox.com/chat/Message.json?chat_dialog_id=5d75393ba28f9a17e1cb0f9e&message[ctn]=guys
3. Set the ID of the dialog
chat_dialog_id to refer to a specific dialog.curl -X GET \
-H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
-H "On-Behalf-Of: 123" \
https://api.quickblox.com/chat/Message.json?chat_dialog_id=5d75393ba28f9a17e1cb0f9e&message[ctn]=guys
4. Set a search operator for a field
ctn operator is applied to a message field with the guys value.curl -X GET \
-H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
-H "On-Behalf-Of: 123" \
https://api.quickblox.com/chat/Message.json?chat_dialog_id=5d75393ba28f9a17e1cb0f9e&message[ctn]=guys
5. As a result, the API will return messages satisfying the specified criteria.
curl -X GET \
-H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
-H "On-Behalf-Of: 123" \
https://api.quickblox.com/chat/Message.json?chat_dialog_id=5d75393ba28f9a17e1cb0f9e&message[ctn]=guys
Filter and sort messages with API key
Filter and sort messages with API key
1. Use 'Authorization' header to pass API key
curl -X GET \
-H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
-H "On-Behalf-Of: 123" \
https://api.quickblox.com/chat/Message.json?chat_dialog_id=5d75393ba28f9a17e1cb0f9e&date_sent[lt]=1568057349&sort_desc=date_sent
2. Use 'On-Behalf-Of' header to pass user id
curl -X GET \
-H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
-H "On-Behalf-Of: 123" \
https://api.quickblox.com/chat/Message.json?chat_dialog_id=5d75393ba28f9a17e1cb0f9e&date_sent[lt]=1568057349&sort_desc=date_sent
3. Set the ID of the dialog
chat_dialog_id to refer to a specific dialog.curl -X GET \
-H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
-H "On-Behalf-Of: 123" \
https://api.quickblox.com/chat/Message.json?chat_dialog_id=5d75393ba28f9a17e1cb0f9e&date_sent[lt]=1568057349&sort_desc=date_sent
4. Set a search operator for a field
lt operator is applied to a date_sent field.curl -X GET \
-H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
-H "On-Behalf-Of: 123" \
https://api.quickblox.com/chat/Message.json?chat_dialog_id=5d75393ba28f9a17e1cb0f9e&date_sent[lt]=1568057349&sort_desc=date_sent
5. Set a sort operator for a field
sort_desc operator is applied to the date_sent field.curl -X GET \
-H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
-H "On-Behalf-Of: 123" \
https://api.quickblox.com/chat/Message.json?chat_dialog_id=5d75393ba28f9a17e1cb0f9e&date_sent[lt]=1568057349&sort_desc=date_sent
6. As a result, the API returns messages filtered and sorted upon the request.
curl -X GET \
-H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
-H "On-Behalf-Of: 123" \
https://api.quickblox.com/chat/Message.json?chat_dialog_id=5d75393ba28f9a17e1cb0f9e&date_sent[lt]=1568057349&sort_desc=date_sent
Messages will be marked in 2 cases:
- if the current user ID is in
occupants_idsfield fortype=2(GROUP) dialog; - if dialog’s
type=1(PUBLIC) dialog.
| Operator | Description |
|---|---|
| lt | Less Than operator Types: number, string, date Applicable to fields: date_sent, sender_id, recipient_id, updated_at Example: date_sent[lt]=1556829805 Description: Will return messages with date_sent less than 1556829805. |
| lte | Less Than or Equal to operator Types: number, string, date Applicable to fields: date_sent, sender_id, recipient_id, updated_at Example: updated_at[lte]=1556829805 Will return messages with updated_at less than or equal 1556829805. |
| gt | Greater Than operator Types: number, string, date Applicable to fields: date_sent, sender_id, recipient_id, updated_at Example: date_sent[gt]=1556829805 Will return messages with date_sent greater than 1556829805. |
| gte | Greater Than or Equal to operator Types: number, string, date Applicable to fields: date_sent, sender_id, recipient_id, updated_at Example: date_sent[gte]=1556829805 Will return messages with date_sent greater than or equal 1556829805. |
| ne | Not Equal to operator Types: number, string, date Applicable to fields: _id, message, date_sent, sender_id, recipient_id Example: recipient_id[ne]=9988237 Will return messages with recipient_id not equal to 9988237. |
| in | Contained IN array operator Types: number, string, date Applicable to fields: date_sent, sender_id, recipient_id Example: sender_id[in]=91419276,91419395 Will return messages with sender_id equal to 91419276 and equal to 91419395. |
| nin | Not contained IN array Types: number, string, date Applicable to fields: date_sent, sender_id, recipient_id Example: recipient_id[nin]=91419276,91419395 Will return messages with recipient_id not equal to 91419276 and 91419395. |
| or | OR operator Types: number, string, date Applicable to fields: date_sent, sender_id, recipient_id Example: sender_id[or]=91419390,96753878 Will return messages with sender_id equal to 91419390 or 96753878. |
| ctn | Contains substring operator Types: string Applicable to fields: message Example: message[ctn]=party Returns messages which text contains the word “party”. |
| Operator | Description |
|---|---|
| sort_asc | Types: all types Example: sort_asc=field_name Search results will be sorted by the specified field in ascending order. |
| sort_desc | Types: all types Example: sort_desc=field_name Search results will be sorted by the specified field in descending order. |
Query Parameters
mark_as_read=1 to perform. As a result, when the message is retreived by the opponent, the opponent ID is added to the array of read_ids field. Works only if the message had the unread status previously, not backwards. You can update message status using the Update Message request. 1 to include reactions data in the message response. Default is 0. Headers
ApiKey {your_api_key}. Must be used either QB-Token or Authorization.Responses
201
201
Show properties
Show properties
?include_reactions=1.403
403
404
404
curl -X GET \
-H "QB-Token: d23b555a6f9b6db4e3ebfd5e02a8e238e5012bba" \
https://api.quickblox.com/chat/Message.json?chat_dialog_id=5d75393ba28f9a17e1cb0f9e
{
"skip": 0,
"limit": 100,
"items": [
{
"_id": "5d755856a0eb47411e0b72a9",
"attachments": [],
"chat_dialog_id": "5d75393ba28f9a17e1cb0f9e",
"created_at": "2019-09-08T19:36:54Z",
"date_sent": 1567971414,
"delivered_ids": [
96753878
],
"message": "Hi guys",
"read_ids": [
96753878
],
"recipient_id": 0,
"sender_id": 96753878,
"updated_at": "2019-09-08T19:36:54Z",
"read": 0
},
{
"_id": "5d76a618a28f9a1edfcb0f9b",
"age": "25",
"attachments": [
{
"type": "image",
"id": "47863"
},
{
"type": "image",
"id": "47863"
}
],
"chat_dialog_id": "5d75393ba28f9a17e1cb0f9e",
"created_at": "2019-09-09T19:20:56Z",
"date_sent": 1568056856,
"delivered_ids": [
96753878
],
"message": "Hi guys!",
"read_ids": [
96753878
],
"recipient_id": 343,
"sender_id": 96753878,
"updated_at": "2019-09-09T19:20:56Z",
"read": 0
}
]
}
{
"errors": [
"You don't have appropriate permissions to perform this operation"
]
}
{
"errors": [
"The resource wasn't found"
]
}
Was this page helpful?