Help & Support

Notifications

This guide will help you retrieve Account related notifications.

When an Account interacts with you or your content, the activity is recorded and notification detailing the interaction is stored in the Lens API.

Notification types

There are various types of notifications, each with a slightly different structure, requiring individual handling. The available notification types include:

  • CommentNotification - when someone comments on your post

  • FollowNotification - when someone follows you

  • MentionNotification - when someone mentions you in a post

  • RepostNotification - when someone reposts your post

  • QuoteNotification - when someone quotes your post

  • ReactionNotification - when someone adds reaction to your post

At any given time new notification types may be added to the Lens API. Make sure you handle gracefully unknown notification types to avoid breaking your app.

Notifications Query

You MUST be authenticated as Account Owner or Account Manager to make this request.

Use the paginated fetchNotifications action to retrieve notifications for an Account.

import { evmAddress } from "@lens-protocol/client";import { fetchNotifications } from "@lens-protocol/client/actions";
import { client } from "./client";
const result = await fetchNotifications(client, {});
if (result.isErr()) {  return console.error(result.error);}
// items: Array<Notification>const { items, pageInfo } = result.value;

Continue with the Pagination guide for more information on how to handle paginated results.