This project is a personal SMS and Call assistant that allows you to communicate through text messages and calls using speech-to-text technology. It uses Twilio to handle incoming SMS and calls, OpenAI to generate responses to incoming messages, Whisper to convert incoming calls to text, and Flask to create a web application. It uses a SQLite3 database to store messages for each number, hereby remembering previous conversations.
To install this project, you will need to have Python 3.x installed on your system. You will also need to create accounts with Twilio and OpenAI, and set up a virtual environment to manage the project dependencies.
-
Clone the repository to your local machine.
-
Create a virtual environment using
python3 -m venv venv
. -
Activate the virtual environment using
source venv/bin/activate
. -
Install the project dependencies using
pip install -r requirements.txt
. -
Set up your Twilio and OpenAI accounts, and create a file named
.env
in the project root directory with the following environment variables:TWILIO_ACCOUNT_SID=your_twilio_account_sid TWILIO_AUTH_TOKEN=your_twilio_auth_token OPENAI_API_KEY=your_openai_api_key
-
Install ngrok by following the instructions at https://ngrok.com/download.
-
Run ngrok to create a secure tunnel to localhost using the command
./ngrok http 5000
. Note that you need the forwarding URL in steps 8 and 9. -
In the Twilio console, set the webhook for incoming SMS messages to
https://<your-ngrok-url>/sms
. -
In the Twilio console, set the webhook for incoming calls to
https://<your-ngrok-url>/inbound/voice/call
. -
Run the application using
python bot.py
.
Once the application is running and the webhooks are set up, you can communicate with the personal SMS and Call assistant using SMS and phone calls.
To send a text message to the assistant, simply send a text message to the Twilio phone number associated with the application. The assistant will use OpenAI to generate a response and send it back to you.
To initiate a phone call with the assistant, call the Twilio phone number associated with the application. The assistant will answer the call and use Whisper to convert your spoken words to text. It will then use OpenAI to generate a response and send it back to you as an SMS message.
This project is licensed under the MIT License. See the LICENSE file for details.
This project was created using the following technologies: