Loading...
Skip to main content

Audience Operators

Audience operators are used to match a user's profile against a set of criteria. Courier supports the following operators:

Equality & Inequality

EQ

Checks if a specified attribute is equal to a given value.

{
"operator": "EQ",
"value": "Oakland",
"path": "location.city"
}

NEQ

Checks if a specified attribute is not equal to a given value.

{
"operator": "NEQ",
"value": "sonicpigeons.com",
"path": "company"
}

String Comparison

STARTS_WITH

Checks if a specified attribute starts with a given value.

{
"operator": "STARTS_WITH",
"value": "pigeons",
"path": "email"
}

ENDS_WITH

Checks if a specified attribute ends with a given value.

{
"operator": "ENDS_WITH",
"value": "sonicpigeons.com",
"path": "email"
}

INCLUDES

Checks if a specific attribute in the user's profile includes any of the specified values.

{
"operator": "INCLUDES",
"value": ["push", "email"],
"path": "favorite_notification_channel"
}

OMIT

Checks if a specified attribute is not included in the user's profile.

{
"operator": "OMIT",
"value": "email",
"path": "favorite_notification_channel"
}

Numeric Comparison

GT

Checks if a specific numeric attribute in the user's profile is greater than a specified value.

{
"operator": "GT",
"value": "100",
"path": "foss_ball_victories"
}

GTE

Checks if a specific numeric attribute in the user's profile is greater than or equal to a specified value.

{
"operator": "GTE",
"value": "99",
"path": "foss_ball_victories"
}

LT

Checks if a specific numeric attribute in the user's profile is less than a specified value.

{
"operator": "LT",
"value": "100",
"path": "foss_ball_victories"
}

LTE

Checks if a specific numeric attribute in the user's profile is less than or equal to a specified value.

{
"operator": "LTE",
"value": "99",
"path": "foss_ball_victories"
}

Date Comparison

IS_BEFORE

Checks if a specified date attribute is before a given date. The date should be in ISO 8601 format.

{
"operator": "IS_BEFORE",
"value": "1990-01-01",
"path": "date_of_birth"
}

IS_AFTER

Checks if a specified date attribute is after a given date. The date should be in ISO 8601 format.

{
"operator": "IS_AFTER",
"value": "1990-01-01",
"path": "date_of_birth"
}

Existence

EXISTS

Checks if a specific attribute exists in the user's profile.

{
"operator": "EXISTS",
"value": "true", // false if you want to check for the absence of the attribute
"path": "email"
}

Special Operators

MEMBER_OF

Checks if the user is a member of the tenant specified in the path.

{
"operator": "MEMBER_OF",
"value": "acme",
"path": "account_id"
}
caution

All operators are case-sensitive.

Nested Operator Examples

Here are some examples demonstrating how to use nested operators for more complex audience targeting:

Combining AND and OR Operators

Scenario: Notify Software Engineers in San Francisco or Oakland

{
"operator": "AND",
"filters": [
{
"operator": "EQ",
"path": "title",
"value": "Software Engineer"
},
{
"operator": "OR",
"filters": [
{
"operator": "EQ",
"path": "location.city",
"value": "Oakland"
},
{
"operator": "EQ",
"path": "location.city",
"value": "San Francisco"
}
]
}
]
}

Combining Equality and Inclusion Checks

Scenario: Notify Software Engineers who like TypeScript

{
"operator": "AND",
"filters": [
{
"operator": "EQ",
"path": "title",
"value": "Software Engineer"
},
{
"operator": "INCLUDES",
"path": "favorite_programming_languages",
"value": "Typescript"
}
]
}