How to build a chatbot with Dialog flow | Chapter 1 — Introduction
Chatbot is a program that can conduct an intelligent conversation. It should be able to convincingly simulate a human behaviour and pass the turing test.
In this series we will learn how to build a chatbot from scratch, connect it with external API to pull data and deploy it on Slack as a bot.
In this post, we’ll learn
- Why build a chatbot?
- Introduction to Dialogflow
- Flow of conversation
- Setting up dialogflow account
- Authorise Dialogflow on Google Cloud
Why build a chatbot?
A chatbot is, in essence, a piece of robotic software used to imitate human conversation through text chats and voice commands (a good example being Siri or Amazon Alexa).
2 Types of chatbots:
- Rule based chatbots (if you ask for phones the relevant phone pages open up in an e-commerce site that’s an example of a rule based chatbot)
- A.I. based chat bots (learn over a period of time using Machine Learning techniques) — dialog flow is an example of that
Chatbots are extremely valuable for businesses and this value will only increase as time goes by.
On obvious area of chatbot implementation is customer service. Bots are invaluable here. Waiting on hold may soon be a thing of the past as they become advanced enough to deal with basic level customer service queries, and this is already being used by a lot of companies worldwide. Nordstrom, for example, implemented a chatbot to assist with customer service at the end of 2016, and this has made their technical support much more responsive and immediate. It’s no secret that this has resulted in significant cost reduction.
Text and Voice based chatbots are the future and if you are an entrepreneur or a techie, it’s the right time to spend some time learning about building these bots.
No programming experience is required as this series is mostly gonna be using GUI(Graphical User Interface) of Google’s dialogflow.
Introduction to Dialogflow
Dialogflow (formerly Api.ai, Speaktoit) is a Google-owned developer of human–computer interaction technologies based on natural language conversations. The company is best known for creating the Assistant (by Speaktoit), a virtual buddy for Android, iOS, and Windows Phone smartphones that performs tasks and answers users’ question in a natural language. Speaktoit has also created a natural language processing engine that incorporates conversation context like dialogue history, location and user preferences. — Wiki
Supports 14+ languages in 16+ programming languages.
SDKs to work with web apps, mobile app & wearables
Integrates with 14+ chat platforms such as slack, messenger, Alexa, Google Home etc.
Flow of conversation within DialogFlow
User: We, Machines!
Text / Voice : The user interacts with an app like facebook messenger / google home to start the interaction with the bot.
Dialogflow: Bot platform
Agent: A module within dialogflow which incorporates Natural Language Processing to understand what the user meant and to figure out what “action” has to be carried out. The agent transforms the user request into machine readable actionable data.
Intent: Support or the service that the user wants from the agent. Intent is configured by the developers. Intent determines the action by the code.
Fulfillment: This is the code. This part of the conversation lets you pass on the request from your bot to an external source and get response and pass it back to the user. This is achieved via Webhook. Setting up a webhook allows you to pass information from a matched intent into a web service and get a result from it.
Note: Don’t be threatened by the terms here. Once we setup dialogflow account and open the site, all this will fall into place.
Setting up Dialogflow account.
Ok now that the boring ‘theory / lecture’ part is over, let’s jump in and start setting up the environment where we’ll be creating our bot!
- Goto : https://dialogflow.com/
- Create an account with a gmail account, and “agree” to the terms & conditions.
If you wanna delve deeper, do go through the docs here.
Authorise Dialogflow on Google Cloud
First step in creating our bot is to create an agent.
This will create a new GoogleCloud Project automatically. If you are prompted for the authorisation, do allow. If you don’t have a google cloud platform account please create one.
- Chatbots built with Google’s DialogFlow are intelligent personal assistants.
- Dialogflow abstracts out the Natural Language Processing, Machine Learning and other deeper concepts and gives a clean usable user interface to focus on the conversation flow and build bots.
In the next chapter, we’ll understand the building blocks of dialogflow and start building our bot.