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, EE',
'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?
Base on sample config, two sms send from twilio
with TWILIO_EE_SENDER
number and one of them from AWS-SNS
and region is eu-west-1
.
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.4.tar.gz
(8.0 kB
view hashes)
Built Distribution
Close
Hashes for az_messaging-1.1.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7e96dc973225edf2cfe08ccb2114741345b15904cf37f601b6a807f792d54fd8 |
|
MD5 | bb5a7384e2cd079b7d94551e34813fb3 |
|
BLAKE2b-256 | a2cd44b95a6891bb09363c0e0461712b3d38bd06157a181ab59df534bcb36ca9 |