Skip to main content

How to create a simple Chatbot?

Developing an amazing Chatbot ...

What is a Chatbot?

First to understand how it works, you need to know how it was originated and some algorithms  like  the Natural Language Processing (NLP). It is another AI area, but it is around the language (usually written), it is the component that bridges the gap between human conversation and understanding programmed by a computer. NLP allows the computer to interpret the vast and complicated human language, understand it, process it, and effectively "speak", just like humans.

Through the process, the machine has to understand all the jargon that is being using and developing or adapting with the ability to respond, as a human computer. NLP has to do with the creation of systems that process or "understand" the language to perform certain tasks, such as answering questions, analyzing the sentiment in a sentence, making translations between different languages, and another.

In the past, the NLP involved a lot of mastery of linguistics, the terms understandable such as phonemes and morphemes were quite standard, since there are entire linguistic classes dedicated to their study, to analyze a word this must be broken down into its prefixes, suffixes and analyze the root. However, with Deep Learning, this process is completely different, since it uses several techniques.
One of the techniques used is trying to represent words in vectors and store them in an efficient way. For instance, Word2Vec, the basic idea behind this technique, it tries to store as much information as it can in this words vector, keeping the dimension at a manageable scale (25 to 1000 dimensions), this technique operates on the idea that wants to predict the words around it. Another technique used to do translations is Sequence-to-Sequence (Seq2Seq).
So, a Chatbot is a computer program designed to simulate conversation with human users using artificial intelligence technology like NLP and NLU. They are also known as virtual agents or cognitive agents (in deep, they are different).

What are some uses, benefits and disgusts about using Chatbots?

The Chatbots are used to getting a quick answer in an emergency, resolving a complaint, getting detailed explanations, making a reservation, paying a bill, buying basic items, and more.

They have some benefits like: 24 hours services, getting an instant response, answer to simple questions, easy communication, a good customer experience, friendliness, approachability and another.

However, there are disgusts, for example: in some cases the people prefer to talk with a real assistant or use the website, they making mistakes and it was not able to chat in a friendly manner.

Channels and frameworks to create Chatbots

In the actuality, there are several way how to integrate your Chatbot with the most popular messenger applications, like Facebook, Skype, Slack, Line, Telegram, Twitter and more. It is important to know that, because it is better connect our Chatbot with some popular application that create our own platform.

Additionally, exists some frameworks that you can use to create your own Chatbots. For example, you could use Dialogflow (previously was called API.AI), Watson Assistant (formerly was called Watson Conversation), Wit.ai, Microsoft Bot Framework, and more. Some of them have SDKs that you can integrate it using several programming languages such as Python, Java, Node.js, Ruby, PHP, Android, Javascript, C# and another.

Basic concepts 

There are several concepts that you should know if you want to create a Chatbot. For example:

#intentions

An intent represents the purpose of a user's input. You can think of intents as the actions your users might want to perform with your application.

@entities

Objects that you want to interact with. Entities represent a class of object or a data type that is relevant to a user's purpose.

$context

It represents the current context of a user's request or something that the user told in the past.

How to design a Chatbot?

The first thing that you should do is try to define the scope, prioritize objectives and answer questions like: what is the Chatbot purpose?, what he should know and what he should not know? how I am going to manager the errors and the feedback? What channels and frameworks I will go to use?. To help you with this task, you can use some kind of canvas:

Then, it is important to give a personality to the bot, for instance, it is needed to give a name and a sex to him. Additional, it is great setting a visual appearance (how it will look), so you need to create a design. On the other hand, you should give a tone and voice to the Chatbot.


Once time that you have more clear how will be the Chatbot, it is moment to start creating flows and diagrams with whole information that bot should know and creating a table with the intents (possible questions that the customer can type), entities, contexts and the answers to the questions. These steps helping the developing process, having the information ready to use with almost all the needed by the bot.
The way how the information is shown is important, the appearance should be interesting and attractive. Try to avoid long texts, instead, use more images, videos or animations like gifs, buttons and carousels ... use your creativity and be innovative.

In this process, you can also use techniques like Design Thinking, to verify and validate that information that the Chatbot understand and the information that it uses to give a response. For example, you can simulate the Chatbot with a lot of flashcards (with some intents and answers) and the final customer, so the customer says a question and the human-bot tries to looking for a flashcard that has the better match with the question. If you do not have a perfect flashcard, that means, that you are not taking something into account, and need to improve some answer or flows.

In this video, you can see some steps that you should know when you are creating a virtual agent (Chatbot) with Dialogflow:

In this another video, you can see an easy demo using SDKs from Google or IBM to create Chatbots with UI:

Here you can see the demo code.

Additionally, you can test the Chatbot here:


Also, you can read about an Chatbot integration as Cognitive Kiosk here.

Popular posts from this blog

ISTQB - Foundation Level Agile Tester Recap

ISTQB - Foundation Level Agile Tester Recap This is a summary that will help you to approve the Agile Tester certification test. 1 - Agile Software Development 1.1 - The fundamentals of Agile Software Development  The Agile Manifesto has 4 values : - Individuals and interactions over processes and tools (people-centered) - Working software over big documentations (time to market advantage) - Customer collaboration over contract negotiation (customer requirements) - Responding to change over following plan (change is more important)   The Agile Manifesto has 12 principles : - Satisfy the customer with continuous delivery - Changing requirements - Deliver software frequently (few weeks or months) - Business people and developer must work together - Build projects around motivated individuals - Face to face conversation - Working software is the primary measure of progress - The team should maintain a constant pace indefinitely - Technical excellence and good design - Simplic

RasPI Assistant: Google Assistant + Dialogflow + Raspberry Pi

Would you like to control the TV using your voice without spend a lot of money? ... Amazing right?. So, in this post, I will teach you how to do that and more. Some of my dreams always have been control things without touch them, for example: the television, due to tired to raise the hand to change the channel. So ... let's create a device that can do this action automatically. What things will we need? First, I should understand the problem and be aware about it. For example: if we want to control a TV that is not smart, how will we do that? ... a possibility is to send infrared signals (IR) to transmit the events that the person's desire. Also, if I want that the device can hear me, I may need a microphone. Additionally, it should have a speaker to talk with the people. Further, I will need a database to save all the information, APIs that can help me with the smart logic and cheap electronic components like a Raspberry Pi , resistors, leds, wires an