machaao / rasa-sample-nlu-bot

A sample RASA powered NLU chatbot boilerplate which showcases the various different messaging features of MACHAAO Chat Apps Platform via a custom connector
https://messengerx.io
8 stars 11 forks source link
android boilerplate chatbots messaging mini-apps nlu rasa rcs

Gitter

A sample RASA chatbot template using MACHAAO and Heroku

The intent of the document is to provide with a quick and fast development setup guide for python developers looking to develop deeply personalized chat bots on Android & Web

This RASA based Sample NLU chatbot also intends to showcase various RCS-esque messaging options available on the Machaao Platform

figure

Requirements

Get your FREE API Key

Run on Local Machine (from source)

cd rasa-sample-nlu-bot


* Setup a dev virtual environment on your local machine

python3 -m venv ./dev source ./dev/bin/activate


* Setup a dev virtual environment on your local machine (Windows)

python3 -m venv ./dev .\dev\Scripts\activate


* Install requirements
```bash
pip install -r requirements.txt

For M1 Macbook (Conda maybe required - Instructions Pending)

Refer to https://forum.rasa.com/t/an-unofficial-guide-to-installing-rasa-on-an-m1-macbook/51342

Tensorflow setup instructions: https://developer.apple.com/metal/tensorflow-plugin/

Start the RASA Action Core Service

Start the rasa action service(background) and core service in the terminal.

chmod +x local_start.sh
./local_start.sh

Start RASA Action and Core Service (Windows)

Start the rasa action and core services in separate terminals.

call local_start.bat

Using ngrok to expose PORT (Required)

ngrok http 5005

Update your webhook

Update your bot Webhook URL on MessengerX.io Portal with the url provided as shown below to continue development

Webhook Url: <HTTPS-NGROK-TUNNEL-URL>/webhooks/machaao/webhook

Test your bot:

Visit: https://messengerx.io/<bot-name>

Re-Train the Sample Model after changes

In order to re-train your RASA model based on the sample files provided in the "data" folder

rm -rf models/*
rasa train --domain domain.yml

figure

Run on Heroku (Optional - Not Production Setup)

We are assuming you have access to a heroku account and have installed heroku command line client for your OS.

Login to Heroku

heroku login

Create a new app on Heroku and note down your heroku app name

Push and deploy the docker image to Heroku

heroku create

Build the docker image

docker build -t rasa .

Login to Heroku Container Service

heroku container:login

Push to Container Registry

heroku container:push web

Release the image to your heroku app

heroku container:release web

Open the heroku app or open the logs to confirm

heroku open
heroku logs --tail

Update your webhook

Update your bot Webhook URL on MessengerX.io Portal with the heroku app url

Webhook Url: <YOUR-RASA-SERVER-URL>/webhooks/machaao/webhook

Note