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.
Related
I need to check, using facebook graph api, if a facebook user has liked a certain page (I am the admin and can grant myself any permission). Does anyone know how I can achieve that?
I can't find it in the docs. The closest in the docs is the following:
https://developers.facebook.com/docs/graph-api/reference/v2.10/object/likes/
It says that the request returns: "An array of User or Page objects representing the people or Pages that liked the object" Which is in fact what I am looking for, as I could simply query the user in the list and see if there is a match. BUT , in fact, what the request (mentioned above) actually returns is an array of User or Page objects representing the people or Pages that the object (my page) liked.
The request from the docs might sill be implemented to solve the problem:
facebook graph api if a user has liked a page
BUT it doesn't help me, because I don't want to take the user's permission. I want to implement the solution from the side of the admin of the page- the admin needs to check for multiple users if they liked the page or not.
Can anyone help me sort this out?
I want to search the user's list of likes, to know if he liked my page or not
https://graph.facebook.com/v2.10/me/likes
I also want to know I did not follow my profile or not
https://graph.facebook.com/v2.10/me/???
There is no way to check if someone follows your profile. For getting to know if a user likes your page, you would need to authorize that user with the user_likes permission.
To check if the user likes your page without going through the whole list, you can use the following API endpoint: /me/likes/[page-id] ... if it returns something, the user liked the Page.
I currently am making a list of my fans who communicated with my page and I store their data in a personal database. But now I was wondering if there is a way to see if a user is still fan of my page.
Example: A user likes my page and posts something on my wall. 2 weeks later, the same user unlikes my page and I update my fan database. I will still get his name in the query because he once posted a message on my wall. Any solutions or ideas?
Note: The user does not need to login to an application or give permissions.
No, there is no way to check if a user is a fan of your Page. The user would have to authorize an App with user_likes, and you would not get that permission approved just for checking the like status.
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.
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.