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:

  • ENDS_WITH (ends with)
{
"operator": "ENDS_WITH",
"value": "sonicpigeons.com",
"path": "email"
}
  • EQ (equal to)
{
"operator": "EQ",
"value": "Oakland",
"path": "location.city"
}
  • EXISTS (check any specific attributes (e.g. email, phone number, etc.) exists in the user's profile)
{
"operator": "EXISTS",
"value": "true", // false if you want to check for the absence of the attribute
"path": "email"
}
  • GT (checks any specific numeric attribute in user's profile is greater than specified value)
{
"operator": "GT",
"value": "100",
"path": "foss_ball_victories"
}
  • GTE (checks any specific numeric attribute in user's profile is greater than or equal to specified value)
{
"operator": "GTE",
"value": "99",
"path": "foss_ball_victories"
}
  • INCLUDES (checks if user's profile specific attribute includes any of the specified values, e.g. favorite_notification channel includes push)
{
"operator": "INCLUDES",
"value": ["push", "email"],
"path": "favorite_notification_channel"
}
  • IS_AFTER (checks if specified date attribute is after given date, e.g. date of birth is after 1990-01-01) the date should be in ISO 8601 format)
{
"operator": "IS_AFTER",
"value": "1990-01-01",
"path": "date_of_birth"
}
  • IS_BEFORE (checks if specified date attribute is before given date, e.g. date of birth is before 1990-01-01) the date should be in ISO 8601 format)
{
"operator": "IS_BEFORE",
"value": "1990-01-01",
"path": "date_of_birth"
}
  • LT (checks any specific numeric attribute in user's profile is less than specified value)
{
"operator": "LT",
"value": "100",
"path": "foss_ball_victories"
}
  • LTE (checks any specific numeric attribute in user's profile is less than equal to than specified value)
{
"operator": "LTE",
"value": "99",
"path": "foss_ball_victories"
}
  • NEQ (checks if specified attribute is not equal to given value. e.g. company is not equal to "sonicpigeons.com")
{
"operator": "NEQ",
"value": "sonicpigeons.com",
"path": "company"
}
  • MEMBER_OF (Check's to see if the user is a member of the supplied path. Currently only supported in send. For now, the only supported path is account_id. Example, check to see if the user is a member of the account "acme" )
{
"operator": "MEMBER_OF",
"value": "acme",
"path": "account_id"
}
  • OMIT (checks if specified attribute is not included in user's profile, e.g. if user's favorite_notification_channel does not include email)
{
"operator": "OMIT",
"value": "email",
"path": "favorite_notification_channel"
}
  • STARTS_WITH (checks if specified attribute starts with given value, e.g. email starts with "pigeons")
{
"operator": "STARTS_WITH",
"value": "pigeons",
"path": "email"
}

These operators are case-sensitive. If a user is created with Courier's profile the user's profile looks like this:

{
"profile": {
"title": "Software Engineer",
"email": "suhas@courier.com",
"phone_number": "1234567890",
"location": {
"city": "San Francisco",
"state": "CA",
"country": "US"
},
"favorite_programming_languages": ["Go", "Typescript"]
}
}

Now let's consider following use cases and see how we can use them:

1. You want to notify a subset of users who are from San Francisco.​

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

2. You want to notify a subset of users who are Software Engineer and they either live 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"
}
]
}
]
}

3. You want to notify a set of users who with title Software Engineer and they have listed Typescript as one of their favorite programming languages.

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