Advanced filters

Sometimes, literal pattern matching on its own is not precise enough. If the pattern you're searching for is not unique to your product or company, you're bound to receive notifications you're not interested in. Badour offers a way to filter out these matches before they reach you. You can filter on site, author and more.

Note that filters are only applied after a match for the keyword's pattern is found first. If the matched item then also passes through the filter, a notification is sent. If it does not pass through the tilfer, the match is dropped. Only matches that pass through the filter are counted towards your quota.

Filters are written in a subset of the gval expression language. At the bottom of this page, you'll find a reference for the supported syntax and the fields that are available to be used in expressions.

Example 1

If you'd like to be notified when someone mentions your open source project (let's take Aegis as an example), but don't want to be notified when it's mentioned in an issue or pull request in the project repository on GitHub, you can express this as follows:

site != "github" || sub_site != "beemdevelopment/Aegis"

This'll make sure that any non-GitHub matches are let through, and if the match did originate from GitHub, that the repository is not "beemdevelopment/Aegis".

Example 2

You can make these filters as complex as you'd like. If you're only interested in comments on the /r/androiddev or /r/androidapps subreddits, you can express that as follows:

type == "comment" && field == "body" && site == "reddit" && sub_site in ["androiddev", "androidapps"]

Syntax

The following parameters are available:

site Which website this item comes from. Possible values: reddit hn lobsters stackexchange github
sub_site If the item comes from Reddit, the value will be the subreddit name (without /r/ prefix). For StackExchange, the value will be the sub site name (example: 'stackoverflow'). For GitHub, the value will be the repository name (example: 'golang/go'). In all other cases, this is set to nil. Note: case-sensitive
type The type of item. Possible values: post comment issue pr
author The username of the author
field The field that the keyword was found in. Possible values: body title url
url The URL that links to this item

A subset of the gval expression language syntax is supported:

  • Modifiers: + - / * ** %
  • Comparators: > >= < <= == !=
  • Logical operators: || &&
  • Numeric constants 123 12345.678
  • String constants "foobar" (double quotes required)
  • Boolean constants: true false
  • Parentheses to control order of evaluation ( )
  • Arrays : ["foo", "bar"]
  • Objects : {"a":1, "b":2}
  • Prefixes: ! -
  • Ternary conditional: ? :

Note: All string operations are case-sensitive.