This is the Practice Version which means that you will find much of the code is missing and you will have to write it yourself.
If you haven’t installed Rasa NLU and Rasa Core yet, you can do it by navigating to the project directory and running:
pip install -r requirements.txt
You also need to install a spaCy English language model. You can install it by running:
python -m spacy download en
-
data/nlu_data.md file contents training data for the NLU model.
-
nlu_config.yml file contains the configuration of the Rasa NLU pipeline:
language: "en"
pipeline: spacy_sklearn
-
data/stories.md file contains some training stories which represent the conversations between a user and the assistant.
-
domain.yml file describes the domain of the assistant which includes intents, entities, slots, templates and actions the assistant should be aware of.
-
endpoints.yml file contains the webhook configuration for custom action.
-
policies.yml file contains the configuration of the training policies for Rasa Core model.
Note: If running on Windows, you will either have to install make or copy the following commands from the Makefile
-
You can train the Rasa NLU model by running:
make train-nlu
This will train the Rasa NLU model and store it inside the/models/current/nlu
folder of your project directory.if you get warning message saying that you have trained file, then delete the old nlu folder. -
Train the Rasa Core model by running:
make train-core
This will train the Rasa Core model and store it inside the/models/current/dialogue
folder of your project directory. -
In a new terminal start the server for the custom action by running:
make action-server
This will start the server for emulating the custom action. -
Test the assistant by running:
make cmdline
This will load the assistant in your terminal for you to chat.
- Go to your Slack app's settings page and use the Bot User OAuth Access Token: And add this in the slack_credentials.yml file:
slack:
slack_token: "Bot User OAuth Access Token"
slack_channel:
- Start the action server by typing the following command in terminal:
make action-server
- Setup ngrok for the port that the action server is using by the following command:
ngrok http 5055
This will give you an output like the following:
- Copy the highlighted url in the above image into your endpoints.yml file:
action_endpoint: "your_url_here/webhook"
url:
- Start the core server in another terminal window:
python -m rasa_core.run -d models/current/dialogue -u models/current/nlu --port 5002 --connector slack --credentials slack_credentials.yml --endpoints endpoints.yml
This will start the server at port 5002.
- Now you have to expose this port to the world by using ngrok, open another terminal and type:
ngrok http 5002
- Take the above url and paste it into the Events Subscription page of your slack app in the following format:
your_url_here/webhooks/slack/webhook
And you should now be able to talk to your chatbot in Slack!