There are times when you may want to be a little smarter in your use of match phrases and search the incoming message for a combination of phrases/words.
Conducttr provides for three "logical operators" that can be used within the match phrase field:
- && - the double ampersand performs an AND operation on two words or phrases between parentheses. For example "Professor Plum && Lead Pipe" would match true on the phrase "it was professor plum in the study with the lead pipe". Notably it would also match true is the phrases were reversed such as "the lead pipe was used by Professor Plum".
- || - the double pipes performs an OR operation on two words. For example "center || centre".
- ! – the exclamation mark is used to mean NOT. For example, if the message trigger were to fire on an email that did not mention the word “please” then the matchphrase would be “!please”
- ( ) – parenthesis are used to group matchphrases to create more complex matches.
For example, consider this matchphrase:
(rob || Robert) && (is a vegetarian || is vegetarian || is veggie || is vegan || is a vegan)
A message trigger with this matchphrase would fire on “Robert is a veggie” and on “Rob is a vegan” and so on. Of course there can be complications if someone were to say “Robert doesn’t eat meat”. This could be written as:
(rob || Robert) && (doesn’t eat || does not eat || never eats) && (fish || meat)
We could test for the sentiment that Rob isn’t a vegetarian with the phrase:
(rob || robert) && (meat || fish) && eats && !(doesn’t eat || does not eat || never eats) && eats
The above phrase looks of any mention of Rob or Robert and meat or fish and eats but excludes any that says doesn’t or does not eat.