getMyFollowers(userIds) takes up to 100 user IDs and answers, in one call, which of them follow the current user, each with its status, accepted or pending. To show Follow back, combine it with getAllFollowings(), which tells you whether the current user follows them.
getMyFollowers(userIds) checks follow status. It returns user IDs and statuses only, not users: no names, avatars or other profile data, and no pages. Take those from the users your app already shows.On Android and iOS it shares its name with the follower list. Pass user IDs to run this check. Call it without user IDs (Android) or with a query option (iOS) to get the follower list, which returns each follower’s user object, page by page. Use the list to show the current user’s followers. See Get Follower/Following List.Parameters
Each item in the result has two fields:
A listed user who is not in the result does not follow the current user. That includes a user ID that doesn’t exist, a deleted user, a user the current user has blocked, and the current user’s own ID. An unknown ID doesn’t cause an error: the call still answers for the other IDs, and if none of the IDs is a known user, the result is empty. Only
accepted means the user follows the current user; treat pending as not following yet.
The method has no status filter. It always returns accepted and pending together, with each user at most once, most recently changed first. If follow requests are turned off for your network, every entry is accepted.
Check One User
When the current user taps Follow, or opens a profile, check that one user. Send a list with the user’s ID, then look for anaccepted entry. This tells you, for example, whether the person was already a follower when the current user followed them, which you can record in your own analytics.
Check before you call follow, so the answer describes the moment of the tap.
Check a List of Users
When you show a list of users, such as someone else’s followers or following list or the authors of posts, collect the IDs of the users on screen, callgetMyFollowers(userIds) once, and look up each user in the result. To choose each user’s button, combine it with getAllFollowings(), which tells you whether the current user follows them:
getAllFollowings() returns up to 5,000 follows. If the current user has more, a user missing from it may still be followed or have a pending request. See Get All Followings.
Show Follow Buttons on a Feed
A common use is the follow button on each post in a feed: show Follow back on authors who already follow the current user. Check the authors one page at a time, as the feed loads:- When a page of posts loads, collect the author IDs, remove duplicates, and skip authors you have already checked.
- Call
getMyFollowers(userIds)with up to 100 IDs at a time. With more than 100, the call fails with a parameter error: the SDK does not split or cut the list, so no author is wrongly reported as not following. - Keep the answers in your own map:
truefor eachacceptedauthor andfalsefor every other ID you sent. A missing key means “not checked yet”. If a call fails, leave its IDs unchecked so the next page load checks them again. - Call
getAllFollowings()to know whom the current user follows, then choose each post’s button.
Hide the button on the current user’s own posts.
PagingData, which hands posts to the list one at a time, so there is no single “page loaded” list to pass in. Run the check from the screen instead: read the loaded posts from itemSnapshotList, and call updateFollowButtons once scrolling settles, so a fast scroll doesn’t send many small calls. Only loaded posts are checked; posts further down are checked when they load. For Paging 3 with the SDK, see Observe a Paged Live Collection.
followsMe before you call updateFollowButtons again, so every author is checked again. After the current user taps a button, call updateFollowButtons again for the posts on screen: getAllFollowings() already includes the change, so the button updates without checking the authors again.
Keep Follower Status Current
getMyFollowers(userIds) is a one-time call, not a live collection. It keeps nothing on the device and does not notify you when someone follows or unfollows the current user. Each call sends a new request, so call it again when you need fresh answers, for example when the screen reloads or on pull to refresh. Clear your own map first, so every user is checked again.
If the request fails, the call emits an error (Android), throws (iOS), or rejects (TypeScript, React Native) with the server’s error.
Platform Notes
Not available on Flutter.
Related Topics
Get All Followings
Check whether the current user follows a user.
Get Follower/Following List
Page through followers and followings with user profiles.
Follow/Unfollow User
Follow back a user who follows the current user.