Run a Rasa Bot
Rasa is the leading open-source machine learning toolkit that lets developers expand bots beyond answering simple questions with minimal training data. At the core, Rasa bot has a machine learning model which trained on example conversations.
Rasa is developed with Python but for the most part, you don't need to know Python to design the basic conversational flows. You will need Python knowledge only when creating custom actions in Rasa which call external actions.

Quick start guide

The fastest way to start with Rasa is using Rasa starter kit. The starter kit uses webhooks to communicate between Rasa and Rocket.Chat.
1. clone the starter repo
1
git clone https://github.com/RocketChat/rasa-kick-starter
2
cd rasa-kick-starter/
Copied!
2. configure the bot
    open the rasa-kick-starter/bot_rasa folder and update the credentials.yml file with Rasa bot's username, password, and Rocket.Chat URL:
1
rocketchat:
2
user: "<RASA USER NAME>"
3
password: "<RASA USER PASS>"
4
server_url: "<ROCKETCHAT HOST>"
Copied!
    train the bot's Machine Learning Model:
1
docker run -it -v $(pwd)/bot_rasa:/app rasa/rasa train
Copied!
After the training, the machine learning model will be created inside the bot_rasa/models folder.
3. run the bot
1
docker-compose up bot_rasa
Copied!
You should see the following output:
1
$ docker-compose up bot_rasa
2
Starting rasa-kick-starter_bot_rasa_1 ... done
3
Attaching to rasa-kick-starter_bot_rasa_1
4
bot_rasa_1 | 2019-10-31 21:23:24 INFO root - Starting Rasa server on http://localhost:5005
Copied!
Open your browser and navigate to http://localhost:5005. You should see the response from the running Rasa bot:
1
Hello from Rasa: 1.5.0a1
Copied!
If you have Rocket.Chat running on the same machine, the bot's URL is http://bot_rasa:5005. This guide uses a remote Rocket.Chat instance, so it is necessary to get a public URL for the Rasa bot to be able to link it properly. It is recommended to use ngrok for this purpose.
Download ngrok, open terminal in the folder you downloaded ngrok to and execute the following command:
1
./ngrok http 5005
Copied!
You should see the following output:
1
Session Status online
2
Session Expires 7 hours, 59 minutes
3
Version 2.3.35
4
Region United States (us)
5
Web Interface http://127.0.0.1:4040
6
Forwarding http://dde093e1.ngrok.io -> http://localhost:5005
7
Forwarding https://dde093e1.ngrok.io -> http://localhost:5005
Copied!
Public URL will be provided next to Forwarding column. In this case, http://dde093e1.ngrok.io.
4. configure Rocket.Chat webhook
Go to Administration > Integrations. Click New Integration button in the top right corner and then select Outgoing WebHook.
Select Message Sent Event Trigger from the dropdown list. Complete the configuration with the following settings:
    Enabled: True
    Channel: #general
    URLs: http://<ngrok_public_url>/webhooks/rocketchat/webhook
    Post as: <RASA USER NAME>
NOTE: Make sure you replace the URL with a valid public URL obtained on the previous step using ngrok.
Click Save changes in the top right corner.
5. talk to your bot
On the server, login as a regular user (not the BOT user), go to general room, and try to talk to your bot by typing @bot_rasa hello:
Rasa bot is talking
Last modified 6mo ago
Export as PDF
Copy link