- sudo apt-get install python3-pip
- sudo pip3 install virtualenv
- virtualenv venv
- source venv/bin/activate
- pip install -r requirements.txt
- python manage.py migrate
- python manage.py runserver
- Install python form "https://www.python.org/downloads/windows/"
- In your terminal: pip install virtualenv
- Inside the app folder: virtualenv venv
- To activate the virtual environment: venv/bin/activate
- pip install -r requirements.txt
- python manage.py migrate
- python manage.py runserver
- First create an account with Twilio if you don't already have one from: https://www.twilio.com/try-twilio
- When you have successfully created your twilio account, you will be transfered to this page. Follow the steps on this page to activate your twilio sandbox.
- Create a new file .env inside bot/ folder. Declare these environment variables in .env
TWILIO_ACCOUNT_SID =
TWILIO_AUTH_TOKEN =
TWILIO_NUMBER =
- Click on my first Twilio account and you will be redirected to the twilio whatsapp console. From this we will need to copy the Account SID, the Auth Token and the Twilio number and paste them in bot/.env. Like:
TWILIO_ACCOUNT_SID = AC53aa8197de6f7767c509335a6de6588a
TWILIO_AUTH_TOKEN = the auth token here
TWILIO_NUMBER = +14155238886
- Now we need to setup our tunnel so that our app is connected to the twilio sandbox. We need to create an account with https://ngrok.com/
- Download ngrok for your system and run it, since our app is running on localhost port 8000 run this command
ngrok http 8000
. Copy theForwarding url
- Finally on the twilio dashboard, under the Develop tab, locate the whatsapp sandbox settings and click on it. You will be redirected to the settings page. Here we need to paste the url we copied from ngrok and paste it in
WHEN A MESSAGE COMES IN
. now we are done and ready to use our whatsapp bot - On whatsapp inside your twilio bot, send a simple "hello" and the bot will reply to you.
- To view all your discusions with the bot, once again just open the url you copied from ngrok or use http://127.0.0.1:8000/
- On whatsapp add this number "+14155238886"
- Send "join tape-income"
- Finally send a simple "Hi or Hello"
- To view conversations visit: https://b35f-102-222-183-205.in.ngrok.io