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

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.0.tar.gz (12.1 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.0-py3-none-any.whl (17.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: django_unicom-0.1.0.tar.gz
  • Upload date:
  • Size: 12.1 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.0.tar.gz
Algorithm Hash digest
SHA256 8154fb441876cc98d7759248622bff8a222533d3ed202b88b135ac13538aea76
MD5 9e86796aee85d055b22749d5323d2a67
BLAKE2b-256 d29ca1deb6308bb10d824afc8084202ecac4d5f537b3c4daeb186d5398eb6855

See more details on using hashes here.

File details

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

File metadata

  • Download URL: django_unicom-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 17.0 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 934e15d2c9e75b5b6419f62b279c294852dcca126d5b64de6d64bb8009267d73
MD5 7b81b171193911289546380e3135c1f7
BLAKE2b-256 5b2d146455421b7effe9c8430df0c93335293bbea8f704e9eee22424ce10a2c5

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