Connected audience object
A connected audience object is a selector that identifies the audience to send the message to.
This object is composed of either a single connected audience filter or several connected audience filters in a logical expression using either AND
or OR
operators.
Multiple filter example:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
{
"AND":
[
Connected Audience Filter,
{
"OR" :
[
Connected Audience Filter,
Connected Audience Filter
]
},
Connected Audience Filter
]
}
Connected audience filters
Combining multiple custom attribute filters will create a connected audience filter, which will create a connected audience filter when combined with AND
and OR
operators.
Custom attribute filter
This filter allows you to segment based on a user’s custom attribute. These filters contain up to three fields:
1
2
3
4
5
6
7
8
{
"custom_attribute":
{
"custom_attribute_name": (String) the name of the custom attribute to filter on,
"comparison": (String) one of the allowed comparisons to make against the provided value,
"value": (String, Numeric, Boolean) the value to be compared using the provided comparison
}
}
Allowed comparisons by data type
The custom attribute’s data type determines the comparisons that are valid for a given filter.
Custom Attribute Type | Allowed Comparisons |
---|---|
String | equals , not_equal , matches_regex , does_not_match_regex , exists , does_not_exist |
Array | includes_value , does_not_include_value , exists , does_not_exist |
Numeric | equals , not_equal , greater_than , greater_than_or_equal_to , less_than , less_than_or_equal_to , exists , does_not_exist |
Boolean | equals , does_not_equal , exists , does_not_exist |
Time | less_than_x_days_ago , greater_than_x_days_ago , less_than_x_days_in_the_future , greater_than_x_days_in_the_future , after , before , exists , does_not_exist |
Attribute comparison caveats
Comparison | Additional considerations |
---|---|
value |
The value is not required when using the exists or does_not_exist comparisons. value must be an ISO 8601 datetime string when using the before and after comparisons. |
matches_regex |
When using the matches_regex comparison, the value passed must be a string. To read more about using regular expressions with Braze, refer to Regular expressions and Custom attribute data types. |
Custom attribute example
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
{
"custom_attribute":
{
"custom_attribute_name": "eye_color",
"comparison": "equals",
"value": "blue"
}
}
{
"custom_attribute":
{
"custom_attribute_name": "favorite_foods",
"comparison": "includes_value",
"value": "pizza"
}
}
{
"custom_attribute":
{
"custom_attribute_name": "last_purchase_time",
"comparison": "less_than_x_days_ago",
"value": 2
}
}
Push subscription filter
This filter allows you to segment based on a user’s push subscription status.
Filter body
1
2
3
4
5
6
7
{
"push_subscription_status":
{
"comparison": (String) one of the following allowed comparisons,
"value": (String) one of the following allowed values
}
}
- Allowed comparisons:
is
,is_not
- Allowed values:
opted_in
,subscribed
,unsubscribed
Email subscription filter
This filter allows you to segment based on a user’s email subscription status.
Filter body
1
2
3
4
5
6
7
{
"email_subscription_status":
{
"comparison": (String) one of the following allowed comparisons,
"value": (String) one of the following allowed values
}
}
- Allowed comparisons:
is
,is_not
- Allowed values:
opted_in
,subscribed
,unsubscribed
Last used app filter
This filter allows you to segment based on when was the last time the user used the App. These filters contain two fields:
Filter body
1
2
3
4
5
6
7
{
"last_used_app":
{
"comparison": (String) one of the allowed comparisons listed,
"value": (String) the value to be compared using the provided comparison
}
}
- Allowed comparisons:
after
,before
- Allowed values: datetime (ISO 8601 string)