The full tech stack to run a chatbot — behind the scenes of an open source bot platform

jcabot

Jordi Cabot

Posted on July 12, 2022

The full tech stack to run a chatbot — behind the scenes of an open source bot platform

Image description

We always aim to "educate" aspiring chatbot developers about the software challenges of building and running a good chatbot. Today we want to go a bit further and give you a behind-the-scenes look at all the languages, libraries and frameworks that must play together to run a chatbot.

As the full stack depends on the specific chatbot (especially regarding the communication channels where it will be deployed), we will use our ecommerce chatbot as an example.

1. The core chatbot logic

The core elements of the ecommerce bot (the intents, training sentences and business logic to execute for every matched intent) are implemented with our Java Fluent API that wraps a set of EMF-based core classes modeling our chatbot specification primitives and the help of Lombok to simplify the writing of the bot specification.

As the bot is automatically adapted to the data of the eCommerce shop hosting the bot, the bot logic communicates with the WooCommerce API and stores some shop data into a SQL PostgreSQL database.

2. The NLP Engine

To determine which chatbot intent is the best match for the user textual input, we rely on nlp.js (in JS) though we are in the process of moving to our new Python NLP server for better optimization of the needs of eCommerce conversations. A preprocessor language model is also used to improve the chances of a matching.

3. The front-end

The eCommerce chatbot is implemented as a WordPress plugin in PHP whose mission is to simply embed in the proper PHP WP pages the Xatkit widget displaying the bot. The widget itself is a react component that talks with the server component managing the core chatbot logic via a websocket.

4. The configuration and monitoring component

Any non-trivial bot comes with a dashboard to configure the bot (e.g. removing some predefined conversations, adding new ones, ...) and monitor its results, showing, for instance, the user questions the bot was unable to understand.

Our eCommerce dashboard is a Spring application relying on Thymeleaf as server-side Java template engine and foundation as responsive front-end framework.

All in all, chatbots are indeed a complex piece of engineering

Take a look at all the links above. We have 5 major programming languages (together with their package managers: maven, npm,...). 7 if we count HTML and CSS. Plus a myriad of auxiliary libraries and frameworks that require specialized knowledge, e.g. knowing Java doesn't mean you can master Spring in a breeze. Or even less that you would be able to create Java Fluent APIs.

If you don't have the luxury of having a large team with specialized profiles, maybe it's time to start testing all these intelligent code assistants. And I'm only half-joking.

Definitely, I feel we need better software engineering tools that help manage the complexity of these type of multi-language projects and their dependencies. For instance, we have (a few) tools for reverse engineering large codebases written in one language and help you understand and evolve it. But I don't know any that can do the same with a number of different repositories (we have over 80, including private ones, in Xatkit !) in a mix of languages where the dependencies between the components are not as "easy" as looking for imports or references in the package manager definition.

While we wait for these tools to pop up, any tech question on the internals of Xatkit you'd like to know? And if you want to read more about the technologies we have listed above, this twitter thread gives some pointers to good tutorials for them:

💖 💪 🙅 🚩
jcabot
Jordi Cabot

Posted on July 12, 2022

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related