Chatbot Building 101: Detailed Guide for Creating Your First Bot

Chatbot Building 101: Detailed Guide for Creating Your First Bot

You have probably heard that artificial intelligence is conquering the business world, and that Dominos, KLM, and many other successful companies decided to replace their customer service, support, and sales staff with chatbots.

Chatbot can be much more than a user interface or a convenient tool for customer support and lead generation. With the proper planning, goal setting and formatting, it can function as an independent program that provides different types of services to end users, analizes its audience, and tests various business models.

Understand how chatbots can help businesses

Benefits of chatbot implementation are far-reaching, but for most big and small companies they include:

  1. Easy interface that consumers understand and love – consumers love instant messaging, everybody is on their phones all the time, at home, on the commute, in bars, restaurants, at work, and in schools;
  2. Cutting business costs – companies that use chatbots can do more, with fewer employees in customer service, support, sales, and marketing divisions.
  3. Allowing employees to focus on business improvements and development – by automating repetitive and boring tasks.
  4. Providing services and selling products 24/7 – your company’s services and support won’t be limited by your staff’s working hours.
  5. Adding new communication channels between businesses and consumers – is another level of convenience for your users that increases their overall satisfaction.
  6. A chance to thoroughly analyze your audience’s needs – consumers reveal more about themselves when they are communicating in the free text, or voice form.
  7. Presenting the company’s offer in a new and exciting way – let’s face it, chatbots are very trendy.

Apart from these universal benefits that we can relate to almost all business chatbots on the web, there are also plenty of industry- or case-specific advantages that you should recognize. These can vary from improving product sales to automating employee onboarding.

List of services

If you are a professional chatbot developer, clients will often tell you the list of functionalities they want in their chatbots. In this case, you should focus on widening up this menu and finding ways to implement more features.

Let’s take a look at this example, shall we:

Sam – The Car Dealership Chatbot

I created this chatbot for the Snatchbot Store. The order wasn’t specific, so in the beginning, the only feature was a car presentation.

  1. Presenting cars on offer;

Still, I decided to add new features to the list, including:

  1. Filtering vehicles with “new” and “used” tags;
  2. Allowing users to choose between paying the car in full, and taking a car loan;
  3. Allowing users to add their used car’s trade-in value and subtracting it from the car’s price;
  4. Subtracting down payment from the loan sum;
  5. Choosing the loan by the number of monthly payments;
  6. Calculating a monthly payment for a specific loan;
  7. Sharing dealership’s contact, location and company information;

This is an impressive list of features for a bot you can get for free in the Snatchbot Store. Still, if the bot wasn’t a store-prototype, we could add even more complex functionalities like:

  1. Allowing users to choose loans by interest rate;
  2. Limiting users’ loan choices depending on their monthly salary or credit rating;
  3. Scheduling test drives;
  4. Notifying users and dealership staff about the scheduled test drives, through Google Calendar app;
  5. Calculating used car’s trade-in value;
  6. … Opportunities are endless.

Important decisions

To implement all these features, and publish our chatbot online we would need to make some ground-breaking decisions.

1.    How to create your first chatbot?

Code everything yourself – The most skilled developers and development teams can code the whole chatbot themselves. Of course, this type of chatbot building can be challenging and time-consuming. It will also require prior knowledge of machine learning and natural language processing, as well as one or a few programming languages, like Python or Java.

The pros of this approach are in the customizability of the end product. If you choose to build a bot from scratch, you can control every feature and every aspect of the chatbot building process. Some of the open source libraries that you can use for making your bot smart include Apache Open NLP and Stanford Open NLP.

Using chatbot frameworks – If you would like to simplify the chatbot building process, you should either choose a specific bot framework or a chatbot platform. Although these two terms are used interchangeably, the difference between them is similar to the difference between CMS platforms like WordPress, and web development libraries like Bootstrap in website development.

Frameworks allow developers to code better and faster, to integrate their chatbots with NLP engines and easily deploy them to communication channels. Some of the most popular bot frameworks include:

  • Microsoft Bot Framework – provides Bot Builder SDK, Luis NLP engine, Developer Portal and Bot Directory.
  • ai – extracts time, place, date and other common entities and users’ intents and sentiments.
  • DialogFlow – is currently the most famous NLP engine, that allows you to deploy your chatbot and offers a list of SDKs and libraries. The DialogFlow is presently somewhere in between the bot framework and the chatbot platform.

But what are chatbot platforms, and what are the advantages they bring? Platforms like Snatchbot, Many Chat or Chatfuel, allow people who have zero experience in coding to create fully functional chatbots, deploy them on the supported channels and even connect them with outside databases and APIs.

Some chatbot platforms like Snatchbot, for instance, have their own NLP engines, so you can build and deploy natural language understanding models directly on the platform and add it to your chatbot with one click. At the same time, Many Chat, Chatfuel, and most other platforms require you to import NLP functionality from DialogFlow, through an API connection.

2.    Where to deploy your chatbot?

Chatbots can be deployed on many different channels. If you are coding your bot, you can connect it with any communication platform that allows this type of integration, and the list is enormous.

With platforms and frameworks, you already have a list of premade automatic integrations. That is why you should check whether framework integrations suit your needs, before choosing. Platforms like Many Chat and Chatfuel are very limited regarding deployment because they are predominantly crafted for the Facebook Messenger (although Chatfuel bots can also be published on Telegram).

As far as automated platforms go, Snatchbot is the absolute champion in terms of deployment. It allows you to connect your bots with: Live, Viber, Facebook Messenger, Slack, Skype, Twilio (for sending SMS) custom API channel, or your website.

From the frameworks we mentioned in the text, DialogFlow offers the highest number on integrations, and you can connect it with: Google Assistant, Slack, Facebook Messenger, Line, KiK, Skype, Cisco Spark, Telegram, Cisco Tropo, Twilio, Twitter, Viber, and Dialog Flow Phone Getaway.

Unlike Snatchbot where all integrations are automated and can be done in one or a few clicks, the Dialogflow offers integration libraries on GitHub.

3.    What other tools you should use?

Apart from the chatbot platforms and frameworks, there are plenty of other tools that can speed up the chatbot building process. The selection of tools depends on your development choices. Most people who want to code their chatbot use editors like Visual Studio Code.

Besides that, it is also recommended to create an account on GitHub, where you will find helpful libraries for adding the NLP functionality and integrating your chatbot on channels.

I would also recommend Draw.io, an excellent free diagramming solution that allows you to create a scheme of the bot’s conversational flow or 3rd party connections. If you provide chatbot building services, always send a bot diagram to your clients before starting the project work. This way you will solve all potential misunderstandings and add more transparency.

Some chatbot platforms have limitations regarding images and videos that you can upload. That’s why it is sometimes useful to host these elsewhere and add them to the chatbot’s flow in the form of URLs. So, before you start building the first chatbot create an account on image and video hosting platforms. In my projects, I mainly use Imgur for images and YouTube for videos. A YouTube account will also be helpful later on after you create a video demo of your chatbot for promotion.

Instant messaging communication is fun, and that is one of the best advantages of using chatbots for customer service, support and lead generation. To make it even more humorous and exciting, you should add emojis to chatbot messages. So, before you start adding dialogs to the chatbot interactions, choose a favorite emoji library. I use Getemoji.com.

Apart from integrating chatbots on instant messaging platforms, you can also build outside connections with various apps, through REST APIs. Most chatbot development platforms allow you to send POST and GET requests to custom URL addresses and receive responses from outside sources. If you are a professional developer, you can build APIs yourself and programs that edit and redistribute HTTP requests and transfer data.

Even if you don’t have coding experience, you can successfully use this functionality, with the help of platforms that provide app integration services. These include Zapier, IFTTT, and Integromat, so I would suggest you create accounts on these platforms and combine free and premium features they offer.

Now, to sum this up, I will provide you with a complete list of tools you should check before you start with your first chatbot building project:

  • Code editors like Visual Studio Code (only if you building your chatbot from scratch)
  • GitHub (same here, although it might also be helpful for connecting your platform-hosted chatbot with an API)
  • Draw.io
  • Imgur.com
  • YouTube.com
  • Getemoji.com
  • Zapier.com
  • Integromat.com
  • IFTTT.com

4.    Where will you host the generated data?

Hosting of the chatbot data is a critical issue, especially for chatbots that are used for personal data extraction and manipulation. Most first world countries have stringent laws that regulate data use, and user privacy.

Lately, the digital marketing community was stunned with the GDPR, the strictest law yet, which regulates the extraction, storage and use of EU citizen’s data. Similar rules are also applied in the United States, primarily if your chatbot deals with sensitive data, in healthcare, or financial field.

For example, the United States’ HIPAA strictly regulates health information privacy, especially when data is stored in the cloud (which is the case with most chatbot platforms). That is why data hosting and exports are fundamental issues when creating chatbots.

Besides platforms, you can also host user-generated data on private servers, but this type of chatbot building project requires coding skills and experience.

Chatbot UX Design Basics

After we have created a diagram, which includes all chatbot functionalities and created account on the desired platform and all the other helpful tools, we will start building our first chatbot.

Before we start, we should check the chatbot UX design basics and find out how we to make our bot more open, useful and attractive to users. We will list some of the basic terms every chatbot developer should know:

Welcome message

Every chatbot conversation starts with the Welcome message. It usually contains some basic greeting, introduction, and in some cases it can have a call to action button or more complex navigation in the form of main chatbot menu.

Main menu

Same as websites chatbots can also contain menus. The best place to add a menu is at the beginning of the conversational flow. It can be in a welcome message or in a particular block that is purposely created for navigation. Adding the main menu, in the beginning, allows us to segment users by their intents and increase chatbot understanding later on.

Of course, there are also chatbots that entirely rely on processing natural text forms, and don’t contain any navigation or user segmentation. These types of chatbots are much harder to build because they need to have an NLP model for every possible user intent.

With today’s level of natural language understanding, menus and quick reply buttons are still essential parts of chatbots. Especially the ones created for business purposes.

Permanent menu

Permanent menu is not the same as the main menu. From the users’ point of view, this menu is usually placed in line or under their text input field in the chat window. Most instant messaging platforms limit the number of options we can add to the permanent menu, and that is why it is rarely used for message navigation.

Instead, we can add options like:

  1. Visit the company’s website – or some other custom URL;
  2. Restart the chatbot – start from the beginning of the conversational flow;
  3. Live chat – talk to a human being;

Content

Like websites and mobile apps, chatbots too are meant to share some content. Most platforms allow us to use text, images, and videos, for telling the company’s story, listing its services, promoting and selling products, providing support to users, etc.

Extracting user data

Data extraction makes chatbots interactive, and it allows us to use this data for creating orders, generating leads, subscribing users to broadcasts, getting feedback, conducting business and other types of analysis, creating buyer personas, etc.

Some chatbot platforms allow us to add user input fields to the conversational flow. Others can extract text and voice, and even recognize when users don’t format their inputs in the right way.

For example, if the chatbot asks users to type their email address, with the use of certain platform features, it can only accept correctly formatted emails that contain “@” and domain abbreviation. If the users’ input isn’t formatted in the right way, chatbot will send an error message.

Snatchbot platform offers the highest number of extraction options, including:

  • Email extraction
  • Phone number extraction
  • Number extraction
  • Address extraction
  • Date extraction
  • Duration extraction

Exporting data

Most chatbot platforms offer one or a few data export options. Usually, the information is shipped by REST protocols, using the POST or GET requests. Chatbot admins can place user answers in HTTP request body as parameters (which are often called attributes).

When sending these requests the platform opens communication with the end server, so in some cases, they can also receive information from third-party apps and display it to the user.

On most platforms, this functionality is named “JSON” or “JSON API.” Sending information one way, without expecting a response is often marked as “webhook.” Webhook feature is the easiest way to export data and can be quickly integrated with Zapier, Integromat, IFTTT and other similar platforms, and all the apps on their lists.

Receiving back information and displaying it to the user, is a much more complicated process because chatbot platforms can only receive responses that are correctly structured. That is why these connections often require the creation of custom programs that collect and re-send HTTP requests and responses.

Most platforms allow admins to save any user input as an attribute or a variable, which can be then added to the outgoing HTTP request.

Variables and arithmetics

Not a lot of chatbot platforms allow you to use variables, but the ones that do, give us the opportunity to build handy features. Variable in a chatbot is the same as the variables used in mathematics or programming. It allows us to store specific values and use them later.

Imagine an eCommerce chatbot that offers a cart payment feature. This type of functionality is tough to make without establishing an outside connection, with a database that will store the products users added to the cart. On platforms that allow us to use variables, we don’t need to connect chatbots with outside sources; we can save product prices or names as variables, and then add them to the final price sum when users finish their shopping.

Apart from variables some chatbot platforms also allow us to use more or less complex arithmetic and logical functions. Snatchbot is the only big platform that has these options. It allows you to add, subtract, divide and multiply numbers and variables and use logic functions to create if clauses within messages.

Payment getaways

Adding a payment getaway will empower your chatbot and turned it into a revenue stream. Messenger-based chatbots usually support Facebook payments, while Snatchbot is the only platform that allows PayPal integration. Even the platforms that don’t support a particular payment getaway can be connected to it with the help of JSON interaction.

Live Chat

It doesn’t matter how many potential user inquiries you have covered; there will always be questions your chatbot won’t be able to answer. As a chatbot admin, you will feature hundreds of complex, and sometimes even meaningless and borderline-stupid queries and constatations.

Every chatbot developer strives to include human-like intelligence and wit in their chatbot project. Unfortunately, this concept is still unavailable, even to the biggest companies, like Google or Facebook and their research teams. That is why both big and small businesses need to help their chatbots from time to time, by allowing human operators to intervene.

Depending on the platform a human agent will be able to join the conversation through the instant messaging app, or the chatbot platform. The live chat option should be visible to users at all times, so it is a good idea to add it to the permanent menu.

The live chat function can also be called when users are stressing their dissatisfaction with the chatbot. In this case, the human agent will do damage control and quickly solve users’ issues.

Connections and Natural Language Procession

Chatbot understanding of users text or voice can be rule-based and or it can involve natural language processing. While rule-based understanding only recognizes the predefined words, natural language processing uses the machine learning component to match similar phrases and syntaxes with predefined user intents and entities.

This process also allows admins to use user-generated responses for training chatbots and improving their understanding. To use NLP in your bots, you first need to choose a platform that will enable you to build NLP models. Each model covers one user intent or entity. So, for example, a user who wants to buy a bus ticket can type:

  • I want to buy a bus ticket.
  • Can you give me one bus ticket, please?
  • I’d like to purchase a bus ticket…

In this case, buying a bus ticket is the intent, and there are hundreds or even thousands of ways to post this inquiry (especially if we also involve bus destination, departure and arrival times, etc.). By adding hundreds of examples, and training your chatbot, you can teach it how to recognize all similar phrases and sentences and use meaningful responses when users post these inquiries.

Most chatbot developers who use Many Chat or Chatfuel, use DialogFlow or Louis frameworks for creating the NLP functionality and adding it to their chatbots. Snatchbot, on the other hand, has its NLP engine, and it is one of the rare platforms that allow you to build chatbots without coding and add NLP without connecting to outside APIs.

Goodbye message

In the same way as we welcome the chatbot users, we should finish our conversation with an appropriate greeting. Goodbye message tells users that they have come to the end of the conversational flow, and informs them about potential follow-ups. This message is vital for good UX because if we don’t put an end to the conversation, users might think that our chatbot is bugging.

Broadcast

Does the goodbye message mean that we finished our conversation with the user for good? Of course not. Let me introduce you to one of the most used chatbot features, which motivated hundreds of marketing professionals to enter the chatbot development world.

The broadcast feature, allows us to broadcast content to instant messaging app users, who already communicated with our bot. Broadcast messages can be sent to all contacts, or we can use various parameters to filter out our best buyers, subscribers, leads, or any other user category. Messages can also be scheduled and continuously reposted on a daily, weekly or monthly basis. Sounds like a marketer’s dream, doesn’t it.

I explained some of the most basic elements of every chatbot and tricks that will help you to design your first chatbot and perfect its user experience. Chatbot development is a growing niche. We just started posting our content, so in the next couple of months, you may expect dozens of articles about chatbot development, use, and promotion. Don’t forget to follow our trending and news articles because the world of automated conversational agents is shaping as we speak.

1

Branislav Srdanovic

Freelance chatbot developer, who always emphasizes practicality, user experience and usefulness of chatbots and passionately writes about automation, A.I. and the improvements the latest tech can bring to big and small enterprises.
Farid Dokuchaev November 9, 2019

Thanks a lot! Very interesting topic. Want more information about integration integromat and snatchbot!