Forum Discussion
How to Use the standard user attribute in the Connected audience object filter
- 2 months ago
🤦♀️ I think I misinterpreted the docs! Sorry about that, st-haingo The correct approach for filtering based on standard user attributes in the Braze API is indeed to use custom_attribute, and I appreciate your patience.
To clarify, the correct structure for your audience filter when using standard user attributes should look like this:
{ "custom_attribute": { "custom_attribute_name": "country", "comparison": "equals", "value": "VN" } }
So this means that in your API request body for scheduling a message, you should structure it like this:
{ "messages": { "apple_push": { "alert": { "title": "良い一日を!", "body": "I hope 2024 is going to be a better year for this world 12" }, "message_variation_id": "" } }, "campaign_id": "", "schedule": { "time": "2024-11-20T00:50:00+0000" }, "audience": { "AND": [ { "custom_attribute": { "custom_attribute_name": "country", "comparison": "equals", "value": "VN" } } ] } }
If that still doesn't work let me know, or you can always get in touch with support. But I'm gonna tag in some other Braze experts here to validate me (I'm still really new at JSON!) -- DavidO or AllanHeo or Manoj__ any chance you can double check my work? 😅
🤦♀️ I think I misinterpreted the docs! Sorry about that, st-haingo The correct approach for filtering based on standard user attributes in the Braze API is indeed to use custom_attribute, and I appreciate your patience.
To clarify, the correct structure for your audience filter when using standard user attributes should look like this:
{
"custom_attribute": {
"custom_attribute_name": "country",
"comparison": "equals",
"value": "VN"
}
}
So this means that in your API request body for scheduling a message, you should structure it like this:
{
"messages": {
"apple_push": {
"alert": {
"title": "良い一日を!",
"body": "I hope 2024 is going to be a better year for this world 12"
},
"message_variation_id": ""
}
},
"campaign_id": "",
"schedule": {
"time": "2024-11-20T00:50:00+0000"
},
"audience": {
"AND": [
{
"custom_attribute": {
"custom_attribute_name": "country",
"comparison": "equals",
"value": "VN"
}
}
]
}
}
If that still doesn't work let me know, or you can always get in touch with support. But I'm gonna tag in some other Braze experts here to validate me (I'm still really new at JSON!) -- DavidO or AllanHeo or Manoj__ any chance you can double check my work? 😅
Hello eakinsey Your code is absolutely spot-on, and it looks like you’re a total pro!
st-haingo If you'd like to explore additional attributes, you can check out this Braze Postman sample here:
https://documenter.getpostman.com/view/4689407/SVYrsdsG?version=latest#25272fb8-bc39-41df-9a41-07ecfd76cb1d
Related Content
- 11 months ago
- 9 months ago
- 5 days ago