Filter Conversations
POST/accounts/:account_id/conversations/filter
Advanced filtering with conditions, in the same format as Filter Contacts; results are sorted by last activity, 25 per page.
Send the conditions in payload. Each condition compares one attribute with
values, and is joined to the next condition by its query_operator
(and or or); the last condition has query_operator: null. The format is
the same as in Filter Contacts.
| Setting | Value |
|---|---|
| Method | POST |
| Path | /api/v1/accounts/{account_id}/conversations/filter |
| Authorization | User token. Only visible conversations are returned. |
Permissions:
- User token: any agent of the account — see Who can see a conversation.
- Agent-bot token: not allowed.
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
account_id | integer | Yes | Account ID. |
Query parameters
| Name | Type | Required | Description |
|---|---|---|---|
page | integer | No | Page number (25 per page). |
assignee_type | string | No | me (assigned to the caller), unassigned, assigned, new (with unread incoming messages). |
Body parameters (JSON)
| Name | Type | Required | Description |
|---|---|---|---|
payload[].attribute_key | string | Yes | Attribute (table below) or the key of a conversation custom attribute. |
payload[].filter_operator | string | Yes | Operator (table below). |
payload[].values | array | Yes | Values. equal_to on status, inbox_id and labels accepts several values (match any). Send [] for is_present / is_not_present. |
payload[].query_operator | string | Yes | and / or to the next condition; null on the last one. Any other value returns 422. |
Filterable attributes
attribute_key | Operators | Values |
|---|---|---|
status | equal_to, not_equal_to | open, pending, snoozed, resolved, !resolved (= open, pending, snoozed), all |
assignee_id, contact_id, inbox_id, team_id, display_id, campaign_id | equal_to, not_equal_to, is_present, is_not_present | IDs |
labels | equal_to (has any), not_equal_to (has none), is_present, is_not_present | Label titles |
browser_language, conversation_language, country_code, referer, mail_subject | equal_to, not_equal_to, contains, does_not_contain | Text (stored in additional_attributes) |
created_at, last_activity_at | is_greater_than, is_less_than, days_before | YYYY-MM-DD, or a number of days for days_before |
attribute_key can also be the key of a conversation custom attribute
defined in Settings → Custom attributes.
An unsupported operator or an unknown custom attribute key makes that
condition be silently ignored (for example contains on labels, or a
custom attribute that is not defined in Settings → Custom attributes), so
the filter returns more conversations than you expect. Check your conditions
against the table.
Example request: Bot or Manual conversations in inbox 31 that have the
label vip.
curl -X POST 'https://online.99digital.co.il/api/v1/accounts/12/conversations/filter?page=1' \
-H 'api_access_token: <YOUR_API_ACCESS_TOKEN>' \
-H 'Content-Type: application/json' \
-d '{
"payload": [
{ "attribute_key": "status", "filter_operator": "equal_to", "values": ["open", "pending"], "query_operator": "and" },
{ "attribute_key": "inbox_id", "filter_operator": "equal_to", "values": [31], "query_operator": "and" },
{ "attribute_key": "labels", "filter_operator": "equal_to", "values": ["vip"], "query_operator": null }
]
}'
Example response (200 OK). The conversation is shortened to its id;
each item is a full conversation object.
{
"meta": {
"mine_count": 0,
"new_count": 1,
"assigned_count": 0,
"unassigned_count": 1,
"all_count": 1,
"last_page": true
},
"payload": [
{ "id": 1501 }
]
}
Error responses
| Status | When | Body |
|---|---|---|
422 | A query_operator is not and, or or null. | {"error": "Query operator must be either \"AND\" or \"OR\"."} |
Remarks
- Here
!resolvedmeansopen,pendingandsnoozed. In thestatusparameter of List Conversations it means onlyopenandpending. - The status names differ from the dashboard:
openis Bot andpendingis Manual. See Statuses.
Request
Responses
- 200
- 401
- 403
- 422
The matching conversations on this page, and the counts.
The access token is missing or wrong, or its user does not belong to this account.
The token's role does not have the permission this endpoint needs, or the endpoint is not open to agent-bot tokens. See Authorization.
A query_operator is not and, or or null.