Facebook – Retrieve Facebook user id of all the friends

facebookfacebook-adsfacebook-pages

I have a regular Facebook profile page with 800 friends. How can I get the Facebook user id of all 800 friends of mine?

The reason for doing this is the following: I have a colleague that has a fanpage for his electronics store, and I think that my list of friends would be a great base to promote his store.

So I was thinking that, when creating a Facebook ad, he can create a Custom Audience. According to Facebook, a custom ad can be created by entering a list of Facebook user ids (I assume comma-delimited). So that's what I'm trying to accomplish.

Best Answer

You'll want to access it through the Graph API. The details on pulling friends are here.

You can also play around a bit with the explorer tool to get a feel for things. In this case, you'd just append YOURUSERID/friends in the explorer window and request the information with a token.

If you're a masochist, https://www.facebook.com/YOURUSERNAME/friends?ft_ref=flsa will get you a list of all your FB friends. You can scroll until nothing more loads and then parse out the ID using XPath or one of the browser scraping tools. The stuff is in there but it'd be a real pain to get out.