This is a complete chatbot backend built with Rasa
Chatbot: https://rasachatbotapp.herokuapp.com/
Both action server and rasa-core runs as separate processes in the same container. Rename the .env-sample to .env and optionally update the API_KEYs, TOKENs etc.
docker build -t rasachatbot .
docker run -it --rm -p 5005:5005 -v $(pwd)/trackerStore/chatHistyLogs:/app/chatHistoryLogs --env-file $(pwd)/.env rasachatbot
It starts a webserver with rest api and listens for messages at localhost:5005
curl --request POST \
--url http://localhost:5005/webhooks/rest/webhook \
--header 'content-type: application/json' \
--data '{
"sender": "default",
"message": "Hi"
}'
Response
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 59
Access-Control-Allow-Origin: *
[{
"recipient_id": "default",
"text": "Hello There"
}]
docker run --rm --volume $(pwd):/app --env-file $(pwd)/.env -it\
--workdir /app rasachatbot bash ./scripts/start_shell.sh
Optionally to run the actions server in separate container start the services using docker-compose. The action server runs on http://action_server:5055/webhook (docker's internal network). The rasa-core services uses the config/endpoints.local.yml to find this actions server
docker-compose up
You may download a pretrained model from this repo's release page and copy to models directory. To retrain the model you can run:
docker run --rm --volume $(pwd):/app \
--workdir /app rasa/rasa:1.10.10 \
train --fixed-model-name rasa-model \
--config config.yml
heroku login
heroku create <appname>
heroku container:login
heroku container:push -a <appname> web
heroku container:release -a <appname> web
Rasa supports integration with multiple channels. Apart from exposing the REST api over http, we can integrate with facebook.
Go to https://developers.facebook.com and create an app. We can handle messages sent to a facebook page from our app. To do so add messenger to the facebook app and subscribe to a page. Update app secret and page token in config/credentials.yml. On the facebook app, update the webhook url to the deployed heroku app (https://APPNAME.herokuapp.com/webhooks/facebook/webhook).