Messaging for django
Project description
AZ Messaging config
[[TOC]]
Install with pip
pip install az-messaging
settings.py
INSTALLED_APPS = [
# ....
'azmessaging',
# ...
]
AZ_MESSAGING = {
'CLASS': {
'SMS': 'azmessaging.channels.SMSNotificationChannel',
},
'SMS': {
'SERVICE_PROVIDER': {
'SNS': {
'CLASS': 'azmessaging.sms.SMSAPISNSAmazon',
'ROUTING': [
{
'countries': 'UK, US',
'region_name': 'eu-west-1'
},
{
'continents': 'EUROPE, AFRICA',
'region_name': 'eu-west-2'
}
],
'key_id': os.environ.get('AWS_ACCESS_KEY_ID', None),
'access_key': os.environ.get('AWS_SECRET_ACCESS_KEY', None),
'region_name': os.environ.get('AWS_SNS_DEFAULT_REGION', None),
},
'TWILIO': {
'CLASS': 'azmessaging.sms.SMSAPITwilio',
'ROUTING': [
{
'countries': 'DE',
'sender': os.environ.get('TWILIO_EE_SENDER', None),
},
{
'continents': 'ASIA',
'sender': os.environ.get('TWILIO_ASIA_SENDER', None),
}
],
'account_sid': os.environ.get('TWILIO_ACCOUNT_SID', None),
'auth_token': os.environ.get('TWILIO_AUTH_TOKEN', None),
'sender': os.environ.get('TWILIO_DEFAULT_SENDER', None),
},
},
'DEFAULT_SERVICE_PROVIDER': 'SNS', # REQUIRED
'PRIORITY_SERVICE_PROVIDER': [ # REQUIRED
'TWILIO',
'SNS',
]
},
}
Migrate
python manage.py migrate
SMS
How to use it?
from azmessaging import default_settings as settings
from azmessaging.models import SMSNotificationType
identifier = 'what ever you want'
message = 'Your code is: 1222'
sms_type = SMSNotificationType.TRANSACTIONAL
klass = settings.READER.klass('sms', identifier)
sms = klass(identifier=identifier, message=message, sms_type=sms_type)
sms.set_receivers(['+16503331111', '+37211123450', '+37211123451'])
sms.notify()
TODO
-
Documentation
-
Support multiple provider
-
SMS Support
-
SMS Support SNS AWS
-
SMS Support Twilio
-
SMS Routing Base on country/continents
-
SMS Support every provider you want.
-
SMS Batch
-
Push notification
-
Console
-
Websocket
-
Telegram bot
Develop
License
The MIT License (MIT). Please see License File for more information.
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
az-messaging-1.1.1.tar.gz
(7.8 kB
view hashes)
Built Distribution
Close
Hashes for az_messaging-1.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 699b3a581b8f302b640c7c266b939ddd3faf80ef4c172a26c521bd391281e5b4 |
|
MD5 | 0640a9235fd8631cb310ae75a641be2c |
|
BLAKE2b-256 | f72431f72c8ba55547a0488a3a1a1a21e859c017e728d2283c00501fe0c1e178 |