Building ChatBot app using Dialogflow(Api.ai)

What is chatbot?

Generally chat bot is machine learning software which will interact with the er and response back automatically and intelligently in live so don’t want to maintain human resource to interact with people . one good example is you are going to insurance website which contain only general(static) data so you want to know insurance scheme and policy details and so on.. Insurance website enables chat bot app it will chat automatically based on your input so without wasting time you can get more details in chat bot app.

Chatbot app demo

What is Dialogflow?

Back in September 2016, Google purchased Speaktoit, a company specialising in natural language technology. The company’s main service at the time was API.AI, an SDK that allowed creating voice interfaces for mobile apps. Google re-purposed the tool to create Google Assistant Apps (formerly known as ‘Actions on Google’).Now Dialogflow is one of powerful tool to build more intelligent chatbot app.

Dialogflow

I will show you dialogflow basic internal functionality and flow of request and responce:

Agent: First you should create new agent. Agent is your project name and it’s like act as project root.so agent is one of most important component in dialogflow. As you see screenshot has different settings you can change as your requirement.

Agent settings

An intent is the root of your conversation For example, when user starts like “hey’’,”hi’’,’’hello’’ as the input message in the conversation which will trigger welcome intent in below screenshot so welcome intent contains user says as “hey”,”hi”,”hello” and then automatically show response in the intent.As you see the screenshot one more intent called default Fallback intent which will trigger when user says is not matched.

Sample Intent

User says is one of more powerful way to mapping response in intent. For example, user says ‘’Hello’’ then automatically show response to the user as ‘‘Hi! Welcome to chat bot app.How can I help you today?’’

One more cool feature is we can use Fulfillment to get a response from own database

Sample User says

An Entity is a property which can be used to answer the request from the user — the entity will usually be a keyword within the request such as a name, date, location etc. When the user speaks or types their request, Dialogflow will look for the entity and the value of the given entity can be used within the request.

DialogFlow has some pre-defined entities like address, city, etc…, these are called system entities. There are also the entities we define in our agent, which are called developer entities.

Sample Entities

Context is a very powerful component in dialogflow because context will take charge flow of conversation and lifespan is used to expire the conversation of present context.For example, we have two type of intent one is “Do you want to save the location’’ user says as input “YES’’ and another intent is Do you want cancel” user says same input “YES” but the intent should be change based on user conversation.We must use context to maintain user conversation.

Two types of context

  1. Input context: Input context to maintain which context coming from
  2. Output context:Output context is name of present context name.

Finally just go through the flow of dialog flow request and response.

Dialogflow flow

Dialogflow is still completely free for developers to use so play with it and build powerful chatbot app.

In the next blog i will write about how to use fulfillment and integration part in dialogflow.

$……………….……………… Happy coding………………………………….$

References:

If you enjoyed this article, feel free to hit that clap button 👏 to help others find it.
Like what you read? Give bala venkatesh a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.