Sometimes, you might only want a user to go to a particular message if they have responded in a particular way. This is what connection rules are for.
Connection rules help determine the flow of messages delivered to end-users in the bot UI. By applying rules, builders can create multiple bot flows and tailor the kind of information collected and shared with users.
Simple logic
Create a connection
To create a connection rule, first create a message connection. Once the messages are connected, open the Edit connection tab.
Flowchart
To do this in Flowchart, click the gear button located between the messages.
[Image: Two messages connected in Flowchart]
List view
In List view, click the purple connection text at the top or bottom of the message (in the below image, either the messages called ‘Name’ or ‘Company details’).
[Image: a message connection as displayed in List view]
Create a rule
To create a connection rule, follow these steps.
-
- Click Add rule in the Edit connection sidebar.
- Here you can input
- The variable
- (i.e. the relevant message name)
- The operation
- (i.e. [is], [is not], [contains], [does not contain], etc.)
- Learn more about operations.
- The value
- (i.e. the required end-user response)
- The variable
- Once complete, click anywhere in the window. The rule will automatically save.
- Repeat this process until
- All necessary rules are added to this connection, and
- Learn about creating several rules below.
-
All other connected messages feature the necessary rules.
- Learn about creating multiple connection rules below.
- All necessary rules are added to this connection, and
[Image: Rule setup where "3. Personal details" [is] "Yes"]
Example
Say you wanted to collect someone’s personal details, such as their name. You might want to first ask whether they are happy to provide those details.
The first message named "Personal details" might say, “Are you happy to provide us with your personal details?”. And the second message would read: “What is your full name?”.
But, you only want the second message to appear if the user responded “Yes” to the first message. How do you make that happen?
To create this rule, you'd need to click Add rule in the Edit connection sidebar and input the following into the rule fields:
-
Variable: Personal details
- (i.e. the message name)
- Operation: Is
-
Value: Yes
- (i.e. the user's response)
Once created, you'd then need to apply the opposite rule to the separate connection if the user responds "No". The contents of this rule would be:
- Variable: Personal details
- Operation: Is
- Value: No
Create several rules
In some cases, multiple things must be true in order for a user to reach a particular message (e.g. they must live in the state of California and be over 21 years of age).
To accommodate this, builders can apply several rules to the same connection.
To do this, select the relevant connection in either Flowchart or List view and apply the rules as above.
- Hint: In some cases, this may involve creating rule groups. To learn how, jump to this section.
Notice the Any/All toggle at the top left of the Edit connection sidebar? This determines whether any or all of the rules need to be true in order for the user to flow to the connected message. Apply it accordingly.
To learn more about this feature, jump to this section.
What makes a rule
Alongside variables, all rules contain operations and, as mentioned, if connections contain multiple rules, you'll need to apply the Any/All toggle accordingly.
Here's a quick guide on which operations can be used in conjunction with each response type and how to apply the Any/All toggle.
Operations
The kinds of operations available will vary according to whether a response type:
- Supports alphabetical, numerical & symbol characters,
- (i.e. the text-based response types)
- Whether users can only input numerical characters, or
- (i.e. the number-based response types),
- If the user can only respond with a date.
- (i.e. the Date response type)
Below is a list of all the operations available according to each message response type.
[Image: The operation [is] selected in the Operation dropdown]
Response type
Text-based (e.g. text, single choice, multiple choice, API request, etc.)
Available operations
- is
- is not
- contains
- does not contain
- starts with
- ends with
Response type
Number-based (e.g. number, currency, percentage, duration, etc.)
Available operations
- is
- is not
- is greater than
- is less than
- is greater than or equal
- is less than or equal
Response type
Date
Available operations
- is
- is not
- is before
- is after
Note: By default, all rules start out with the operation [is]. Consider if this is the correct operation for your rule(s) each time you're building out your bot logic. It may be that the rule requires the "contains"/"does not contain" variant, for example.
-
Hint: The "contains"/"does not contain" operations are particularly suited to messages containing multiple-choice responses rather than single-choice responses.
- For example, if a user selects more than one answer, then any rule which uses “is”/”is not” is unlikely to work because their answer contains more than just that answer. That’s where “contains”/”does not contain” comes into play, because even if there are other answers, it won’t invalidate it. For the same reason, "contains" may also prove useful when building looping logic.
Any/All toggle
The All/Any toggle can be found at the top of the Edit connection sidebar when a connection contains several rules. Knowing how it works is vital as the toggle can determine how those several rules interact with one another.
When toggled to Any, any of the connection rules can be satisfied in order to allow the end-user to proceed to the relevant next message.
When toggled to All, all of the rules in a given message connection need to be met in order to proceed to the relevant message.
Consider it similar to using “And” or “Or” in a Boolean search when doing legal research.
[GIF: Any/All toggle switched to All]
Example
To return to the example above, if the builder switches the toggle to Any, then an end-user can either live in California or be over 21 years of age in order to proceed to the relevant message. However, if the toggle is switched to All, the user must meet both criteria. They must live in California and be over 21 years of age.
Complex logic
Bot logic can get complex pretty quickly. Here we'll cover how and when to create
Multiple connection rules
When multiple connections flow from a single message, rules need to be applied to each connection to ensure the bot flows as expected.
A simple example would be a "Yes" / "No" question. If a user responds "Yes", a rule would need to be applied to the connection that links the message to the relevant bot flow.
Similarly, if they respond "No", the relevant messages would need to be connected and given rules to ensure the end-user is directed to the relevant subsequent messages.
[Image: Two connected messages linked to "2. Personal details", each with rules applied]
Rule groups
In addition to several standalone rules, builders can also create rule groups.
Functioning much like brackets in algebra, rule groups allow builders to create more complex bot logic which makes for more flexible and powerful bots. To see rule groups in action, watch the explainer video below. Alternatively, learn more.
Waterfall logic
Waterfall logic is a form of bot logic that allows bots to ask users for multiple pieces of information at once, and then use those responses to determine multiple successive message flows (i.e. follow-up questions).
For example, imagine you’re at a restaurant and you order steak AND fries. The waiter might ask you two questions following your initial order:
- “How do you like your steak?”
- “And would you like large or small fries?”
This might sound simple, but when building a bot it requires a little work. In a bot, it looks like this (spoiler: in Flowchart, the messages display much like a waterfall).
- First, an end user is asked to respond to a selection of options (i.e. multiple choice); and, after selecting one or more of those options,
- The end user is then prompted to proceed down different paths one after the other, following up on some or all of the options selected.
Want to test it out? Watch this short explainer to learn more.
Example
Common use cases include the retrieval of personal details. For example, in a message concerning a contract agreement signee, a bot could ask, "What details are you able to provide today?"
The multiple-choice responses could include their
- Name
- Phone number
- Address
If the user can only provide the name and email of the signee and responds as such, the bot can then display the relevant follow-up questions, e.g. "What is their name?" and "What is their email?".
While both the phone number and address messages are built into the logic, they won't surface since the user cannot provide them at this time. But if they could, they would!
Setup
First, you'll need to create the bot flow that'll display certain messages (in succession) depending on the user's response(s).
This will require
- A collection of connected messages, and
- The necessary rules applied to each.
Once set up, your bot will be retrieving multiple pieces of information at once and your end-users will be saving even more time than before. Follow-up questions made easy!
–
Got a question? Contact us at support@joseflegal.com.