How to Build a Hotel Chatbot in Under an Hour

One of the disciplines in which Artificial Intelligence research has made great strides in the world today is the area of Natural Language Processing (NLP). NLP deals with programming methodologies that enable computers to understand human (natural) language. Google’s search engine, for example, is an excellent use case of NLP, as different search results are returned depending on the query being asked by the user. Google search is facilitated by an example of a Natural Language Processing system running in the back-end; this system extracts key information from the user query, matches this to a list of keywords maintained by the Google database, and uses that to generate a sorted list of search results depending on the popularity and relevance of the result with respect to the keywords in the search query.

The rapid pace of progress that NLP has seen over the last twenty years has given rise to another interesting and highly useful application for modern businesses: Chatbots. Chatbots are essentially computer programs that conduct human-like conversations with end-users using techniques from Natural Language Processing. In the business world, chatbots are used to simulate customer conversations with employees belonging to profiles such as customer service or information support. This idea of using chatbot technology to fulfil business customer requests has sweeping potential applications that are currently in the process of revolutionising the world of business.

The reasons for this are not difficult to understand. Chatbots once properly configured require minimal down-time/maintenance, and are available to respond to live queries 24x7. An intelligent chatbot can handle conversations with multiple users at once, fulfill user requests to perfection and if necessary, redirect complex queries to human operators, whose work time is freed up to focus on higher-level, more creative tasks. Chatbots can also be linked to other services like Payment Gateways or Emails, which means business customers can potentially have all of their varied requests handled without even having to leave the chatbot interface. Custom chatbots can be created for all kinds of purposes, such as Banking Operations, Currency Conversion, Food Delivery, Hotel Booking, Weather Forecasts and so on. Chatbots do not necessarily have to be customer-facing, and can even be created for internal use-cases such as FAQ Support and Robotic Process Automation (RPA). The reliability, versatility and convenience factor that chatbots possess have the potential to make them highly important all-purpose RPA tools that provide massive upgrades to business productivity and performance.

In this post, we will create a simple chatbot customised for Hotel Customer Service using Google Dialogflow, a Graphical User Interface (GUI) tool that greatly simplifies the process of creating and training custom chatbots. This will create a basic, functioning version of the chatbot, which can later be improved by providing more training data that will allow the bot to respond intelligently to a greater set of user queries.

Step 1: Creating the Dialogflow Agent

Create an account on Dialogflow (dialogflow.com). This account can be linked to your Google or Facebook accounts. Then use this account to enter the Dialogflow console by clicking on “Go to console”.

The “Create New Agent” option, provided among the options in the top-left hand corner, is used to create a new “Agent”, which is another name for a Chatbot with a specific purpose.

Once an Agent Name is provided and the CREATE button is clicked, the new agent is created and can start being trained to respond to queries.

We can start by enabling the Small Talk option in the left-hand list in Dialogflow. Go into this “Small Talk” window and click on “Enable”. Enabling Small Talk will allow the chatbot to respond to some non-essential social questions elegantly, further giving the impression of a simulated human conversation.

Step 2: Understanding Intents and Entities

Before going further, it is important to understand the concept of Intents, Entities and Parameters; as this terminology is used to describe the components of the sentences used to train chatbots in replying to user queries with the right answers.

Intent:

The term “Intent” refers to the motivation or the purpose behind the query provided by the user. Generally in business conversational environments, customer queries can be classified and grouped according to the purpose behind the request. For example:

“Withdraw AED 500 from my account.” could be a request belonging to a “Funds Withdrawal” intent inside a Bank Operations Chatbot.

“I’d like to book a Deluxe Room.” could be a request belonging to a “Room Booking” intent inside a Hotel Service Chatbot.

Classifying user queries according to their intents is considered useful in chatbot development, because business conversations can be structured according to the intent behind the customer query. That is, the chatbot can provide a different class of response according to the kind of request submitted by the customer. So in response to a customer asking to book a specific hotel room type, for example, the chatbot’s reply could be to request the number of such rooms or the dates and duration of intended stay. This reply will obviously change in response to the request being posed, and hence it is a good idea to capture the “Intent” behind the query.

Entity:

While intents allow the chatbot to understand the purpose behind the user query, entities refer to specific pieces of information contained in the user query. Any important data contained in the user’s query, such as object types, dates/times, places, addresses should have their corresponding entities.

For example, in the queries provided in the previous section, “AED 500” could refer to a withdrawal-amount entity and “my account” could refer to an account-origin entity in the query “Withdraw AED 500 from my account.” Similarly, in “I’d like to book a Deluxe Room.”, “I” could refer to the guest entity and “Deluxe Room” could refer to the room-type entity.

Step 3: Creating the Intents and Entities

So in our Hotel Chatbot example, we are interested in creating a chatbot for already-existing guests living inside the hotel. These guests may require assistance with several services like Room Service, Booking Modification, Hotel/City Information etc. In this chatbot, we shall focus on first creating the Room Service Intent and training the agent with respect to the relevant entities.

To create an intent, simply click on the + symbol to the right of the Intents section in Dialogflow. Give the name of the intent and click on the SAVE button to save changes.

This was used to create the “Room Service Intent” in this particular example.

The next step is to create the entities that would relate to the data provided in a query belonging to the Room Service Intent. For example: A request such as “I’d like a glass of water.” would have an entity to handle “glass of water”.

For this hotel chatbot example, an entity named “room-service-objects” has been created (entities in Dialogflow need to have hyphenated names such as this). This entity is given parameter values which relate to the objects inside an expected query for room service, such as towels, water, bedsheets etc. so that any such expected query can be handled.

Next, we need to go back to the Intents section and open up the Room Service Intent again. Inside this the “Training Phrases” section should contain examples of training phrases relevant to the Room Service Intent. For example: “Can I get a glass of water?”. Because of the “room-service-objects” entity already trained to handle this object, it is noticed that while supplying the training phrase, the NLP system already recognises the “glass of water” object in the query and assigns to it the relevant entity.

Scrolling down, response variants can be provided for when the agent sees a request matching this intent with these entities. This represents the answer the chatbot is supposed to provide whenever a user asks it a question belonging to this intent.

With that, the agent has learnt how to handle any request it gets that it classifies as belonging to this intent.

Similarly, intents and entities need to be provided for every use case within the domain of a hotel chatbot that should assist hotel guests. The more of these that can be provided, the more the kinds of requests the chatbot can successfully handle. Some examples of such intents could be “Hotel Information” or “Booking Modification”, or even a “Goodbye Intent” to gracefully exit from the conversation.

And with that, we have a basic, functioning chatbot agent running on Dialogflow. Dialogflow greatly simplifies the process of providing intents and entities to train chatbots on responding to specific kinds of queries. It can be used to make chatbots for specific verticals, and is an excellent tool to get a chatbot up and running in quick time.

Skcript https://www.artelliq.com/blog/how-to-build-a-hotel-chatbot-in-under-an-hour/ https://www.artelliq.com/media/heroes/Screenshot%202019-05-15%20at%2012.04.43%20PM.png