Homepage > Journal > Chatbot design using Amazon Lex

Chatbot design using Amazon Lex

How you like that:

We've been using AWS (Amazon Web Services) cloud services for several years. For a long time, however, we hadn't had the opportunity to check the text-based interface of Amazon Lex until a client asked us: "Test the concept for a chatbot for a medical startup."

Let's get started

I'd like to highlight some critical issues. If you're a designer and you want to design and implement a chatbot using Amazon Lex, you need the following:

Chatbot — a computer program that interacts with a user using a natural language or a text-based interface. Amazon Lex — one of the services included in Amazon Web Services.

Amazon Lex lets you build conversational interfaces using voice and text for any application (e.g., chat platforms).

Download the Amazon Lex Developer Guide documentation.
  1. An experienced developer, who will help you with this; if they don't have enough experience, they will be useless. AWS documentation is almost always up to date. In the case of Lex, "almost" makes a big difference.
  2. The PHP language is not natively supported by AWS Lambda (an integral part of Amazon Lex), so you need a developer with Python, Java, C #, or Node.js knowledge.
  3. When trying to understand the AWS logic, obtaining a Cloud Practitioner certificate helped me a lot, which will also be helpful for you. Why? You will realize this after logging into the AWS panels, the so-called Amazon Lex console. You will see more than 1,400 solutions with names that mean nothing to you. It's impossible to comprehend this without preparation. Each solution depends on another, so working in the Lex panel will also require it.
  4. AWS Lex documentation that a designer should read.

I will add that I have read most of the popular Polish articles about chatbot design. Their authors write that when designing a chatbot, you need a brief, UI/UX, storytelling, etc.

Meanwhile, in my opinion, to create bots, you must:

  1. Determine who the user is and what they want to achieve when using a chatbot.
  2. Understand the logic of a particular technology that you will base your design on. What's important is that you will learn about details as you go. Why? None of the agencies work on their own technology. Only technology giants or small teams with a huge budget and even more knowledge can afford it. Therefore, the designer must adapt to what is available in the market and not vice versa. In this case, we chose Amazon Lex.
  3. Understand the technology's logic to comprehend how you think about designing the text-based interface for your chatbot.

Advantages of using Amazon Lex

As I mentioned in a little side note above, Amazon Lex is used for building conversational interfaces using voice and text for, among others, mobile devices, web applications, or messaging platforms. To do that, Amazon equipped this tool with convenient integrations and technologies.

The benefits and advantages of using Amazon Lex include the following:

  • Simplicity. Amazon Lex console enables you to quickly and straightforwardly build your own chatbot. Using only a few example phrases can create a complete natural language model that allows the bot to interact.
  • Automatic speech recognition (ASR) and natural language understanding (NLU). These are the same technologies that Amazon's virtual assistant—Alexa—is built with.
  • Seamless deployment and scaling. Thanks to it, you can deploy your chatbots directly from the AWS management console. You also don't need to worry about scaling, as this happens automatically.
  • Integration with the AWS platform. Amazon Chatbot has built-in integration with other AWS services like AWS Lambda, Amazon Cognito, and Amazon CloudWatch.
  • Cost-effectiveness. Amazon Lex doesn't involve any upfront costs or minimum fees. You will be only charged for the text/speech requests made (pay-as-you-go billing model).

Thanks to the combination of the above features, the Amazon Lex chatbots will surely provide your users with an engaging user experience and improve your digital products.

Who is the chatbot user, and what do they want to achieve?

The above question is a very important aspect of every chatbot. Chatbot as a human-machine communication channel (brand, product, service) can only be used in some instances.

At the current stage of Amazon technology development, the Lex chatbot is used to resolve a specific issue, like renting a car, booking a hotel, or ordering coffee. The Amazon Lex bot, however, will not calm an angry person or replace a form in which the precision of the user's response is the most important thing, e.g., applying for electronic identification (eID).

The Amazon Lex chatbot can be a seller or provide customer service. It can ask qualifying questions and give the user several options to choose from. Moreover, it allows you to complete an inquiry or order by collecting relevant data, including personal data.

The big advantage of the Amazon Lex chatbot over a regular website form is the ability to learn about the user's natural responses. This means that when the user chats with a chatbot, they formulate sentences themselves. For comparison, in a regular form, the user follows a predetermined path.

Did You Know...

Machine learning — technological memory of certain patterns and behaviors that the machine has "experienced" before. Machine learning also enables the analysis of new data and searching for solutions that have worked in other situations that the machine knows about.

This allows us, as chatbot developers, to learn the style of communication (used words, how the problem is described) of the user. Thanks to this, we can improve the chatbot and apply machine learning. The process of collecting data in Amazon Lex does not happen automatically; it needs to be programmed.

The chatbot seems to be an effect of the designer's creativity. By using the available tools, we will manage to determine the user's role based on the provided answers.

At the beginning of the conversation, our chatbot determines whether it is talking to a representative of a pharmaceutical company, doctor, or patient.

After deducting who the interlocutor is, the chatbot launches the appropriate conversation scenarios. All this helps to lead a doctor or patient with specific needs to the designated goal.

A pencil sharpener in a form of a robot on a desk
Chatbots are an increasingly standard solution for companies. | Source: Matthew Hurst / Flickr.com / Bit.ly/2CRvN09 / CC BY-SA 2.0

Differences between website UI and chatbot text-based interface

A button on a website leading to a form:

Example of a button leading to a form

A text chat with a chatbot:
Do you want me to place your order? Yes/No

Chatbot design vs. Amazon Lex operation logic

A Chatbot consists of conversation components. The two basic components of Amazon Lex logic are intent and slot. Understanding them is key to the design process.

Intent represents the goal that the user wants to achieve. For example, make an appointment with a doctor, make a hotel reservation, buy a flight ticket, etc. Intents are made up of slots.

A slot is part of the data that the user must provide to achieve their goal (Intent). Such data can be a meeting place, date, or city. You can create slots yourself. Amazon Lex also has its own slot library that simplifies the chatbot creation process. Lex recognizes countries, numbers, data types, and programming technologies.

For the chatbot to start an intent, the user must be specific: "I want to make a hotel reservation," "My flight was delayed," or "I am looking for a gynecologist in this area." This is called an utterance.

Each chatbot can have several intents, i.e., it can achieve several goals of users. The chatbot can make a hotel reservation and buy a flight ticket.

While asking the user for the data needed to fill the slots, the chatbot can answer by using prompts. These are the questions such as: "For what day do you want to make a reservation?", "For how long was your flight delayed?", "What's wrong?", "In what area are you looking for a gynecologist?".

Fulfillment is a process started by the chatbot after filling the Intent with all data, i.e., slots. During it, we decide whether the collected data will be saved to the database and where it will be sent (e.g., for analysis by the image recognition algorithm or translation).

Amazon Lex - Quickly Build Conversational Interfaces

Amazon Lex chatbot vs. A website form

The language of the chatbot

Currently, Amazon Lex's automatic speech recognition only works with American English. You can introduce machine translation into the chatbot with additional effort and integration of several other services, such as Amazon Translate or Google Translate. However, this will not be the native Amazon Lex mechanism. In the case of a standard form on a website, you don't have to limit yourself and can implement it in any language.

Knowledge about the user

In the case of a form, the knowledge about the user we receive is very limited. We can find out whether the user reached the end of the form and sent their inquiry or (and at what point) abandoned the form. Meanwhile, the chatbot knows what phrases a customer uses, how they formulate thoughts, and what mistakes they make. It provides valuable information about the user. This allows the improvement of the chatbot by expanding its dictionary.

It also allows you to increase conversion, improve product presentation, and enter expressions (triggers) into descriptions. Triggers will increase interest in the product or service.

A man sitting at a table using a chatbot on a phone
The chatbot is useful when improving the process of communication with the client on a website or in a mobile application. | Source: Pexels.com

What should you remember when designing a chatbot?

Essential things to remember:

  1. You need to determine who the user is and what goal they want to achieve.
  2. Remember the language of conversations and the limitations of multilingualism.
  3. Divide user goals into intents. One goal equals one Intent.
  4. Determine what data is necessary for the chatbot to achieve the goal.
  5. Evaluate what should happen to the data that the chatbot collects: whether they are to be forwarded to process an order or whether they are to be analyzed.
  6. Design the conversations of the chatbot so the user submits relevant data to achieve the goal.
  7. Analyze user queries to improve chatbot conversations and improve product and sales presentation.
  8. Conversations can be designed so the chatbot recognizes the persona of the user (target group). When talking to the chatbot, the user can return to another conversation thread.
  9. The Amazon Lex chatbot can be distributed using chat services such as Facebook Messenger, Slack, Kik, and Twilio SMS, as well as any website and mobile application.

Hero shot: Michele M. F. / Flickr.com / Bit.ly/2XBFuJt / CC BY-SA 2.0

Are you looking for a Web Development Company?

How you like that:
Journal / JPG / Dymitr Romanowski - avatar
Author: Dymitr Romanowski
Product Designer, Head of Design

Are you interested in working with us? Take a look at our Portfolio