Installation and Usage

Installation

Django

Python package:

pip install django-notifyAll

settings.py

  • Add notifyAll in your INSTALLED_APPS

Further settings depends on the Provider you Choose. Visit Provider page for that.

Usage

  • import notifier from notifyAll services as :
from notifyAll.services import notifier
  • Then call notifier.Notifier(), there are some required params which are as follows:

source

This signifies who wants to send notification.

destination

To whom you want to send notification.

notification_type

This signifies the Notification type available options are sms, email or push.

Note : push Notification support is not available yet,

provider

Type of Provider e.g., plivo, twilio, gmail etc, for more info visit Provider page for that.

context

All other information will come under context, it is of type dict. e.g., notification body, cc, bcc or attachement in case of email.

  • Possible keys of context :
body :
Body of Notification.
cc :
For email provider only.
bcc :
For email provider only.
attachment :
For email provider only.
html_message :
For email provider only. If you want to send message including HTML then you need to send your notification body in the above key.

Example Usage :

from notifyAll.services import notifier


def notify():
    """
    """
    context = {
        'subject': 'subject'
        'body': 'body'
        'html_message': '<h1>html message</h1>'
    }

    data = {
        'source': '[email protected]',
        'destination': '[email protected]',
        'notification_type': 'email',
        'provider': 'gmail',
        'context': context,
    }

    notification = notifier.Notifier(**data)

    return notification.notify()

For more information about usage visit our Example project.