Design and Implementation of Telegram Bot for Integrated Hospital Information System

There are still many public hospitals that have not taken advantage of the Telegram bots API. Telegram Bots support Multi-Channel Access to facilitate access to data owned by information systems. Each part of the hospital requires a different module. Modules need to be integrated to make the flow of exchange data easier. The use of internet messengers such as Telegram can simplify the integration process needed so that users can quickly get information from the system. This study aims to develop a hospital information system that is integrated with the Telegram Bot. System testing was carried out in the laboratory by 30 patients and one user as an administrator. System testing using the black box method focuses on input, functionality, and output for all queuing processes. This Telegram Bot uses the help of Cronjobs and Webhooks to retrieve information and execute messaging commands for the Telegram Bot. The results shown in this study are Telegram Bot which is designed to be tested using the User Acceptance Test (UAT) with very positive responses and is considered successful. This Telegram bot facilitates patients and hospital workers to get information immediately.


Introduction
Currently, many hospitals have implemented a modern hospital management system.Technological developments can help reduce clinical errors, increase privacy and security and improve disease surveillance (Kania-Richmond et al., 2015;Pantzartzis et al., 2017).Hospital management information systems can provide benefits in the form of an efficient process, can improve administration and control, superior care, tight cost control and increase profitability (Balaraman & Kosalram, 2013;Ran et al., 2020).All business processes that occur today have been carried out automatically, but the system is only managed by each existing module and there is a lack of evaluation carried out on the existing system by the hospital (Hari Setiaji & Wahid, 2015).The hospital is a vital organization with various information that needs to manage from multiple departments (He et al., 2021;Kosherbayeva et al., 2020).This information has numerous forms and formats.There are differences in access rights to this information, making the design of information systems require a different form (Çetin et al., 2021;Hanlin et al., 2022).If users are given the same information system with the same access rights, in that case, there is a possibility that users such as cleaners can view patient data, which is very confidential and can only be seen by doctors, nurses, or patients.Differences in information systems by department and module can help distribute access rights and information that users should obtain (Rochmah et al., 2020;Wang et al., 2016).However, users with multiple access rights who need direct and accurate information will need time to view the information.
The gap analysis of this research that in general hospitals have not utilized the Telegram bots API.Telegram Bots allows for Multi-Channel Access to facilitate access to data that owned by the information system.The use of internet messenger is straightforward and has widely used on smartphones.Based on research, Telegram is a multi-platform application that runs on Android, iOS, Windows, and other operating systems (Fernández-Álvarez & Rodríguez, 2022;H Setiaji & Paputungan, 2018).It has accessible features to use and design to be very light, fast, and reliable.Telegram has developed an additional feature, namely bots that can interact with users using commands (Sutikno et al., 2016).Telegram Bot assistance does not only facilitate the provision of information but also in processing it (Gregorio et al., 2017;Nobari et al., 2021).Previous research is about queue untethering based on multichannel access technology in the radiology department of a hospital using the Telegram Bot API to develop bots with multichannel access queuing technology.This technology can help patients queue virtually and save their queue number via Telegram Messenger (Dyatmika et al., 2019).
Another research uses the Telegram Bot API as a tool to create a Telegram Bot on Campus Information Sharing (Setiaji & Paputungan, 2018).Communication between the system and Telegram Bot is done via a webhook available for Telegram using the Telegram Bot API.Webhook offers a way for Telegram Bot to get the communication process without latency.Telegram Bot in this research is also can work through commands given by users.Another research is building a train chatbot to help users get information about train status, seats, etc.The Telegram Bot developed in this study used to share information and make it easier for train passengers to get information by simply accessing the Telegram Bot without opening the train website (Sahaya Sakila V et al., 2018).Telegram Bot API is used to access information, such as notifications, history, books borrowing history, book return history, book catalogs, and book orders.Users can use commands to get information from Telegram Bot (Arimbawa P et al., 2018).API or Application Programming Interface is a set of rules that can be followed and used by software programs as access to resources provided by specific other software programs that implement the API (Nayagam & Arun, 2014;Ogorodnyk et al., 2021).Thus, the use of API defines how programmers will take advantage of certain parts and features of an application (Krishna & Sharma, 2019;Liu et al., 2022).Based on their website at core.telegram.org,Telegram has two types of APIs available for software developers to use.These are Bot API and TDLib.Bot API allows people to build chatbots in the Telegram app and TDLib to build customizations in Telegram.Telegram Bot API is an HTTP-based interface created for developers who want to build bots for Telegram.
Other studies have tried to use instant message technology as a means of academic service information.This information service application is built with the Rational Unified Process (RUP) process model, the Forward Chaining method, and the Python Telepot Framework for the Telegram Bot API to run applications via Telegram instant messages (Rianto et al., 2019).Another research built a chatbot based on Telegram Bot to provide information and academic services at the Department of Informatics Engineering, University of Mataram.Telegram offers an API that can use to develop bots.The bot is built using Python, SQLite, and React JS.The prototype model is used as a development method.The bot prototype can broadcast the latest information to its registered users and provide academic services such as thesis and internship services (Zubaidi & Ramdani, 2019).However, the reason for using Telegram over many other instant messaging platforms for this research is its easy-to-use, open source-based, and easy-to-use API platform, which is available to access via their website at telegram.org.Based on the above study, the purpose of this research is to develop a hospital information system that is integrated with the Telegram Bot.

Method
Hospitals use information systems to transmit information in real-time and directly to employees and patients for hospitals.The information system generates information for the designed Telegram Bot using a database-level integration method.This Telegram Bot was designed to be used by two types of users, namely workers and patients.Hospital workers can use Telegram Bots as a tool to help provide information obtained from the integrated information system in the form of notification messages.For example, it can be a notification message when a new patient registers or a report that requires approval.Telegram Bot on the patient's side can assist in patient registration only by using the patient ID number obtained when the patient previously had registered at the hospital for the first time.Patients only need to enter an order to register, and then patients can enter their patient number, their health complaint, and the type of allergy they have.Thereby, the patient can register for further examination at the hospital.Figure 1 can illustrate these processes.

Figure 1. Telegram Bot Overview
As previously explained, this bot has two types of users, and each user has different access rights for the bot.There is a requirement to enter the single sign-on information system page to use the Telegram Bot fully on the hospital worker's side.This bot was run by three different scripts that run on the server-side of the system.The reason for this splitting of scripts is that if one of the three scripts fails, the others will still work, and the bot will not close.This bot was run using a webhook, which means the bot will wait for an event to occur to respond to it.Script listener.php is set up for webhook.If any event occurs in a message form, listener.phpwill save the message to a table in the database called the inbox table.Script of processor.phplooped the contents of the inbox table.Then, it got the messages that were recently saved and had not been processed.Processor.phpproceeded to provide the required response and keep the response to outbox.php.It is where sender.phpcame in and sent responses to users using saved responses and Chat ID.System testing was carried out in the laboratory by 30 users as patients and one user as administrator.System testing used the black box method, focusing on input, functionality, and output for all queuing processes.This test provided a conclusion to what extent the application can solve existing problems.Based on the Telegram Bot overview mentioned previously, the use case shows in Figure 3.This Telegram Bot has two types of users, and each has a different command for each procedure used.until it can finally be entered into the database.Information will be sent to user according to the command they enter.

Results
The integrated information system is a web-based system consisting of several different integrated modules through the database level that will use to fill in the information on the use of Telegram Bot.There are seven modules for various parts of the information system with different purposes and information types but are still connected through the database and have a Single Sign-on feature for ease of use.The different modules are divided into several sections, such as accounting, pharmacy, front office, HRD, service, facilities, and infrastructure modules.These modules are standard information system modules for hospital information systems.Then, the system provides information to notify this Telegram Bot and receives information from patients who register for examinations.The designed Telegram Bot has several commands that users can use.These commands describe in Table 1.Facilities and Infrastructure Table 2 shows each type of notification that can receive by hospital staff who have previously registered.This notification will send through the conversation the worker has with the Telegram Bot.Testing for Telegram Bot and the integrated system was carried out in two types, namely for patient type users and for hospital worker type users.The test describes in Figure 4. Figure 4 shows the response that the user will receive after sending the /start command.This command will start a conversation from the user to the bot.Patients can use other commands such as /daftar and /infodokter, as shown in Figure 6 and Figure 7.       Notices for hospital workers are vary based on their job differences.Other hospital workers cannot get this notification because the notification is set to be sent to users with doctor occupation type.System evaluation is the last part of the system development stage.This section will show possible errors or bugs in the system.Tests are carried out when the user uses the wrong command and cannot be recognized by the bot.The bot will display a notification that the bot does not understand what the user is trying to say and a list of commands that the bot understands.

Figure 13. Incorrect Command
The test is carried out when a power outage and lost internet connection.The bot will not function because the supporting facilities, the internet are not connected to the application.Thus, the bot cannot poll, and the server cannot process data.System testing is done by asking testers to try all the features on the system.The test is carried out using a single sign on system to enter the system first and using the tester's Telegram account to get features on the Telegram Bot developed.Before testing begins, it is ensured that all system features and Telegram Bots do not have bugs and errors in their use.Examiners who have tried the Telegram system and bot are given a questionnaire which will be processed using the UAT (User Acceptance Testing) method and Likert's Summated Rating scale.The test continues by using the UAT method and a Likert scale of 1 to 5. The questionnaire divides into four aspects; suitability, performance, safety, and usability.The enormous response from respondents regarding the suitability aspect is strongly agreed (SA) with a percentage value of 48.6% and agree (A) with a percentage of 43% responses.The enormous response from respondents regarding the performance aspect is agreed (A) with a percentage of 66.7% responses, followed by moderately agreed (MA) of 18.4%, and strongly agreed (SA) of 13.4%.
The enormous respondent's response regarding the safety aspect is agreed (A) with a percentage of 50% and strongly agreed (SA) of 37.5%.The enormous response fro m respondents regarding the usability aspect is agreed (A) with a percentage of 50%, followed by strongly agreed (SA) of 44.5%.The data obtained through the UAT is measured using the LSR (Likert's Summated Rating) scale method.LSR aims to compare a person's attitude score with the scale distribution of other people groups.The answers to the statements are expressed in choices that accommodate answers between disagree to strongly agreed.A calculation to measure the success rate of the application using t he LSR scale technique on the results of the questionnaire can see as follows.It can conclude from the enormous percentage of each aspect, such as the suitability aspect, which generates an agreed response (SA) with a 48.6% percentage.On the other hand, the performance aspect received an agreed response (A) of 66.7%.The safety aspect received an agreed response (A) of 50%.Then, the usability aspect received an agreed response (A) of 50%.The results to calculate the success of its implementation based o n the assessment of the questionnaire results that the respondents have filled out are described using the LRS scale (Likert's Summated Rating) with a range of 768-960.A score of 768-960 means very positive, a score of 576-768 means positive (the system is considered quite successful), a score of 384-576 means negatives (the system is considered less successful), a score of 192-384 means very negative (the system is considered failed).

Discussion
The system that has been built is compared with other systems referenced in this research to better understand which points this system brings those other systems have not.The comparison will be presented with a table.It will compare each feature possessed by each system.App1: Hospital Telegram Bot App2: Queue Bot App3: Rail Bot (Sakila et al., 2018) App4: Bot UIII (Setiaji & Paputungan, 2018) Table 3.Comparison Table Table 3 shows a comparison between the Telegram Bot system built with several systems used as a reference for making the Telegram Bot module in this hospital management information system.Each application that supports the feature will be written as a supporter, while the applications that do not support the feature describes as follows: The dashboard feature for message logs is found in the webbased hospital management information system, the Telegram Bot module designed in this research, and the UIII Bot (Risanty & Sopiyan, 2017;Setiaji & Paputungan, 2018).This feature is used as a feature that can help system administrators to view message logs between Telegram users and bots (Arimbawa P et al., 2018;Zubaidi & Ramdani, 2019).The messaging feature using commands is owned by every Telegram Bot referenced in this research.This feature allows users to use the Telegram Bot more efficiently by using the commands available in the Telegram Bot (Halim et al., 2021;Rahman & Yaqin, 2019).The error message handling feature can be overcome by every Telegram Bot system referenced in this research (Aisyah et al., 2021;Asmazori, 2021;Soraya et al., 2021).The Telegram Bot system developed in this research minimizes message errors by issuing a message that there is an error in the command or typing of the message sent by the user.The notification message feature for users is available on every referenced Telegram Bot system design.This feature can be in the form of automatic messages sent by Telegram Bots when certain events occur (Arimbawa P et al., 2018;Risanty & Sopiyan, 2017).

Conclusions and Suggestions
This research concludes that the Telegram Bot can develop for Integrated Hospital Information System.The business processes that have been built adapted to the flow in the hospital, such as the patient registration process through the website and Telegram bots and the notification process for each module in the hospital management information system.This bot facilitates patients and hospital workers.The patients can quickly register at the hospital easily because of BOTS usage for registration assistance, and hospital workers get information immediately.

Figure 1 .
Figure 1.Telegram Bot Use CaseHospital workers must register in advance to be able to use the Telegram Bot.First, workers have to type a command to get their Chat ID.Then, they need to log in to the hospital information system Single Signon feature to save their Chat ID and receive notification via telegram conversation with the bot.Patients who want to use the bot do not need to register with the bot.Instead, patients only need to use different commands for different purposes, such as registering for a health examination, getting information about the doctor's schedule, and canceling registration.Figure3is a flowchart for the user connect using the Telegram bot.The user start by entering a command which will bring up a list of commands that the user can choose, example for the patient to registration.The registration process can be carried out if the user successfully enters the data according to the required format, if the format does not match the user must enter it correctly Figure3is a flowchart for the user connect using the Telegram bot.The user start by entering a command which will bring up a list of commands that the user can choose, example for the patient to registration.The registration process can be carried out if the user successfully enters the data according to the required format, if the format does not match the user must enter it correctly

Figure 4 .
Figure 4. Start a Conversation

Figure 5 .
Figure 5. Register for ExaminationFigure5shows another message containing the command that will use to register for a health examination.The command is /umum for patients who register without insurance and /jaminan for insured patients.

Figure 6
Figure6shows a list of doctors' schedules available at the hospital.Patients can get this information by typing the command /infodokter into the Telegram Bot.

Figure 7 .
Figure 7. Register for Examination without Insurance.

Figure 8 .
Figure 8. Registration with InsuranceFigure7shows an example of a user registering for an examination with /umum for a user without insurance or a general patient.While Figure8shows the commands used by a user with insurance.This type of registration has a separate command because patients need to enter more information, such as their company name and insurance class if they want to register with the insurance form.

Figure 9 .
Figure 9. Unregistering for Examination Figure 9 shows the feature for unregistering an examination.Patients can cancel a recently registered examination request by simply using the /batal command.

Figure 10 .
Figure 10.Register to Telegram Bot

Table 1
shows the commands that Telegram Bot users can use.Each command has a different function for different uses and user types.For example, another use for Telegram Bot is notifications which registered hospital worker users can only use.The types of notifications that users can get can see in Table2.

Table 2 .
Types of Notifications