Prompt
How do I send push notifications for account security alerts?
Latest observation
Oct 14, 2026
OpenAI APIWeb search: off
To send push notifications for account security alerts, you typically need:
1) Detect security events
Trigger alerts when something important happens, such as:
- New login from an unrecognized device
- Password change
- MFA disabled/enabled
- Suspicious login attempts
- Email/phone changes
- Recovery code use
2) Choose a push notification service
Common options:
- Firebase Cloud Messaging (FCM) for Android / web
- Apple Push Notification service (APNs) for iOS
- Or a service that abstracts both, like:
- OneSignal
- Pusher Beams
- AWS SNS
- Azure Notification Hubs
3) Register devices
Your app should:
- Ask the user for notification permission
- Generate a device push token
- Send that token to your backend
- Store it tied to the user account
4) Send alerts from your backend
When a security event occurs:
- Create an alert record
- Send a push payload to the user’s registered device tokens
- Include a short, clear message
Example:
- Title: Security alert
- Body: New sign-in detected from Chrome on Windows in New York.
- Action: Review activity
5) Keep messages secure and minimal
For security alerts:
- Don’t include sensitive info in the notification body
- Prefer generic wording
- Direct users to the app for full details
- Use signed-in authenticated API endpoints to fetch the event details
6) Add fallback channels
Push notifications can fail, so also consider:
- SMS for critical events
- In-app alert center
7) Best practices
- Deduplicate repeated alerts
- Rate-limit notifications
- Let users opt in/out by alert type
- Require re-authentication for sensitive changes
- Log notification delivery attempts
- Support multiple devices per user
Example flow
- User logs in from a new device
- Backend detects unusual login
- Backend creates a “security alert”
- Backend sends push via FCM/APNs
- User taps notification
- App opens to the security activity page
If you want, I can also provide:
- a sample backend implementation
- FCM/APNs code
- or an architecture diagram for account security alerts