Bot creating technology for wide use based on a logical approach

Стаття | Article    


Telenyk Sergii

Igor Sikorsky Kyiv Politechnic Instiitute

Kyiv, Ukraine

Cracow University of Technology

Cracow, Poland

Zharikov Eduard

Igor Sikorsky Kyiv Politechnic Instiitute

Kyiv, Ukraine

Vovk Yevhenii

Igor Sikorsky Kyiv Politechnic Instiitute

Kyiv, Ukraine

Nowakowski Grzegorz

Cracow University of Technology

Cracow, Poland

Tokmenko Olena

Taras Shevchenko National University

Kyiv, Ukraine

Abstract. The report proposes the information technology for computer-aided design and implementation of bots based on a logical approach. The general approach to creating bots with the use of a complex of logical and linguistic models has been described. The general scheme of work of the web-based system with the use of a chatbot has been developed. The model of logic of actions, and the inference method have been described, which can be used for the formal description of the bot creating process. An example of using a logical model to create a bot has been described

Keywords: information technology, messangers, bot, automated bot creating, logic of actions.


Human activity, which can be work, study or leisure, is regulated by template-algorithmic processes. For institutions, enterprises, and companies, it means waiting in queues, writing applications, moving from one office to another. In the sphere of rest, it is the search for a company of people who are ready to spend their free time in a certain way. In educational institutions, it is, on the one hand, notifying students and their parents about changes, events happening or will happen in the institution, and on the other hand, providing answers to questions from students and their parents about such changes, events, issuing various certificates. Such processes regulate the work, but introduce delays.

There is a need for technologies for managing virtual human interaction in solving a wide range of problems. The tools of interaction are electronic document management systems, emails, services of educational institutions for student (pupil) and teacher interaction, specialized services for finding people by interests, location, etc., various messengers, social networks.

However, the use of such tools of the information society has disadvantages that have negative consequences for system owners and their users. The system often pays a relatively small but fixed rent during the period of use of the system within the license agreement with the developer, or one-time but significant costs for developing such a system. In this case, regardless of the method of acquisition, the system owner is not deprived of the costs for maintaining this system in working order by adding the necessary content, scaling in case of increasing the number of users, etc.

In the case of the user, the disadvantages are related to the use of the system. Because modern users have access to online management systems for almost every component of their lives, and each of these systems has its interface that does not always correspond to the usual UX user, as well as its authorization method, login, and password (when using a single password on all systems the user violates the rules of safe use of web systems), there is a need for regular decentralized review of information on each area of life within the system or a set of systems, remembering a large number of passwords and features of each system. At least, this leads to extra time, and in general, we can talk about a set of disadvantages with negative consequences for the user.

In general, the use of decentralized management systems for each individual component of the social component of the user is time-consuming for them, and resource-intensive for the system owner. Therefore, there is a problem which the centralized management of all components of user activity in social networks.

The development of modern technologies, the experience of using solutions based on them have shown that the problem described above can be partially solved by means of rapid automated creation and use of wide-class chatbots. It would be good to supplement such solution with a system which integrates the user’s work with all messengers, social networks and information systems of the information society in terms of content, graphics, and owner’s features, but it should be the subject of another article by the authors.


It is necessary to develop a general approach, mathematical models and methods as the basis of information technology to create wide-class chatbots. Essentially, it means solving traditional problems of coordination in such schemes ‘employee-to-employee’, ‘customer-to-dispatcher’, ‘student-to-dean’s office specialist’, ‘student-to-teacher’ with the help of a new solution aimed at creating special programs – bots, which by using the capacities of social network messengers automate human functions related to informing, ordering and fulfilling orders, implementing multi-step processes, separate stages of which depend on various circumstances, events and participants’ features. The general approach, such models and methods should be aimed at the rapid creation of programs that implement the selection and implementation of the interaction (service) scheme from many possible options for their layout with subschemas depending on the type and the user’s individual features, while being deprived of algorithmic approaches associated with the need to reprogram the bot when user’s new features appear, implemented subschemas change, or new subschemas occur. This technology must meet a high level of requirements, especially its following features: flexibility, scalability, accessibility to the end-user without special knowledge and skills, reliability, convenience and ease of use, distribution, use of remote resources, load adaptation, fast and simple integration with information systems.


Instant messaging systems are widely used by individual users and human communities around the world. In fact, today they have evolved from a means of communication between people into a means of obtaining information, and into an incredibly powerful marketing tool. The key part, when using them, is the ability to communicate with bots. Therefore, this report discusses the basic principles of creating bots based on logical and linguistic models within an approach that captures, accumulates, generalizes, and uses the user’s positive experience to ensure maximum efficiency of their social network activity. It is important to review developments in this area, analyze scientific publications to select necessary tools for bot development, the basis to integrate into a single system, and examples to demonstrate the efficiency of the proposed solution.

In the last few years, the popularity of instant messaging systems (messengers) has been increasing. Bots have played a significant role in evolving a means of communication. The de facto standard definition of a chatbot has become that it is a computer program responsible for user interaction based on auditory or textual methods. There are many attempts to classify bots, from which it is advisable to choose the classification of chatbots by: the type of messages (commands) – text and voice; the level of interactivity – bots with the response to the call of the specified command and the message analysis, and the team (teams) selection; the type of interaction with the chat server – Long polling and Listeners.

Most available messengers provide the ability to select the interface of the communication level of the chatbot and the messenger server. The next choice is offered at the level of interaction type, where there are two modes of interaction – Long polling, which regulates the messenger server polling via API once in an interval of N milliseconds, where the specification of the number of milliseconds is regulated by a specific API, event subscription mode, while the mentioned API Endpoint will be called if there is a change. With regard to the advantages and disadvantages of regimes in view of the problem of the study, the following well-grounded conclusions can be drawn. The bot performance using the first mode creates an additional load in the messenger server, but does not require an SSL certificate for an external address, and is used mainly in mobile and desktop applications. The bot performance using the second mode is designed for interaction of the ‘server to server’ type, and reduces the load on the messenger server. Therefore, when implementing the solution in accordance with the principles of web-based architecture, it seems more appropriate to use the second mode.

This useful tool is interesting for business. Bots have been actively used abroad for several years, and are gaining popularity in Ukraine. Thus, a promising niche for IT developers has been created. An important aspect for potential customers is the bot command perception, good understanding of the user’s query, and the relevance of its answers.

The report proposes a holistic approach to creating bots for the messenger, describes the architecture of information technology for creating bots based on the models of mathematical logic, artificial intelligence, and linguistics to implement bot functions and its communication with users.


The proposed solution does not cover the whole set of tasks related to the centralized management of all components of user activity in social networks by creating web-based technologies. However, it can simplify user interaction with the system, gain experience, and create conditions for more efficient solutions.

The implementation of such a solution is to create user interaction through a chat, within a specific messenger, based on a targeted query processing platform that implements a complete algorithm of actions in all cases provided by a particular chat. Figure 1 shows the general performance of the server architecture of the bot performance level.

Fig. 1. A fragment of the server architecture of the bot performance level

Let’s analyze the fragment components. The Message provider component performs the functions of wrapping the message source (messenger). Handlers process messages from the Message provider, delegate tasks to services, update the State storage, and generate responses to the user. The State storage stores the parameters of state while processing user queries. Services implement additional logic for processing user queries.

A chatbot can be used, for example, for registration, ordering a taxi, planning the performance of such order, and monitoring the implementation of the plan in the system of the international provider of this service. A typical task for chatbots is to order a car. The need to integrate the mechanism of receiving user queries via a chatbot is due to the advantages of user interaction with messengers described above. One of the possible options for specifying the actions, states, and requirements for the input data model for the taxi ordering process takes the form of the following sequence:

  1. Country selection.

  2. City selection.

  3. Car class selection.

  4. Determining the customer’s mobile phone number.

  5. Clarification of the pickup time.

  6. Clarification of the pickup address (street, building).

States and transitions are shown in Fig. 2. For each state, there is a relevant list of features.

Fig. 2. A fragment of the server architecture of the bot performance level

In fact, we have a traditional model of states and transitions for the control theory, which has turned out to be a convenient form of setting the problem of creating a bot. There are many approaches to implement this model – from a purely algorithmic approach to approaches based on combining problem-solving in the system capacities to solve subproblems.

The above example can be easily implemented based on an algorithmic approach to the sequence of commands created in the chatbot. This easy-to-implement approach is not very convenient for the user and the system owner, as its shortcomings, i.e. lack of interactivity and possible changes in the sequence of actions when implementing the order, lead to significant losses. Thus, adding Action No. 7 to clarify the terms of payment will not change the data, but the software module should be rewritten. Therefore, such a mechanism is simple, but not flexible.

Approaches that respond to state (situation) changes by implementing certain actions, and focus on responding to queries about the possibility of achieving certain states (situations) that learn how to solve problems have proven to be more flexible and efficient. Here, the answer to the query is to generally create an action plan that leads to the target state, and which is then being implemented. To do this, each action of the plan included in the system must be described in terms of objects. Achieving the aim in such systems is associated with the derivation of an action plan that provides the solution to the problem.

However, the implementation of this approach requires the development of a formal logical model for the formation of task conditions, and solutions, and appropriate information technology which is capable to use the experience and knowledge within messengers, bots, the information system to automatically create bots based on logical models and inference methods of appropriate action plans.


The web-based architecture of information technology for creating bots based on a logical model is shown in Fig. 3.

Such scheme supplements and expands the system functionality, and makes it user-friendly. It will be demonstrated that it also provides the system owner with the benefits of changing the order processing sequence, and adding/removing structural elements to the previously implemented sequence of actions. Let’s apply the approach proposed in [4] to the use of templates in creating web-applications for creating templates in determining the sequence of actions. Let’s modify the requirements for the input data model for the taxi ordering process:

  1. Country selection.

  2. City selection.

  3. Car class selection.

  4. Clarification of the customer’s mobile phone number (if absent, then the number available in the messenger).

  5. Clarification of the pickup time. 6. Exact address (street, building).

  6. Payment method.

  7. Payment (in case of non-cash payment).

  8. Use one of the previous routes.

  9. Getting an answer about the order status.

Fig 3. The general scheme of a web-based system performance using a chatbot

The logic of states and transitions in accordance with Fig. 4 has been presented in a graph of a special kind, the problem solving based on it is to find ways using known algorithms.

Fig. 4. Modified state storage

The implementation of such behavior is performed by available messenger capabilities. However, if you modify the requirements, and add the possibility of renting a car, which will require checking the driver’s license, user’s state of health, etc., the algorithm cannot be implemented on the basis of the existing state mechanism, and implemented in modern messengers.

Templating the logic of states for chatbots to form the result based in preconditions and postconditions of each state by constructing a tree of transitions (calls, methods) that correctly process situations from the initial to final precondition and postcondition defined by the user. Let’s analyze a specific scheme for a clearly defined situation. It is necessary to order a car clarifying country, city, car class or make, as a car rental or as a taxi.

The precondition is as follows: the user is authorized, has a license to drive a vehicle. The postcondition is that the user wants to rent a car for one day.

The system has a set of methods that implement sending the agreement, checking the driver’s license, city and country, checking the ability of a user to drive the vehicle, work with the payment service. The number of methods is not limited, each of them is characterized by the precondition (determining the need of their call), and the postcondition (determining the results of its fulfillment).

Thus, the system now operates with a set of states defined by the peaks of the graph, in which the transitions are made on the basis of preconditions and postconditions, and for each individual user’s query, the precondition (input peak), and the desired result (postcondition) have been specified.

Under this approach, to implement the technology of automated creation of the application using the chatbot module, you need:

1) Template the logic of state construction based on the user’s input data (construct a graph, bind to the condition peaks).

2) Create an API Endpoint to receive messages from the messenger.

3) Specify a set of commands and the API Endpoint in the messenger configuration at the moment of creating a bot to receive messenger queries.

4) Using the appropriate template, add a Message provider for a particular messenger at the level of business logic.

5) Receive messages by calling the Message provider from the API Endpoint.

6) Describe the behavioral logic of the Handler for each command in the format of the result of its fulfillment.

7) Define the State storage, and template its filing.

8) Connect a third-party server for text message recognition (with further development of your own), and get a set of commands from it.

9) Generate at the level of business logic a class of interaction with a third-party API (when fulfilling No. 8) by available methods, and supplement the behavior of Handlers.

10) Supplement calls of Handlers with further calls of the State storage by a call of the third-party service from No. 8, if necessary.


The formalism proposed in [3] will be used, on the basis of which a software system will be created, which will provide the solution to the problem. To create bots with useful behavior for practice, we will divide the stages of the action and implementation plans. This allows at the planning stage to communicate with the user to quickly and accurately select the next actions, and at the stage of plan implementation – control the conditions of previous actions, the appropriate reaction of the environment, redistribution of actions between participants, and other adjustments.

The second fundamental step is the division of the planning stage into stages of construction of detailed plans and scheme composition. We make plans at the first stage. In the second stage, a complex action plan is combined with simple (template) actions accumulated by the system.

Formalizations in the logic of action planning defined in terms of states and transitions considering the allocation of stages of construction of detailed plans and scheme composition are, on the one hand, objects (TAgent. TRealObject, TConception, TRelation, TValue, TProblem), situations (states) (ТSituation), events (TEvent) and actions (ТAction) (as well as relevant operations and relationships), on the other hand, plans (as well as relevant operations and relationships).

The state (situation) characterizes the state (situation) of the controlled object through its parameters. The implementation is a sequence of states and transitions that fulfills the conditions of initialization, the possibility of transitions, truth, and completion.

The formalism is designed to respond to queries that specify the initial and target situation (state), and involve the search or construction of a specific action plan, the implementation of which will ensure the transition of the controlled object from the initial situation (state) to the target one. The main element of the plan is the sequence of actions. To the definition of the plan we enter the constructions of basic actions – the ml empty action, exit from the plan, conditional transition, cycle.

Considering the role of the composition, the plan is defined as follows:

1) any action is a plan;

2) if $\pi 1,\pi 2$ – plans, then $x1,x2$ – plan;

3) if $\delta 1$– action, $\sigma 1,\sigma n$ – situations, $\pi 1,\ldots ,xn$– plans, then case $\delta 1,\left( \sigma 1,\pi 1 \right),\ldots ,\left( \sigma n,\ldots \pi n \right)$– plan;

4) if $x1$– plan, and $\sigma 1$– situation, then while $\left( \sigma 1,x1 \right)$– plan.

To construct detailed plans, we will use the AP-system, and for the composition of plans – the PC-system, as proposed in [3]. Let’s analyze the axiomatization features which are important for creating bots.

In the AP-system within the framework of a clause logic, based on the definitions of symbols, terms and formulas, as proposed in [3], we define:

Type abstracts:

1) formula for individuals – type abstract,

2) if А – formula for individuals, $\alpha $– type abstract, then $\left\{ \alpha A \right\}$– type abstract,

3) no other type abstracts;

Definitors as constructions t def $\eta $, where t – individual term, $\eta $– term for types;

Specifiers: objects, situations, events t spec А, where t – individual term for objects, situations, events, or term for types, А – type abstract; actions t: $\left\langle \left\langle \beta 1 \right\rangle ,\left\langle \beta 2 \right\rangle \right\rangle $, where t – individual term for action, or term for types, $\beta 1$and $\beta 2$– precondition and postcondition as situation specifiers; problems t: $\left\langle \left\langle \beta 1 \right\rangle ,\left\langle \beta 2 \right\rangle \right\rangle $, where t – individual term for TProblem object, or term for types, $\beta 1$and$\beta 2$ –precondition and postcondition as situation specifiers;

Clauses: expressions A$\to $K, where A – a sequence of atomic formulas of the language of the АР-system, К – one atomic formula.

The knowledge base of the АР-system consists of:

1) A set of specifiers of the description of the initial situation and types;

2) A set of clauses specifying the features of operations and predicates for individual objects and types;

3) A set of definitors and clauses defining the type features;

4) A set of clauses specifying the preconditions and postconditions of actions;

5) A set of clauses specifying the event component of preconditions.

In the definition of the АР-system within the framework of the clause logic of the first order, based on the definitions of symbols, terms and formulas, as proposed in [3], we define:

Action programs:

1) if t – individual term of the action type, then t – action program;

2) if $y1,y2$– action programs, then – action program;

3) if $l1$– individual term of the action type, $\varepsilon 1,\ldots \varepsilon n$– formulas of the situation type $y1,\ldots yn$– action programs, then case $\left( l1,\left( \varepsilon 1,y1 \right),\ldots ,\left( \varepsilon n,yn \right) \right)$– action program;

4) if $y1$– action program, and с1 – formula of the situation type, then while $\left( y1,\varepsilon 1 \right)$– action program;

5) no other action programs;

Action program specifiers:

1) if $y1$– scheme term, $y2$– action program, then $y1,y2$ – action program specifier;

2) no other action program specifiers;

Clauses: expressions A$\to $K, where A – a sequence of atomic formulas of the language of the PC-system, К – one atomic formula.

The knowledge base of the РC-system consists of:

1) A set of action program specifiers;

2) A set of clauses defining problem-solving schemes;

3) A set of clauses defining scheme features.

The inference procedure will be shown on the example of a natural case where queries take the form $\left\langle \left\langle \lambda 1 \right\rangle ,\left\langle \lambda 2 \right\rangle \right\rangle $, where $\lambda 1,\lambda 2$– abstracts of the initial and target situations. The inference procedure includes the following steps:

1) Establishing an individual situation or a situation type in the AP-system (if the query defines individual terms of the initial and target situations);

2) Establishing an action program in the PC-system (if the query defines abstracts of the initial and target situations);

3) Establishing an action program in the PC-system (if the query defines types of the initial and target situations);

4) If necessary, redefying an action program in the PC-system;

5) If necessary, constructing an action program in the PC-system;

6) If necessary, establishing the necessary type transformations.

To reduce the search, programs for popular queries are saved, and known techniques are used, first of all, the standardization of statements, the method of analogies. To substantiate the accuracy of the obtained output results, the theorems on effective achievability can be used, as proved in [3].


Based on the analysis of messengers, chatbots, problems of their creation, use, and development, an approach to the automated creation of bots based on logical and linguistic models has been proposed. The problems of formalization of processes creating bots have been analyzed. One of the key features of this solution is the automation of an action chain, the implementation of which leads to the fulfillment of the user’s query.

The logical formalism has been described as the basis of this solution, the formal definition of the aim achievement and conditions, to which the action plans providing the aim achievement should correspond, has been offered. The inference procedure has been proposed, which allows us to form action plans to solve problems formulated as pairs of initial and final states.

The implementation of the proposed solution will allow us to rapidly create bots for a wide range of problems, formulated in terms of pairs of initial and final states, based on a combination of functions of the appropriate classes of objects, also given by pair of initial and final states, to form the appropriate action plan. Thus, the bots can be rapidly created to obtain the necessary information, place orders, provide access to educational resources, etc.

Further research should be conducted to create and study bots in order to solve certain classes of problems, create technologies for efficient natural communication of a bot with the user, create the information technology to integrate the user with all messengers, social networks and information systems.


[1] Radziwill N. Evaluating Quality of Chatbots and IntelligentConversational Agents [Electronic Source] / N. Radziwill, M. Benton. – 2017. –Access:

[2] Most popular global mobile messenger apps [Electronic Source]. –2018. – Access:\-popular\-globalmobile\-messenger\-apps/

[3] The approach to applications integration for World Data Centerinterdisciplinary scientific investigations / Grzegorz Nowakowski, SergiiTelenyk, Kostiantyn Yefremov, Volodymyr Khmeliuk // W: Proceedings of the 2019Federated Conference on Computer Science and Information Systems, September1–4, 2019, Leipzig, Germany [online] / eds. Maria Ganzha, Leszek Maciaszek,Marcin Paprzycki. – Warszawa : Polskie Towarzystwo Informatyczne, 2019. –(Annals of Computer Science and Information Systems, ISSN 2300-5963 ; 18). – S.539-545. – doi: 10.15439/2019F71. – ISBN 978-83-952357-8-8 (Web)

[4] Sergii Telenyk, Nowakowski Grzegorz, ZharikovEduard, Vovk Yewhenii. Conceptualfoundations of the use of formal models and methods for the rapid creation ofweb-applications // The 10th IEEE International Conference on Intelligent DataAcquisition and Advanced Computing Systems: Technology and Applications. 18-21 September,2019, Metz, France

May 31, 2020