Mark notifications as read or unread

Ask the Community

How to use the notification API to mark some or all notifications as read or unread


Mark A Specific Notification As Read #

Usage #

Vanilla JavaScript:
window.CordSDK.notification.markAsRead('my-awesome-notification-id');
window.CordSDK.notification.markAsRead('my-awesome-notification-id');
Copy

What this function returns #

A promise which resolves when the database write has completed.

Arguments this function takes #


notificationID #

required
string
The ID of the notification to mark as read.

Mark A Specific Notification As Unread #

Usage #

Vanilla JavaScript:
window.CordSDK.notification.markAsUnread('my-awesome-notification-id');
window.CordSDK.notification.markAsUnread('my-awesome-notification-id');
Copy

What this function returns #

A promise which resolves when the database write has completed.

Arguments this function takes #


notificationID #

required
string
The ID of the notification to mark as unread.

Mark All Notifications As Read #

Usage #

Vanilla JavaScript:
window.CordSDK.notification.markAllAsRead(
  { filter: { metadata: { flavor: 'minty' } } },
);
window.CordSDK.notification.markAllAsRead(
  { filter: { metadata: { flavor: 'minty' } } },
);
Copy

What this function returns #

A promise which resolves when the database writes have completed.

Arguments this function takes #


options #

optional
MarkAllNotificationsAsReadOptions
Miscellaneous options.

This is an object with the following fields:

Show property details


Not finding the answer you need? Ask our Developer Community

Ask Cordy