




















































Dialogflow (previously called API.AI) is a conversational agent building platform from Google. It is a web-based platform that can be accessed from any web browser. The tool has evolved over time from what was built as an answer to Apple Siri for the Android platform. It was called SpeakToIt, an Android app that created Siri-like conversational experiences on any Android smartphone. The AI and natural language technology that powered the SpeakToIt app was opened up to developers as API.AI in 2015.
This tutorial is an excerpt from a book written by Srini Janarthanam titled Hands-On Chatbots and Conversational UI Development.
In this article, we will create a basic chatbot using Dialogflow, add user intents, and finally, we will see how to integrate the chatbot with a website and Facebook.
First, let us create a developer account on API.AI (now called as Dialogflow).
Let us create our first agent on Dialogflow:
"hows the weather in london" "whats the weather like in london" "weather in london" "is it sunny outside just now"
In the preceding utterances, the user is asking for a weather report in the city of London. In some of these utterances, they also mention time (that is, now). In others, it is implicit. The first step of our algorithm is to map these many utterances into a single intent: request_weather_report.
The Intent name corresponds to users' intents. So name them from the user's perspective. Let's add a user_greet intent that corresponds to the act of greeting the chatbot by the user. To add an intent, click the CREATE INTENT button.
Give the intent a name (for example, user_greet).
hello hello there Hi there Albert hello doctor good day doctor
Hi there. I am Albert. Nice to meet you!
You can also add up to 10 additional responses by clicking the ADD MESSAGE CONTENT.
You will see the chatbot recognizing your typed utterance and responding appropriately.
Think about what kind of information users will ask the chatbot and make a list. These will become user intents. The following is a sample list to get you started:
request_name request_birth_info request_parents_names request_first_job_experience request_info_on_hobbies request_info_patent_job request_info_lecturer_job_bern
Of course, this list can be endless. So go on and have fun.
Once you have put in the sufficient number of facts in the mentioned format, you can test the chatbot on the simulator as explained in step 10.
Now that we have a chatbot, let us get it published on a platform where users can actually use it. Dialogflow enables you to integrate the chatbot (that is, agent) with many platforms. Click Integrations to see all the platforms that are available:
In this section, we will explore two platform integrations: website and Facebook:
Website integration allows you to put that chatbot on a website. The user can interact with the chatbot on the website just as they would with a live chat agent.
You can share the bot privately by email or on social media by clicking the Email and Share option.
<iframe width="350" height="430" src="https://console.api.ai/api-client/demo/embedded/ 2d55ca53-1a4c-4241-8852-a7ed4f48d266"> </iframe>
In order to publish the API.AI chatbot on Facebook Messenger, we need a Facebook page to start with. We also need a Facebook Messenger app that subscribes to the page. To perform the following steps you need to first create a Facebook page and a Facebook Messenger app. Let's discuss the further steps here:
You should now be able to open the Facebook page, click Send Message, and have a chat with the chatbot:
Brilliant! Now you have successfully created a chatbot in API.AI and deployed it on two platforms: web and Facebook Messenger. In addition to these platforms, API.AI enables integration of your agent with several popular messaging platforms such as Slack, Skype, Cisco Spark, Viber, Kik, Telegram, and even Twitter.
If you found this post useful, do check out the book, Hands-On Chatbots and Conversational UI Development, which will help you explore the world of conversational user interfaces.
Build and train an RNN chatbot using TensorFlow [Tutorial]
Facebook’s Wit.ai: Why we need yet another chatbot development framework?
Voice, natural language, and conversations: Are they the next web UI?