Best Practices for building Dialogflow Chatbot

Anshul Shrivastava
AxleWeb Technologies
4 min readMar 11, 2021

Dialogflow is one of the best tool out there for building chatbots. Dialogflow is really easy to use as well. In this blog post, I will highlight some of the best practices that one should follow while building chatbots on Dialogflow.

Start with a Flow chart

Before going into Dialogflow and start creating Intents and Entities, what you really need to do is visualise the conversation flow that you want your bot to have with the users. The best way to do that is by creating a mind map or a flow chart.

You can start by simply drawing the flow on a pen and paper but there are a few tools out there which can help you in the process. On of the tool that we use for creating flow charts is coggle.it

Learn about Dialogflow Concepts

Another important thing you must do before you start creating Dialogflow bots is you should take some time to learn various concepts such as Intents, Entities, Contexts, Training Phrases, Responses, Fulfillments and Webhook.

We have already created several videos on these topics. You can check them out here: https://axlewebtech.com/youtube

Dialogflow

Naming convention for Dialogflow intents

Right now, there is no way to organise Dialogflow intents into a logical way. There is no option to create a Folder or Sort Intents in some way or another. So the approach we follow is add some numbers or alphabets before our Dialogflow intent name so that intents are sorted by number or alphabets.

For e.g. if we have following intents in our Dialogflow agent

  • Default Welcome Intent
  • Fallback Intent
  • Contact Intent
  • Opening Hours Weekdays
  • Opening Hours Weekend
  • Restaurant Menu
  • Room Availability

We can add some numbering to the name of intents to sort them in a logical way such as:

  • 1. Default Welcome Intent
  • 2. Restaurant Menu
  • 3. Room Availability
  • 4.1 Opening Hours Weekdays
  • 4.2 Opening Hours Weekends
  • 5. Contact Intent
  • 9. Fallback Intent

In this way, we can organise the intents when the list grows bigger and also we can keep the related intents together even if their names are not similar.

Use Context and Follow up Intents

Always try to use Contexts and Follow up intents as much as you can. When your bot can understand context and give context aware answers, it feels more natural to the user while talking to your bot.

One of such context aware conversation example is below where user is trying to check opening hours of a restaurant.

User: What time are you open on weekdays

Bot: We are open 11AM to 10PM on weekdays

User: What about weekends

Bot: We are open 11AM to 11PM on weekends

In the above conversation, when user asked about weekend opening hours, he didn’t clearly specified that he wants to know the opening hours for weekend. But since the bot was aware of the context which was “opening hours”, the bot was able to give a meaningful answer.

Here is a nice short video which can help you understand contexts:

Follow up intents are another useful feature which behind the scenes uses contexts to give users a better conversation experience. Below is an example of follow up intent where user is trying to play music through voice.

User: Play songs by Atif Aslam

Bot: Playing some songs…

User: Next

Bot: Playing another song from the same singer…

In above example, when user said “Next” it is a follow up intent to the original intent which in above case is “Play songs”.

Use Webhooks and Fulfillments

It is very important that your bot can provide dynamic responses based on question asked. Some of the examples are you ask current temperature to a bot. The bot is supposed to provide the current temperature of the city but how will it get the current temperature. Obviously it has to make an API call to some weather service which will provide the latest temperature etc.

Similarly an e-commerce bot is supposed to provide the details like availability of the products, their price, pictures, in stock or out of stock, delivery to a specific city etc.

All these things are possible only when you use Webhooks and Fulfillments. With webhooks, you can make an API call to your e-commerce service provider and check the details. The response from API can be shown to the user in the natural language format.

Few other Points to consider

Always give your bot users an option to restart the conversation if they are stuck somewhere. It could be a simple message saying “If you want to restart the conversation, please say Hi”. This is not ideal but at-least your users would be able to continue conversation with the bot if they are stuck somewhere.

Also consider enabling small talk option. Small talk means some random chit chat that a user does with the bot. For e.g. “who are you”, “where are you”, “Are you happy” and other such questions.

It is impossible to write intents and responses for all such questions but Dialogflow can handle such questions for you if you have enabled the small talk option.

Additionally, you should add multiple variations while adding training phrases and responses. This will help your bot understand wide variety of utterances and will be able to provide natural sounding response.

I think if you consider these points while building a Dialogflow chatbot, you can build a great chatbot with great user experience. If you still need a professional help in building a chatbot, please feel free to reach out to us at https://axlewebtech.com or email us at contact@axlewebtech.com.

The videos below will give you a good idea of how the technology works.👇

In case you’re interested in more technical videos, check out this channel .👇

Start your journey towards having a chatbot at a reasonable price. We’ll be pleased to serve you. 🙂

Here is our Website Link :- https://axlewebtech.com/

--

--