Starting with facebook app (need guidelines) - facebook

i'm trying to make a facebook app, to make draws (like raffles) between the users who like my fan page, or eventually who likes a post.
I've been developing another app which do other stuff, but i'm stuck with this and it's really frustrating to not be able to do something so simple as this.
In the first place, i wish to make it available in a page tab (and that users doesn't need to "install" the app. Maybe this isn't needed if the user is just "looking" at a page that is loaded in my hosting)
Second, i don't know how could i get (assuming the one who enters the app/page tab is an admin) all the users who liked the page/post without using an access_token (because this damn access_token has an expiration time, and if i could, i'd try not to use an access token at all, since i assume the user who gets in into some parts is an admin
Any ideas?

You can't make an app that draws a contest winner from the people who like your page. Facebook does not allow you to query the fans of your pages anymore.
You can still query the users who like a post on your page though so you should set your contest up this way.
To get started, you'll need to create a connector app for your page. Users don't need to register for this app. As long as they like your page, your app will be able to access their public data. Your app will have an API key and secret. Using these, you'll be able to access information about your page.
To find a user who liked a post, you can query this with a variety of languages. I'm not sure which one you are using, so I'll give you instructions to do this from the Graph API Explorer: https://developers.facebook.com/tools/explorer
Make your post on a page, and type PAGE_ID_OR_USERNAME/feed where you replace PAGE_ID_OR_USERNAME with your page's id or username. Find the id of the post you just listed in there. It will look something like this: 213365490637345_40261112079719 (not a real post_id)
Now you can get all the user ids of people who liked that post by typing this into the explorer box:
fql?q=SELECT user_id FROM like WHERE post_id = "213365490637345_40261112079719"
And then choose a random id from that list and contact that particular user. You may have to use Facebook as your page when you try to contact them.

Related

Facebook will not allow me to post to a user's wall without a dialog. How can causes.com get away with it?

I have an app that allows users to share the page to specific users by clicking on check boxes next to their name and then doing a bunch of posts. I received an alert in February that said I would not be able to post to friends' walls unless there is a dialog box.
However, I noticed if you sign a petition on Causes.com, they do something very similar where they post the petition to a bunch of friends' walls.
I'm curious how they get away with that. Maybe I'm not familiar enough with the Facebook API.
I'm not sure if this helps, but Facebook does have business partnerships with certain sites/companies that have more privileges to their api keys, facebook app. This could be one of these instances.
One instance of this is, when you go to a major site and the site is able to read your facebook session, and within that site they show your name and picture once the site is rendered. In essence, these sites already know who you are.

How to get public Facebook Page data no matter the country/language admin selected?

As you may know, Facebook Page Administrators can select for posts to be visible to only certain countries/langauges ( https://www.facebook.com/note.php?note_id=180817924821 ).
However, I would like to use the Graph API to retrieve feed messages ( /feed ) for ALL countries/languages or be able to select data for a specific country.
For example:
1) I would like to get ALL posts (and comments ...) from all of Starbucks Facebook Page. So no matter what the administrator says, just ALL.
2) I would like to be able to retrieve only the posts that are visible to users in Germany.
Are both these example actually possible? Probably, because I use access_tokens Facebook will probably use my own country/langauge to decide what data I get so that would mean I would have to change country all the time which is of course not an option to ask my users.
Any of you know what to do?
This is only possible if you're using the app as an admin of the posting page.
As you mentioned, the API will detect the user behind your access_token and only display posts that would normally be accessible to them on the desktop site.
This is an intentional restriction, so there's no way around it.

Checking which users have liked a Facebook page

I've been researching this for a couple of days and I'm seing a lot of answers to similar questions and they are unfortunately all "No, you can't do that." So, perhaps you can help me find a more efficient way or perhaps you have a better answer.
I'm running a game at an event. When users sign up for my game, they'll authorize my Facebook app. They get points in my game for doing certain things. One of the things they get points for is Liking a chosen Facebook page.
They don't Like the page through any interface I control though, so I'm going to be running a process in the background which checks if my authorized users have liked the page.
I'm going to have tens of thousands of people playing this game though. I've got an access_token for each of them and I know I can fetch a list of likes for Person X with their access_token, but fetching 10,000+ lists of likes to check if they've liked the page seems ridiculous... especially since if they haven't liked it, I can't just cross them off the list. I need to keep checking every few minutes for the duration of the event just to see if they have liked the page yet and give them points. Once they have liked the page then I no longer need to keep checking them, but that's still going to require a ton of requests.
Is there a way that I can determine which of my 10k+ users, for whom I have individual access_tokens, have liked my page?
Or can I get list of people who have recently liked a particular page?
Any other suggestions?
EDIT: As the administrator of my FB page, I can use the website to just click through and I can see all of the people who have liked my page, so I feel like there should be some way to access this information programmatically as well. Am I just missing something?
This problem seems like a candidate for using FQL. There's a table called page_fan that acts as a join table between the user and page tables. You could run a query for each user to see whether a row exists for the chosen page. For example:
SELECT 1 FROM page_fan WHERE uid = me() and page_id = 8484927467
I'm running a game at an event. When users sign up for my game, they'll authorize my Facebook app. They get points in my game for doing certain things. One of the things they get points for is Liking a chosen Facebook page.
Please clarify some details on that:
is your game app running as a page tab app inside facebook, or some place else?
if it is running in a page tab, is that also the page they are required to like?
If that would be the case, you would get the info if the user has liked the page within the signed_request parameter automatically, no further API queries etc. necessary.
fetching 10,000+ lists of likes to check if they've liked the page seems ridiculous...
Keep in mind that you don’t have to go through each user’s list of likes, though – you can ask if someone liked a specific page by querying for /userid/likes/pageid. (I know, it’s still one request for each user.)
I need to keep checking every few minutes for the duration of the event just to see if they have liked the page yet and give them points. Once they have liked the page then I no longer need to keep checking them, but that's still going to require a ton of requests.
Are you aware of the method in the JavaScript SDK of binding an event to a user clicking a like button on your page? Maybe you could use that – implement the like button in your site, catch the event of the user using that very button to like the page … and then AJAX the fact that the like happened to your server, maybe make one more request for that particular user to verify that there’s no “cheating” involved (someone making a call to your AJAX endpoint themselves, without actually having liked) … and you should have what you want, right?
Hey guys go to the BANNED USERS panel at your page settings and select PEOPLE WHO LIKE YOUR PAGE. Thanks

Check whether user of non-facebook app likes/shares particular URL on FB

I'd like to know if there is a possibility to check (using Graph API or any other way) whether given user likes / shares a specific link. Probably I'll have this user's facebook ID or facebook login, but my site is non-Facebook application. Actually it's Dot Net Nuke portal (target: .NET with MS SQL Server) with part of it being avaliable as Facebook app, but certainly not greater part of it, so the solution should be out of Facebook Connect, although it's not a showstopper if it's necessary.
We'll be giving points to users who share/like most of links that we serve in our portal and such possibility would be a great help to make a ranking.
Another option we consider is making some kind of "wrapper" or proxy for FB like / share buttons which will at first save some data in our database (probably - this user clicked on like for this link) and then go on with standard FB like / share route. Did anybody of You tried such solution?
If You have any other suggestion on the subject, please, post them, we'll be really thankful.
It is possible to know if a user has LIKED a site or not. You can get all user's likes with Graph API (you need user_likes permission). Take a look at the docs: http://developers.facebook.com/docs/reference/api/user/
I'm not sure if you can know if he has shared your site, but you could try by parsing his wall with the read_stream permission and then look for your site name/URL post by post.
For just general liking of items on your site, you can use a Facebook Social Plugin. However, you won't be able to associate (or really even access) user activity with users on your site without integrating Facebook Connect and creating a Facebook application for your site. At that point you can design with greater control all the possible user activity and interleave with your facebook calls other calls that affect users' accounts on your site.

Editing a User's Likes on Facebook

I've been looking at the Facebook API to find some way to edit a user's Likes (that is, add or remove items from https://graph.facebook.com/me/likes/). The API doesn't say anything about it specifically, but does say this:
You can publish to the Facebook graph by issuing HTTP POST requests to the appropriate connection URLs above.
Where above, one of the connection URLs is the aforementioned https://graph.facebook.com/me/likes link. However, there's no documentation for the PROFILE_ID/likes post, and whenever I try to post it returns the error "invalid post_id".
I assume this is because to like something, you post a request to POST_ID/likes. It's a bit inconsistent. What I'm trying to do is get the user's profile to add a Page to their likes (by posting using the page's id as an "id" parameter in the post body). However, it seems like there's just no way to edit user's likes.
At the end of the day, I just want to allow a user to click a button in my application (mobile device application, not a web app) and have them add our Facebook page into their list of pages, and I've found no way of doing that short of presenting our page to them and making them click on the "Like" button manually. Many other things are supported without showing the Facebook website, like posting to their wall or making albums, but I can't find anything to do this.
Any ideas?
Looks like I can't. Not in the way I want to anyway.