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.

Series Content:

Chapter 1: Basic Gyaan about Chatbots and setting up the dialog flow environment

Chapter 2: Understanding the building blocks of Dialogflow

Chapter 3: Using linear, followup and non-linear dialogs to create a “TripPlanner” bot

Chapter 4: We created a new bot “StockTracker” bot to pull data from an external site through fulfilment and revert the result to the user

Chapter 5: Connect the “StockTracker” Chatbot with Slack

In this post, we’ll learn

  • Why build a chatbot?
  • Pre-requisites
  • 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:

  1. 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)
  2. 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.


Pre-requisites

No programming experience is required as this series is mostly gonna be using GUI(Graphical User Interface) of Google’s dialogflow.

Although, in chapter 4, we will be using a little bit of programming to pull data from a stockmarket data site to display the result via our chatbot. If you have some experience in dabbling with javascript /Restful APIs it might help. Even if you don’t have any experience, don’t fret will break it down.


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.[1] 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!

  1. Goto : https://dialogflow.com/
  2. Create an account with a gmail account, and “agree” to the terms & conditions.

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.


Summary:

  • 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.




This story is published in The Startup, Medium’s largest entrepreneurship publication followed by 348,974+ people.

Subscribe to receive our top stories here.