Colpabot is a chatbot developed as part of a bachelor thesis, built using the Microsoft Bot Framework. It is designed to assist patients undergoing colonoscopy preparation.
- User Persistent Data: Initiates conversation by asking for language preference and colonoscopy date, storing this information for personalized interactions.
- Natural Language Processing: Matches user prompts to a predefined Q&A database, applying various operations for accurate responses.
- Image Support: Sends relevant images alongside certain answers.
- Reminders: Provides timely reminders about important aspects, like diet before the colonoscopy.
- Command System: Offers various commands to enhance user interaction. Type
/help
for more information. - Multi-platform:
- Local testing with Bot Framework Emulator
- Scalable deployment on Azure
- Integration with Telegram (chat here - Telegram account required)
-
.NET SDK version 6.0
# Check your dotnet version dotnet --version
-
Infobip's WhatsApp adapter version 4.13.5 for the integration with WhatsApp
-
Fastenshtein version 1.0.10 for Levenshtein distance calculation
-
Quartz version 3.13.0 for scheduling reminders
-
sqlite-net-sqlcipher version 1.9.172 for encrypting the database
-
SixLabors's ImageSharp version 3.1.5 for detecting image sizes
-
Optional prerequisites:
-
DeepL's free API key
After obtaining the key, create a
deepl_key.txt
file in the same directory as the README and paste the key there. -
To deploy to Azure, you will need:
MicrosoftAppId
MicrosoftAppPassword
These values should be added to
appsettings.json
. You will also need to modify theBotUrl
in this file. -
For WhatsApp integration via InfoBip, create an InfoBip account and retrieve the following:
InfobipApiBaseUrl
InfobipApiKey
InfobipAppSecret
InfobipWhatsAppNumber
InfobipWhatsAppScenarioKey
For more details, refer to this GitHub repository and this documentation.
-
-
Choose one of the following methods:
Option A: Command Line
# Navigate to project folder (ColpaBot) cd ColpaBot # Run the bot dotnet run
Option B: Visual Studio
- Launch Visual Studio
- File -> Open -> Project/Solution
- Navigate to
ColpaBot
folder - Select
ColpaBot.csproj
file - Press
F5
to run the project
- Download and install the Bot Framework Emulator
- Launch the emulator
- Go to File -> Open Bot
- Enter the Bot URL:
- Usually
http://localhost:3978/api/messages
when debugging - May be
http://localhost:5000/api/messages
after building and executing
- Usually
- If
MicrosoftAppId
andMicrosoftAppPassword
are set inappsettings.json
, include them with the Bot URL. These are values obtained from the Azure portal.
- Navigate to
Resources/QuestionsAndAnswers/
- Open the appropriate language file (e.g.,
questions_and_answers_EN-GB.tsv
for English) - Add new rows with questions and answers
- You can use
.
to copy the previous answer - To attach an image to the message, add
ImageName
in the actions column- This image should be in the
Images
folder withName
as its file name. - To show one of many images with a message, create a folder and with the images you want to show. The names of these images do not matter, but the folder's name should be the
Name
in theImageName
- This image should be in the
- When using actions, you should take into account the specific rules that the order of actions must follow.
- Image[...] must be the first one in the general section.
- CopyQuestion[...] must be the first one in the specific sections. Something to note is that this action copies both the question AND the non-image actions of that entry.
- DontAnswer must be the last one in all the sections.
- You can use
- Save the file
- Optional: Translate to other languages:
- Ensure Python and the
deepl
library are installed - Run
python translate.py
in the script's directory
- Ensure Python and the
- Open
Resources/reminders.tsv
- Follow the file's structure to add or modify reminders
- For new messages, add them to
Resources/bot_messages.tsv
- Run the translation script
The bot was deployed using a GitHub workflow with Visual Studio.
- Login to Visual Studio with your Microsoft Azure account
- Go to the project's GitHub repository
- Click on Actions
- Select the workflow
- Click on "Run workflow"
For more details, see Deploy your bot to Azure.
This project is licensed under the MIT License - see the LICENSE file for details.