Building a chatbot using Dialogflow

Lukas Verret
Ixor
Published in
4 min readFeb 17, 2022

Chatbots are gaining in popularity as more and more companies realise they can offer added value in multiple domains. Chatbots can improve customer service by offering support 24/7, immediately answer customer questions, keep track of conversations for analytics and save costs. So not only is a chatbot able to improve the customer experience but it can help to get a better insight into their behaviour. In this blog post, we will guide you on how we build and structure chatbots at Ixor using Google Dialogflow.

What is Dialogflow

Dialogflow is a natural language understanding platform used to design and integrate a conversational user interface into mobile apps, web applications, devices, bots, interactive voice response systems, and so on.

There are multiple frameworks to build a chatbot, we chose to use Dialogflow as the backbone for our chatbots as it offers the following benefits:

  • Easy to set-up and maintain
  • Powered by Google machine learning
  • Option to use existing FAQ’s and documentation in the chatbot
  • Supports multiple platforms, multiple languages and offers end-to-end integration

How does Dialogflow work

Agent

The agent is the actual chatbot handling the conversations with the end-users.

Intents

An intent tries to recognize the end-user’s intention for one conversation turn and can be considered the building block of the conversation flow. So when a user has a query, the intent captures what the user wants to do or wants to know. Intents are trained by example phrases or training phrases of what end-users might say. Dialogflow can generalize on these examples and will also respond to similar phrases. When an intent is matched, it can trigger an action that will be performed or a response that is returned to the end-user.

Entities

The specific information you want to identify and extract from the intent like dates, people, places,…

Contexts

Similarly to humans, an agent needs context to categorize the correct intent. Context can be used to manage the flow of the conversation in the form of input and output contexts.

Events

So far, intents were matched if an end-user has a query that is similar to a training phrase. But intents can also be triggered by events, e.g. a welcome event is triggered by opening the chatbot.

Designing a conversation

Set goals

Determine what your chatbot needs to do. Does it need to book appointments, should it troubleshoot customers or even something else? The list is almost endless, but there is of course a development cost for every feature. You will never be able to answer 100% of all the questions and requests, but try to implement the 80–20 rule as a target.

Create a persona and set the tone

You need to know your users before you can proceed. Although it may seem trivial, you need to address them using the right tone. An accounting firm for example typically does not want to use emoji’s in its communication. Adress your users in a way that is consistent with your brand.

Map the conversation flow

Make a flow chart or decision tree on how you want to guide your users through the chatbot. This is done using intents and actions which were discussed in the previous section. Obviously, you need to provide a welcome statement and a proper conversation ending. Keep your messages short and to the point, people do not like to read long sentences. Provide quick-replies to better steer the conversation and avoid ambiguities in the user requests.

Provide a fallback scenario

No matter what you do, there will always be cases where your chatbot will not be able to answer a question or fulfil a request. This can either be because the user makes a request that is outside the chatbot’s scope or because the question simply is too vague. Prepare for this by:

  • Clearly stating beforehand what the chatbot’s functions are
  • Acknowledge and apologize to the user when something is not known or not possible
  • Allow the user to forward the request to a real human, ideally, this would be a live-chat representative but it could just even be an e-mail address.

Ensure a feedback loop

Once the chatbot is live, do not let it stop there. Dialogflow and most other services provide chat logs that you can inspect and analyze. Use this to your advantage, it can give you key insights on what your users want, the problems they encounter and what they are expecting from the chatbot.

Conclusion

Getting a chatbot up and running is remarkably straightforward in Dialogflow. Even without extensive coding or a deep NLP understanding, you can set up a basic conversational agent that can improve your customer experience and lead to cost reductions.

At IxorThink, the machine learning practice of Ixor, we are constantly trying to improve our methods to create state-of-the-art solutions. As a software company, we can provide stable products from proof-of-concept to deployment. Feel free to contact us for more information.

--

--