Skip to main content
The appNotifications module exposes the in-app notification feed for the authenticated user — read notifications, count unread ones, and mark them as read.

fetchNotifications

Fetches a paginated list of the user’s notifications.
const { data, pagination } = await sublay.appNotifications.fetchNotifications({
  page: 1,
  limit: 20,
});
The whole argument is optional.
page
number
The page of results to fetch.
limit
number
The number of notifications to return per page.
ReturnsPromise<PaginatedResponse<UnifiedAppNotification>>
A notification is a discriminated union on a type field, spanning system, entity/comment comments and replies, mentions, upvotes, reactions, reaction milestones, new-follow, connection-request, connection-accepted, and space-membership-approved. Each notification has id, type, isRead, metadata, and createdAt.

countUnreadNotifications

Returns the number of unread notifications.
const count = await sublay.appNotifications.countUnreadNotifications();
ReturnsPromise<number>

markNotificationAsRead

Marks a single notification as read.
await sublay.appNotifications.markNotificationAsRead({
  notificationId: "ntf_abc123",
});
notificationId
string
required
The ID of the notification to mark as read.
ReturnsPromise<void>

markAllNotificationsAsRead

Marks all the user’s notifications as read.
const { markedAsRead } = await sublay.appNotifications.markAllNotificationsAsRead();
ReturnsPromise<{ markedAsRead: number }>