Articles on: Flows

Response Rules

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.

How to Use Response Rules



Has any of the words - To match this rule, a contact can send any of multiple words. For example, if the contact responds witheither male, m, or man, you will use this rule to allow for any of these words to be a valid response.

Has all of the words - Here, a contact's response must contain all of the words in your response rule. If your rule is stomach ache, fever, chills, then the contact must send all of these words.

Has the phrase - If your response rule is a phrase like Los Angeles County DMV then the contact must send this exact phrase for the response to be valid.

Has only the phrase - similar to 'Has the phrase' but the response should have ONLY that specific phrase, not a message including the phrase as well as additional text.

Starts with - If the contact's response must start with a specific word, you can use this rule. For example, if the response must start with the word Alpha and not Beta.

Has some text - Use this rule to allow for any text response to be valid.

Has a number - When looking for any number in the response, use this rule.

Has a number between - Use this rule when you wish to only accept a number within a range. For example, a number between 1 and 10.

Has a number below - If the contact's response must be below a specific number, use this rule. For example, a number below 10, but not 10 itself.

Has a number at or below - Similar to 'has a number below', this rule asks for a number below a specific number, but includes the maximum. For example, a number below 10 and 10 itself.

Has a number equal to - If the contact's response must exactly match a specific number. For example, only the number 123 is valid.

Has a number above - The contact's response must have a number above the minimum specified number. For example, the response must be higher than 10, but not 10 itself.

Has a number at or above - Similar to 'has a number above', but the minimum number is allowed. For example, 10 or above including 10.

Has a date - The contact's response must include a date. This date must be in MM/DD/YYYY or DD/MM/YYYY format. You can set your workspace's date format. These settings affect features that require date & time values, such as campaigns, triggers that fire on a schedule and anything operating on date & time functions.

Has a date before - This rule allows you to only accept dates before a specified date. Anything after will not be valid.

Has a date equal to - If a date must exactly match only a single date, use this rule.

Has a date after - This rule will accept only a date after the specified date as valid.

Has a time - Any time will be accepted with this rule. Be sure to set your date & time formatting to ensure that and functions that operate around a date & time will operate properly.

Has an email - This rule will accept an email address. Responses that lack a domain such as @gmail.com will not be valid.


Examples



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.

Matches Regex



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.

Open-Ended Responses



What if you want to collect any response sent by the contact? You can do this by not setting any rule. This will create an 'All Responses' category. This is useful when collecting long-form for free text that do not need to match anything.



In the 'Wait for Response' node, we've not set any rule. This will allow us to save any response from the contact.



Questions? Send us a message via the support widget in the bottom right corner.

Updated on: 25/07/2023

Was this article helpful?

Share your feedback

Cancel

Thank you!