Care SMS - Backend Configuration for Django Apps
Care SMS supports multiple SMS backends for sending messages. Each backend is designed for specific use cases like testing, development, or production. Here's how you can configure and use each backend in a Django project:
1. Setting Up the Backend
To configure an SMS backend in a Django app, add the SMS_BACKEND setting in your settings.py file.
Example:
# settings.py
SMS_BACKEND = 'sms.backends.<backend_module>.<BackendClass>'
2. Dummy Backend
The Dummy Backend does nothing with the messages and is useful for testing.
Configuration:
# settings.py
SMS_BACKEND = 'sms.backends.dummy_backend.DummyBackend'
Usage:
from sms import send_text_message
send_text_message('Test Message', 'Sender', ['Recipient'])
3. LocMem Backend
The LocMem Backend stores messages in an in-memory outbox, ideal for testing without external dependencies.
Configuration:
# settings.py
SMS_BACKEND = 'sms.backends.locmem_backend.LocMemBackend'
Accessing the Outbox:
from sms.backends.locmem_backend import outbox
print(outbox) # List of sent messages
Usage:
from sms import send_text_message
send_text_message('Test Message', 'Sender', ['Recipient'])
4. Console Backend
The Console Backend writes messages to the console or a custom stream. This backend is useful during development.
Configuration:
# settings.py
SMS_BACKEND = 'sms.backends.console_backend.ConsoleBackend'
Usage:
from sms import send_text_message
send_text_message('Test Message', 'Sender', ['Recipient'])
5. File-Based Backend
The File-Based Backend saves messages to files in a specified directory, useful for debugging or lightweight persistence.
Configuration:
# settings.py
SMS_BACKEND = 'sms.backends.file_backend.FileBackend'
SMS_FILE_PATH = '/path/to/log/directory'
Usage:
from sms import send_text_message
send_text_message('Test Message', 'Sender', ['Recipient'])
6. MessageBird Backend
The MessageBird Backend sends SMS via the MessageBird API. Requires an API key.
Configuration:
# settings.py
SMS_BACKEND = 'sms.backends.messagebird_backend.MessageBirdBackend'
MESSAGEBIRD_ACCESS_KEY = 'your_messagebird_access_key'
Usage:
from sms import send_text_message
send_text_message('Test Message', 'Sender', ['Recipient'])
7. Twilio Backend
The Twilio Backend sends SMS via the Twilio API. Requires account credentials.
Configuration:
# settings.py
SMS_BACKEND = 'sms.backends.twilio_backend.TwilioBackend'
TWILIO_ACCOUNT_SID = 'your_account_sid'
TWILIO_AUTH_TOKEN = 'your_auth_token'
Usage:
from sms import send_text_message
send_text_message('Test Message', 'Sender', ['Recipient'])
8. AWS SNS Backend
The AWS SNS Backend sends SMS via AWS SNS. Requires AWS credentials and configuration.
Configuration:
# settings.py
SMS_BACKEND = 'sms.backends.aws_backend.SnsBackend'
AWS_SNS_REGION = 'your_region'
AWS_SNS_ACCESS_KEY_ID = 'your_access_key_id'
AWS_SNS_SECRET_ACCESS_KEY = 'your_secret_access_key'
AWS_SNS_SENDER_ID = 'your_sender_id'
AWS_SNS_SMS_TYPE = 'Transactional' # or 'Promotional'
Usage:
from sms import send_text_message
send_text_message('Test Message', 'Sender', ['Recipient'])
Sending SMS
Once configured, use the send_text_message function to send SMS:
from sms import send_text_message
send_text_message('Hello, World!', 'SenderID', ['+1234567890'])
This function uses the configured backend automatically.
Metadata
Release files for care-sms 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| care-sms-1.0.0.tar.gz | 25.2 kB | Without provenance | Details for care-sms-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| care_sms-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for care_sms-1.0.0-py3-none-any.whl |
Total release size: 40.7 kB
Release files / care-sms-1.0.0.tar.gz
| Download URL | care-sms-1.0.0.tar.gz |
|---|---|
| Size | 25.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bb374f230dfabe6b7cc54f579d9ee678a38f22a2436ccda1311cb90d71062672
|
|
BLAKE2b-256 checksum How to use checksums |
803eee328c345f6b48aa39ef4a4d8e9acfb0383460ef1a0ee500b6b43d18d1f5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.13.1
|
Release files / care_sms-1.0.0-py3-none-any.whl
| Download URL | care_sms-1.0.0-py3-none-any.whl |
|---|---|
| Size | 15.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
40c7e2ebe9bfd54be4ce2f653fc7f174f8c9619fedeea08ff619747f58ed586d
|
|
BLAKE2b-256 checksum How to use checksums |
fdc25d266b11ed6e4cc491a0ea296408b58d3705df56305a1a9a88ffc4e6b72a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.13.1
|
Security for care-sms 1.0.0
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.