Guides

Is Followed By Me?

It's a common use-case to want to know whether the profile that is currently logged in, follows the profile that they are viewing the data for.

This is useful for displaying the correct UI, validating which actions the profile can take, etc.

There is not a specific query to get this information, you can leverage the data available on the Profile object (which is available in every method that returns profile data) to find the value.

You can find the boolean value in the isFollowedByMe property on the Profile object.

ℹ️

isFollowedByMe will default to false if this method is invoked without authentication (e.g. not logged in)

Request

  • forProfileId: string (required)
    • The identifier of the profile to check is followed by the authenticated profile.

Invocation

const { isFollowedByMe } = await lensClient.profile.fetch({
  forProfileId: "PROFILE_ID",
});
query Profile {
  profile(request: { forProfileId: "PROFILE_ID" }) {
    # other profile fields are available
    isFollowedByMe
  }
}

Response

{
  // ...other profile fields are available
  "isFollowedByMe": true
}

Full GraphQL API Example

📘

Is Followed By Me: GraphQL API Full Example