Push Notifications with FCM
This guide covers the Firebase Cloud Messaging (FCM) implementation for push notifications.
Overview
Push notifications keep users engaged by alerting them to new content, messages, appointments, and other important updates even when they're not actively using the app.
How It Works
- User grants permission - Browser asks for notification permission
- FCM token generated - Unique token for this device/browser
- Token stored - Saved in database linked to user
- Server sends notification - Edge function sends to FCM
- FCM delivers - Push arrives on user's device
User Guide
Enabling Notifications
- Open the app
- You may see a prompt asking "Allow notifications?"
- Click Allow or Accept
- That's it! You'll now receive push notifications
If You Missed the Prompt
- Go to Settings in the app
- Find Notifications
- Click Enable Push Notifications
- Accept the browser permission
Managing Notifications
Most notification settings can be found in:
- App Settings → Notifications
You can typically control:
- Which types of notifications you receive
- Quiet hours
- Sound settings
Troubleshooting
Not Receiving Notifications
Check browser permissions:
- Click the lock icon in your browser's address bar
- Find "Notifications"
- Make sure it's set to "Allow"
Check in-app settings:
- Go to Settings → Notifications
- Make sure notifications are enabled
Try re-enabling:
- Disable notifications in app settings
- Wait a few seconds
- Enable them again
- Accept the browser prompt
Notifications Delayed
Push notifications should arrive within seconds, but delays can happen due to:
- Poor internet connection
- Device battery saver mode
- Too many apps sending notifications
No Sound
Check your device settings:
- Make sure device is not on silent/vibrate
- Check notification sound settings
- Some browsers don't support notification sounds
Best Practices
For Users
- Keep the app updated - Install PWA updates when prompted
- Don't disable notifications for important apps
- Check settings periodically - Make sure your preferences are correct
For Admins
- Don't over-notify - Too many notifications lead to users disabling them
- Make notifications actionable - Each notification should have a clear purpose
- Test notifications regularly - Ensure they're working correctly