In this guide, I explain the benefits of using flowcharts for building your Dialogflow bots.
Do you need to create a flowchart for your Dialogflow bot?
Creating flowcharts can go a long way in helping you to clarify the bots you wish to develop.
Here is what one of my clients says about the flowcharting process:
Take the time to learn the workflow/concepts he presents in his flowcharting tutorial. (This workflow is far superior to the approach suggested in the official DialogFlow documentation.) Using Aravind’s flowcharting approach you’ll be amazed at how quickly a functional prototype can be put together. - Steven L
When you create a flowchart, you can sit down and think through your bot's behavior, and the additional rigor of the process will actually help you improve your bot's conversation flow.
Here are some case studies which show the value of first creating a flowchart for your Dialogflow bot. The examples here were all done when I was using XMind as my flowchart tool, but everything written below would work just the same in Mindomo. (see the section called "Choosing the right tool").
Using a flowchart during a coaching call to help client explain the bot design
During one of my coaching calls I had a client from Europe trying to design a chatbot in a non-English language. While I cannot go into too much detail, I can mention that they had a fairly complex flow and my client was struggling to put the design of the bot into words.
Since I realized that the process of explaining the design was actually taking a long time, I offered to draw out the flowchart on my machine (I was sharing the screen) and that we would walk through some sample conversations and use it to design the chatbot.
Since the flowchart conventions I use are quite close to how you would actually write out the conversation, this immediately made the whole design process go much faster.
Later, the client also commented that using the flowchart process also helped him translate the bot into his own language.
You might have heard of Google Duplex.
I tried to replicate its appointment scheduling behavior in a simple cloned bot I called the Simplex. 🙂
Initially, I didn't draw out a flowchart and decided to just jump in to Dialogflow and start building it. Since the flow is a little complex, I was having some difficulty designing the bot. So I went back to the "Drawing board" and started designing the flow in XMind.
I immediately noticed some subtle things I had missed. The nice thing is, if you take the time to specify the contexts into your flowchart, you can in some cases simply copy/paste the entire thing into Dialogflow and have a working chatbot.
Working chatbot from XMind flowchart
In what was possibly the best possible case study of the advantage of flowcharting, I completed a project sometime back where I helped a client from Europe design a bot for the Google Assistant.
Now what made this particularly interesting is that this client didn't feel very comfortable describing the bot during a Skype call as he was not sure about his ability to speak conversational English.
So he simply designed the entire flow in XMind, sent the file over to me, and I used it as a starting point to design the bot. After a few more back and forths over email, we had a bot which was designed to his specifications.
Choosing the right tool for Dialogflow flowcharts
In this section, I talk about the list of features a tool/service should provide so that you can create Dialogflow conversation flowcharts quickly and easily.
I will specifically review three tools for their suitability for this purpose: XMind, Mindomo and draw.io.
I recommend that you use a single node to capture/represent an entire intent. That means you should have both userSays and the bot's response inside the single node. It makes your flowchart a lot more readable.
Format different lines inside a single node with different styles
Let us say I add the intent name into the node in the flowchart above. It would be helpful if I have a way to visually distinguish the intent name from the rest of the text inside the box, by using bold, italics, colors etc.
Support different shapes for different nodes
I recommend using different shapes to signify/represent different things in your Dialogflow flowchart: rectangle is an intent, ellipse is a context, and a circle is the alias for an output context. This means the tool should provide a way to use different shapes for different flowchart nodes. This is quite a common feature nowadays, although I have seen some free mindmapping tools (desktop apps) which don't provide this feature.
Automatically reformat layout to org-tree structure
This is actually a really important feature. And unfortunately it is something which is missing in nearly all the tools I have reviewed. In fact, this was the single biggest reason why I originally selected XMind as my recommended tool.
It is pretty obvious that the layout should auto-reformat when you are creating conversation flowcharts, unless you want to spend all your time manually moving nodes around to fit a certain structure.
The org-tree structure is important (compared to the usual hub-and-spoke radial arrangement) because you want a visual depiction of the "flow" of the conversation. In other words, if you were to print the text inside a series of nodes in top to bottom order, you should actually produce a conversation transcript.
For example, if you were to do this for the flow diagram from section 1, you would get the following:
Support drill down into individual branches
When the mindmap gets larger, it would be very helpful to focus on specific branches of the "conversation tree" without being distracted by other branches. If the tool supported a drill-down feature, that would be very helpful.
Here is the before drill-down and after drill-down for the flowchart:
You can now focus completely on the flowchart for just the Python branch.
I recommend using node labels (which are outside the node boundary but attached to it) to simplify naming the nodes.
As you can see in the image above, it is easier to label (and name) the intent and the context in the image if the tool supports node labels.
Now, the other option is to add this "meta" information into the node itself (similar to how I named the intent in section 3). It is a little more clunky, but the lack of this feature is not a major problem.
Support adding notes to individual nodes
This is also a very important feature. Everything that you cannot capture within the individual node, should be captured in a note associated with that particular node.
drawIO: No (to the best of my knowledge)
This doesn't need an explanation. You want to be able to easily share your mindmap with others.
Mindomo: The PDF export option is paid. You can publish your map as a public map and share the link, but that is probably not something you would want to do. For private maps, you can also share links with specific email addresses, if the other users have Mindomo accounts.
XMind: Since XMind is a desktop app, you can only share the XMind file itself. If you update the map, you need to send it again. 🙁
drawIO: Similar to Mindomo since it is a web based tool.
Easy to collaborate
Depending on how many people are working on the project, this can be a nice-to-have or a need-to-have tool.
Obviously, it helps if the tool is a web based one and not a desktop app.
If you are the kind who also wants visually/aesthetically pleasing mind maps, this might matter to you.
drawIO: You need to work very hard to get it to look nice
Finally, we come to the important question of price.
Nothing can beat draw.io, because you can do everything for free. 🙂
But your time is not free (usually)! So unless you want to spend all your time manually reformatting nodes, you probably want to use the appropriate tool for the purpose.
Mindomo gives you three free maps, but some features (such as export to PDF) are not available until you upgrade to the paid service.
Here is Mindomo's pricing:
That's about $40 for 6 months.
Initially, I used to think the trial version of XMind was free. But apparently, it is not free for commercial use. If you are only learning, you can use the free version of XMind. But if you use it for creating a commercial bot, you need to pay for the tool.
The subscription version of XMind is $34 for 6 months (you can only see the price after you register, so you can check it out for yourself). You get a further discount if you go for the yearly plan (~$54 a year).
Note: Steven has pointed out in the comments that you can also buy XMind 8 desktop license for $129. This means you can make a one time payment and own the software forever, as long as you do all the work on the same machine. It can be used on up to 2 computers, according to their product description page.
If you just want to own a product and not worry about remembering all your monthly payment subscriptions, purchasing XMind 8 might be a good choice.
Mindomo is a bit more expensive than the subscription option for XMind, but the difference in price is quite small. Plus, Mindomo is probably the better option when you are working as a team as it is actually a web-based tool.
There are also other tools you can use for this purpose: FreeMind, MindNode, Visio, Coggle etc.
My suggestion is to turn this section into a checklist and see how many of these your chosen tool can support. Then ask yourself if you are willing to spend the time figuring out workarounds for the unsupported features. And also ask yourself how much your time itself is worth.
It is likely you will just go with XMind or Mindomo.
Here is a video which goes into more detail:
Time-stamped table of contents:
01:09 | Multiline nodes
02:40 | Different styles inside a single node
04:08 | Different shapes
04:49 | Automatically reformat layout to org-tree structure
06:35 | Support drill down
08:06 | Node labels
08:58 | Add notes to individual nodes
09:47 | Easy to share
10:20 | Easy to collaborate
10:47 | Aesthetics
11:15 | Price
13:07 | My recommendations
13:37 | Other tools
Here are some of the conventions I recommend when designing chatbot conversations in Mindomo. (Most of these translate to XMind too).
It would be much easier for you to follow these conventions if you take my free Flowchart to Chatbot course. It is a 3 day course which explains how you can create the flowcharts for three types of chatbots - Decision Tree (Dichotomous Key), Quiz Bot and Survey (open ended feedback) bot.
Use a rectangle for representing training phrase and bot response
You should put both the training phrase and the bot response inside a single rectangle, since it is conceptually a single block in Dialogflow.
For example, here is what it looks like in the Dichotomous Key bot.
Use ellipse to represent context
You should use a distinct shape to represent contexts - something which doesn't look like an intent. You will be most often distinguishing between the shape of the intent and the shape of the context in your flowchart. So I recommend using the ellipse.
Just as in regular flowchart branches, you will use the branch to signify a change in direction - in this case in the conversation. You can define input and output contexts to implement conversation branching.
When two intents share the same input context, it is represented as a branch in the flowchart.
What should you do if two intents in your flowchart have the same output context?
Instead of trying to create lines which cross each other in the flowchart, you should use connectors.
If you are familiar with Markdown, you know that we use anchor text defined inside square brackets and the actual URL is defined inside regular parenthesis - such as [Google](https://www.google.com)
You can do the same to represent entity input inside your flowchart.
Use notes to describe webhook logic
Sometimes, the rectangular space provided inside Mindomo is not sufficient. And you might need to add some notes to your flowchart too. In that case, use the Notes feature to keep track of all the additional information.
Use angle brackets for non-specific training phrases
Sometimes you wish to write a vague phrase which represents what the user says, without being too specific.
In that case, use angle brackets. These are very helpful when you are just getting started with the flowchart and haven't spent a lot of time thinking through the conversation flow.
Add intent name in bold and color at the top of the rectangle
This is self explanatory. You need to add the name of the intent into the rectangle in such a way that it is easy to visually distinguish the name.
You also want to represent rich responses such as buttons in a specific format. This makes it easy for people creating and reading the flowchart to understand that you are using buttons as part of the bot's response.
I suggest using the pipe symbol (|) to separate multiple buttons (the text is the same as whatever goes on the text of the button).
Use underline to indicate multiple responses
Sometimes you want to provide multiple responses from the bot for a single user query.
Use the underline format to represent this.
Use border colors to indicate end of conversation intents
You can use a border color such as a red border to indicate that a conversation has finished.
Free Course: Converting your flowchart into a Chatbot
A big advantage of following this approach is that it maps very well to the process of designing your Dialogflow intents.
In other words, once you design the flowchart in some reasonable detail, you will be able to quickly translate it into a Dialogflow agent.
I explain how you can do this in my free 3 day (dripped) course Flowchart to Chatbot.
- Dialogflow Knowledge Connector : Pros and Cons
- How to integrate Telegram with Dialogflow
- Why I avoid using slot filling (required parameters) in Dialogflow
- Free Tool: Convert your WordPress website into a Dialogflow FAQ chatbot
- Dialogflow Mega Agent Tutorial
- Reader Question: Will followup events work when an intent has an input context?
- How to learn Dialogflow in a week
- Reader Question: Do I need a contextual fallback intent for every single context?
- Reader Question: Can I use a single agent for Facebook, WhatsApp and website bot?
- Five ways to integrate a Dialogflow chatbot into your website