When I see my clients/students/readers struggle with their Dialogflow bots, it is usually because they lack knowledge of one of these important pieces.
These are the basic concepts - intents, entities, contexts and webhooks.
Once a reader emailed me and asked: "I want to create 20000 intents. Is it possible?"
I got curious and asked her why she needed so many intents.
Turns out, she first build her bot using Chatfuel and it could answer questions about non-profits located in different cities in the world. Now she was moving her bot from Chatfuel to Dialogflow. But Chatfuel doesn't have the concept of entities, so she thought she needed to create one intent for every city in the world!
She also mentioned she had been looking for an answer to this question for a week. You can avoid spinning your wheels on these kind of problems if you learn the building blocks thoroughly.
Must Know Features
Here is a frequent question on Dialogflow forums:
"So I have a step in the conversation where the user can answer with whatever they want. How do I capture such an input?"
Usually, the person asking the question just has to wait till someone comes and answers. (The answer is to use a wildcard entity).
There are some features in Dialogflow that I refer to as Must Know features. If you take the time to learn them, you can avoid spending unnecessary time on forums hoping someone notices and answers your question.
There are some features in Dialogflow that are best avoided. I refer to them as Dialogflow blackholes. Sometimes, when you begin using these features, you go deeper and deeper into a hole, and there isn't an easy way out.
When clients are completely stuck (and come to me for help), the most common reason is that they started by using slot filling, and then proceeded to force every feature of their bot into a slot filling intent! In my view, slot filling is one of these blackholes.
Even if you don't explicitly wish to avoid these features, you need to at least learn about their downsides so you can understand the tradeoffs when you do use them.
There are a few common conversation patterns which nearly every Dialogflow bot includes.
- Getting a list of inputs from the user
- Doing a lookup after extracting relevant information from the user's message
- Re-prompting for input when the bot cannot get it right the first time
It is very helpful to understand some basic primitives (e.g. how to make use of the context lifespan) when you need to use these patterns in your bot. I call this conversation design.
Webhooks are what help you implement business logic into your chatbot. And the piece which causes the most difficulty for my students seems to be webhooks. At the same time, you do need to learn how to use them because there is very little you can do in Dialogflow without implementing webhooks.
Here is a simple tip to speed up your bot creation: create a conversation flowchart to spec out what your bot is supposed to do. At least when you are starting out.
Creating flowcharts is helpful in many ways
- it solidifies your own understanding of what you are trying to build
- you can share it with folks to explain to them what to build (e.g. if you are the project manager handing off the webhook work to a programmer)
- when you put some effort into creating a detailed flowchart using my flowchart design process, you can actually translate it into a working bot very quickly
The downside of creating flowcharts is the challenge of keeping the flowchart itself up to date with the changes you are making in the agent. I admit that this isn't easy and I haven't found a simple solution to this problem. In spite of that, you are still much better off creating the conversation flowchart when you start.
Agent ZIP file
Here is an interesting fact: every Dialogflow agent can be exported as a ZIP file. When you unzip the file, you will see a bunch of JSON files organized into an appropriate folder structure. Inside the JSON files, you can see all the training phrases, the responses etc.
In other words, the agent ZIP file is sufficient to completely specify your agent's behavior.
What this means is that there are some ways to avoid the tedium in creating a Dialogflow bot. For the simplest scenario of an FAQ chatbot which doesn't have any entities, you can in fact use my bot generator app and create the entire agent in one click!
I am not saying this to promote by app (well, maybe a little 😉 ) but to point out the benefits of understanding the agent's ZIP file structure. You can use this understanding to automate other tasks when it comes to agent creation and maintenance, which in turn will reduce errors.
Now we come to the Godzilla of Dialogflow pieces.
The REST API provided by Dialogflow is an extremely powerful feature. You can use it to do a lot of things:
- speed up agent creation
- speed up agent updates
- search through your agent for information quickly
- create powerful integrations so Dialogflow can work with your existing systems
- use it for analyzing your agent's behavior
- create automated conversation tests so you can make updates to your agent without worrying what might break
You get the picture.
Nearly every shortcoming you see in Dialogflow, there is usually a way to use the REST API to overcome it.
For example, you can click on Demo from the top menu and you will be able to interact with a website chatbot. Now, Dialogflow's existing web client is very limited. You cannot show clickable hyperlinks in the chat window. You cannot display rich text. No line breaks. No images/gifs/videos.
However, by using the REST API, I was able to create a website bot which has many of these features. This is just one of many ways you can improve your Dialogflow agent by using the REST API. It is essential that you round out your knowledge of Dialogflow by learning about the REST API.
At the same time, it is probably the most advanced topic you will learn. So be sure to learn all the other things I have mentioned in this article before you tackle the REST API.
Do I need to learn them in order?
I would suggest learning them in order. However, you will sometimes have to jump back and forth a bit.
It is more important that you don't leave out any of these topics.
Check out my free course where I go into these concepts in a little more detail.
Oh, and here is the complete answer to your puzzle. 🙂