Used by thousands of students worldwide - help us reach 150 members
Notifications
/notificationsPush notification device registration and the in-app notification inbox (list, unread count, mark as read) for the authenticated user.
/notifications/device-tokenRegister a push notification device tokenDELETE/notifications/device-tokenUnregister a push notification device tokenGET/notificationsList the current user's notificationsGET/notifications/unread-countGet the number of unread notificationsPUT/notifications/:id/readMark a notification as readPUT/notifications/read-allMark all notifications as readRegister a push notification device token
Registers a device push token for the authenticated user. The operation is an upsert keyed on the user and token: registering the same token again updates its platform and re-activates it.
Body parameters
tokenrequiredstring | The device push token (for example the APNs device token). |
platformstring | Device platform: `ios` or `android`.Default: ios |
Errors
400JSON `{ "message": "Token is required" }`.401Plain text `Unauthorized: No token provided`.403Plain text `Forbidden: Invalid token`, or `Forbidden: You do not have the required permissions`.500JSON `{ "message": "Error registering device token", "error": "..." }`.
curl -X POST "https://app.ummahspot.com/notifications/device-token" \
-H "Authorization: Bearer $SHARH_TOKEN" \
-H "Content-Type: application/json" \
-d '{"token":"string"}'{
"message": "Device token registered"
}Unregister a push notification device token
Marks the given device token as inactive for the authenticated user so it no longer receives push notifications (typically called on logout). The token is read from the JSON request body. The call succeeds even if the token was not registered for this user.
Body parameters
tokenrequiredstring | The device push token to deactivate. |
Errors
400JSON `{ "message": "Token is required" }`.401Plain text `Unauthorized: No token provided`.403Plain text `Forbidden: Invalid token`, or `Forbidden: You do not have the required permissions`.500JSON `{ "message": "Error unregistering device token", "error": "..." }`.
curl -X DELETE "https://app.ummahspot.com/notifications/device-token" \
-H "Authorization: Bearer $SHARH_TOKEN" \
-H "Content-Type: application/json" \
-d '{"token":"string"}'{
"message": "Device token unregistered"
}List the current user's notifications
Returns the authenticated user's notifications, newest first, with page-based pagination. `actor` is the user who triggered the notification, populated with `username`, `profilePicture` and `profilePictureKey`; it is `null` for system notifications such as `admin_message` and `announcement`. `type` is one of `comment_on_post`, `reply_to_comment`, `like_on_post`, `like_on_comment`, `new_post`, `admin_message`, `announcement`. `post` and `comment` hold the related ObjectIds when applicable.
Query parameters
pagenumber | 1-based page number.Default: 1 |
limitnumber | Notifications per page.Default: 20 |
Errors
401Plain text `Unauthorized: No token provided`.403Plain text `Forbidden: Invalid token`, or `Forbidden: You do not have the required permissions`.500JSON `{ "message": "Error fetching notifications", "error": "..." }`.
curl -X GET "https://app.ummahspot.com/notifications" \
-H "Authorization: Bearer $SHARH_TOKEN"{
"notifications": [
{
"_id": "66a1b2c3d4e5f60012345678",
"recipient": "665f1c2e9b1d4a0012ab34cd",
"actor": {
"_id": "665f1c2e9b1d4a0012ab99ef",
"username": "alghazali",
"profilePicture": "https://lh3.googleusercontent.com/a/..."
},
"type": "comment_on_post",
"title": "New Comment",
"body": "alghazali commented on your post",
"post": "66a1a0009b1d4a0012ab1111",
"comment": "66a1b2009b1d4a0012ab2222",
"isRead": false,
"readAt": null,
"createdAt": "2026-09-18T10:15:00.000Z",
"updatedAt": "2026-09-18T10:15:00.000Z",
"__v": 0
}
],
"currentPage": 1,
"totalPages": 3,
"total": 42
}Get the number of unread notifications
Returns how many of the authenticated user's notifications have not been marked as read.
Errors
401Plain text `Unauthorized: No token provided`.403Plain text `Forbidden: Invalid token`, or `Forbidden: You do not have the required permissions`.500JSON `{ "message": "Error fetching unread count", "error": "..." }`.
curl -X GET "https://app.ummahspot.com/notifications/unread-count" \
-H "Authorization: Bearer $SHARH_TOKEN"{
"unreadCount": 5
}Mark a notification as read
Marks one notification as read and sets its `readAt` timestamp. Only notifications whose recipient is the authenticated user can be updated; anyone else's notification id yields 404. Returns the updated notification (`actor` is an unpopulated ObjectId here).
Path parameters
idstring | Notification ObjectId |
Errors
401Plain text `Unauthorized: No token provided`.403Plain text `Forbidden: Invalid token`, or `Forbidden: You do not have the required permissions`.404JSON `{ "message": "Notification not found" }` when the notification does not exist or belongs to another user.500JSON `{ "message": "Error marking notification as read", "error": "..." }` (also returned for a malformed ObjectId).
curl -X PUT "https://app.ummahspot.com/notifications/:id/read" \
-H "Authorization: Bearer $SHARH_TOKEN"{
"notification": {
"_id": "66a1b2c3d4e5f60012345678",
"recipient": "665f1c2e9b1d4a0012ab34cd",
"actor": "665f1c2e9b1d4a0012ab99ef",
"type": "comment_on_post",
"title": "New Comment",
"body": "alghazali commented on your post",
"post": "66a1a0009b1d4a0012ab1111",
"comment": "66a1b2009b1d4a0012ab2222",
"isRead": true,
"readAt": "2026-09-18T10:20:31.000Z",
"createdAt": "2026-09-18T10:15:00.000Z",
"updatedAt": "2026-09-18T10:20:31.000Z",
"__v": 0
}
}Mark all notifications as read
Marks every unread notification of the authenticated user as read and sets their `readAt` timestamp.
Errors
401Plain text `Unauthorized: No token provided`.403Plain text `Forbidden: Invalid token`, or `Forbidden: You do not have the required permissions`.500JSON `{ "message": "Error marking all as read", "error": "..." }`.
curl -X PUT "https://app.ummahspot.com/notifications/read-all" \
-H "Authorization: Bearer $SHARH_TOKEN"{
"message": "All notifications marked as read"
}