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
-
Install the package:
pip install django-unicom
-
Add
unicomto your Django settings:INSTALLED_APPS = [ ... 'unicom', ]
-
Include
unicomURLs in your project’surls.py:This is required so that webhook URLs can be constructed correctly.
from django.urls import path, include urlpatterns = [ ... path('unicom/', include('unicom.urls')), ]
-
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:
-
Clone the repo:
git clone https://github.com/meena-erian/unicom.git cd unicom
-
Create a
db.envfile in the root:POSTGRES_DB=unicom_test POSTGRES_USER=unicom POSTGRES_PASSWORD=unicom DJANGO_PUBLIC_ORIGIN=https://yourdomain.com
-
Start the dev environment:
docker-compose up --build
-
Run tests:
docker-compose exec app pytest
or just
pytest
Note: To run
test_telegram_livetests you need to createtelegram_credentials.pyin the tests folder and define in itTELEGRAM_API_TOKENandTELEGRAM_SECRET_TOKENand to runtest_email_liveyou need to createemail_credentials.pyin the tests folder and define in itEMAIL_CONFIGdict with the propertiesEMAIL_ADDRESS: str,EMAIL_PASSWORD: str, andIMAP: dict, andSMTP: dict, each ofIMAPandSMTPcontainshost: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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2dd1a8c2435c373aec2224c1a4374d01359e4db3465f78f177bbecb5bbb179e8
|
|
| MD5 |
c6c54ccc7bb1192da694c7aa63f454f5
|
|
| BLAKE2b-256 |
36c7ff7eebef176b9e9f036e611c0e2e7d7c2ee05ef53cd8ebc5752c22f06a58
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a71039deccdc3c2e992b7389a95a289ff3699dcd6dec65d9f91da1663cc52525
|
|
| MD5 |
5c72f8c4e5aad9cc3dd2523fae416750
|
|
| BLAKE2b-256 |
062347f19548e48b9f0ee14394d5f007aebd6bd2212443be64d901676d31c048
|