๐๐ฟ๐ผ๐๐๐ฒ๐ฟ ๐ฃ๐๐๐ต ๐ก๐ผ๐๐ถ๐ณ๐ถ๐ฐ๐ฎ๐๐ถ๐ผ๐ป๐ ๐ณ๐ผ๐ฟ ๐๐ท๐ฎ๐ป๐ด๐ผ
I stopped using email for feedback alerts. Email servers cost money. They fill your inbox. I checked the database manually. I was too slow.
I built a Web Push system for my Django site. Now I get native OS alerts. These work even when the admin tab is closed.
The process is simple:
- Users subscribe in their browser.
- Django stores the subscription.
- A visitor sends feedback.
- A Huey background task triggers.
- The push server sends the alert.
- The service worker shows the notification.
Tools I used:
- pywebpush for server communication.
- py-vapid for key generation.
- Huey for background tasks.
Follow these safety tips:
- Keep messages under 120 characters.
- Do not send private data in the alert.
- Use generic messages like You have a new message.
- This keeps sensitive info safe.
Improve your opt-in rate:
- Do not ask for permission immediately.
- Give users a reason first.
- This raises sign-ups from 20% to 60%.
Source: https://dev.to/djangotricks/browser-push-notifications-for-a-django-website-4obd