Django ClickSend SMS
A lightweight Django app for sending SMS messages through the ClickSend REST API. Supports single SMS, bulk SMS, Django settings integration, and a test management command.
Features
- Send a single SMS
- Send bulk SMS
- Easy Django integration
- Simple, high-level SMS client
- Optional test command (
send_test_sms) - Works with Django 3.2+
Installation
Install using pip:
pip install django-clicksend-sms
Or install from a local folder:
pip install /path/to/django-clicksend-sms/
Django Setup
Add the app to your INSTALLED_APPS:
INSTALLED_APPS = [
...
"clicksend_sms",
]
Add your ClickSend credentials:
CLICKSEND_USERNAME = "your_clicksend_username"
CLICKSEND_API_KEY = "your_api_key"
Usage
Sending a Single SMS
from clicksend_sms.client import ClickSendSMSClient
def send_otp(phone, otp):
client = ClickSendSMSClient()
return client.send_sms(
to=phone,
message=f"Your OTP is {otp}"
)
Sending Bulk SMS
from clicksend_sms.client import ClickSendSMSClient
client = ClickSendSMSClient()
messages = [
{"to": "+1111111111", "message": "Hello User 1"},
{"to": "+1222222222", "message": "Hello User 2", "sender_id": "MyApp"},
]
response = client.send_bulk_sms(messages)
print(response)
Management Command: Send Test SMS
You can quickly test sending an SMS using the built-in Django command.
python manage.py send_test_sms <phone> "<message>"
Example:
python manage.py send_test_sms +11234567890 "Hello from Django!"
Package Structure
clicksend_sms/
__init__.py
apps.py
client.py
settings.py
management/
commands/
send_test_sms.py
How It Works
ClickSendSMSClient
This class handles:
- Loading credentials from Django settings
- Formatting message payloads
- Sending requests to ClickSend REST API
- Supporting both single and bulk SMS
Error Handling
Common errors:
- Missing credentials:
ValueError: ClickSend credentials are not configured.
- Non-JSON API response:
{"error": "Invalid JSON response", "status_code": ###}
Development
Install in editable mode:
pip install -e .
Build package for PyPI:
python setup.py sdist bdist_wheel
Upload:
twine upload dist/*
License
This project is free and open-source.
Metadata
Release files for django-click-send-sms 1.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_click_send_sms-1.0.3-py3-none-any.whl | Python 3 | none | any | Details for django_click_send_sms-1.0.3-py3-none-any.whl |
Release files / django_click_send_sms-1.0.3-py3-none-any.whl
| Download URL | django_click_send_sms-1.0.3-py3-none-any.whl |
|---|---|
| Size | 5.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a0e8de24de8e20dca15ba359c4995e612c797a9f362415151248e7b50d296046
|
|
BLAKE2b-256 checksum How to use checksums |
2c9a3fc33d7e2c15ee65856b66b960c0fe44764d26eb6328ac0f9371e0ea9749
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|
Security for django-click-send-sms 1.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.