15

Using the Facebook Graph API or some other means, is there a currently-available way to get a user's follower count? You'd think it would be a simple readable metric field at the user level, but after hours of searching, I cannot find such a field.

I know Facebook considers the concept of followers to be valid, because they have a working "edge" for it with their web interface, https://www.facebook.com/user_name/followers as well as listing the account on the user's main page (see image example below).

Certainly it seems the capability to read, or at least derive, the followers count existed previously in the form of reading the "subscribers" list for a user, but that's now obsolete. An alternative method seems to have been to use FQL to query the data. This method is now also obsolete. And there are stackoverflow questions about it, a good example is here, but they seem to relate to previous capabilities no longer available.

Example from Facebook user page

Community
  • 1
  • 1
robbpriestley
  • 3,050
  • 2
  • 24
  • 36

6 Answers6

10

According to the docs, there is no possibility to get the follower count: https://developers.facebook.com/docs/graph-api/reference/user

The subscribers endpoint was removed with v2.0 already: https://developers.facebook.com/docs/apps/changelog#v2_0

Other threads about the same topic:

Community
  • 1
  • 1
andyrandy
  • 72,880
  • 8
  • 113
  • 130
  • I agree about the endpoint. I've looked several times at the API reference page you link to, but I don't see it explicitly stated that there's "no possibility" as you say. Not that I doubt you, but if it's not too much trouble, could you quote me specifically where it says that? – robbpriestley Jun 01 '16 at 20:44
  • if something is not even in the user table, you can be pretty sure it does not exist ;) - this has been discussed some times already though, i have added the first links i could find in my answer. – andyrandy Jun 01 '16 at 21:42
  • 1
    why the downvote? please add a comment so i can improve my answer if needed. – andyrandy Dec 19 '17 at 12:04
2

If you have an access_token, you can call {profile-id}/insights/page_fans_country and retrieve the number of people who like the page aggregated by country. This works for any public profile.

https://graph.facebook.com/{profile-id}/insights/page_fans_country?access_token={access-token}

You could then sum up the countries to get the total number of followers. If you need to retrieve followers for your own profile, you can call page_fans which provides the total number of people who have liked your page.

Evan Appleby
  • 284
  • 4
  • 17
  • Sum up the values from one of the arrays containing 45 countries. As close as you can get it seems since `page_fans` returns nothing. – David Harkness Apr 05 '17 at 23:26
  • insights/page_fans actually returns valid results for me on a new integration using the php sdk – ShaneMit Aug 28 '17 at 17:26
  • This doesn't work for Users. Error: `(#100) Tried accessing nonexisting field (insights) on node type (User)` – Westy92 Aug 26 '21 at 15:05
2

You can use fan_count:

{
  "id": "235014179868339",
  "name": "Zoella",
  "fan_count": 2647287
}

Facebook Graph API Explorer

Edward Pescetto
  • 856
  • 1
  • 7
  • 16
  • 2
    This only works for facebook pages not individual profiles. – Learner Sep 16 '17 at 01:41
  • Warning on `fan_count` for Page objects: I just a few days figuring out it returns the number of people who like the page. Not the number who follow it. I don't know if it's the same for User objects. Watch out in case it's the same. – Alan W. Smith Nov 09 '17 at 21:59
  • 2
    `fan_count` description from the Page object's metadata: "The number of users who like the Page. For Global Pages this is the count for all Pages across the brand". `fan_count` is not a followers count. – Fedir Alifirenko May 30 '18 at 13:37
1

This is an updated and working code snippet which can be used to retrieve Facebook like count of a specific page. To use this code snippet you’ll need a Facebook App ID and Secret Key. This use latest 2.8 API version method.

enter image description here

Step 1:

Go to https://developers.facebook.com/ login with your facebook account. If you don’t have one you have to create one.

Step 2:

Created an app from facebook developer.

Step3:

You have to get App ID and App Secret from app you created.

enter image description here

Step 4:

PHP Code to get facebook like count of a page.

<?php
function fbLikeCount($id,$appid,$appsecret){
  $json_url ='https://graph.facebook.com/'.$id.'?access_token='.$appid.'|'.$appsecret.'&fields=fan_count';
  $json = file_get_contents($json_url);
  $json_output = json_decode($json);
  //Extract the likes count from the JSON object
  if($json_output->fan_count){
    return $fan_count = $json_output->fan_count;
  }else{
    return 0;
  }
}
echo fbLikeCount('coregenie','___APPID___','___APPSECRET___');
?>

Please edit your page name , app id, app secret.

This method is working. Tested on 19/12/2017

Cecil Paul
  • 595
  • 6
  • 27
  • just a guess, because it happened in the same time: did you downvote my answer? because it is 100% correct, the question was if there is a way to get the followers of a user profile and that is definitely not possible. what you describe in length is about LIKES, not FOLLOWERS. – andyrandy Dec 19 '17 at 12:06
  • 1
    fan_count was added in v2.6 and according to the docs, it returns the total likes. https://developers.facebook.com/docs/graph-api/reference/page/ – AdonisN Jan 03 '18 at 18:38
1

What I did to see if these metrics exist in the api was to check the requests made by Facebook when creating a report, I got the following metrics:

metric=page_daily_follows,page_daily_follows_unique,page_daily_unfollows,page_daily_unfollows_unique,page_follows

It should be clarified that these are not in the documentation, I hope it helps.

kk.
  • 3,747
  • 12
  • 36
  • 67
Mauricio
  • 11
  • 1
0

You can use metric page_follows to get the follower count, I used it and it was correctly.

Tyler2P
  • 2,324
  • 26
  • 22
  • 31