Notification items represent individual notifications within the notification tray. This page covers how to query, filter, and manage the seen status of individual notification items, providing fine-grained control over notification tracking and user interaction.

Query Items

Retrieve notifications with options

Mark Individual Items

Update seen status for specific notification items

Pagination Support

Efficiently handle large notification sets with built-in pagination

Data Model

Each notification item contains comprehensive information about the notification:
PropertyTypeDescription
notificationIdStringUnique identifier for the notification
userIdStringID of the user who received the notification
actorIdStringID of the user who triggered the notification
typeStringType/category of the notification
isSeenBooleanWhether the user has seen this notification
lastSeenAtDatetimeTimestamp when the notification was last seen
occurredAtDatetimeTimestamp when the notification occurred
dataObjectAdditional notification-specific data

Query Notification Items

token = client.notificationTray.getNotificationTrayItems().observe({ liveCollection, _, error in
    
    let snapshots = liveCollection.snapshots // list of items
})

Mark Individual Items as Seen

var item: AmityNotificationTrayItem! // Item returned from live collection

Task { @MainActor in
    try await item.markSeen()
}