User filters are used in the method of obtaining a list of leads (not all users, but only the required subset).
We have a visual filter editor on the Leads page. This article describes the syntax.
Example:
{
"type": "and",
"filters": [
{
"property_name": "$name",
"type": "known",
"value": {}
}
]
}
A filter is a JSON object that contains two fields:
type
(filter type: and
or or
) and an array of filters
(array of filters directly).
When using the and
type, a user satisfies the filter, if he satisfies all filters.
When or
— if he satisfies at least one of the filters.
For now these filter types are supported:
General:
Numbers:
String:
Boolean:
Date:
List:
Universal for all types. Name contains any value:
{
"type": "known",
"property_name": "$name",
"value": {}
}
Universal for all types. Name is undefined:
{
"type": "unknown",
"property_name": "$name",
"value": {}
}
Number of sessions is more than 5:
{
"type": "gt",
"property_name": "$sessions",
"value": {"value": 5}
}
Number of orders is more than 5 or undefined:
{
"type": "gt_or_unknown",
"property_name": "orders",
"value": {"value": 4}
}
Number of sessions is less than 5:
{
"type": "lt",
"property_name": "$sessions",
"value": {"value": 5}
}
Number of orders is less than 5 or undefined:
{
"type": "lt_or_unknown",
"property_name": "orders",
"value": {"value": 5}
}
Number of sessions in range from 2 to 5 (including gaps):
{
"type": "range",
"property_name": "$sessions",
"value": {"value1": 2, "value2": 5}
}
Number of sessions equals 5:
{
"type": "eq",
"property_name": "$sessions",
"value": {"value": 5}
}
Number of sessions is unequal to 5:
{
"type": "neq",
"property_name": "$sessions",
"value": {"value": 5}
}
Name equals "Maks" (case insensitive):
{
"type": "str_eq",
"property_name": "$name",
"value": {"value": "Maks"}
}
Name is not equal to "Maks" (case insensitive):
{
"type": "str_neq",
"property_name": "$name",
"value": {"value": "Maks"}
}
Name contains "mak" (case insensitive).
Acceptable number of symbols in value
: from 3 to 15 (including gaps):
{
"type": "str_contains",
"property_name": "$name",
"value": {"value": "mak"}
}
Name does not contain "mak" (case insensitive).
Acceptable number of symbols in value
: from 3 to 15 (including gaps):
{
"type": "str_notcontains",
"property_name": "$name",
"value": {"value": "mak"}
}
Property “unsubscribed from emails” is true
:
{
"type": "bool_true",
"property_name": "$email_unsubscribed",
"value": {}
}
Property “unsubscribed from emails” is false
:
{
"type": "bool_false",
"property_name": "$email_unsubscribed",
"value": {}
}
Date of last reply is more than 12 days ago:
{
"type": "daysmore",
"property_name": "$last_reply",
"value": {
"value": 12,
"unit": "days"
}
}
unit
field contains measures(units) of value
.
Units can be: minutes
, hours
, days
, weeks
.
Date of last reply is more than 12 days ago or undefined (user has never replied):
{
"type": "daysmore_or_unknown",
"property_name": "$last_reply",
"value": {
"value": 12,
"unit": "days"
}
}
unit
field contains measures(units) of value
.
Units can be: minutes
, hours
, days
, weeks
.
Date of last reply is less than 12 days ago:
{
"type": "daysless",
"property_name": "$last_reply",
"value": {
"value": 12,
"unit": "days"
}
}
unit
field contains measures(units) of value
.
Units can be: minutes
, hours
, days
, weeks
.
Date of last reply is less than 12 days ago or undefined (user has never replied):
{
"type": "daysless_or_unknown",
"property_name": "$last_reply",
"value": {
"value": 12,
"unit": "days"
}
}
unit
field contains measures(units) of value
.
Units can be: minutes
, hours
, days
, weeks
.
Custom property apps
contains MyTestSite
item
{
"type": "lcontains",
"property_name": "apps",
"value": {
"value": "MyTestSite"
}
}
Name contains any value and email contains "gmail.com":
{
"type": "and",
"filters": [
{
"property_name": "$name",
"type": "known",
"value": {}
},
{
"property_name": "$email",
"type": "str_contains",
"value": {"value": "gmail.com"}
}
]
}
Number of sessions is more than 20 or last reply is less than an hour ago:
{
"type": "or",
"filters": [
{
"property_name": "$sessions",
"type": "gt",
"value": {"value": 20}
},
{
"property_name": "$last_reply",
"type": "daysless",
"value": {"value": 1, "unit": "hours"}
}
]
}