Facebook get users that like our business page - facebook

Our business wants to give a free gift to all the users that like our facebook page. Do you know a way to get the list of emails with all users that liked our page?
Is it possible to obtain that using graph API?
Is there any possibility to offer this functionality to our customers? My problem will reduce to check if one user likes our page.

Radu,
This is not possible at (with FB API) at this time.
See here

You could create tab (with a canvas url) on your facebook page that does the following:
User clicks the tab (or is directed there by some other link)
On the canvas page, use the FB api to check if that user has liked your page. If not, persuade them to do so.
If the user liked the page, show a form where the user can enter his email.
Store the data on your own server.
Hope this helps.

After much research, I used this solution:
I call FB.login to authorize my application and request 'user_likes' permission
check /me/likes/[pageid]
If the response is not null the user likes our page.

Related

fb graph api multiple userid and page like

from my ios app after fb login, facebook returns me the userid.
i call https://graph.facebook.com/v2.8/me/likes/[pageid]?access_token=...
to check if the user likes my fb page. But i get empty array while the same user has liked my page from the web.
The user has different userId when logins directly to facebook website and different when logins in my app. While the user has liked my page from web , how can i see it in the api call from my app using the userid that fb returns me when he logins from my app?
Thank you very much
Please note that there is no direct way of checking whether a particular user has liked a certain page or not using FB Graph API.
But i believe there is a workaround for this and you can try to hit the below URL in your browser
https://www.facebook.com/search/<page_id>/likers?ref=about
It will return all the people information who have liked the page provided. I am not sure would this return all the results or just some of them. But i believe you can try this.
You can then do some web scraping which will help you indentify whether 'person A' has liked a page say 'abc'.
Now you can hit the below endpoint to retreive all the likes this 'person a' has liked
FB.api('/person_id_obtained_from_above/likes')
But please note that you need user_likes permission to retrieve someone else's likes
Let me know if this worked for you.

How to check if user is a fan of facebook page by Graph API?

I want to check if user is a fan of a specific Facebook page, I have tried searching in Google but I haven't found the answer yet.
I am an admin of fanpage. I am having a promotion program on my page and becoming a fan of my page is a requirement. I want to check if users like my page to give them presents. Because of a large users, I want to create a tool to do it.
Do you have any solutions? Thank you!
You would need to authorize the user with the user_likes permission. That way, you can get his Page likes with the /me/likes endpoint.
Be aware that you are not allowed to incentivize Page likes, users must like a Page only because they really want to, you can´t reward them in any way or gate content behind a Page like.
You can also use /me/likes/{page_id} where {page_id} is an actual page object id as a shortcut.
If the user doesn't like the page, you'll receive a response like
{
"data": [
]
}

check if user likes a page without application perm request

I have a simple tab page, php sdk working and I know I can get the "like" for this specific page from the user signed_request.
This page is a colaboration with another company who also has an FB page. What i´d like to know is if I can get the like status of their page for the current user so I can authorize an action on this tab that is dependant of the user liking both my page and my partner´s.
Is this possible without using an actual app, an access_token and the appropriate perms requested?
e.g. my page is fb.com/Coke and my partner is fb.com/Target
On this specific tab page I want to enable a button only if me (Coke) is liked (which I can get already) and if my partner (Target) is also liked.
I tried the graphAPI (me/likes) and FQL (using the connection table) and both compalin of an unauthorized request.
Short Answer:
No, this will not be possible in a production setting.
Further explanation:
Some users have their list of likes as public. In that case, it would work.
But in order to get likes from a user that has that setting as anything but public (such as myself, only friends of friends can see it), then it requires an app and an access_token that has a user_likes permission.
From the documentation:
Permissions Required:
user_likes permissions if querying the current user.

Response from edge.create if Like clicker has no FB page

I'm subscribing to a Like button on my page to notify me when someone clicks the Like button. I then give this user a discount for telling their friends about the site. But what if the user doesn't have a Facebook page? Will I still get a call at my handler function. The Response passed by the edge.create call to the handler is just the URL that was liked, so there doesn't seem to be any flag passed that tells me that the user didn't really post anything to a FB page. How can I handle this and not be giving discounts for nothing?
Thanks
What do you mean by "user has no FB page"? Not every Facebook user will also have a Facebook page. I only have pages on my Facebook user account are there solely for testing purposes. If I wasn't developing apps with the Facebook API, then I wouldn't have any at all. So requiring your users to have a Facebook page may not be in your best interest. Just let them like your website using their normal Facebook user account.

Show content on external website, only if user is a 'fan' of the URL?

Similar to the ever-trendy Fan Page trick that allows page owners to only show certain content when a user performs the 'like' action (visible-to-connection), I wish to be able to only show certain content on a website once a user has liked the website.
If there is no FB code for this, I have considered using a Facebook like callback (triggered when a user likes on the current page) to set a cookie that establishes a user has liked the page or perhaps a database table that sets a users status to 'liked', again using the callback within the documentation.
Any ideas would be helpful. Thanks.
I haven't seen a "fangate" implementation for non-Facebook pages that didn't require you to go through the full Facebook authentication process (with the user_likes scope) first. You could set a cookie when they like, but that'll only work if they liked it via your site (i.e. if they liked you on Facebook, it wouldn't get caught by your site), and the cookie could get deleted or lost.
you can use the Javascipt SDK to easily accomplish this.
First, call FB.init:
https://developers.facebook.com/docs/reference/javascript/FB.init/
Then call getLoginStatus:
https://developers.facebook.com/docs/reference/javascript/FB.getLoginStatus/
If they're not logged in ( not authorized your app ), then call
FB.login and then recall getLoginStatus.
If logged in, then get the user's likes via FQL:
https://developers.facebook.com/docs/reference/javascript/FB.Data.query/