I want to create an entrance app for some events at a congress.
Only users which liked our company-facebook page before should be allowed to enter.
I was reading around the last days, that it is not possible (only if the user logged in with facebook connect on our site) to see via the Graph API, which users liked our page? We would have the email adress (over an external registration form), but not the FacebookID.
I'm wondering if there are solutions outside, which i didn't found...
It's not possible to get the list of users who have liked your page.
But since you are having the email_ids of the users who have liked the page, you were left with one thing - searching users with email_id BUT unfortunately this has been disallowed by facebook. See here. It says-
The ability to pass in an e-mail address into the "user" search type was removed on July 10, 2013. This search type only returns results that match a user's name (including alternate name).
For future ref, if you have some application, you can query for /me and save their facebook ids.
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 create a 'Find friends from facebook' button on my site. Many websites have it, and it basically gets your friends from facebook and identifies those of them who are already registred on that website, to allow you add them as friends or whatever.
I have clicked that button on a very famous website and the website show me a list with my friends who are registred on that website, and almost 1/3 of my friends where there.
I have been reading the facebooks API, have created an app, and finally managed to create a 'Find facebook friends' button. But when I click on that button, my website receives from facebook only an array with the name and fb ID of every friend I have.
How is that usefull for me? How can I know who of them are registred on my website to show it to the user that clicked the button? I thought it should give me for example the email of each friend, so I can compare it to my DB and get the registred users, but, now that I think of it again, it's true that it is impossible due to several fb privacy violations.
How do those websites know who of your friends are registred by clicking the button?
Thank you very much!
You need to associate a user's Facebook ID with their account on your site (in the user DB table for example).
Then you have the list of all Facebook IDs of your friends. You can run a query in your DB to see which of your registered users' Facebook IDs match the ones from your query.
Basically the intersection of 2 list of FB IDs.
The ones in both lists are your friends registered on the site.
If you're happy to add an extra permission to your FB authentication (publish_actions) then you you don't need to keep your own list of users in a DB to get this info - you can query the scores API for the app. Just make a Graph call to /APP_ID/scores and it will return a list of friends of the current user who are using this app. Your application doesn't even need to publish any scores info - in this scenario, the API will just return scores of 0.
The addition of publish_actions does mean that there will be an extra permission dialog appearing when users connect to your app/site if you are not already requesting this permission.
Only friends who have given your app/site the publish_actions permission will be shown in the list - so if you have an existing site and have not previously requested this permission then friends who are old users will not be shown. Totally understand this might not be suitable for you and perhaps you should implement Fabien Warniez's solution instead.
Javascript example:
FB.login(function(response) {
FB.api('/145634995501895/scores', function(scoresResponse) {
$.each(scoresResponse.data, function(key, value) {
console.log(value.user.id + ':' + value.user.name);
});
});
}, {scope: 'publish_actions'});
Replace 145634995501895 in the above code with your application ID.
I am helping out a friend with a site for a venue that lists all events on FB with a location, ticket URI, time, etc.
I have found lots of info on how to get the data, but what I am unclear on is how to get public events without being logged in to FB.
What type of tokens do I need to have a website simply pull events data and display it to visitors?
Basically, what I am attempting to do is show a set number of upcoming events and assume that the visitors to the site are not logged in to FB.
On this page, https://developers.facebook.com/docs/reference/fql/event, it says this:
Permissions
To read the event table you need:
a generic access_token for public events (those whose privacy is set to OPEN)
a user access_token with user_events permission for a user who can see the event for non-public events
an app access_token with user_events permission (for non-public events, must be the app that created the event)
a page access_token with user_events permission (for non-public events, must be the page that created the event)
I am not looking to get help with the code really, I am just having trouble figuring out how the access/auth process works.
It appears FQL may be the best option so I can do queries based on date ranges, but alas, I am stuck on the access/auth/token part.
What do I need to have in place to be able to list a Page's events on a 3rd party site?
If anyone has any advice there, I would appreciate it. Thanks.
Just to explain to others, you cannot get ALL the events in the city by graph search. You need to refine it either by user details or some other metric.
I figured it out.
This question helped, but was not correct and there is a syntax error in an answer:
Get Facebook events from public fan page
From what I found, you need to become an FB developer, create an app, get an ID and secret.
Use the SDK (PHP in my case), and this question had a good example of returning the list I want:
Link from ticket_uri is opening a blank page
I am having the same issue though of getting blank pages on the ticket link if the user is not logged into FB.
But my original issue is solved.
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.
I am really lost with these two problems with Facebook API...
All has been working fine posting to user walls, but I have one client with a page. The page was created from scratch, not via themselves as a user - ie they did not login and create a page they just started from the Facebook welcome screen>create page.
There page works fine, however,
1) Our system is submitting a post via API and receiving an ID in return (eg {"id":"123456_123456"} back from Facebook - this tells me facebook has accepted it and has given me an ID for the post.
However, the post DOES NOT appear on the page it relates to (and I have checked where it is submitting it to and it is the correct User ID). This system has been working fine for all other users.
2) When the login occurs via Javascript for this user, we get an empty value for "me.name" (we get me.email etc, just no name)
Is all this normal, or do pages have a different technique to posting and retrieving data?
Email is a private data of facebook user , It is a permission issue what you are encountering
The only way to get the users e-mail address is to request extended permissions on the email field.
After logging in .
This is how facebook api works , w.r.t revealing private data of its users
Ok I solved this one, I don't doubt the ability of anyone here - perhaps my question is still being misunderstood...
Some Facebook pages (especially business pages) where the page hasn't been created by an existing user are different to Facebook groups and user pages. You cannot just submit using an short ot long term access token.
You have to call facebook as http://graph.facebook.com/ID_OF_PAGE/accounts with your token first.
Facebook returns a list of pages, each with their own unique ID and a token for each.
You then grab the token for the page you want then resubmit with the page ID and that pages OWN token - and voila it posts to it!
Their are still bugs with Facebook as I found. It says on one business page I created for a client "Use Facebook as ." - ie the name is missing before the "." - it should say "Use Facebook as MYNAME."
This introduced another problem with the JS FB.login because the name of the person returns undefined. I had to verify their Email instead - other wise it says "You are logged in as ."
I think its because FB lets you create a page from scratch, as a new user, and without logging in as yourself - then some values are not being set and it messes up.
Perhaps may help someone...