Skip to content

Rocket.Chat connector kick starter for Rasa.AI

Notifications You must be signed in to change notification settings

APPX-Studio/rasa-kick-starter

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rasa-rocketchat-kickstarter

A simple bot to test the integration with Rocket.Chat.

Quickstart

1. Install Rocket.Chat

If you already have a Rocket.Chat instance you can skip this step

docker-compose up -d mongo
docker-compose up -d mongo-init-replica
docker-compose up -d rocketchat

Access http://localhost:3000/

Create an admin user with the password admin.

2. Rocket.Chat Bot User Configurations

Create a Rasa bot user in Rocket.Chat. You can either manually login to Rocket.Chat and create a bot user via the user management page or can use the following script to create the bot user.

Run the following command to create the RASA bot.

Note: Please replace the user name and password of the RocketChat admin and bot user accordingly.

python3 scripts/bot_config.py -an admin_username -ap admin_password -bn bot_username -bp bot_pass -r http://rocketchaturl

If you are using docker-compose following is a sample usage

python3 scripts/bot_config.py -an admin -ap admin -bn bot_rasa -bp bot_rasa -r http://localhost:3000

3. Configure Rasa Bot

  • Configure the Credentials file

    Update your credentials.yml file inside the bot_rasa folder with Rasa bot's username and password.

    rocketchat:
      user: "bot_rasa"
      password: "bot_rasa"
      server_url: "http://localhost:3000"
  • Train the Machine Learning Model The Rasa bots machine learning model can built by using either Rasa CLI or Docker. After the training a machine learning model will be created inside the bot_rasa/models folder.

    • If using Docker

      docker run -it -v $(pwd)/bot_rasa:/app rasa/rasa train
    • If using Rasa CLI

      pip3 install rasa
      cd bot_rasa
      rasa train

4. Start Rasa server

Rasa bot can be started via the Docker or Rasa CLI.

  • If using Docker-compose

    docker-compose up -d bot_rasa
  • If using Rasa CLI

    cd bot_rasa
    rasa run

5. Make Rasa Bot accessible by Rocket.Chat

The Rasa bot should be reachable via Rocket.Chat.

  • If you are following the tutorial with docker-compose file then following is the URL to access the Rasa bot.

    http://bot_rasa:5005
  • If you are trying to connect to a standalone Rocker.Chat instance or using Rasa CLI, lets user ngrok to get a public url for the Rasa Bot.

    Install ngrok via: https://ngrok.com/download

    After downloading the ngrok navigate to the ngrok file in the downloded content and execute the following command. This will provide a public URL to the Rasa bot

    ./ngork http 5005

    Following will be the output of ngrok

    Session Status                online                                                                                                                                                                        
    Session Expires               7 hours, 59 minutes                                                                                                                                                           
    Version                       2.3.30                                                                                                                                                                        
    Region                        United States (us)                                                                                                                                                            
    Web Interface                 http://127.0.0.1:4040                                                                                                                                                         
    Forwarding                    http://e3d5a17b.ngrok.io -> http://localhost:5005                                                                                                                             
    Forwarding                    https://e3d5a17b.ngrok.io -> http://localhost:5005  

    Copy the http URL provided by ngrok: http://e3d5a17b.ngrok.io

6. Configure Rocket.Chat webhook

Go to Administration > New Integration > Outgoing webhook. Inside the configuration insert this:

Event Trigger: Message Sent
Enabled: True
Channel: #general
URLs: http://bot_rasa:5005/webhooks/rocketchat/webhook
Post as: bot_rasa

If you are using ngrok then replace the URL http://bot:5005, with the url obtained by ngrok.

URLs: http://ngrok_public_url/webhooks/rocketchat/webhook

Save all the changes.

Example

Type @bot_rasa hello to start a conversation with the Rasa bot example

Additional Information

If you want the Rasa bot to direct message with the users create another webhook with the following configurations

Event Trigger: Message Sent
Enabled: True
Channel: all_direct_messages
URLs: http://bot_rasa:5005/webhooks/rocketchat/webhook
Post as: bot_rasa

About

Rocket.Chat connector kick starter for Rasa.AI

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%