getNotifications
Returns an array of notifications for the currently authenticated user (DID).
The user must have an active session for this query to work.
How to use?
const { data, error } = await orbis.getNotifications(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
[
{
content: {},
family: "string",
status: "new" || "viewed",
type: "social" || "messages",
user_notifiying_details: {},
post_details?: {}
},
...
]
Examples
Query notifications from the Global Feed
/** To query the feed notifications for the connected user */
const { data, error } = await orbis.getNotifications({ type: 'social' });
Query notifications scoped to a Context
/** To query the notifications for the connected user in a specific context */
const { data, error } = await orbis.getNotifications({
type: 'social',
context: 'kjzl6cw---xejbmcp'
});