getNotificationsCount
Returns the count of new notifications
for the currently authenticated user.
The user must have an active session for this query to work.
The count of new notifications is computed based on the latest timestamp from the setNotificationsReadTime
function.
How to use?
const { data, error } = await orbis.getNotificationsCount(options);
Parameters
options
- object with the parameters used to retrieve notificationstype
-string
type of notifications to retrievesocial
- mentions, likes, replies, etcmessages
- unread messages
context
-string
The context for which you want to view notificationsinclude_child_contexts
-boolean
Set totrue
if you also want to retrieve notifications from sub-contexts
Returns
{
count_new_notifications: 15
}
Examples
Query notification count from the Global Feed
/** To query notification count for the connected user */
const { data, error } = await orbis.getNotificationsCount({ type: 'social' });
Query notification count scoped to a Context
/** To query notification count for the connected user in a specific context */
const { data, error } = await orbis.getNotificationsCount({
type: 'social',
context: 'kjzl6cw---xejbmcp'
});