Access user's news feeds via Facebook Graph API - facebook

Pacific controls systems is developing a web application which includes gadget. we have a requirement to show a user's news feeds in a gadget. This requirement could be fulfilled with "me/home" Facebook API endpoint but this endpoint is deprecated right now.
Facebook API documentation redirect developers to use "me/feed" instead "me/home". To get access to user's news feeds we need "read_stream" permission. But according to Facebook support forum, this permission only be granted to apps which aims on platforms where Facebook is not already available.
Is there any workaround available to fulfill our requirement?.

read_stream does not exist anymore since a very long time. You can use user_posts instead, just keep in mind that you will not get all posts. Detailed information can be found in the changelog: https://developers.facebook.com/docs/apps/changelog#v2_3
Possible feed endpoints are listed in the API reference: https://developers.facebook.com/docs/graph-api/reference/v2.5/user/feed
Usage of user_posts has to get reviewed by Facebook before it can be used for users without a role in the App, it is called "Login Review": https://developers.facebook.com/docs/facebook-login/review

Related

How to get my own Facebook user timeline using Graph API?

I would like to get all the posts and updates that are normally displayed in FB official application for MY account (this includes updates from my friends and liked pages).
I wasn't able to find any details how to get that, the only thing I've managed to get is my own posts.
Anyone got any experience with that using current Graph API verion (3.3)?
All the alternate FB clients (ex. Friendly) must be doing this somehow.
There is no way to get ANY data of users who did not authorized your App. Which means, there is no way to get posts of friends. You can only get your own friends, with the user_posts permission and the /me/posts endpoint. If some Apps access friend data without their authorization, they are most likely doing something that is not allowed.
Here is what I found in their API docs:
There are two scopes:
The user feed requires the user's permission
The public feed has fewer capabilities but doesn't require perms

Search recent media and comment via Instagram API and Graph API

I want to build an app where the app user can from within the app
search Instagram's most recent media by a search term (Hashtag-Search)
post comments to Instagram posts
For searching Instagram the Graph API can't be used, because it doesn't has such capability. Therefore I need to use the old Instagram API, correct? But Instagram states "The Instagram Graph API is Now Available to All Developers. For Non-Business Instagram Accounts please continue to use the existing Instagram Platform API". The users of my platform have business accounts which I need for posting comments via the Graph API.
Do I have to use the Instagram API for searches by the app users (1.) and the Graph API for posting comments(2.)?
Is there another way to search for Instagram media which is not against Instagram policies?
Yes, You need to use both APIs; in other words, have to have access token for both apps just for the same Instagram account, doing oauth handshake to each API's authentication.
Also to note - for your first requirement: Search media by hashtags in Instagram API, you need your app to have public_content scope; which Instagram no longer approves to new apps. So, unless you have an oauth app already with this scope for Instagram API; most likely it wouldn't be possible to use developer apis for search.
For limited tag search you can use public web api:
https://www.instagram.com/explore/tags/{tagName}/?__a=1
for example: https://www.instagram.com/explore/tags/apple/?__a=1
This is just for recent media - I guess, this API does not guarantee all media.
This is no longer correct.
The graph API has the endpoint ig_hashtag_search, which will find the ID of the hashtag. You can then use it to search for media on endpoints recent_media and top_media.

How to access Instagram feed of any user with new Graph API?

Facebook recently introduced Instagram Graph API, which allows to fetch data from Instagram page that is connected to your Facebook company page, instagram.com/developers states:
The Instagram Graph API is Now Available to All Developers.
For Non-Business Instagram Accounts please continue to use the existing Instagram API.
So, for example, if my company has account instagram.com/my_first_company, I can only retrieve its feed and no one else.
Using old Instagram API to retrieve public_content permission (access to any feed) is no longer an option too, from old API documetation:
public_content - to read any public profile info and media on a user’s
behalf (applications no longer accepted)
What will happen to existing tools that have public_content permission? (for example, there are tons of plugins for various CMS that allow to display recent Instagram photos)
Is there any valid way to access public_content (access to any feed) right now (besides fetching HTML pages of Instagram website)?
Are there any plans to enable Graph API for non-business customers, of so when?
UPD. There seem to be ?__a=1 endpoint that allows to get access to recent photos of any public feed without any tokens. But it's not official and no one knows when/if Instagram will close it. If you do - please let me know.
UPD 2. Instagram removed ?__a=1 endpoint, not sure for how long, probably forever. Currently the only way to access instagram feed is to scrap instagram.com website, which is a horror.
Prerequisite: You first need the business Instagram account to be linked with FB Page. https://help.instagram.com/356902681064399 - That one can do from the profile page of Instagram account.
Get the Instagram business account id:
graph.facebook.com/v2.8/<fbPageId>?fields=instagram_business_account. (the fbPageId is the page id of the facebook page the account is linked)
To fetch instagram media feed: graph.facebook.com/v2.8/<igBusinessId>/media to fetch the media feed of the Instagram account. (the igBusinessId is the id returned in above linked instagram_business_account) - This is still owned media as per the page access_token. Not any other user's feed.
All other endpoints (such as comments moderation, detailed insights API) mentioned here works on the business media list returned on above call.
Please note:
This still does not allow to fetch un-authenticated user's Instagram feed. That is not possible via API now. There is no valid way via API to get to public_content scope. There can be few Instagram Marketing partners for which this is enabled. But, in general the scope is deprecated now!
Currently, for FB graph API to work we need linked business page to Instagram account. As above apis uses page tokens.
You can get information about any IG business account using your FB access_token using the business_discovery API as given here.
You must have an IG business account to read other users data like user_info or media details using the id of your IG business account as a node.
Ex:
GET graph.facebook.com/[YOUR-IG-BUSINESS-ACCOUNT-ID]?fields=business_discovery.username(USERNAME){media{caption,media_url,media_type,like_count,comments_count,id}}

Can the news feed returned by Facebook Graph api be changed to show Most Recent stories?

Using the current (v2.4) Graph api I can see a user's news feed at /{user-id}/home assuming I have the user access token and the read_stream extended permission.
As per the Facebook developer docs, "The posts returned by this API may not be identical to the posts a person would see on facebook.com or in Facebook's mobile apps."
Is there any way—probably undocumented because I can't find it in the official docs—to modify what is returned? e.g. to emulate the Show Most Recent Stories option on facebook.com?
Or to limit the posts to those published by white-listed users, for example?
(I would like to be able to access the public posts of a user's friend. I can't do it via the friend's {user-id}/feed even though the posts are public because of FB's privacy-related API restrictions, but I was hoping to be able to do it via the News Feed, which will only work if the full News Feed is available rather than the limited Top Stories feed returned by default.)
Note: I know similar questions have been asked on SO before but they either haven't been answered categorically or relate to earlier versions of the API.
Both /{user-id}/home endpoint and read_stream permission are deprecated, and will be removed for all apps (no matter what API version they are using) on October 6, 2015 – see https://developers.facebook.com/docs/apps/changelog#v2_4_deprecations
If you want to get posts by the user’s friends, then those friends have to become users of your app and grant it access to their posts first.
I don't know why they deny API access to content that is freely available on facebook.com
Presumably mainly because you are not a Facebook user here viewing content that other people have made accessible to them, but a 3rd party app developer – and in that capacity, you could do all sort of (shady) things with that data if it was freely available to you, like do extended social profiling, data mining, etc. Therefor users must now explicitly agree to share content with your app, before you can access it.
It’s also why they removed all friends_* permissions that existed previously, that allowed people to grant apps access to data belonging to their friends to a certain extend.
Basically it boils down to this: Whether or not a 3rd party app gets access to my data should be my decision, and not that of any Facebook friends of mine.

Reading news feeds from Facebook fails after upgrading graph API 2.0

Hi There is a requirement in my application, where we need to show the user news feeds. For this we were using Facebook permission "read-stream" before Facebook has changed their list of permissions.
Now after they have shifted to the new API v2.0 there are comments saying that
"read_stream permission is granted to apps building a Facebook-branded client on platforms where Facebook is not already available. For example, Android and iOS apps will not be approved for this permission. In addition, Web, Desktop, in-car and TV apps will not be granted this permission."
If this is so what is the alternative to make my app fetch news feeds as earlier.
There is a another permission called "User_Posts" which says "Provides access to the posts on a person's Timeline. Includes their own posts, posts they are tagged in, and posts other people make on their Timeline"
But i am not able to see any posts or news feeds in my application when i have replaced "read_stream" with "user_posts".
The alternative is the user_posts permission and the /me/posts endpoint. Of course this does not return posts of friends for privacy reasons. You can read more about that in the changelog.
If you don´t get any results, make sure the Access Token includes the user_posts permission and debug it in the Debugger.