Skip to content

SonicAI is a WhatsApp Chatbot designed to provide users with a convenient and engaging way to interact with an AI assistant. Powered by OpenAI's GPT-3.5-turbo, SonicAI offers a responsive and dynamic chat experience that can help users with a variety of tasks and inquiries.

Notifications You must be signed in to change notification settings

shamspias/whatsapp-voice-gpt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WhatsApp Voice GPT Chatbot: SonicAI

Overview

SonicAI is built using Python, Flask, Twilio API, and OpenAI API. The chatbot utilizes asynchronous tasks with Celery to handle user requests and communicate with the OpenAI API efficiently. It supports both text and voice messages, allowing users to interact with the chatbot in their preferred format. The project is designed to be easily deployable and scalable, offering a seamless integration with WhatsApp.

Features

  • Engaging text-based conversations with GPT-3.5-turbo-powered AI
  • Voice message recognition and processing
  • Dynamic conversation tracking and history
  • Supports commands to clear conversation history
  • Utilizes asynchronous tasks with Celery for efficient request handling
  • Built with Flask, Twilio API, and OpenAI API

Installation

To set up SonicAI, follow the steps below:

  1. Clone the repository:
git clone https://github.com/shamspias/whatsapp-voice-gpt.git 
  1. Change into the project directory:
cd whatsapp-voice-gpt
  1. Create a virtual environment:
python3 -m venv venv
  1. Activate the virtual environment:
source venv/bin/activate
  1. Install the dependencies and install redis-server:
pip install -r requirements.txt
  1. Create a Twilio account and get your account SID and auth token. You can find the instructions here.
  2. Create an OpenAI account and get your API key. You can find the instructions here.
  3. Create a .env file in the project directory and add the following environment variables or copy the contents of .env.example into the .env file:
TWILIO_ACCOUNT_SID=your_twilio_account_sid
TWILIO_AUTH_TOKEN=your_twilio_auth_token
TWILIO_PHONE_NUMBER=your_twilio_phone_number
OPEN_AI_KEY=your_openai_api_key
CELERY_BROKER_URL=your_celery_broker_url
CELERY_RESULT_BACKEND=your_celery_result_backend
SYSTEM_PROMPT=your_system_prompt
  1. Run the celery worker:
celery -A app.celery worker --loglevel=info
  1. Run the flask server:
python app.py
  1. Expose the flask server to the internet using a tunneling service like ngrok. You can find the instructions here.
  2. Add the ngrok URL to your Twilio phone number's messaging webhook. You can find the instructions here.
  3. Add the ngrok URL to your Twilio phone number's voice webhook. You can find the instructions here.
  4. Send a WhatsApp message to your Twilio phone number to start a conversation with the chatbot.
  5. Send a WhatsApp voice message to your Twilio phone number to start a voice conversation with the chatbot.
  6. Send a WhatsApp message to your Twilio phone number with the command /clear to clear the conversation history.
  7. Send a WhatsApp message to your Twilio phone number with the command /help to view the list of available commands.

Contributing

Contributions are welcome! If you'd like to contribute, please submit a pull request or open an issue with your proposed changes or bug reports.

About

SonicAI is a WhatsApp Chatbot designed to provide users with a convenient and engaging way to interact with an AI assistant. Powered by OpenAI's GPT-3.5-turbo, SonicAI offers a responsive and dynamic chat experience that can help users with a variety of tasks and inquiries.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages