Overview
The Notification Service manages user notifications across multiple delivery channels. It handles notification creation, delivery preferences, push notification registration, and email unsubscribe management. Key Features:- Push notifications (iOS and Android)
- Email notifications with templates
- Device registration and management
- Notification preferences and unsubscribe
- Multi-channel delivery
- RESTful HTTP API
- PostgreSQL for notification storage
- AWS SNS for push delivery
- Integration with email service
- Event-driven notification creation
User Notifications
List User Notifications
Get paginated list of notifications for the authenticated user.Number of notifications to return per page
Pagination cursor from previous response (base64 encoded)
Array of notification objects
Unique notification identifier
User ID who owns this notification
Event type:
channel_mention, item_share, channel_invite, etc.Type of entity:
document, channel, message, etc.ID of the entity this notification refers to
Whether notification has been delivered
Whether user marked notification as done
When user viewed the notification
Notification creation time
User who triggered the notification
Event-specific metadata (message text, share details, etc.)
Cursor for fetching next page of results
Get Notification by ID
Retrieve a single notification by its ID.Notification identifier
Type of notification event
Entity type (document, channel, message)
Entity identifier
Delivery status
Event-specific data
Get Notifications by Event Item
Get all notifications for a specific event item (e.g., all notifications about a particular document).The entity/event ID to get notifications for
Notifications related to this event item
Pagination cursor
Bulk Get by Event Items
Retrieve notifications for multiple event items in a single request.Array of event item IDs to fetch notifications for
All notifications matching the provided event item IDs
Delete Notification
Delete a specific notification.Bulk Delete Notifications
Delete multiple notifications at once.Array of notification IDs to delete
Device Management
Register Device for Push Notifications
Register a mobile device to receive push notifications.Device push token from FCM (Android) or APNs (iOS)
Device platform:
ios or androidRegistration success status
- Service creates/updates SNS platform endpoint for device
- Associates endpoint with user in database
- Enables endpoint for push delivery
- Updates token if device re-registers
Unregister Device
Remove a device from receiving push notifications.Device push token to unregister
Unsubscribe Management
Unsubscribe from Item Notifications
Stop receiving notifications about a specific item (document, channel, etc.).Type of entity to unsubscribe from:
document, channel, messageID of the specific entity
Unsubscribe from Email Notifications
Opt out of email notifications entirely.Unsubscribe from All Notifications
Completely opt out of all notification types.Get Unsubscribe Preferences
Retrieve user’s current notification preferences.Whether user opted out of email notifications
Whether user opted out of all notifications
List of specific items user unsubscribed from
Entity type unsubscribed from
Entity ID unsubscribed from
Remove Item Unsubscribe
Re-enable notifications for a previously unsubscribed item.Notification Types
The service supports various notification event types:Channel Notifications
channel_mention
channel_mention
User mentioned in a channel messageMetadata:
channelId: Channel where mention occurredmessageId: Message containing the mentionmessageText: Preview of message contentsenderName: Name of user who mentioned
channel_invite
channel_invite
User invited to join a channelMetadata:
channelId: Channel user was invited tochannelName: Name of the channelinviterId: User who sent inviteinviterName: Name of inviter
channel_message
channel_message
New message in a subscribed channelMetadata:
channelId: Channel with new messagemessageId: New message IDmessageText: Message previewsenderName: Message author
Document Notifications
item_share
item_share
comment_mention
comment_mention
Push Notification Format
iOS (APNs) Payload
Android (FCM) Payload
Email Templates
Notifications can be delivered via email using pre-defined templates:Channel Message Template
Subject: New message in Body includes:- Sender name and profile picture
- Message preview
- Link to channel
- Unsubscribe link
Item Share Template
Subject: shared with you Body includes:- Document name and preview
- Sharer information
- Access level granted
- Link to document
- Unsubscribe options
Processing Patterns
Async Notification Creation
Notifications are created asynchronously:- Event Trigger: Action occurs (message sent, document shared)
- Queue Message: Event published to notification ingress
- Process: Notification service consumes event
- Create: Notification record created in database
- Deliver: Push/email sent based on user preferences
Delivery Channels
Notifications are delivered via multiple channels:- Push: Real-time mobile notifications via SNS
- Email: Templated email via email service
- In-app: Retrieved via API for in-app notification center
Batching
Multiple notifications for the same entity are batched:- Prevents notification spam
- Combines multiple mentions into single alert
- Configurable batching window (default: 5 minutes)
Error Handling
Push Delivery Failures
When push notifications fail:- Invalid tokens trigger device unregistration
- Expired endpoints are recreated on next device registration
- Failed deliveries logged for monitoring
Email Delivery Failures
Email notification failures:- Bounce handling via email service
- Hard bounces trigger email unsubscribe
- Soft bounces are retried
Common Errors
| Error | Cause | Resolution |
|---|---|---|
Invalid device token | Token expired or invalid | Re-register device |
Endpoint disabled | SNS endpoint disabled | Service automatically re-enables |
User not found | Invalid user context | Check authentication |
Notification not found | Invalid notification ID | Verify notification exists |
documentId: Document with commentcommentId: Comment containing mentioncommentText: Comment previewmentionerId: User who mentioned