Skip to content

This project is a whatsapp based restaurant finder chatbot with rasa 2.2 backend and Zomato API to fetch restaurants.

Notifications You must be signed in to change notification settings

coolmunzi/restaurant_bot

Repository files navigation

About the project

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.

Screens

Technolgy stack used

  1. Rasa 2.2 - Chatbot backend framework
  2. Twilio API - To connect to Whatsapp using REST based API
  3. Ngrok - To generate public ip address and connect to the local rasa server
  4. Zomato API - API to query the Zomato's restaurant database

Prerequisites

  1. Install rasa 2.2

  2. Generate Zomato API key

  3. Create account in Twilio and start the whatsapp sandbox.

  4. Install ngrok in the local machine and add your authorization token.

Installation & Usage

  1. Clone the repo using following command

     $ git clone https://github.com/coolmunzi/restaurant_bot.git
    
  2. Create a virtual environment and change the directory to the cloned repo

  3. Change your directory to the cloned repo and create a Python virtual environment

  4. 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}" 
    
  5. Add your zomato api key in zomatoApi.py file inside script folder.

      headers = {'user-key': '{Put your Zomato API key here}',
        'Accept': 'application/json'}
    
  6. Train the rasa model:

      $ rasa train
    
  7. Start the rasa server from terminal:

      $ rasa run -m models --enable-api --cors "*" --debug
    
  8. Start rasa actions server in another terminal:

      $ rasa run actions
    
  9. Start ngrok from terminal

      $ ./ngrok http 5005
    
  10. 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. alt text The end point should be in the format as shown below:

     {Ngrok generated ip address}/webhooks/twilio/webhook