Posts from Instagram not showing up on Facebook Open Graph API - facebook

I have an issue with Facebook OpenGraph API. Whenever I request data using either '/home' or '/feed', none of the posts from Instagram showed up.
I've been googling around and apparently some people raised the same issue with no solution yet. And I read some that the issue not only affecting posts from Instagram, but also other third-party app/device/platform.
Even the ticket posted on Facebook's dev page seems somewhat dead (no continuation). Link: https://developers.facebook.com/bugs/110563582419837/
If any of you guys also stumbled on this issue and has some ideas/pointers/links, please do share and let's discuss it.
Much appreciated. Cheers!

There are two bug reports in Facebook's bug tracker about this:
https://developers.facebook.com/bugs/110563582419837 and https://developers.facebook.com/bugs/202119973248747
The core reason is that the photos are attached to Open Graph actions as User Generated Photos and not via the regular Photo upload API.
As such, the regular photos permissions don't grant access to them and you need the user to specifically allow you the access their Open Graph activity for the app that posted the actions. The bug reports above are accepted on the basis that this appears to be an oversight in the case of actions with user generated photos, but it could also be by design in which case what i've outlined below as a workaround would be the only supported way to do this:
If you specifically need to request Instagram (or another Open Graph photos app) photos for a user, you can ask for Permission to access the actions posted by that app.
For Instagram photos you can do this by requesting the user_actions:instapp permission and once you've done that the Instagram Photos album will no longer appear to be empty, and the Instagram activity will appear in the feed connection.
To find out the namespace for an arbitrary app, access https://graph.facebook.com/<APP ID> and look for the namespace field,
e.g. for instagram, a call to https://graph.facebook.com/124024574287414/?fields=id,namespace returns:
{
"id": "124024574287414",
"namespace": "instapp"
}
A sample photo from my own /feed connection, retrieved with the read_stream, user_photos, user_actions:instapp permissions, is:
{
"data": [
{
"id": "[SNIPPED]",
"from": {
"name": "[SNIPPED]",
"id": "[SNIPPED]"
},
"picture": "[SNIPPED]",
"link": "https://www.facebook.com/photo.php?fbid=[SNIPPED]",
"icon": "https://fbstatic-a.akamaihd.net/rsrc.php/v2/yb/x/StEh3RhPvjk.gif",
"privacy": {
"value": ""
},
"type": "photo",
"object_id": "[SNIPPED]",
"application": {
"name": "Instagram",
"namespace": "instapp",
"id": "124024574287414"
},
"created_time": "2013-01-07T17:33:04+0000",
"updated_time": "2013-01-07T17:33:04+0000",
"comments": {
"count": 0
}
},
I can also access the /photos connection of my 'Instagram Photos' album with the same permissions, and can access all Instagram 'take' actions (i.e the photos) at /me/instapp:take

Facebook employee here. Looking at the internal task that is tracking this issue, all I can say at this time is that this is an issue that we are currently aware and investigating into. If you would like to be notified of any updates, be sure to click "subscribe" on the bug report.
For the time being, I recommend finding the album ID of the user named "Instagram Photos", then calling a GET request to /INSTAGRAM_ALBUM_ID/photos to get their Instagram photos. On the Graph API Explorer tool, I confirm that I am able to fetch all of my instagram pictures. Since my album is public, you should be able to view them as well.

Related

Create a photo album on Facebook through the Graph API

I am trying to create a FB photo album, so that I can use that album in a FB AD. I am using the following request on fiddler:
POST https://graph.facebook.com/v2.5/{page_id}/albums
and I pass the page access token in the body of the request. I keep getting this reply:
{"error":{"message":"(#200) Requires extended permission: manage_pages and publish_pages","type":"OAuthException","code":200,"fbtrace_id":"FCspsWIecMV"}}
After a lot of research, I found this video: https://www.youtube.com/watch?v=vZ28bjBNk6I
This video shows how to give extended permissions, which seems to be the problem, but it is not working properly. I used the following query to give the necessary permission to myself:
https://graph.facebook.com/oauth/authorize?client_id={ap_id}&redirect_uri={our_page}&scope=publish_pages
But it only redirects me to the 'our_page' link. But the first time I have used this link, with "manage_pages" in the scope, it actually has shown me the page in which I had to allow this permission. So I guess the query is correct, because by querying the /me/permissions I get this:
{
"data": [
{
"permission": "manage_pages",
"status": "granted"
},
{
"permission": "public_profile",
"status": "granted"
}
]
}
Any tip on how I can get this done?
I found out that, by selecting the app in the https://developers.facebook.com/tools/explorer, the necessary permissions are then shown for the specific request. After clicking there, all my requests started to work, so it seems that this method is permanent. Below there's an illustrative screenshot of how to do it.

Can I aggregate Facebook Likes, Tweets, and Google Pluses?

I'm building a voting application on my new website, cabinethardware.org. I'd like the voting to be done in such a way that when someone votes for a project (to receive a $1000 rebuilding grant) that they are encouraged to plug the project via social networks. My programmer has had difficulty with the application, and it occurred to me that one way of doing it is to just put like, tweet and G+ buttons on the site and add them together. So if a project gets 24 likes, 12 tweets, and 18 G+, it would have 64 votes. It doesn't bother me if someone votes on all three engines.
Before a project is eligible for a grant, it must receive 100 votes. My question is, is there a way that I can aggregate the likes, tweets, and G+ so that I can see on the backend how many votes each project has, without going to each project and adding them up by hand? Also, I'd like to display to customers the combined total.
Does anyone know of a way to combine the count of these three?
For Google+, you would only need to perform one API call to the Google+ APIs that would be searching the Google+ public data. Searching the Google+ public data is demonstrated in the API explorer.
The post response contains information about reshares and +1s:
"verb": "post",
"object": {
"objectType": "note",
"content": "Setting up a server-side flow project that accesses Google+ data using the .NET stack can be a little tricky, I walk you through it in this blog post.",
"url": "https://plus.google.com/109716647623830091721/posts/g8LjdGAXdDc",
"replies": {
"totalItems": 0,
"selfLink": "https://www.googleapis.com/plus/v1/activities/z125srm50lf1slxrd04cfftatqyoglnoqio/comments"
},
"plusoners": {
"totalItems": 6,
"selfLink": "https://www.googleapis.com/plus/v1/activities/z125srm50lf1slxrd04cfftatqyoglnoqio/people/plusoners"
},
"resharers": {
"totalItems": 0,
"selfLink": "https://www.googleapis.com/plus/v1/activities/z125srm50lf1slxrd04cfftatqyoglnoqio/people/resharers"
},
For Facebook, you can use the Pages API to count likes for your page, you can experiment with this in their API explorer.
The following data shows their response data:
{
"about": "Build and distribute amazing social apps on Facebook. https://developers.facebook.com/ ",
"company_overview": "Facebook Platform enables anyone to build social apps on Facebook, mobile, and the web.\n\n",
"is_published": true,
"talking_about_count": 39241,
"username": "FacebookDevelopers",
"website": "http://developers.facebook.com",
"were_here_count": 0,
"category": "Product/service",
"id": "19292868552",
"name": "Facebook Developers",
"link": "https://www.facebook.com/FacebookDevelopers",
"likes": 952596,
"cover": {
"cover_id": "10151121467948553",
"source": "https://fbcdn-sphotos-f-a.akamaihd.net/hphotos-ak-ash4/s720x720/299374_10151121467948553_45631061_n.png",
"offset_y": 0
}
}
Likes are just a member in the response data.
For twitter, you can query for mentions of a user with their search API and passing a search string for the user as #user. A count of the objects within results is going to be your mention count. The response data is a little too much to paste in here but here's an example query using their API.

How to get a Facebook access token that has enough rights to get the posts in which you're tagged in?

The Facebook posts in which you're tagged in - using #Name - appear in your wall feed.
A friend of mine posted a link and tagged me in it:
On the Graph API documentation, when I click on my wall feed link (Ctrl + F: Profile feed), I'm able to see this post:
...
{
"id": "XXX",
"from": {
"name": "XXX",
"id": "XXX"
},
"to": {
"data": [
{
"name": "XXX",
"id": "XXX"
},
{
"name": "Christophe Maillard",
"id": "XXX"
}
]
},
"message": "The startup Guide (cc XXX, Christophe Maillard)",
"link": "http://mashable.com/2012/06/27/startup-guide-1000-users/",
"name": "How to Get to Your First 1,000 Users",
"caption": "mashable.com",
"description": "With the help of some smart marketers and entrepreneurs, we're created a clear outline for attracting your startup's first 1,000 users.",
...
}
...
The URL of this feed is https://graph.facebook.com/me/feed?access_token=XXX.
When copy/pasting the given access token - the one replaced by XXX in the URL above - within the debugger, I get something like this:
As we can see, the access token is generated by the app Test_console which used quite a lot of scopes.
Then, I go to the Graph API Explorer, I generate an access token using the Get Access Token button, and I specify all the scopes the debugger gave me, i.e. the ones the Test_console app used to generate its working access token. Finally, I access the URL me/feed by submitting the GET request. The problem: I can't see the post in question in which I'm tagged in with the explorer.
I also have my own app, and it reacts exactly like the Graph API Explorer: I can't find that post in my wall feed using the Graph API as well.
Obviously, it's possible to get the posts in which you're tagged in using the Graph API, because the Test_console app is able to generate an appropriate access token. But how can I get such an access token for my own app?
You need to grant the appropriate permissions for your app. In the graph api explorer https://developers.facebook.com/tools/explorer?method=GET&path=me switch to your app in the applications field (top right) to see what permissions that currently grants your app (by clicking the "get access token" button again). Then make sure you add in the correct one (i think it's read_stream you're after ) https://developers.facebook.com/docs/authentication/permissions/

Scope of Facebook API

I am trying to learn and create a Facebook API on the go. However, I haven't found any page on the developer pages that specifies the scope of the Facebook API in great detail. I understand public information can be accessed using Graph API. But at the same time understand that further access is possible, not sure how much though.
Is there anyway to access the 'Edit news feed options' of a user that authorizes an application?
I don't really understand what you mean by "scope", but the Graph API is not more than a series of URLs to contact the facebook servers with queries and obtain answers in form of JSON objects.
You can start learning by looking at the reference for the API here:
http://developers.facebook.com/docs/reference/api/
There are unofficial APIs for every language you can imagine, for example java: http://code.google.com/p/facebook-java-api/ , c#: http://facebooksdk.codeplex.com/ , etc.
To read the news feed, you can access it by:
https://graph.facebook.com/me/home?access_token=TOKEN (where TOKEN is the access token)
Fb will respond with a JSON object similar to the one pasted below.
{
"data": [
{
"id": "11111_1111111111,
"from": {
"name": "Name",
"id": "11111111"
},
"message": "SOME_MESSAGE",
"actions": [
{
"name": "Comment",
"link": "http://www.facebook.com/111111/posts/11111"
},
{
"name": "Like",
"link": "http://www.facebook.com/11111/posts/11111"
}
],
"type": "status",
"created_time": "2011-04-20T20:19:04+0000",
"updated_time": "2011-04-20T20:19:04+0000"
},
etc etc etc
],
"paging": {
"previous": "https://graph.facebook.com/me/home?access_token=TOKEN",
"next": "https://graph.facebook.com/me/home?access_token=TOKEN"
}
}
Having that, you can use the ID for the person or the message to perform new queries, as explained in the FB API page:
All of the objects in the Facebook
social graph are connected to each
other via relationships. Bret Taylor
is a fan of the Coca-Cola page, and
Bret Taylor and Arjun Banker are
friends. We call those relationships
connections in our API. You can
examine the connections between
objects using the URL structure
https://graph.facebook.com/ID/CONNECTION_TYPE.
The connections supported for people
and pages include:
Almost every information on FB is accessible through the Graph API, provided the user authorized the app with the rigth permissions:
http://developers.facebook.com/docs/authentication/permissions/

Facebook ID from URL

Given a facebook url such as http://facebook.com/cnn, is there any way to get the ID of that page short of scraping it?
It is better (and legal) to do this with graph API. Just perform API request to https://graph.facebook.com/cnn and get id from the response.
Here is the response for cnn:
{
"id": "5550296508",
"name": "CNN",
"picture": "http://profile.ak.fbcdn.net/hprofile-ak-snc4/hs178.ash2/41813_5550296508_728_s.jpg",
"link": "http://www.facebook.com/cnn",
"category": "Company",
"website": "www.cnn.com\nwww.ireport.com\n",
"username": "cnn",
"company_overview": "TRIVIA FROM THE CNN TOUR...",
"products": "CNN US...",
"likes": 1689936
}
Facebook's own Graph API supports it. From the documentation:
The "ids" query parameter also accepts URLs. This is useful for
finding IDs of URLs in the Open Graph. For example:
https://graph.facebook.com/?ids=http://www.imdb.com/title/tt0117500/
As of Today(28th July 2015), There still exists an easy way to get page(or user's) id.
Browse to facebook page(or user) url. The syntax is https://www.facebook.com/[username or pagename]
Right click to view source and then search for string "pageID": in case of page. The numeric id next to searched string will be id.
In case of user, search for "uid":.
Been working with it today. So, for people who want to know how this works. Use this:
https://graph.facebook.com/<the_fb-address>?access_token=$accessToken
And remember: this is only for pages. Not user pages/friends' timelines etc.
Those will have to approve your Facebook App first before you can read their profiles.