A restaurant finder chatbot that is based on Rasa 2.2 backend and consumes Zomato API to find the restaurant for a user given location. Chatbot requires 2 inputs from user: location and cuisine to find the restaurants using Zomato API. Chatbot is connected to Whatsapp via Twilio, hence a user can find restaurants via Whatsapp.
- Rasa 2.2 - Chatbot backend framework
- Twilio API - To connect to Whatsapp using REST based API
- Ngrok - To generate public ip address and connect to the local rasa server
- Zomato API - API to query the Zomato's restaurant database
-
Install rasa 2.2
-
Generate Zomato API key
-
Create account in Twilio and start the whatsapp sandbox.
-
Install ngrok in the local machine and add your authorization token.
-
Clone the repo using following command
$ git clone https://github.com/coolmunzi/restaurant_bot.git
-
Create a virtual environment and change the directory to the cloned repo
-
Change your directory to the cloned repo and create a Python virtual environment
-
Add twilio credentials in credentials.yml file:
twilio: account_sid: "{Add your account sid}" auth_token: "{Add your Authorization token}" twilio_number: "whatsapp:+{Add your twilio number}"
-
Add your zomato api key in zomatoApi.py file inside script folder.
headers = {'user-key': '{Put your Zomato API key here}', 'Accept': 'application/json'}
-
Train the rasa model:
$ rasa train
-
Start the rasa server from terminal:
$ rasa run -m models --enable-api --cors "*" --debug
-
Start rasa actions server in another terminal:
$ rasa run actions
-
Start ngrok from terminal
$ ./ngrok http 5005
-
Copy the forwarding ip address generated by ngrok and paste the same in 'WHEN A MESSAGE COMES IN' field inside Whatsapp Sandbox settings in Programmable Messaging Settings as highlighted in the below image. The end point should be in the format as shown below:
{Ngrok generated ip address}/webhooks/twilio/webhook