Getting Statuses from Facebook - javascript

After a day of searching I still don't fully understand how to pull statuses from a Facebook page, or if it's even possible.
All references to the PHP SDK now include login as the first step - but what I'd like is to create an App on Facebook and then use those credentials to pull 2 or 3 recent statuses to display on my own site.
I did read briefly about access tokens, but it's seems they are all temporary.
So my question is: Using PHP or JavaScript, is there a simple way to pull statuses from a Facebook page in a format that I can style (ie, not the Facebook Like box).
Thanks.

Related

Using access token without facebook log in (Graph API)

I'm working with javascript and i've made a site for only one person (admin), who needs to log in to Facebook and then the script extracts data from many public pages on facebook through some ids i've saved in a local database.
What i'd like to do now is actually the same, but without user interaction. This means the admin shouldn't log in his facebook account to start viewing facebook pages stats.
Is there anyway to code making use of a token (I've read that you can make them permanent) and instead of logging in to facebook in your welcome page, just start watching pages stats? Is there anyway to just skip the log in pop up from Facebook?

How can I add the ability to extract and post tweets onto the site when user submits link?

I'm making a rails application, I want users to post their tweets by submitting a link [of the tweet]. I'm guessing its done with javascript/twittera api. Things needed to be extracted:
tweet owner
tweet + image
link to user profile page
Twitter REST API requires oAuth authentication. So, you would have to provide access token with all of your API calls. oAuth specification allows you to get access token through javascript as well. So you might want to look into that.
If you decide on using REST API, I would suggest moving this to server-side. You would be able to save user tweet urls and data.
Alternatively, if you are just playing with javascript and want to do this for yourself, you can simply see in your browser's developer tools where official Twitter widgets are getting tweet data and use that edges. I remember myself doing this several years ago.
But, please note. These urls are not public and official way of working with twitter data. So, they may change at any time and break your code.

Accessing a public Facebook feed without logging in

I am working on a seemingly simple Facebook integration to allow my client (a local restaurant) to display their daily specials on their website. To make this work properly I need to sort through their posts, find the most recent post that has a certain string of characters (to distinguish from other posts they make), and display the post on the webpage. I know how to do this part but I am having trouble getting the data in the first place.
My question: How do I access the data for this Facebook page's posts? This needs to work
Without logging into Facebook
Preferably client-side
I would also like to use the JSON from the Graph API but I need an access token according to all the research I have done so far which would force me to go server-side. The Facebook social plugins are not specific enough to do what I want. Any help using the Graph API or another method to retrieve the page's posts is very much appreciated.

Creating a facebook likebox

A client of mine (a design studio) asked me to style the like-box social plugin on their site.
As far as I know this cannot be done now with the deprecation of "css" parameter on the fbml tag.
So the route I have to take is to recreate the like-box myself using the js SDK (or php SDK), but the problem is that I cannot find the users (and their photos) that like my page. I'm searching through the opengraph explorers parameters but i cannot find anything.
Does anyone know which url I must follow in the graph api to get what I want?
Do I have to have an access token for such an action? I noticed that the likebox plugin works event if you don't have a facebook account (It shows pictures).
Thank you.
You can't recreate the like box on your own. The Facebook APIs will not return a list of users who like your object. This was done to stop people from getting user lists of likers and spamming them.
Currently, you can only query to find if a specific, authenticated user or which of their friends likes your object.
You could build something similar by populating your fake like box with images of recent posters. You would need to deal with filtering out duplicates, and the page posting as itself, but this should get you started: /PAGE_ID/feed?fields=from.name,from.picture&limit=10
You will need an access_token to get this data. I'd authenticate as an app to do it.

Grabbing facebook feed in website

I develop mobile websites for my clients. This particular client would like some facebook wall activity to be displayed on the website. I have looked into the facebook graph api and am getting confused on authentication.
I need the blah in https://graphs.facebook.com/clientsfacebookid/feed?access_token=blah
in order to grab the info i want. I read about authentication and all of that but it doesn't seem to serve my purposes.. For example a lot of the stuff I read about getting a token is related to creating apps and stuff - which is not what I'm trying to do. A lot of ways to authenticate redirect users to log in or grant access to the information but this also doesn't seem like it fits my scenario.
Should I just talk to my client and get them to send me an access code or set up some stream so I can grab an updated access code anytime I need it OR is there some built in functionality in the API that I could benefit from using.
Any thoughts?
P.S. I am trying to implement this via an ajax call in javascript.
Thanks!
What you'll need to do is create a Facebook App and have your client add this to their page. You can then get an OAuth token for this app and use it to query the client's feed. See the Facebook documentation for authenticating as an app for details.
It's actually far simpler if you just want to grab the data from the page. Create an App, but you don't need to add it to the actual page. You can generate an App Access Token by following the instruction on the Facebook Developer Website.
Then, all you need to do is call the Graph API with the generated access_token. E.g.:
https://graph.facebook.com/{page_id}/feed?access_token={app_access_token}
You can then use the data returned by Facebook to display selected posts from the page.
The Page Admin doesn't need to add the app to the page, and this method can be used to scrape any published page. The posts on Pages is public anyway, you just need an access_token to access the page.
If you want a simple way to learn and have an example of a working model try out fourgefeed.com its a simple framework with a simple to implement example kinda like jquery.

Categories