To monitor for new messages being added, head to the messages section of your Slack team’s dashboard. Then select the “New Rule” button in the top right, highlighted in red below.
Once you select “New Rule”, you should see a screen like this:
Here’s what each section does:
- Title - The title of the pattern that displays in the dashboard and in Slack
- Enable Pattern - Allows you to disable the pattern if you want to temporarily disable it
- Pattern Type - How the pattern should apply to messages
- Pattern - The pattern used to scan messages
- Channels - Allows you to select what channels the pattern applies to
The most important parts here are the “Pattern Type” and the “Pattern”. There are three different pattern types:
- Exact match: Matches the pattern exactly (case-sensitive) to the message
- Case-Insensitive match: Matches the pattern (case-insensitive) to the message and can be used with a comma-separated list
- Regex: Matches the pattern as a regex pattern against the message
Generally for a simple matching pattern such as finding usage of specific words, a case-insensitive match works pretty well. As an example, take a look at the default “Profanity” pattern which uses a case-insensitive list of swear words.
Otherwise, if you need more control over your messages, take a look at the regex pattern. Regex or regular expressions is a language used to match parts out of a string. An example of this is the “Credit Cards” or “Passwords” default rules which use a regex string. If you’d like to try building your own regex pattern, try out Regex101 and select Python to test your own patterns.
If you need help getting your pattern to work or have any questions, feel free to contact support and we can help you out.