Mutual Follows/Followers
Find mutual follows with another Farcaster user
On X (Twitter) profile page, there is a “Followed by A, B, C, and 10 others you follow”. This guide demonstrates how to use the Neynar SDK to make the same thing but for Farcaster.
Check out this Getting started guide to learn how to set up your environment and get an API key.
First, initialize the client:
Say we want to get people @rish follows that also follows @manan. This is useful if we want to mutual connections between two users. We’ll fetch @rish’s followings first.
Then we’ll fetch @manan’s followers.
Think of these two arrays as sets. We want to find the intersection of these two sets. We can use the fid
property to find the intersection.
Example output:
you’d probably want to cache the results of fetchAllFollowing
and fetchAllFollowers
so you don’t have to make the same API calls again.
That’s it! You can use this to make a “Followed by A, B, C, and 10 others you follow” info in your Farcaster app.
Ready to start building?
Get your subscription at neynar.com and reach out to us on Telegram with any questions!
Was this page helpful?