Conditions allow you to perform an action only for certain messages, like messages from a particular sender, or messages that start with a particular keyword.
A simple condition has the following form:
For example, if you wanted to match messages that start with the keyword "join", then the variable would be [[word1]], and the value would be join:
Telerivet also makes it easy to build complex conditions that compare multiple variables and values, and that use different types of comparisons.
Variables and Values
When you add a new condition, it initially looks like this:
Click (select variable) to see what variables are available, and choose a variable:
(Variables are explained in more detail in the Using Variables article.)
Next, enter the value to compare in the box on the right-hand side. If necessary, you can also insert variables on the right-hand side.
The comparison type defines how Telerivet compares the variable on the left to the value on the right.
You can change the comparison type by clicking the word is:
There are three main types of comparisons that can be used in an if/then condition:
- Text comparisons allow you to test if the variable starts with, ends with, or contains a particular string of text. The default comparison, is, simply tests if the variable on the left has the same text as the value on the right (ignoring differences between uppercase and lowercase).
- Numeric comparisons, such as less than, greater than, or equal, can be used when the variable has a numeric value.
- Group membership comparisons can be used to test if the contact who sent the message is a member of a particular group.
If you want to add another comparison to your if/then condition, click the or... or and... link.
- When using or, the if/then condition will match if any one of the comparisons match.
- When using and, the if/then condition will only match if all of the comparisons match.
For text comparisons, clicking "Advanced match..." (in the dropdown menu below the the text field) enables you to create more complex text comparisons. With advanced matching, you can search for certain types of characters, such as digits or letters.
Suppose you want to create synonyms for a keyword that allows people to subscribe to a group.
You can click or... to easily add synonyms such as "subscribe", "join", or equivalent words in your own language:
Suppose you want to test if the message contains a dollar sign followed by a numeric amount, for example $12 or $999.
You can select the contains comparison type and click Advanced match.. , then construct a condition as shown below:
Suppose you are a small business and you want to allow your employees to access the shift schedule by texting the word "schedule". However, you only want this information to be available to your employees.
You can add your employees' phone numbers to a group named Employees, and use and... to construct an if/then condition as shown below: