This project developed using Python 3.9 and DialogFlow - natural language understanding platform that makes it easy to design and integrate a conversational user interface.
This repository contains two bots. One for popular Russsian Social Network VKontakte and second for Telegram Messanger.
Make sure you have installed Python 3.9 and poetry
- Clone repository
git clone https://github.com/realrushen/conversation-chatbot.git
- Init virtual environment and install dependencies
poetry install
- Set environment variables from section bellow
- Train DialogFlow model using
/src/learn.py
script from this repo. Detailed instructions see below. - Activate virtual environment and Run bots
poetry shell
python3 ./src/telegram_bot.py
python3 ./src/vk_bot.py
This environment variables are required to run bots:
DEBUG
- true/false to eneble/disable debug log messages.LOGS_BOT_TOKEN
- telegram bot token that sends log messages. To register your bot you need register it with BotFather. It looks like this958423683:AAEAtJ5Lde5YYfu8GldVhSG
.CHAT_ID_FOR_LOGS
- chat_id in Telegram where you want to receive log massages.TELEGRAM_BOT_TOKEN
- main telegram bot token to communicate with your customers.VK_BOT_TOKEN
- same for vk.com.GOOGLE_APPLICATION_CREDENTIALS
- absolute path to your DialogFlow credentials json file. Detailed instructions here.PROJECT_ID
- project name from DialogFlow panel.
Make sure you set environment PROJECT_ID
and GOOGLE_APPLICATION_CREDENTIALS
variables
- Prepare data and generate json file with structure you can see below:
{
"intent_name1": {
"answer": "answer1",
"questions": [
"question1",
"question2",
"question3"
]
},
"intent_name2": {
"answer": "answer2",
"questions": [
"question4",
"question5",
"question6"
]
}
}
- Start model training using python script learn.py
python3 ./src/learn.py https://link.to/file.json