Skip to main content

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.

SettingValue
MethodPOST
Path/api/v1/accounts/{account_id}/conversations/filter
AuthorizationUser token. Only visible conversations are returned.

Permissions:

Path parameters

NameTypeRequiredDescription
account_idintegerYesAccount ID.

Query parameters

NameTypeRequiredDescription
pageintegerNoPage number (25 per page).
assignee_typestringNome (assigned to the caller), unassigned, assigned, new (with unread incoming messages).

Body parameters (JSON)

NameTypeRequiredDescription
payload[].attribute_keystringYesAttribute (table below) or the key of a conversation custom attribute.
payload[].filter_operatorstringYesOperator (table below).
payload[].valuesarrayYesValues. equal_to on status, inbox_id and labels accepts several values (match any). Send [] for is_present / is_not_present.
payload[].query_operatorstringYesand / or to the next condition; null on the last one. Any other value returns 422.

Filterable attributes

attribute_keyOperatorsValues
statusequal_to, not_equal_toopen, pending, snoozed, resolved, !resolved (= open, pending, snoozed), all
assignee_id, contact_id, inbox_id, team_id, display_id, campaign_idequal_to, not_equal_to, is_present, is_not_presentIDs
labelsequal_to (has any), not_equal_to (has none), is_present, is_not_presentLabel titles
browser_language, conversation_language, country_code, referer, mail_subjectequal_to, not_equal_to, contains, does_not_containText (stored in additional_attributes)
created_at, last_activity_atis_greater_than, is_less_than, days_beforeYYYY-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.

warning

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

StatusWhenBody
422A query_operator is not and, or or null.{"error": "Query operator must be either \"AND\" or \"OR\"."}

Remarks​

  • Here !resolved means open, pending and snoozed. In the status parameter of List Conversations it means only open and pending.
  • The status names differ from the dashboard: open is Bot and pending is Manual. See Statuses.

Request​

Responses​

The matching conversations on this page, and the counts.