How to Make a Chatbot?

Type of Chatbots

Scripted Chatbots

These are chatbots that follow a conversion flow that is 100% determined up front. At every step the user is asked to click a button or select from a limited number of options and their choice determines the bot’s response and what options are shown to them next in the form of messages, voice or graphical widgets. It is the same concept as the telephone IVR systems that cause so much customer frustration (press 1 for Sales, 2 for Support etc) but in this case the user experience is much nicer because it is often graphically driven and much smoother.

Intelligent Chatbots

These are chatbots that “understand” natural spoken language that is either input by voice or text. They are often also called “agents” instead of “chatbots”. For example, these bots can be used to answer frequently asked customer service questions, reducing the number of human agents needed to support customers. They can also be built to do a specific task, such as the x.ai agent which is used to book meeting. These chatbots work best when they are used to respond to broad but superficial commands (i.e. they are not required to enter into a dialogue with the user). Amazon Alexa, Siri and Google Home are examples are these types of bots or agents.

Application Chatbots

This is not strictly a distinct type of chatbot as it will contain elements of the above types of chatbots. It is, however, an important use case for chatbots and it will become more important in future. As mentioned, these types of bots have elements of the above bots but also have a graphical interface. When using the graphical interface of the chatbot there will be little difference between using a chatbot or using an application. For example, a flight booking chatbot may show the user a graphical widget that would look the same as the flight booking screen on their app. The difference being that in this case the widget is shown inside the chat channel.

Platforms to Create Chatbot

Another important factor in determining how to create a bot is what message platform you want to use. For example will your bot be a slack bot (used on slack), a Kik bot (used on Kik), a Facebook Messenger bot (used on Facebook Messenger), used on a web chat or another type of platform. Even email is an option.

Which chat platform you use is important for two reasons when developing a chatbot. Firstly, it’s important because you need to ensure that the chatbot development tool you are using makes it easy to connect to the chat platforms that you want to use. Secondly it’s important because each chat platform has specific functionality and the development platform that you use will determine to how much of the functionality on the target platform you are able to use.

For example, if you want to create a Slack bot you need to ensure that the development platform you are using supports creating a bot on Slack. Or if you want to take advantage of the chat extensions feature on Messenger, you need to ensure that the chatbot development tool you choose supports creating chat extensions on Messenger.

Ways to Make a Chatbot

Now we are at the point where we can discuss the actual chatbot development tools and how they relate to the type of bot that you want to create. A quick Google search will allow you to see that there are many bot platforms. There are only three main ways of creating chatbots right now however.

Create a Chatbot with Visual Tool

The first is by using a visual tool. These tools are built primarily for creating scripted bots. These tools, such as chatfuel, motion.ai, manychat, flowxo and octane.ai are great for building simple scripted bots.

To create a chatbot with these tools you will have to define the conversation flow of the bot in a visual way. For example you will have to define what choices the user will have at every step of the conversation and then define how the bot will respond when the user clicks a given choice. You will have to define the further choices it will allow at that point and so on until the interaction the conversation is concluded or ended by the user.

Each of these tools has a slightly different focus and some allow for more customization than others including “intelligence” features for example being able to respond to a word or phrase. The emphasis is on ease of use over functionality. True custom functionality that is needed for intelligent bots and application bots, such custom artificial intelligence, system integrations and custom graphical interfaces is not possible using these types of tools.

How to Make a Chatbot from Scratch

The second way to create a chatbot by coding a chatbot. This means using a programming language and relevant developer tools and libraries to create a chatbot. Using code offers many advantages over using a visual tool. There is no limit on customization (within the bounds of what is possible on the chat platform) and the development process can be managed professionally using all the tools and approaches that exist for software development including source control and testing.

If customization is required or integration with internal systems is required, the best choice is to code the bot. Of course the issues with making a bot this way are the same issues that exist for all software development.

A high degree of expertise is required to code software in general. Although creating a bot in code is not a particularly hard task for a software developer, it requires some expertise and understanding. A scripted bot on the other hand can be built very quickly on a no code platform with no expertise.

Another issue is that software developers can end up coding common features, from scratch, again and again, duplicating effort, especially when there is no good source of shared standard components. This results in a lot of wasted effort and potentially ad hoc non-optimal solutions to common issues.

Developers, especially when pushed to take short cuts because of time constraints, can end up with an architecture and code base that is not extensible or even easy to follow.

A chatbot that is developed through code can be a scripted bot, an intelligent bot or an application bot.

The Making of Intelligent Chatbots

Intelligent bots are built using AI, including natural language understanding tools such as Watson, DialogFlow, Wit.ai and Rasa NLU. You don’t need to be a data scientist to use these tools and some of the work can be done by non-developers using a GUI interface. A developer is however needed to integrate the natural language tool with the actions that the bot will take.

The tools mentioned above allow developers to define what the “intent” associated with a phrase that is spoken or written in natural language is. For example, all of the following phrases have the intent of booking a flight.

  • I want to book a flight to Paris.
  • I need to go from Dubai to Paris.
  • I need a flight to Paris from Dubai.

A developer would be able to associate all the above phrases (and many more versions) with the intent BOOK_FLIGHT. Whenever any of those phrases (and phrases that the NLU tool calculates are related phrases) are written or spoken to the chatbot, the NLU system would call a function in the chatbot code with BOOK_FLIGHT as the intent parameter. The developer would then add code that acts on the BOOK_FLIGHT intent. The NLU system will also pass through other relevant parameters that the NLU system has extracted from the conversation, such as the relevant airports and the relevant dates.

It’s important to note that many NLU engines currently only offered a hosted solution. So like with the no code bot development solutions, with these engines you may not be able to easily access or control your data, implement source control, reuse work between bots or switch systems.

Graphical Interface

Coding a bot also allows developers to include sophisticated graphical interfaces in the chatbot behaviour. These interfaces can only be used if the chat platform allows them to be used. For example, it’s not possible to put graphical interfaces into sms, so an sms bot would not have any sophisticated graphical widget associated with it. Some platforms such as WeChat and Facebook Messenger allow developers to put web views into the chat. This means there is no limitation on what sort of interface can be shown. Graphical interfaces are often much more effective than text interfaces for doing work on the desktop and mobile and should therefore always be used when there is advantage for the end user in doing so.

The Best Framework to Make a Chatbot

Botpress is a framework that allows bot makers to easily create bots using code. What makes Botpress different from other frameworks for creating bots with code is that it has a component architecture which allows for a high degree of reuse of common components. This means that common bot functionality like subscription or broadcasting doesn’t need to be built from scratch. Instead the relevant component can be added to the bot or accessed via the api, instantly giving it the required functionality. This functionality however can be further customized by editing the source code for the component in question. Botpress therefore provides all the benefits of coding a bot from scratch but makes it much faster and easier to build the bots because of the reuse of code modules.

The modular architecture is not only beneficial in terms of allowing for a high degree of reuse of components, it is also beneficial in that it forces developers to use a highly extensible and best practice architecture to create their bots. It has also meant that Botpress has effectively become a middleware for third-party chatbot development tools, such as Botkit and Microsoft Bot Framework, as well.

In addition, Botpress has introduced tools that further increase bot maker productivity. For example there is a separation of roles between those who create and manage the behaviour of the bot (the developers) and those who create and manage the content of the bot (the content creators and front line staff) and manage the user accounts. Botpress has features built into the framework to manage this separation like role based security and multi user management. Botpress invented Universal Message Markdown which is a widely used markdown language in the bot space to address this issue.

Chatbot Builder

The third way of creating a chatbot is by using an off the shelf tool. Obviously doing this limits you to whatever functionality is allowed by the vendor. This will likely be a process of configuring a bot rather than creating a bot. Typically these sorts of solutions are targeted at a specific industry vertical and are for large enterprises. These enterprises are capable of assessing the trade off between the convenience of outsourcing functionality and the long term advantages associated with having control of their data and the underlying processes.

How to Make a Chatbot: Summary

That's it! You have now learned the most important things you need to know to start your new bot project. I hope you find yourself with a better understanding of the steps required to automate conversations. If you think this post was useful, please share this page url and link with people interested in AI or working on chatbots!

In summary there are many ways to make your own chatbot. The methods to create bots reflect the methods available to create software more generally. There is clear analogy between creating a chatbot and creating a website. It is possible to create a website using a no code platform like Wix, or code it from scratch using HTML and CSS. In between those two approaches is the WordPress approach where the website is built up from components. Using Botpress to create a bot is the equivalent of using WordPress to create a website.

Related Articles

Why Chatbots are the Future

Are you making any of the following mistakes when creating chatbots?

Exploring the future of customer engagement with bots

Why every agency should be building customer service bots for their enterprise customers

What is Conversational Artificial Intelligence (AI)