Response rules evaluate the operand designated by the Split Action type. In the example below, we see that a Wait for Response action evaluates the incoming message, or the @input.text operand.
Response rules provide a series of tests that you can run against the selected operand.
For example, the "has only the phrase" response rule tests the operand for any of the words you designate. Response rules are executed from top to bottom–the first rule that matches takes effect and no other rules are evaluated after there is a match.
If the operand matches a response rule, the contact will pass through the category assigned to that rule. In the example above, the Wait for Response action is waiting for an incoming message, which it will evaluate against the response rules assigned to the OHIO, INDIANA and Other* categories.
*Note that a flow will always match at least one response rule in a Split Action as the last response rule must always be a catch-all (the "Other" rule).
Passage through categories is represented in the analytics tab as well as the flow editor. For example, the number of times a contact passed through the Yes or No categories of a Split Action that evaluates responses to yes or no questions.
Multiple response rules that share the same category name will be represented as one category within a Split Action from the view of the flow editor.
Response rules allow you to:
- Categorize multiple responses into one category. For example, if you are asking Contacts what their favorite type of soda is, you can create rules that allow Coke and Pepsi to be categorized as Cola.
- Change numeric responses to narrative responses, or vice versa. For example, if you ask your Contacts to rate their satisfaction with a service on a scale of 1 to 5, you can create a rule that allows the response 1 to be categorized as Poor, and 5 to be categorized as Excellent.
- Define an acceptable range for a numerical answer.
- Direct unexpected responses to an Other category. For example, if you are asking your contacts for their gender and receive the response Cat, this answer is categorized as Other.
- Translate responses so that affirmative answers such Yego (Kinyarwanda) or Si (Spanish) are categorized as Yes.
Special Response Rules
Has a phone number
You can use the "has a phone number" response rule to validate that the response includes something that looks like a valid phone number. The response itself will be saved as a fully qualified number. For example, if someone responds with 0788123123 the number will be saved as +250788123123. If a valid number isn't submitted you can follow-up asking contacts to respond again.
In some cases, like validating an ID number or coupon code, you may need a more complicated rule to determine if a response is valid. Regular expressions (regex) are a standard used to describe an acceptable submission format. A great resource for testing your regular expressions is Regex101, which allows you to test any of the responses you expect against a regular expression.
For example, say we are asking someone to enter a serial number for a device they are registering:
We know that valid serial numbers must begin with the letter "U" and be exactly nine digits, so we can match the serial numbers using a regular expression.
Note that regular expressions are case insensitive, so you do not need to put different options based on case.
Questions? Send us a message via the support widget in the bottom right corner.