This website contains affiliate links. See the disclosure page for more details.
Originally published: May 2017 Updated: July 2020
There are some situations where you shouldn’t use followup intents, because it will not work.
The while loop
There was a chatbot called the Florist bot that was originally used as an example bot in the Dialogflow documentation (when it was still called API.AI).
This is what the flowchart of the Florist bot looked like.
In the figure below, the area marked in red is actually a while loop. In theory, the user can just keep indefinitely adding red roses into the bouquet and never say “No, thanks” and exit the loop. This is the “while loop” in software terminology.
It is not possible to use followup intents for this conversation flow, since you wouldn’t know how many levels deep you need to go.
The Split and Merge pattern
Another common conversation flow pattern is the split and merge pattern.
The flowchart for a Quiz bot would follow a split and merge pattern and would look a little like this:
Note that at various points the conversation splits, and then merges back.
Note: My usual convention for representing flowcharts is different from the image above, and I am using it for illustration purposes.
You can in theory use followup intents for the split-and-merge pattern, but you would be duplicating a lot of intents. And the longer your conversation (for e.g. more questions in the Quiz bot above), the more duplication you will have in your follow-up intents.
Graph Theory notation
This section is somewhat advanced, but I am hoping the figures will illustrate what I am talking about.
There is the regular directed tree. To go from any node A (represented by a circle) to any other node B, there is exactly one path. If your flow structure looks like this, followup intents are a good choice.
Directed Acyclic Graph
If you have a directed acyclic graph, you potentially have a split-and-merge pattern. In the directed acyclic graph below, it is possible to go from node a to node d via two different paths. You can go a->b->d or a->c->d. But you cannot follow the arrows and go back to the same node where you started.
If your flow structure has split-and-merge patterns like the directed acyclic graph, you will end up creating a lot of duplicate intents.
Directed graph with cycle
In the graph below, you can start at node a, go along edge 1 to node b, then along edge 2 to node c, and then along edge 3 and go back to node a. This is a “cycle” in graph notation. If your conversation flows like this, you have a while loop in your flowchart.
If your flow structure looks like a directed graph with a cycle, you cannot use followup intents.
You might believe that you won’t have split-and-merge patterns and it is safe to use followup intents. Sometimes this is true, but sometimes you might be surprised down the line. So unless you are also fairly confident your conversation flow will not change much down the line, I would recommend avoiding followup intents and instead using input and output contexts to simulate them.
The recently released Zoho SalesIQ v2 allows non-programmers to build chatbots using an easy-to-use code less bot builder. What is really unique about Zoho SalesIQ is the fact that you can also integrate AI into their code less bot builder. In my Zoho SalesIQ chatbots course, I explain how to use Zoho SalesIQ to add a chatbot to your website.
"The magic key I needed as a non-programmer" The custom payload generator was the magic key I needed (as a non-programmer) to build a good demo with rich responses in DialogFlow Messenger. I've only used it for 30 minutes and am thrilled. I've spent hours trying to figure out some of the intricacies of DialogFlow on my own. Over and over, I kept coming back to Aravind's tutorials available on-line. I trust the other functionalities I learn to use in the app will save me additional time and heartburn. - Kathleen R Cofounder, gathrHealth