Over a million developers have joined DZone.

The Anatomy of a Chatbot

DZone 's Guide to

The Anatomy of a Chatbot

We explore all the components of a chatbot (like backends, channels, and integrations) and the typical costs that go into building one today for most organizations.

· AI Zone ·
Free Resource

Building a chatbot as an alternative to mobile apps is becoming a viable option as developer tooling for chatbots matures — but how much does it cost to build one?

Enterprises are tempted by the idea of creating chatbots that do not require sophisticated UI design, support for multiple mobile platforms, long development cycles with lengthy app store reviews, or expensive acquisition strategies to draw users into apps.

But building a chatbot still requires careful planning to ensure meaningful return on investment, beyond the bells and whistles associated with owning an intelligent chatbot. In this article, I will highlight the six components required to build an intelligent chatbot at the average market price at $60 per hour using the available developer tools today.

6 Components Required to Build an Intelligent Chatbot

1. Backend

Your chatbot will need a backend to handle messages from different channels and process them with NLP services such as Wit.ai, Api.ai, or LUIS. Further, your backend will also hold all of your business logic and integrations with existing systems and will be used to build your conversational intelligence so that you know how to lead the conversation with the user. The majority of platforms support both .NET and Node.js server-side SDKs, so you can safely choose the language based on your preferences.

2. Channels

Once you have your backend set up, you will need to create endpoints for integrating with each specific channel. Every channel integration is different, but in general, they follow the practice of setting up an endpoint in your backend for sending and receiving messages that rely on access tokens authorization. Further, you will need to implement some channel specific UI in the form of quick reply buttons, or visual cards that guide the user during his conversation.

If we take, for example, Facebook Messenger, it supports opening hosted Webviews that give you an unlimited flexibility of showing conversation rich UI using JavaScript, HTML, and CSS.

3. Natural Language Understanding

As soon as you are able to receive messages from your specific channel, you are most likely to use some of the natural language processing (NLP) services to extract intents and entities out of the user messages. Example of such services are Wit.ai, Api.ai, and LUIS that all support both .NET and Node.js SDKs.

Setting up an NLP service and processing the messages using an SDK for the service is straightforward. However, training the NLP intents and entities that might be already existing in an external system is not trivial, since the NLP services provide UI for inputting the entities and their values manually. In reality, you will need to understand entities that map to specific objects that already exist in an existing system such Products, Contacts, Employees etc.

As with any user input, you will need to implement some business logic validation rules on top of the extracted data. It can range from simple validation such as regular expressions, or custom validation calling a web service to check the validity of a pin code.

4. Conversational Intelligence

This is where things start to get really complicated. Designing an intelligent conversation based on the NLP intents and entities is a journey that can be as deep as a black hole for your expenditure. You have to develop an algorithm for each conversation, and a simple navigation, so that the user can start over. You can use simple decision trees, state workflows, slot-based algorithm or some advanced deep learning algorithms to control the conversation.

5. Integrations

Since the main purpose of your chatbot is to execute some business process such as ordering items, purchasing products, or booking appointments, you will need to integrate with an existing system. The integration will involve business logic validation and rules, a persistence of data and any other operations that might be required as part of your business process. If you already have a backend with a good service layer, you can easily realize some savings here.

6. Control Panel (Optional)

Once your chatbot is deployed and your users are actively using it, you might need a backend for exploring your chatbot conversation history (for channels that don't support it out of the box), users, error logs. You can also add a simple analytics metrics to understand your bot's performance.

Total Cost of a Chatbot

The back of the napkin estimate for an intelligent chatbot that uses Natural Language Understanding and is integrated with an existing set of systems deployed in Facebook Messenger comes to about $35,040 based on our experience.

ai ,chatbot ,bot development ,nlu

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}