Skip to main content

Unified communication layer for Django (Telegram, WhatsApp, Email)

Project description

Django Unicom

Unified communication layer for Django — easily integrate Telegram bots, WhatsApp, and Email with a consistent API across all platforms.


🚀 Quick Start

  1. Install the package:

    pip install django-unicom
    
  2. Add unicom to your Django settings:

    INSTALLED_APPS = [
        ...
        'unicom',
    ]
    
  3. Include unicom URLs in your project’s urls.py:

    This is required so that webhook URLs can be constructed correctly.

    from django.urls import path, include
    
    urlpatterns = [
        ...
        path('unicom/', include('unicom.urls')),
    ]
    
  4. Define your public origin: In your Django settings.py:

    DJANGO_PUBLIC_ORIGIN = "https://yourdomain.com"
    

    Or via environment variable:

    DJANGO_PUBLIC_ORIGIN=https://yourdomain.com
    

That’s it! Unicom can now register and manage public-facing webhooks (e.g., for Telegram bots) based on your defined base URL.


🧑‍💻 Contributing

We ❤️ contributors!

Requirements:

  • Docker & Docker Compose installed

Getting Started:

  1. Clone the repo:

    git clone https://github.com/meena-erian/unicom.git
    cd unicom
    
  2. Create a db.env file in the root:

    POSTGRES_DB=unicom_test
    POSTGRES_USER=unicom
    POSTGRES_PASSWORD=unicom
    DJANGO_PUBLIC_ORIGIN=https://yourdomain.com
    
  3. Start the dev environment:

    docker-compose up --build
    
  4. Run tests:

    docker-compose exec app pytest
    

    or just

    pytest
    

    Note: To run test_telegram_live tests you need to create telegram_credentials.py in the tests folder and define in it TELEGRAM_API_TOKEN and TELEGRAM_SECRET_TOKEN and to run test_email_live you need to create email_credentials.py in the tests folder and define in it EMAIL_CONFIG dict with the properties EMAIL_ADDRESS: str, EMAIL_PASSWORD: str, and IMAP: dict, and SMTP: dict, each of IMAP and SMTP contains host:str ,port:int, use_ssl:bool, protocol: (IMAP | SMTP)

No need to modify settings.py — everything is pre-wired to read from db.env.


📄 License

MIT License © Meena (Menas) Erian

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_unicom-0.1.1.tar.gz (12.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_unicom-0.1.1-py3-none-any.whl (17.4 kB view details)

Uploaded Python 3

File details

Details for the file django_unicom-0.1.1.tar.gz.

File metadata

  • Download URL: django_unicom-0.1.1.tar.gz
  • Upload date:
  • Size: 12.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.5

File hashes

Hashes for django_unicom-0.1.1.tar.gz
Algorithm Hash digest
SHA256 2dd1a8c2435c373aec2224c1a4374d01359e4db3465f78f177bbecb5bbb179e8
MD5 c6c54ccc7bb1192da694c7aa63f454f5
BLAKE2b-256 36c7ff7eebef176b9e9f036e611c0e2e7d7c2ee05ef53cd8ebc5752c22f06a58

See more details on using hashes here.

File details

Details for the file django_unicom-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: django_unicom-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 17.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.5

File hashes

Hashes for django_unicom-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a71039deccdc3c2e992b7389a95a289ff3699dcd6dec65d9f91da1663cc52525
MD5 5c72f8c4e5aad9cc3dd2523fae416750
BLAKE2b-256 062347f19548e48b9f0ee14394d5f007aebd6bd2212443be64d901676d31c048

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page