What is a Chatbot? How to Build One and What Platforms You Should Use

What is a Chatbot? A chatbot is a conversational interface that can be used to interact with a product or service. While the term is well known in tech circles, to the outside world, chatbots are still a bit of a novelty. Recently, they’ve become increasingly popular thanks to advancements in natural language processing technology that make them much better at what they’re built to do.

These developments have led to the creation of new tools such as the Google Cloud Natural Language Processing API or the Stanford CoreNLP. For example, advancements in voice recognition services such as the Google Cloud Speech API is what has made some familiar vocal interfaces like Amazon Alexa, Google Home, or Apple Siri work so well.

In this post, I’ll be sharing some guidelines for designing an effective chatbot application. We’ll talk about the building blocks of dialog and I’ll share some best practices for designing the chatbot experience. Finally, we’ll look at three chatbot platforms—API.AI, LUIS, and Amazon Lex—to compare them based on features, performance, and pricing.

What is a Chatbot and why it is important

The great potential of chatbots lies in their ability to provide personalized and contextualized one-too-many communication using the most natural of interfaces: natural language.

One-to-many communication means that a single entity (a person or a business) can communicate easily with many people. Today, there are plenty of tools that make one-to-many communication possible, from email marketing to social media. But while it is easy to reach large audiences or even target particular groups, the hard part is communicating effectively at the individual level. Chatbots allow you to reach a large audience while keeping the singular conversation personalized and contextualized. This means that every single user will receive a personalized response from your chatbot.

Messaging is one of the most natural ways to communicate. Messaging apps like Facebook Messenger and WhatsApp are growing incredibly fast. Facebook Messenger, for example, is used by over 1 billion people every month and it is growing faster than Facebook itself.

With chatbots, you don’t have to worry about attracting users to a new messaging ecosystem. Instead, you can reach your users where they already are.

Dialog Structure

Let’s start by learning the basic terminology used in natural language processing (NLP) technology for describing the typical dialog structure employed by chatbots.
Context example


When we receive a message, the first thing we can do is predict the user’s intent. This means mapping the message into an action we understand that represents what the user wants to know, do, or achieve. The message, “Book a flight from London to Paris,” can be mapped to the intent “book flight.


Every intent comes with a set of required parameters. For example, the intent “book flight” requires the parameters of “origin,” “destination,” and “departure date.” Parameters are extracted from the intent of the message. Missing parameters are explicitly requested from the user.


Context is a way to give the system a short term memory. If we are booking a flight, the conversation where we define the booking details falls into the single bucket “book flight.


The session is one conversation from beginning to end.

Best Practices for Chatbot Design 

In designing your chatbot, thinking ahead to user experience is essential. You need to simultaneously provide users with exactly what they want and a user experience that isn’t cold or robotic. You’ll also need to design the chatbot to handle some special use cases.

Tone of Voice
The tone of voice in your dialog defines the personality of your bot and therefore should reflect your brand. This can span from funny and very informal to extremely formal. If your brand already has a well-defined communication style, the choice of the tone of voice is easy. Otherwise, you can start from the text you already have such as taglines, slogans, and marketing copy. Just be careful to make sure your chatbot doesn’t sound like an advertisement! For inspiration, check out what members of your target audience have to say and how they communicate with one another in online communities in your product or service niche. Once you’ve chosen your tone of voice, it’s important to keep it consistent.
Tip. If you choose an informal style, emojis can be a very powerful communication tool.

Make Responses Easier
Buttons are a powerful way to express a choice, and because most messaging platforms support buttons, the majority of users will be familiar with them. Buttons are a great choice if you are asking a multiple-choice question or presenting several options to your users. You will also achieve the goal of keeping typing to a minimum, which makes it easier for the customer to respond and is less error prone.

Keep Conversations on Track
Conversations are truly limitless. Your chatbot will have a specific goal and will not be able to handle an infinity of possibilities. To keep the conversation on track, your chatbot should guide it into the flows that it can handle. A few tips for doing this:

  1. When starting a conversation, list the capabilities that the user can expect from the chatbot with sample messages.
  2. When asking questions, make sure that the question subject is clear and specific.
  3. Use buttons to answer questions when possible.
  4. Guide the conversations. Make your questions as specific as possible to guide the user.

Error Cases
No matter how much time you spend working on your chatbot or how much data you will use to train it, mistakes will happen. It’s normal and, if handled properly, sporadic errors are not a big problem. Here, my most important tip is to always provide an error message and an explanation—never leave users with a blank space.

A few tips for writing error messages:

  1. Show that you are sorry about what happened. Funny fail/sorry gifs, images, or emoticons could be effective here. Offer the user options for how to handle the situation, and reroute users to safe areas within your system. For example, you could offer to start a new conversation from scratch.
  2. If possible, transfer the user over to live support assistance.

Stick to the Truth
This is probably the most important tip of all. Here are a few tips for keeping it real:

  1. Start by making it clear that your users are chatting with a machine.
  2. Be clear about the capabilities and limitations of your chatbot. People will know what to ask your bot and you will avoid disappointing users who try to use features that don’t exist.
  3. Be transparent in dealing with errors (see the previous section).

Comparison of Major Platforms
In this section, I will analyze platforms from three major vendors: API.AI (acquired by Google), LUIS (Microsoft), and Amazon Lex.

API.AI (formerly Speaktoit) was founded in 2010 and focused on human-computer interaction through natural language conversations. Their first product was Assistant (by Speaktoit), a conversational assistant for mobile phones. In September 2014, Speaktoit made the service that powered Assistant public under the name API.AI. In September 2016, the company was acquired by Google.

LUIS (Language Understanding Intelligent Service)
LUIS is part of Microsoft’s Cognitive Services, a collection of tools whose goal is to “Enable natural and contextual interaction with tools that augment users’ experiences using the power of machine-based intelligence.” LUIS is a language understanding service, so it is very focused on NLP tasks such as intent recognition and slot filling, but it lacks useful features that can be used for deploying a chatbot. It should be used together with other Cognitive Services such as Bing Speech API for voice interactions and Microsoft Bot Framework for chatbot features.

Amazon Lex
Lex is Amazon’s service for building conversational interfaces into any application using voice and text. It is powered by the same algorithms used by Amazon Alexa and offers the integrations needed to quickly build a chatbot. It was released in April 2017, so we should keep this in mind during our comparison. An important feature of Lex is its integration with AWS services like AWS Lambda.

Feature Comparison

Visual editor
Intent classification
Preloaded abilities
Exporting/importing training data
Slot matching with ML
Voice interface

All providers offer a visual interface for all the tasks required, which makes them easy to use, even for those who aren’t tech savvy. I personally found the API.AI and LUIS interfaces easier to use while Amazon Lex’s interface is a bit less intuitive. Sometimes Lex’s interface was unresponsive, but I think this is probably due to the fact that the service is still quite new.

API.AI and Lex offer some pre-built chatbots that can be used as a starting point for developing your own functionalities. API.AI has several pre-built options and also integrates a nice support system for small talk that can be used to easily make your bot look smarter. Lex has some useful built-in intents that can be used to handle frequent events that can happen during a task-driven communication (cancel, start over, help, etc.). LUIS has a lot (21) of pre-built intent/slot pairs that can add extra functionalities to your chatbot.

With API.AI and LUIS, you can import and export training data in JSON format. I found this feature really useful because it can be used to programmatically generate training data. Here, API.AI goes one step further, allowing you to not only import an app but also merge the current app into the imported one.

Language Support


Integration with Messaging Platforms

Facebook Messenger
Amazon ALexa
Cisco Spark
Microsoft Cortana
Actions on Google

API.AI has the most impressive set of direct integrations. Since LUIS is basically a language understanding API, it completely lacks this kind of feature. LUIS users should use the Microsoft Bot Framework (which is an SDK, not a cloud service) to easily create these integrations.

Programming Language Support

iOS / Watch OS / Mac OS X
Webkit HTML5
Epson Moverio

All three services offer SDKs for different languages. It should be noted that all the APIs are easy to use, so the presence of “official support” is not critical.

NLP Quality

I put together a small dataset to compare the quality of the NLP processing of each platform. I used three different intents: “find a restaurant,” “find a hotel,” and “order a pizza.” Restaurant and hotel intents need to extract the name of the city from the message. This slot matching task is natively supported by all three platforms and it is quite easy to set up. Pizza ordering is more challenging because the engine will need to match the pizza type in each message. A couple of pizza types will be inserted as possible slot values.
Here are the intents provided as training data:

  • Restaurant
    • Restaurant Milan
    • Find me a restaurant in Paris
    • I want to eat in London
  • Hotel
    • I would like to book a hotel in London
    • I want to stay in Rome
    • I want to book a hotel in London
    • Hotel in Monaco
  • Pizza
    • I want a pizza siciliana
    • I want a pizza napoletana
    • I want to order a pizza margherita

These are the possible slot values provided during training:

  • Pizza type
    • margherita
    • siciliana
    • napoletana
    • bianca
    • diavola
    • quattro formaggi

Hotel Booking Results

Intents and slots
All of the platforms performed well on this task. The only mistake was made by LUIS in the phrase “I want to stay in Como” where it wasn’t able to recognize that Como is a city in Italy (it’s also the name of the city’s famed Lake Como).

Restaurant Booking Results

Intents and slots
API.AI got a perfect score in this task, LUIS did pretty well, while Lex seemed to struggle. The most mistaken phrase was: “I’m in Rome and I want to eat.” Both LUIS and Lex failed in matching the intent. It is true that they didn’t have a similar phrase in the training set, but the “I want to eat” part was in it and should have guided the matching.

Pizza Ordering Results

Intents and slots
This task was the most challenging in slot matching because the slot “pizza type” contains custom values that probably aren’t present in the vocabulary of these platforms.

API.AI struggled in this more difficult task, while LUIS and Lex provided acceptable results. A test sentence that should be highlighted is “I want to order a pizza boscaiola” that looks a lot like the training sentence “I want to order a pizza margherita” except for the pizza type. It should be noted that the pizza type “boscaiola” wasn’t in the dataset, so its recognition poses a big challenge. API.AI recognizes the intent of this phrase but fails in recognizing the pizza type. This hint shows us that API.AI is only recognizing words in the training dataset as slots with no generalization. Lex fails completely on this sentence.

Instead, LUIS recognizes both the intent and the pizza type, which in my opinion, is an incredible result.


PricingAPI.AI + Google Cloud SpeechLUIS + Bing Speech-to-Text APILex
Free text requests per month10,00010,000
Price for 1,000 text requests$0$0.75$0.75
Free voice requests per month60 minutes5,0005,000
Price for voice requests$0.006/15s$0.004 per request (max 15s)$0.004 per request

Let’s try to make these numbers more concrete by plugging them into a plausible use case. Suppose we get 100,000 text requests and 30,000 speech requests each month, with an average length of 10 seconds. So, we receive 5,000 minutes of speech per month.

Cost scenarioAPI.AI + Google Cloud SpeechLUIS + Bing Speech-to-Text APILex
Total cost of text requests$0(100,000 – 10,000)*$0.00075 = $67.5(100,000 – 10,000)*$0.00075 = $67.5
Total cost of voice requests(5000-60)*$0.024 = $118.56(30000 – 5000)*$0.004 = $100(30000 – 5000)*$0.004 = $100
Total cost$118.56/month$167.5/month$167.5/month

Of course, one can decide to use API.AI with Bing Speech-to-Text API, further lowering costs.
In my opinion, API.AI is the best service if you want to start quickly (it offers a lot of built-in functionalities) or if your chatbot doesn’t require a powerful slot matching algorithm.

LUIS has the most powerful NLP engine but requires more effort to build a fully functioning chatbot app. With LUIS, you will have to host the bot logic yourself and use different products to communicate with messaging platforms and to enable speech recognition.

Amazon Lex lies somewhere in the middle. With Lex, it is easy to get started and it offers support for the major messaging platforms and speech recognition out of the box. If you are already an AWS user and if you are used to AWS Lambda, Lex is probably the best choice for you.

If you’re interested to learn how to build a chatbot on Azure, I recommend the Cloud Academy’s Building a Chatbot on Azure course. Watch this short video for an overview of the course.


Written by

Matteo Ronchetti

I'm a Mathematics student passionate about Machine Learning and NLP

Related Posts

Alisha Reyes
Alisha Reyes
— May 11, 2020

New Content: Alibaba, Azure Cert Prep: AI-100, AZ-104, AZ-204 & AZ-400, Amazon Athena Playground, Google Cloud Developer Challenge, and much more

This month, our Content Team released 8 new learning paths, 4 courses, 7 labs in real cloud environments, and 4 new knowledge check assessments. Not only that, but we introduced our very first course on Alibaba Cloud, and our expert instructors are working 'round the clock to create 6 n...

Read more
  • alibaba
  • AWS
  • Azure
  • gitops
  • Google Cloud Platform
  • lab playground
  • programming
Rhonda Martinez
— May 4, 2020

Top 5 Reasons to Get AWS Certified Right Now

Cloud computing trends are on the rise and have been for some time already. Fortunately, it’s never too late to start learning cloud computing. Skills like AWS and others associated with cloud computing are in high demand because cloud technologies have become crucial for many businesse...

Read more
  • Amazon Elastic Book Store
  • Amazon Elastic Compute Cloud (EC2)
  • AWS
  • AWS Certifications
  • Glacier
Alisha Reyes
Alisha Reyes
— May 1, 2020

Introducing Our Newest Lab Environments: Lab Playgrounds

Want to train in a real cloud environment, but feel slowed down by spinning up your own deployments? When you consider security or pricing costs, it can be costly and challenging to get up to speed quickly for self-training. To solve this problem, Cloud Academy created a new suite of la...

Read more
  • AWS
  • Azure
  • Docker
  • Google Cloud Platform
  • Java
  • lab playgrounds
  • Python
Alisha Reyes
Alisha Reyes
— April 30, 2020

Blog Digest: AWS Breaking News, Azure DevOps, AWS Study Guide, 8 Ways to Prevent a Ransomware Attack, and More

  New articles by topicAWS Azure Data Science Google Cloud  Cloud Adoption Platform Updates & New Content Security Women in TechAWSBreaking News: All AWS Certification Exams Now Available Online As an Advanced AWS Technology Partner, C...

Read more
  • AWS
  • Azure
  • blog digest
  • Certifications
  • Cloud Academy
  • programming
  • Security
Stuart Scott
— April 27, 2020

AWS Certified Solutions Architect Associate: A Study Guide

Want to take a really impactful step in your technical career? Explore the AWS Solutions Architect Associate certificate. Its new version (SAA-C02) was released on March 23, 2020, though you can still take SAA-C01 through July 1, 2020. This post will focus on version SAA-C02.The AWS...

Read more
  • AWS
  • AWS Certifications
  • AWS Certified Solutions Architect Associate
Alisha Reyes
Alisha Reyes
— April 9, 2020

New on Cloud Academy: AWS Solutions Architect Exam Prep, Azure Courses, GCP Engineer Exam Prep, Programming, and More

Free content on Cloud Academy More and more customers are relying on our technology and content to keep upskilling their people in these months, and we are doing our best to keep supporting them. While the world fights the COVID-19 pandemic, we wanted to make a small contribution to he...

Read more
  • AWS
  • Azure
  • Google Cloud Platform
  • programming
Joe Nemer
Joe Nemer
— April 3, 2020

Breaking News: All AWS Certification Exams Now Available Online

Remote proctoring for all AWS certifications Cloud Academy is an Advanced AWS Technology Partner, and we are happy to announce all AWS certification exams are available online!  What does this mean for you? You can stay focused on your certification goal. Or you can start a certifica...

Read more
  • AWS
  • AWS certification
  • AWS Certifications
Connie Benton
Connie Benton
— April 1, 2020

How To Build a Career with AWS Certifications

From Iaas and PaaS solutions to digital marketing, cloud computing reshapes the world of technology. As the influence of this technology grows, so does investment. Tens of billions of dollars are being spent on cloud computing-related services each year. This influx is continuing to inc...

Read more
  • AWS
  • Certifications
Vijayakumar Athithan
Vijayakumar Athithan
— March 27, 2020

What is Cognito in AWS?

Web applications usually allow a valid username and password combination for successful sign in to the application. Modern authentication flows incorporate more approaches to ensure user authentication. When using AWS, this is no exception, thanks to the abilities and features offered b...

Read more
  • AWS
  • AWS Cognito
  • Solutions Architect
Andrew Larkin
— March 20, 2020

The 12 AWS Certifications: Which is Right for You and Your Team?

As companies increasingly shift workloads to the public cloud, cloud computing has moved from a nice-to-have to a core competency in the enterprise. This shift requires a new set of skills to design, deploy, and manage applications in cloud computing.As the market leader and most ma...

Read more
  • AWS
  • AWS Certifications
Alisha Reyes
Alisha Reyes
— March 17, 2020

Cloud Academy’s Blog Digest: How Do AWS Certifications Increase Your Employability, How to Become a Microsoft Certified Azure Data Engineer, and more

With everything going on right now, it's likely that the only thing you've been reading lately is related to the coronavirus pandemic. It's important to stay informed during these times, but it's also good to jump into something that can take your mind off of the current situation for j...

Read more
  • AWS
  • Azure
  • blog digest
  • Certifications
  • Cloud Academy
  • programming
  • Security
Cloud Academy Team
— March 13, 2020

Which Certifications Should I Get?

As we mentioned in an earlier post, the old AWS slogan, “Cloud is the new normal” is indeed a reality today. Really, cloud has been the new normal for a while now and getting credentials has become an increasingly effective way to quickly showcase your abilities to recruiters and compan...

Read more
  • AWS
  • Azure
  • Certifications
  • Cloud Computing
  • Google Cloud Platform