This is Project contain API for Chat System like WhatsApp
-
User Authentication
- Login method: Phone number and OTP verification.
-
Profile Management
- Users should be able to edit their profile, including updating their name and profile picture.
-
Chat Functionality
- Enable users to send, receive, forward, and reply to messages and media.
- Suggest replies based on the last sent message.
-
Message Scheduling
- Implement message scheduling capabilities.
-
Event-Based Auto-Sending Messages
- Automatically send messages for specific events (e.g., Diwali greetings, birthday celebrations).
- Pick events from the calendar for auto-sending messages.
-
Recurring Messages
- Allow for the scheduling of recurring messages.
-
Settings
- Provide a setting to turn the auto-sending and recurring messages feature off and on.
- Enable sending messages to selected users.
You need to place .env file inside 'chat_system/chat_system' along with settings.py containing below information
SECRET_KEY=<Your Secret Key>
TWILIO_ACCOUNT_SID=<YOUR TWILIO ACCOUNT SID> # Replace with your Twilio account SID
TWILIO_AUTH_TOKEN=<YOUR TWILIO AUTH TOKEN> # Replace with your Twilio auth token
TWILIO_PHONE_NUMBER='+15005550006' # Replace with your Twilio phone number you bought (this is test phone number provided by twilio)
Run below commands
python manage.py makemigrations
python manage.py migrate
Create Your own superuser
python manage.py createsuperuser
Provide below details
- phone_number:+91<valid 10 digit phone number>
- password: <whatever you want>
- confirm_password: <same as password>
Create Virtual Environment and Install dependency
virtualenv venv
source venv/bin/activate
pip install -r requirements.txt
Run Django App
python manage.py makemigrations
python manage.py migrate --database=chat chat
python manage.py migrate
python manage.py runserver
Run Celery and Celery Beat
celery -A chat_system worker --beat --scheduler django --loglevel=info
docker compose up -build
Now you can start using APIs in Postman.
Note that if you have not bought Number from twilio and set it into .env. You can find OTP using steps below
- Login admin - using credential you just created above using createsuperuser command
- Go to "Users" -> "Respective Phone Number" whome you want to login -> find otp and use it in postman collection to verify and login
Used below versions of pypi for this project. Using Djongo require us to use sqlparse==0.2.4
but latest version of django require sqlparse>=0.3.1
pymongo==3.12.1
Django==3.2.16
djongo==1.3.6
sqlparse==0.2.4
djangorestframework==3.15.1