This project contains a Flask application that uses OpenAI's GPT-3 language model to respond to user queries received through Twilio's API on Whatsapp.
Make sure that you have the following installed:
- Python 3.x
- Flask
- Twilio
- OpenAI
- Clone the repository to your local machine
- Install the required packages using pip install -r requirements.txt
- Add your OpenAI secret API key to the openai.api_key variable in the main.py file
- Start the Flask application by running the command python main.py
- Download and extract ngrok from this link based on your operating system
- Start ngrok by navigating to the extracted ngrok folder in a separate terminal window and running the command ./ngrok http 5000
- Copy the HTTPS forwarding URL generated by ngrok
- Create a Twilio account and sign in to the Twilio Console
- Navigate to the Messaging Services page and create a new Messaging Service
- In the new Messaging Service, navigate to the Sandbox section and add the ngrok HTTPS URL to the "Request URL" field, with "/sms" appended to the end (e.g. https://abcd1234.ngrok.io/sms)
- Save the changes and send a message to the Twilio number associated with the Messaging Service to test the application Usage
Once the setup is complete, the Flask application will be running and ngrok will be forwarding incoming messages to the application. The application will respond to user queries using OpenAI's GPT-3 language model. To modify the language model, refer to the OpenAI API documentation.
📫 How to reach me: deysusovan93@gmail.com