Building a [Smarter] bot with Dialogflow

This post is a followup for Building your first [smart] bot in 10 minutes. Do give it a read before reading this post. In this post we will be building a chatbot that will handle hotel booking. There will be minimal [python] code and it will be hosted on a serverless instance of aws.

Things you will learn in this post –

  1. Fine tuning your dialogflow intents
  2. Using entities
  3. Using contexts

> Creating Intents

You can think of intents as intention. “What is your name?“, The intention of this question is to get the name of the person the question was asked to. Now, I can use different sentences to have the same intention –

  1. Can you tell me your name?
  2. What do people call you ?

All the questions have the same intention – to get the persons name.
To create intents, click on the intents tab and add training phrases.

To make hotel bookings I will need the following parameters

  1. Number of people
  2. A date
  3. Number of nights for the stay

For now let the two training phrases be –


Entities are information that you want to extract from the user inputs. In the above image you can spot three entities that we are taking from the user input.

  • nights
  • date
  • people

You can change the parameter name by double clicking it. 

Required Parameters

To book a hotel room you need all the three entities mentioned above. Scroll down to action and parameters and select the required checkbox for all three parameters.

Click on the prompts that will be displayed if the user fails to give one of the three entities.

Everything seems to be working well. But we still need to ask the user and confirm the given information. To send back a response, scroll down to the response tab and use $parameter_name where ever required.

>Using Context

Context provide you with background information of what’s being talked about.

Ashish doens’t like slow internet. He also not too fond of buggy interfaces.

The second sentence will not make much sense without the first one. Who is “he” ? In dialogflow you can pass variables from one intent to another using context.

To do that, click on the context for your first intent and add a identifier for that intent. Now go to the next intent and put that indentifier as your input context. You can later use the parameters from the first intent in second one using


You can download all my intents using this link and upload it to your dialogflow dashboard.

>Testing it







Leave a reply:

Your email address will not be published.

Site Footer

Sliding Sidebar

About Me

About Me

Hey, I am Thomas Ashish Cherian. What I cannot create, I do not understand.

Social Profiles