Buttondown's filtering schema can be used for multiple things:
Filters are fractal; they can be nested in groups, and groups can be nested in other groups. This is accomplished through a tree-like structure. Every "FilterGroup" has a "predicate" field, which is either "and" or "or", which determines how the filters and groups within the group are combined, a "groups" field, which is a list of "FilterGroup" objects (that's that recursive bit!), and a "filters" field, which are the leaf-level filters themselves.
Let's say you want a simple filter: all subscribers who have a tag called "executive". You can do that like this:
{
"filters": [{"field": "subscriber.tags", "operator": "contains", "value": "executive"}],
"groups": [],
"predicate": "and"
}
Now, let's say you want to filter for subscribers who have a tag called "executive" and a tag called "general-electric". You can do that like this:
{
"filters": [{"field": "subscriber.tags", "operator": "contains", "value": "executive"}, {"field": "subscriber.tags", "operator": "contains", "value": "general-electric"}],
"groups": [],
"predicate": "and"
}
If you wanted to change that and to an or, you can do that like this:
{
"filters": [{"field": "subscriber.tags", "operator": "contains", "value": "executive"}, {"field": "subscriber.tags", "operator": "contains", "value": "general-electric"}],
"groups": [],
"predicate": "or"
}
Now, let's say you want to filter for subscribers who have a tag called "executive" or a tag called "general-electric" and a tag called "admin". This is where the whole nested thing comes in handy. You can do that like this:
{
"filters": [{"field": "subscriber.tags", "operator": "contains", "value": "executive"}],
"groups": [
{
"filters": [{"field": "subscriber.tags", "operator": "contains", "value": "admin"}, {"field": "subscriber.tags", "operator": "contains", "value": "general-electric"}],
"groups": [],
"predicate": "and"
}
],
"predicate": "or"
}
You can read more about the specific filter construction in the Filter documentation.
The leaf-level filters to apply to the audience.
The nested groups to apply to the audience.
The logical operator to use when combining filters (either 'and' or 'or').
Buttondown's filtering schema can be used for multiple things:
Filters are fractal; they can be nested in groups, and groups can be nested in other groups. This is accomplished through a tree-like structure. Every "FilterGroup" has a "predicate" field, which is either "and" or "or", which determines how the filters and groups within the group are combined, a "groups" field, which is a list of "FilterGroup" objects (that's that recursive bit!), and a "filters" field, which are the leaf-level filters themselves.
Let's say you want a simple filter: all subscribers who have a tag called "executive". You can do that like this:
{
"filters": [{"field": "subscriber.tags", "operator": "contains", "value": "executive"}],
"groups": [],
"predicate": "and"
}
Now, let's say you want to filter for subscribers who have a tag called "executive" and a tag called "general-electric". You can do that like this:
{
"filters": [{"field": "subscriber.tags", "operator": "contains", "value": "executive"}, {"field": "subscriber.tags", "operator": "contains", "value": "general-electric"}],
"groups": [],
"predicate": "and"
}
If you wanted to change that and to an or, you can do that like this:
{
"filters": [{"field": "subscriber.tags", "operator": "contains", "value": "executive"}, {"field": "subscriber.tags", "operator": "contains", "value": "general-electric"}],
"groups": [],
"predicate": "or"
}
Now, let's say you want to filter for subscribers who have a tag called "executive" or a tag called "general-electric" and a tag called "admin". This is where the whole nested thing comes in handy. You can do that like this:
{
"filters": [{"field": "subscriber.tags", "operator": "contains", "value": "executive"}],
"groups": [
{
"filters": [{"field": "subscriber.tags", "operator": "contains", "value": "admin"}, {"field": "subscriber.tags", "operator": "contains", "value": "general-electric"}],
"groups": [],
"predicate": "and"
}
],
"predicate": "or"
}
You can read more about the specific filter construction in the Filter documentation.
The leaf-level filters to apply to the audience.
The nested groups to apply to the audience.
The logical operator to use when combining filters (either 'and' or 'or').