Skip to content

realrushen/conversation-chatbot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Conversation ChatBot

support-bot

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.

How to Install and Run

Make sure you have installed Python 3.9 and poetry

  1. Clone repository
git clone https://github.com/realrushen/conversation-chatbot.git
  1. Init virtual environment and install dependencies
poetry install
  1. Set environment variables from section bellow
  2. Train DialogFlow model using /src/learn.py script from this repo. Detailed instructions see below.
  3. Activate virtual environment and Run bots
poetry shell
python3 ./src/telegram_bot.py
python3 ./src/vk_bot.py

Environment Variables

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 this 958423683: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.

Training DialogFlow model

Make sure you set environment PROJECT_ID and GOOGLE_APPLICATION_CREDENTIALS variables

  1. 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"
    ]
  }
}
  1. Start model training using python script learn.py
python3 ./src/learn.py https://link.to/file.json

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published