Metadata-Version: 2.1
Name: mad_notifications
Version: 4.0.2
Summary: A Django app to send push notifications to users.
Home-page: https://www.madithouse.com/
Author: Haseeb Ur Rehman
Author-email: code@madithouse.com
License: Other/Proprietary License
Classifier: Environment :: Web Environment
Classifier: Framework :: Django
Classifier: Intended Audience :: Developers
Classifier: License :: Other/Proprietary License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE.md
Requires-Dist: django>=4.2.6
Requires-Dist: djangorestframework>=3.14.0
Requires-Dist: celery>=5.3.4
Requires-Dist: django-filter>=23.3
Requires-Dist: django-celery-beat>=2.5.0
Requires-Dist: firebase-admin>=6.2.0
Requires-Dist: google-api-core>=2.12.0
Requires-Dist: google-auth>=2.23.4
Requires-Dist: google-auth-httplib2>=0.1.1
Requires-Dist: google-api-python-client>=2.106.0
Requires-Dist: google-cloud-firestore>=2.13.0
Requires-Dist: googleapis-common-protos>=1.61.0
Requires-Dist: twilio>=8.10.0
Requires-Dist: django-phonenumber-field>=7.3.0
Requires-Dist: phonenumbers>=8.13.37

# Mad Notifications

Mad Notifications app for django to send notifications to the user

## Quick start

1. Add "mad_notifications" to your INSTALLED_APPS setting like this:

    ```python
    INSTALLED_APPS = [
        ...
        'mad_notifications',
    ]
    ```

2. Include the notifications URLconf in your project urls.py like this:

    ```python
    path('notifications/', include('mad_notifications.api.urls')),
    ```

3. Run `python manage.py migrate` to create the notifications models.

## Usage

### Shorthand method

```python
from mad_notifications.shorthand import newNotification
# create and send
return newNotification(
    user, # django user object
    title, # string
    content, # string
    template_slug = None, # slug from mad_notification.NotificationTemplate
    data = {}, # dict
    actions = {} # dict
)
```

### Notification Class

```python
from mad_notifications.notification import Notification
# create a notification
notification = Notification(
    user = user,
    title = "New Order",
    content = "You have a new order!",
    data = {
        'order': order_data,
    },
    actions = {
        'click_action': "ORDER_SCREEN"
    },
    template = email_template, # mad_notification.EmailTemplate Object
)
# send the notification
notification.notify()
```

## Overriding default

```python
MAD_NOTIFICATIONS = {
    "FIREBASE_MOBILE_PUSH_NOTIFICATION_CLASS": "mad_notifications.senders.firebase.FirebaseMobilePushNotification",
    "EMAIL_NOTIFICATION_CLASS": "mad_notifications.senders.email.EmailNotification",
}
```

## Developer Guide

### Setting up a new provider

Create logic in `~/senders/PROVIDER.py` and call via tasks in `~/notify/PROVIDER.py`
