Skip to content

sirejja/dialogflow-tg-vk-bot

Repository files navigation

Conversational Bot for Telegram and VK Groups

Features:

  • Bot for Telegram
  • Bot for VK Group
  • Telegram bot for logging
  • Support quering Dealogflow API
  • Script for training DialogFlow agent AI

Google Cloud Project for using Dialogflow AI

  1. Create Google Cloud project.

  2. Create Dialogflow ES agent with previously created GCP id.

    • Create test Intent.

    • Manually train test intent

  3. Add service account. Generate json key GOOGLE_APPLICATION_CREDENTIALS.

  4. Enable Dialogflow API for project.

In case of code 403. IAM->PRINCIPALS->service account->add role->'Dialogflow API Admin'

Env vars:

Training Dialogflow agent

  1. Place training data into 'train_dialogflow\questions.json'. Format:
{
    <intent_name>: {
        'questions': [<question>, ...],
        'answer': <answer>
    }, ...
}
  1. Run script with -p or -path params.
python train_dialogflow.py -p questions.json

Preparations for using VK group bot

  1. Create group
  2. Add API key with sending messages permission.
  3. Enable messages in group.

Run

  1. git clone
  2. Create virtual environment
python -m venv .venv
  1. Activate venv
.venv\scripts\activate
  1. Install requirements
pip install -r requirements.txt
  1. Start TG bot on local machine
python tg_bot.py

Heroku deploy

  1. Start new project
  2. Connect to GitHub
  3. Add env vars in project's settings
  4. Add necessary env vars for GCP and add a buildpack
  5. Deploy your app
  6. Enjoy

Demonstration

About

Conversational Bot for Telegram and VK Groups

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published