-
Notifications
You must be signed in to change notification settings - Fork 39
[Brainstorm] Design for web notifications
Web notifications allow creating broadcast messages to be delivered to users. The implementation has a 'pull' based approach. The browser will call the notification service to find out if there is any unseen notifications for the authenticated user. The API returns these, and it's upto the application to display them to the user.
The service has an API to mark a notification as 'seen', which ensures that the user will not see the same notification again.
Sticky notifications are also supported. These cannot me 'marked as read'.
Note that there may be multiple unseen notifications for a user, so the application will need to address displaying these.
The notification entity is used to store notifications created. The following attributes are available
- notification_id (Unique identifier)
- text (The text of the notification)
- expires_on (Expiry date for the notification)
- is_sticky (Is this a sticky notification)
- is_enabled (Used to temporarily disable the notification)
- context (Context and context id are used to create 'notification buckets'. This will allow the service to be used by any consumer
- context_id
- created_on
- created_by
- updated_on
- updated_by
Once a user marks a notification as read, a notification read record is created. The attributes are
- notification_id
- user_id
- received_on (Will be auto-updated when this notification shows up in the
/notifications/get
API) - read_on (Updated when the
/notifications/read
API is called for this notification)
POST /notification/create
- text (mandatory)
- expired_on
- is_sticky
- is_enabled
- context
- context_id
The creator is automatically set from the authentication information of the API caller.
- success / failure
- notification_id
GET /notification/get
The response is an array of Notification objects for the user. These are all the unseen notifications for the user who is making the API call.
POST /notification/read/<notification_id>
The creator is automatically set from the authentication information of the API caller.
- success / failure