SDK Reference
Methods
GetNotificationsCount

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 notifications
    • type - string type of notifications to retrieve
      • social - mentions, likes, replies, etc
      • messages - unread messages
    • context - string The context for which you want to view notifications
    • include_child_contexts - boolean Set to true 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'
});