Skip to content

stivendiaz/teammy-bot

 
 

Repository files navigation

Build Status

teammy-bot

Q&A bot for Team International Latam

This bot has been created using Bot Framework, it shows how to create a simple bot that accepts input from the user and echoes it back.

Prerequisites

  • Node.js version 10.14.1 or higher

    # determine node version
    node --version

To run the bot

  • Install modules

    npm install
  • Start the bot

    npm start

Create an acount in DialogFlow and configure the environment

  • Go to DialogFlow and create an acount

  • Enable the Dialogflow API

  • Set up authentication with a service account so you can access the API from your local workstation.

    //You will get a json like:
        {
        "type": "service_account",
        "project_id": "your-project-id",
        "private_key_id": "5oMe4lPhaNumeR1cCharaCterS",
        "private_key": "-----BEGIN PRIVATE KEY-----\n5oMe4lPhaNumeR1cCharaCterS\n-----END PRIVATE KEY-----\n",
        "client_email": "client-email@client-email.iam.gserviceaccount.com",
        "client_id": "00000000000000000000",
        "auth_uri": "https://accounts.google.com/o/oauth2/auth",
        "token_uri": "https://oauth2.googleapis.com/token",
        "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
        "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/dialogflow-saovqb%40BOT-NAME-scnpuq.iam.gserviceaccount.com"
        }
    
  • Export environment variables:

        DECRYPT_PASSWORD=think_password_to_keep_in_safe_private_key_from_the_last_step
    
        GOOGLE_KEY_ID=your_private_key_id_from_the_last_step
    
  • Copy constants in ./config/development.yml from google json

        google: 
            project_id: your-project-id
            client_email: client-email@client-email.iam.gserviceaccount.com
            client_id: "00000000000000000000"
            client_x509_cert_url: https://www.googleapis.com/robot/v1/metadata/x509/dialogflow-saovqb%40BOT-NAME-scnpuq.iam.gserviceaccount.com
    
    
    • Encrypt the private_key from the google json:

      • copy the entire private_key from the google json: copy from "-----BEGIN PRIVATE KEY-----\n" to "\n-----END PRIVATE KEY-----\n"

      • run key.generator script and paste the entire private_key

        node ./scripts/key.generator.js
      • search in root project securekey.txt and copy the content

      • paste the entire new private_key in ./config/development.yml

Testing the bot using Bot Framework Emulator

Bot Framework Emulator is a desktop application that allows bot developers to test and debug their bots on localhost or running remotely through a tunnel.

  • Install the Bot Framework Emulator version 4.3.0 or greater from here

Connect to the bot using Bot Framework Emulator

  • Launch Bot Framework Emulator
  • File -> Open Bot
  • Enter a Bot URL of http://localhost:3978/api/messages

Deploy the bot to Azure

Publishing Changes to Azure Bot Service

```bash
# build the TypeScript bot before you publish
npm run build
```

To learn more about deploying a bot to Azure, see Deploy your bot to Azure for a complete list of deployment instructions.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 93.6%
  • JavaScript 6.4%