Skip to main content
GET

Recipes

1

1. Set the ID of the dialog

Set a chat_dialog_id to refer to a specific dialog.
2

2. Set a search operator for a field

Apply a search operator to the query. Here, a ctn operator is applied to a message field with the guys value.
3

3. As a result, the API will return messages satisfying the specified criteria.

All messages containing the guys word are returned for the specified dialog.
1

1. Set the ID of the dialog

Set a chat_dialog_id to refer to a specific dialog.
2

2. Set a search operator for a field

Apply a search operator to the query. Here, the lt operator is applied to a date_sent field.
3

3. Set a sort operator for a field

Use a sort operator to order the search results by the field. Here, the sort_desc operator is applied to the date_sent field.
4

4. As a result, the API returns messages filtered and sorted upon the request.

The messages are returned with the date_sent value less than 1568057349 and are sorted by the date_sent field in descending order.
1

1. Set the ID of the dialog

Set a chat_dialog_id to refer to a specific dialog.
2

2. Set the ID of the message

Set an _id parameter to refer to a particular message.
3

3. As a result, the API returns a specified message.

1

1. Use 'Authorization' header to pass API key

2

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

3

3. Set the ID of the dialog

Set a chat_dialog_id to refer to a specific dialog.
4

4. Set the ID of the message

Set an _id parameter to refer to a particular message.
5

5. As a result, the API returns a specified message.

1

1. Use 'Authorization' header to pass API key

2

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

To execute a request on behalf of a specific user.
3

3. Set the ID of the dialog

Set a chat_dialog_id to refer to a specific dialog.
4

4. Set a search operator for a field

Apply a search operator to the query. Here, a ctn operator is applied to a message field with the guys value.
5

5. As a result, the API will return messages satisfying the specified criteria.

All messages containing the guys word are returned for the specified dialog.
1

1. Use 'Authorization' header to pass API key

2

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

To execute a request on behalf of a specific user.
3

3. Set the ID of the dialog

Set a chat_dialog_id to refer to a specific dialog.
4

4. Set a search operator for a field

Apply a search operator to the query. Here, the lt operator is applied to a date_sent field.
5

5. Set a sort operator for a field

Use a sort operator to order the search results by the field. Here, the sort_desc operator is applied to the date_sent field.
6

6. As a result, the API returns messages filtered and sorted upon the request.

The messages are returned with the date_sent value less than 1568057349 and are sorted by the date_sent field in descending order.
All retrieved chat messages will be marked as read after request.
Messages will be marked in 2 cases:
  • if the current user ID is in occupants_ids field for type=2 (GROUP) dialog;
  • if dialog’s type=1 (PUBLIC) dialog.
Search operators The request can contain all, some or none of the next search operators: Sort operators Next sorting operators are allowed:

Query Parameters

chat_dialog_id
string
required
ID of the dialog.
{message_field_N}
string
Search records with the field that contains the specified value. Can be many 1..N.
{message_field_N}[{search_operator}]
string
Filters records with field which contains value according to specified value and operator. Can be many 1..N.
mark_as_read
integer
Mark the requested message as read. Set 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.
limit
string
default:"100"
Limit search results to N records. Useful for pagination.
skip
string
default:"0"
Skip N records in search results. Useful for pagination.
count
string
Count search results. Response will contain only a count of found records.
sort_desc
string
Search results will be sorted by a specified field in descending order.
sort_asc
string
Search results will be sorted by a specified field in ascending order.

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
skip
integer
limit
integer
items
array of objects
An error response
errors
array of strings
An error response
errors
array of strings