---
title: "Sending Notifications to Django Users"
description: "The article helps implementing notification sending to django >=3.2 user(s)."
canonical_url: "https://haseeburrehman.com/posts/sending-notifications-to-django-users"
---

> Index of every page on this site: [llms.txt](https://haseeburrehman.com/llms.txt)

# Sending Notifications to Django Users

So, you want to notify the user via email or push notification or sms or whatsapp or whatever, after they did something on your website/app.

### Installation

Install `mad_notifications` from using `pip install mad_notifications`

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

update your project's `urls.py` and add

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

Its installed now, what next?

### Basic Usage

Call it where you want it.

```python
from mad_notifications.shorthand import newNotification

return newNotification(
    user = get_user_model(id=SOME_ID), # django user object
    title = "Welcome to my website/app", # string
    content = "Thanks for join my website/app", # string
)
```

this will send an email to the user, where the `title` will be the subject and `content` will be the content.

### Push Notification

So you want to send them a push notification now? Okay I got you.

**Important: Make sure you have firebase already setup in your project.**

From your mobile app, generate firebase device token, and post it to `/notifications/devices/` this will automatically associate the device token with the user, based on the authorization headers.

Now when you send the notification, it will also send the push notification to that device.

## Sitemap

See the full [sitemap](https://haseeburrehman.com/sitemap.md) for all pages.
