Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

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:

    INSTALLED_APPS = [
        ...
        'mad_notifications',
    ]
    
  2. Include the notifications URLconf in your project urls.py like this:

    path('notifications/', include('mad_notifications.api.urls')),
    
  3. Run python manage.py migrate to create the notifications models.

Usage

Shorthand method

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

Notification Class

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.NotificationTemplate Object
)
# send the notification
notification.notify()

Overriding default

MAD_NOTIFICATIONS_USER_NOTIFICATION_CONFIG_MODEL = "mad_notifications.UserNotificationConfig"
MAD_NOTIFICATIONS_NOTIFICATION_MODEL = "mad_notifications.Notification"
MAD_NOTIFICATIONS_TEMPLATE_MODEL = "mad_notifications.NotificationTemplate"
MAD_NOTIFICATIONS_DEVICE_MODEL = "mad_notifications.Device"
MAD_NOTIFICATIONS_DEFAULT_SMS_PROVIDER = "Twilio" # valid values "Twilio" / "Telnyx"

TWILIO_ACCOUNT_SID = ""
TWILIO_ACCOUNT_AUTH_TOKEN = ""
TWILIO_ACCOUNT_PHONE_NUMBER = ""

TELNYX_API_KEY = ""
TELNYX_MESSAGING_PROFILE = ""
TELNYX_FROM_PHONE_NUMBER = ""


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

    "TWILIO_NOTIFICATION_CLASS": "mad_notifications.senders.twilio.TwilioNotification",
    "TELNYX_NOTIFICATION_CLASS": "mad_notifications.senders.telnyx.TelnyxNotification",

    # User config
    "USER_NOTIFICATION_CONFIG_ADMIN_CLASS": "mad_notifications.admin.UserNotificationConfigAdmin",
    # Notification Templates
    "NOTIFICATION_TEMPLATE_ADMIN_CLASS": "mad_notifications.admin.NotificationTemplateAdmin",
    # Device
    "DEVICE_ADMIN_CLASS": "mad_notifications.admin.DeviceAdmin",
    "NOTIFICATION_ADMIN_CLASS": "mad_notifications.admin.NotificationAdmin",
}

Developer Guide

Setting up a new provider

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

Metadata

Release files for mad-notifications 6.0.0rc9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for mad-notifications 6.0.0rc9
File Interpreter ABI Platform Actions
mad_notifications-6.0.0rc9-py3-none-any.whl Python 3 none any Details for mad_notifications-6.0.0rc9-py3-none-any.whl

Release files / mad_notifications-6.0.0rc9-py3-none-any.whl

Download URL mad_notifications-6.0.0rc9-py3-none-any.whl
Size 27.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c278ff9dd2f1562880b0a0d877029adfc0372a548f80fb23b307425202e37a8c
BLAKE2b-256 checksum
How to use checksums
2cc98ff99fcd2e54b463238d0c1e19f89e99dfedd1270ae33bd84ed2465d1d43
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Security for mad-notifications 6.0.0rc9

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.

Release history Release notifications | RSS feed

This release
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page