This article is not about a ready-to-use chatbot. Instead, it is about an approach to building your very own chatbot platform inspired by a BPMN engine. NOTE: address the modern-day demand for instant, on-demand customer service. Chatbots They provide: Around-the-clock assistance. Capability to handle numerous inquiries simultaneously. And much more for businesses. With the ability to understand conversations, chatbots can provide personalized experiences, helping users do business over conversations. without human intervention, saving time and resources Why opt for a chatbot framework? If not chatbots, individuals in business roles, such as sales or support executives, would engage in conversations with customers to gather the necessary information. They possess the intellect and training required to handle these business discussions effectively. However, in the context of text or audio-based conversations, chatbots are employed to facilitate these business interactions. The chatbot framework serves as the platform, supplying the essential intelligence to manage such conversations. Chatbot Conversations as Business Flows Consider business flows as a flow diagram resembling a conversation blueprint where each activity requests and gets data from the user and completes a business use case. This enhances the user experience by guiding interactions in a structured, logical manner . A systematic approach ensures essential information is collected efficiently and the user is led to a satisfactory resolution without going off tangents. Let’s consider the business use case of booking a ride for a daily commute, with the chatbot. A simple conversation flow would look like the below image. Requisites we can expect from the chatbot framework - Manage the state of each conversation. State Management - Handle multiple conversations without cross-interference. Conversation Isolation - Support CRUD of business flows with a good user interface. Conversation Builder UI Make conversations about different business use cases at a time with end users. Parallel Conversations - - Support for multiple messaging platform interfaces like WhatsApp for user interaction with chatbot. Multi Chat Interface Requisites in terms of handling conversation needs for unexpected failures Error handling of conversation after a specific idle time Auto closure mechanism during extensive computation Wait and resume at any time and start from the beginning Ability to close a conversation Driving like text, list option, etc. conversation seamlessly with different user inputs Making and choosing the latter conversation path decisions based on user input BPMN (Business Process Model and Notation) and BPMN Engine is like a universal language designed for businesses to clearly and visually represent their processes. Imagine you're drawing out a roadmap of how a particular task or process is completed within your organization, from start to finish, with all the steps in between; that's what BPMN helps you do—a good fit for our conversation blueprint. BPMN Now, onto the BPMN engine. Think of it like the director of a play. It follows the script and the BPMN diagram and tells everyone (or every part of the system) what to do and when to do it to ensure the process runs smoothly from start to finish. The BPMN engine, like , reads the BPMN diagram, which, in our case, will be the conversation blueprint, and executes each step, helping the chatbot to pursue the conversation. Camunda In simple terms, BPMN helps draw out the conversation blueprint, and the BPMN engine brings that conversation to life! Building blocks of chatbot conversation blueprint - BPMN Components BPMN and its components will be used extensively in further reads. Please check out the If you are not familiar with it. BPMN Reference Now that we know how booking a ride will be executed, let’s see what BPMN components can be used to model the same as a BPMN diagram. Refer to the table below to understand the specific use case of some of the significant BPMN components that can be used for modeling conversations. BPMN Component Description Conversation Use-Case for Chatbot Start Event Indicates the start of the process and execution. To start the conversation. Service Task Service APIs process executables. To execute the business logic and decide the following message. User Task Executables are processed manually by users. Capture the data and complete the task by the end-user or the system. Script Tasks Scripts like JavaScript process executables. Any use case where scripts have to be executed without the load of a service task Timer Boundary Event Starts the timer flow if the execution waits for the time specified. To auto-close the conversation after a specific idle time Error Boundary Event To catch the unexpected error in task execution. Self explanatory. Exclusive Gateway It helps to model decision-based flow. One flow satisfying the condition will be executed. If the conversation proceeds with different paths based on some conditions. Parallel Gateway It helps to model decision-based flow. All the flows satisfying the condition will be executed. Parallel execution, like sending a notification to the system in the background. Event Sub-process Interrupt-based Process within the primary process. It can be executed with a start event like an escalation event. Common conversation flow where the user would like to close the conversation at any time in the main conversation. Escalation Start Event They are used for starting a sub-process by listening to specific escalations identified by their name. Start the event of the common conversation flow like starting a close conversation flow. Escalation End Event This event can end the primary process and trigger the sub-process listening to the escalation start identified by name. To trigger the start of the close conversation flows from the main conversation. Send and Receive Tasks. Executables present in the same process workflow or different workflows that can be used for inter-communication between them. Identified by similar names in both send and receive tasks. Use cases like the driver arrived webhook process informing the user conversation flow. Here, Driver-side and User-side processes are different. End Event Indicates the end of the process and execution. To end the conversation. Many other BPMN components can make the conversations modular, robust, reliable, and feature-rich. A complete modeled BPMN diagram for booking flow with all the complexities covered can look like this - . Book ride BPMN Diagram Camunda - The Process Orchestrator Camunda is a robust open-source platform engineered for workflow and decision automation. It empowers organizations to effortlessly model, implement, and execute BPMN workflows, CMMN cases, and DMN decisions. With a suite of tools, Camunda is a formidable asset in building our chatbot platform and running the book ride conversation flow. Camunda Workflow Engine Camunda workflow engine is the core service Camunda provides to . One of the standout features of the Camunda Workflow Engine is its ability to handle high-throughput scenarios while maintaining a low-latency performance. It is built to be developer-friendly, offering REST and Java APIs for easy integration and a comprehensive set of tools for monitoring and maintaining deployed workflows. manage and orchestrate the BPMN diagrams - The conversations blueprint we modeled as a BPMN diagram will be deployed on the Camunda Workflow Engine as a process. Process Workflow - Process Instance is the working object of the process workflow. Every conversation with a different user will create one process instance. This way, multiple conversations of the same type can be handled without cross-interface. Process Instances - Any data related to the instance will be stored as process instance variables. We can keep the data associated with the state of each conversation here. Process Instance Variables Camunda Modeler Camunda Modeler is a powerful, desktop-based modeling tool that allows , DMN decisions, and more. It provides a user-friendly interface to create precise process models. One of the noteworthy features of Camunda Modeler is its ability to integrate with the Camunda platform seamlessly. designing and configuring BPMN workflows With the help of this software, we can create different BPMN diagrams as conversations for the chatbot using drag-and-drop modeling. And quickly deploy all the conversation on the platform. Alternatively, a can also be used. web-based Camunda Modeler Camunda Cockpit Camunda Cockpit is an advanced web-based tool designed for in real-time. Its primary aim is to offer a clear view of the current state and performance of processes and decisions deployed on the Camunda platform. monitoring and managing business process workflows and decisions Camunda Cockpit will help to visualize the deployed conversation workflows, actively running process instances and their variables. It can be used to troubleshoot and rectify issues, ensuring seamless operation of the chatbot. Chatbot in Action Using Camunda and the framework, my team and I have built a . The Whatsapp messaging platform has been used as the user interface for end-user interaction. And multiple business use cases, including booking a ride, have been used as services provided by the chatbot. Spring Boot production-ready chatbot framework called Karna Please visit the GitHub repository for further learning, where you can explore how to build a chatbot framework using Camunda and understand more technical details of the chatbot with the help of the attached technical deep-dive document. Karna Bot Github Repository 🏆 I am happy to inform you that Karna has won the Grand Prize at the “ “hackathon hosted by Namma Yatri. Bengaluru Open Mobility Challenge' 23