Select Page

As we discussed in a recent post, building a (chat) bot from scratch is a complex task that requires to orchestrate very different technical solutions. Let’s see how Xatkit can help here and help you build great bots in no time!. Consider this relatively simple specification of a Q&A bot:

The bot should understand a given set of questions, search the appropriate answer in a knowledge base, and reply to the user. Users can ask questions to the bot through Slack or Facebook Messenger.

These few sentences already provide a clear idea of the capabilities of the bot we want to build. However, every single word in bold corresponds to a totally different technical stack:

  • Natural Language Understanding is typically implemented with the help of AI-based libraries or online services you need to configure with examples, training sentences, and parameters.
  • Knowledge bases can be represented with ontologies, relational databases, or even Excel files. Each format has its own query language.
  • Slack and Facebook Messenger are messaging platforms where your bot can receive and send messages. Both expose a different API you need to learn in order to interact with the service.

We haven’t yet started the development of our bot and we already have to learn a bunch of technical stuff ????. While this may be fun to some extent, it increases the development time and cost of the project, and adds a lot of risk and uncertainty to it. What if the NLU solution you spent weeks to master does not deliver as expected for your use case? What if Slack or Messenger API evolve? How do you deal with new requirements such as supporting a new messaging platform, or using sentiment analysis to improve customer experience?

One framework to rule them all

We created our open source Xatkit bot platform to solve this very issue: we want you to focus on the design of your bot, while we take care of orchestrating all the services you need.

How can we achieve that? Thanks to three components that are at the core of any Xatkit bot:

  • An abstract DSL
  • A platform mechanism defined at the right level of abstraction
  • A frictionless deployment engine

Bots are state machines

Xatkit embeds a Java DSL to define the behavior of a bot as a state machine able to understand what the user says (or the events it triggers) and react to that. Each bot is represented as a graph of states linked together via user intents, and where each state contains a body with arbitrary code to execute. When the bot receives an intent it transitions from one state to another, and executes the corresponding state’s body.

See below an example state machine for our Q&A bot. The bot starts in a Waiting state, awaiting for a user input. When the user expresses the HowManyBooks intent the bot moves to the BookLookup state, and searches the information in its database before printing the result back to the user. Finally the bot returns to its Waiting state through an automated transition (dashed arrow).

Book Bot State Machine

The key point here is that you don’t need to make any assumption on how the intents are created. You just say these intents exist and that’s all you need for now. The state machine above can be expressed with the Xatkit DSL as follows:

✅ That’s one problem solved! You don’t have to deal with low-level NLU library configuration, Xatkit takes care of it for you!

High-level platforms and actions

Our state machine is a good start, but printing the result in the console is not enough: we want our bot to reply to the user on a given messaging platform. Since Xatkit states accept arbitrary Java code you could do it manually from scratch, but we have something better for you: platforms ????

Xatkit platforms are lightweight plugins wrapping low-level libraries and exposing a simple API adapted to bot designers. Simply put, you can forget about connecting your bot to Slack, dealing with OAuth flows, or recovering from network issues, we do it for you! Instead, you can focus your time and attention on using the high-level methods we carefully crafted, such as SlackPlatform.Reply(message) to reply to a message received from Slack.

Cherry on the cake, Xatkit’s platform infrastructure is not restricted to messaging platforms. It also wraps complex business logic such as connecting to a knowledge base and retrieving data from it. Check our documentation for the list of platforms supported by Xatkit.

We can now adapt our Q&A bot to use the Slack and SQL platform to retrieve the number of books and print it:

???? As you can see there is still some low-level knowledge required to write the SQL query, because the SQL platform is designed to interact with any kind of relational database. You can however raise the level of abstraction and create a platform fitting perfectly your information system and exposing methods such as BookDatabase.getCount().

Frictionless deployment

Our Q&A bot is ready for deployment. Is it time to leave our comfortable world of high level abstractions to make sure the NLU engine is properly configured, the connection to Slack established, and our knowledge base ready to be queried? Not yet, we have one last thing for you ????

Xatkit platforms and NLU providers are configured in a declarative way, so you actually don’t have to see any of the deployment logic to run your bot! The documentation of each platform provides instructions on how to configure it, check for example the configuration of our Q&A bot below:

And that’s all, you can literally provide a state machine and a configuration file to Xatkit and let the framework manage all the services you need. You want to switch the NLU provider? It’s a one-liner in the configuration! You want to use a different database? Change the xatkit.sql.url and you are good to go!

Conclusion

Xatkit isn’t just another bot solution, it’s a fully-fledged orchestration service defined at the right level of abstraction to ease (chat) bot development. The state machine DSL lets you focus on the behavior of your bot in an abstract way, while the platforms ease your life when dealing with specific libraries. Bot deployment is described in a declarative way, and you don’t have to learn a bunch of new technologies to build your own (chat) bot. You can actually start right now, we are taking care of the details ????.

Featured image from bmc blogs.

Learn to build great chatbots

Learn to build great chatbots

Read about the latest trends in the world of bots and chatbots, with special focus on chatbots for eCommerce and customer support

You have Successfully Subscribed!

Pin It on Pinterest

Share This