Help & Support

Follow Relationships

This guide explains how to fetch followers and followings on Lens.

List Followers

Use the paginated fetchFollowers action to list followers of an Account.

import { evmAddress } from "@lens-protocol/client";import { fetchFollowers } from "@lens-protocol/client/actions";
import { client } from "./client";
const result = await fetchFollowers(client, {  account: evmAddress("0x1234…"),});
if (result.isErr()) {  return console.error(result.error);}
// items: Array<Follower>: [{follower: Account, followedOn: Date}, ....]const { items, pageInfo } = result.value;

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

List Following

Use the paginated fetchFollowing action to list followings of an Account.

import { evmAddress } from "@lens-protocol/client";import { fetchFollowing } from "@lens-protocol/client/actions";
import { client } from "./client";
const result = await fetchFollowing(client, {  account: evmAddress("0x1234…"),});
if (result.isErr()) {  return console.error(result.error);}
// items: Array<Following>: [{following: Account, followedOn: Date}, ....]const { items, pageInfo } = result.value;

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

List Followers You Know

You can also cross-reference the followers of an Account that are also the followings of another Account.

This could be a powerful hint to suggest potential connections between two Accounts.

Use the paginated fetchFollowersYouKnow action to list the followings of a target Account that are followed by an observer Account.

import { evmAddress } from "@lens-protocol/client";import { fetchFollowersYouKnow } from "@lens-protocol/client/actions";
import { client } from "./client";
const result = await fetchFollowersYouKnow(client, {  observer: evmAddress("0x1234…"),  target: evmAddress("0x5678…"),});
if (result.isErr()) {  return console.error(result.error);}
// items: Array<Follower>: [{follower: Account, followedOn: Date}, ....]const { items, pageInfo } = result.value;

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

Inspect Follow Status

Given 2 or more Accounts, you might need to know what is their relative following relationship.

Use the fetchFollowStatus action to verify the follow status of a list of target-observer pairs.

import { evmAddress } from "@lens-protocol/client";import { fetchFollowStatus } from "@lens-protocol/client/actions";
import { client } from "./client";
const result = await fetchFollowStatus(client, [{  account: evmAddress("0x1234…"),  follower: evmAddress("0x5678…"),}]);
if (result.isErr()) {  return console.error(result.error);}
// status: Array<FollowStatus>: [{graph: "0x1234", follower: "0x1234", account: "0x1234", isFollowing: {...}}, ....]const status = result.value;