Skip to content

danaelshrbiny10/Automate-WhatsApp-Messages

Repository files navigation

Automate-WhatsApp-Messages

python Code style: black pydocstyle pre-commit

This project aims to provide a way to automate sending WhatsApp messages to contacts and groups using Python.

Table of Contents

Installation

To get started with the Automate-WhatsApp-Messages project:

  1. Clone the repository to your local machine
git clone https://github.com/danaelshrbiny10/Automate-WhatsApp-Messages.git
  1. Create a virtual environment and activate it:
# install virtual enviroment
pip install virtualenv

# Create a virtual environment
virtualenv venv

# Activate the virtual environment
venv/source/activate
  1. Install the project dependencies:
pip install -r requirements.txt

run project

python manage.py runserver

Usage

You can use this postman collection to learn more about the API usage

API Documentation

The API endpoints are documented using Swagger. To access the API documentation:

  1. Start the development server
python manage.py runserver
  1. Open your web browser and navigate to http://localhost:8000/ or http://localhost:8000/redoc/

Database Backend

use PostgreSQL and update the DATABASES settings in ecommerce/settings.py with your PostgreSQL database configuration.

DATABASES = {
    "default": {
        "ENGINE": "django.db.backends.postgresql_psycopg2",
        "NAME": "Whatsapp API",
        "USER": "postgres",
        'PASSWORD': 'your_db_password',
        "HOST": "127.0.0.1",
        "PORT": "5432",
    }
}

JWT Authentication

This project uses JWT (JSON Web Token) authentication for user authentication. JWT is a widely adopted standard for securing API endpoints and provides a stateless mechanism for authentication and involves the following components:

  1. Token-Based Authentication: Instead of traditional session-based authentication, JWT authentication relies on tokens. When a user logs in or registers, a JWT token is generated and returned to the client.
  2. Token Verification: On subsequent requests, the client includes the JWT token in the request headers to authenticate itself. The server verifies the token to authenticate and authorize the user.
  3. Token Expiration: JWT tokens have an expiration time, typically set to a short duration for security reasons. Once expired, the token is no longer valid and the client needs to obtain a new token.

To authenticate requests using JWT tokens, include the token in the request headers. The token should be included in the Authorization header using the Bearer scheme

Bearer <jwt-token>

Technologies

The application is built with the following technologies:

  • Django
  • Django Rest Framework
  • Docker
  • Docker Compose
  • Nginx

License Information

This project is licensed under the MIT License. For more details, see the LICENSE file.