This article describes how multiple actions in a custom bot can work together to meet a single goal. It covers:
- collecting information from end-users
- defining informational subtypes
- creating branching rules
- setting up bot steps
- reusing a bot step instead of recreating it
THE SCENARIO
Suppose that a regional law requires your support organization to interact differently with adults and minors.
1. You could configure and save a Get Information from User step that:
- prompts your end-user to state their age.
- accepts no other response type than a number.
- is skippable.
You would then observe that Visual Bot Builder represents the new step as a card with two branches — Number and Skip.
The Number branch shows an option to set up branching rules.
(A branching rule is sort of a sub‑branch.)
2. You could configure and save three branching rules — allowing for the existence of people whose age is:
- less than 18.
- equal to 18.
- greater than 18.
You might even accommodate end-users who decline to state their age.
You would then observe that your Get Information from User step has gained logic to recognize when numbers differ in their implications and effects.
In Visual Bot Builder, the step card looks different.
BEFORE:
AFTER:
Notice also that the Number branch from this step no longer shows any button. Its absence indicates that branching rules are already defined.
The buttons that remain on your step card are:
- Link to Existing Step () — Sometimes, it's best that branching logic flows to a bot step that is already present. Rather than waste the time to recreate the step exactly, you simply point to it. This approach, called linking, is useful whenever your bot should use one of its configured steps more than once.
3. On the Get Information from User card, you could create and save a bot step that branches sensibly for minors.
a. To the right of the < 18 notation, click Add New Step ().
b. Choose the step type, and then configure it.
You would then observe that the new step runs only for minors.
4. You could, on the Get Information from User card, create and save a bot step that branches sensibly for ADULTS.
a. To the right of the = 18 notation, click Add New Step ().
b. Choose the step type, and then configure it.
You would then observe that the new step runs only for adults whose age is exactly 18.
REVIEW
In step 2, you defined branching rules for three different kinds of numbers that people might enter when asked for their age.
- Your first branching rule allowed for a population that is younger than 18.
Later, in step 3, you configured the first thing that should happen after you learn that someone is a minor. - Your second branching rule allowed for a population that is exactly 18.
Later, in step 4, you configured the first thing that should happen after you learn that someone is an adult. - Finally, your third branching rule allowed for a population that is older than 18.
However, you have not yet configured anything to happen after you learn that someone is part of this third population.
In this hypothetical, the most efficient logic would always branch in one direction for adults and another direction for minors.
So, to maximize efficiency for sorting three populations into two categories, you'd want to use your "adult" bot step twice.
5. You could, on the Get Information from User card, repurpose the bot step that you created in step 4. It should apply not only to adults who are exactly 18, but also to adults who are older than 18.
a. To the right of the > 18 notation, click Link to Existing Step (). A shortcut menu opens, citing only the steps that are already created and configured for the current bot.
b. From the shortcut menu, choose the step to reuse.
c. To save your work and close the sidebar, click DONE.
You would then observe that the bot step you created for adults now runs for adults of every age.
Finally, you'd finish building out and saving your workflows for adults and minors.