How to get facebook groups (not pages) feed (posts' title+content)? - facebook

I've seen many posts around most of them are about pages or with outdated information.
I need to collect the feed (let's say last 10 posts: title + content) of 2 different Facebook groups in real-time (or almost) possibly in JSON in order to get real-time notifications about new posts (e.g. via kimonolabs service, but any other solution is accepted).
How do to that?

There are no realtime updates for groups. You would need to get the feed on your own - with a Cron Job, for example.
Be aware that you can only get access to groups you manage, with the user_managed_groups permission and the /group-id/feed endpoint.
Check out the API reference for example code and all the information you need: https://developers.facebook.com/docs/graph-api/reference/v2.4/group

Related

How can we get our followers data/details from graph API?

Is there any graph API which gives a page's followers detail?If not is there any alternative?I have a Facebook page and i wanted to collect my followers data(user interests,shares etc)
I have tried graph APIs but it gives single users data only.it doest give page followers data unless and untill we know their userids.No way to collect that also.
You cannot access your page follower's data like that, especially not if you refer to followers (compared to fans, which are two different things/objects).
Do do this it would require the user explicitly granting your app the permission to access that info first, but data you mention (user interests for example) had been deprecated and cannot be accessed via the API anymore.

Subscribe via webhook to a Facebook user's Activity Feed?

I'd like to use the GraphAPI and Webhooks to subscribe to a user's activity feed and extract information such as metadata and stats about the shared posts they like. (Yes, I am well aware of the privacy concerns and this will be handled extremely carefully.)
The closest question I could find is here:
Extract Links from Facebook activity feed
The other answers are not relevant, as they either discuss the old FQL or plugins or are specific to Pages.
I've been reading the GraphAPI documentation and the User Likes information only relates to the Pages they like (which doesn't change much). So this is a subset of the info needed - I need likes for Posts, not just Pages.
What I am really interested in is the objects to which a given user has reacted. You can easily see the reactions for everyone to a given post with a GET /v2.8/{post-id}/reactions HTTP/1.1 call. But this is "reactions by post" and I need "reactions by user".
The best solution I can figure out so far is to subscribe to their feed with a webhook and then collect a list of object IDs and then subscribe to their reactions for a certain period and filter by the user. This is not ideal or very efficient as it requires a fair number of subscriptions, and also only accounts for posts in the user's feed and not other posts they might have stumbled upon via some other means.
So - how to extract all User Like info?

Facebook Graph api users search

I'm using Facebook graph Api to search users and data that i get is kinda different from that i get from Facebook UI. For example search response of User interface is friends, mutual friends and other related data in first. How can i query to get related data for current user ( i.e friends and mutual friends in first place).
Here is query that i'm using to search users.
https://graph.facebook.com/v2.5/search?fields=id,name,picture.type(normal)&limit=50&q={q}&type=user&access_token={token}
and data that i get is kinda different from that i get from Facebook UI
That’s because those are two completely different things.
The search functionality offered via the UI is called Graph Search. But the powerful possibilities that offers are not exposed via API. (To protect user privacy, and keep apps from doing extended user profiling via that data.)
Searching via API is limited to what is listed here: https://developers.facebook.com/docs/graph-api/using-graph-api/#search
That’s not much – but it’s all you get.

How to get Facebook share count for all links shared using a given application via Facebook API

Is it possible to get a list of statistics/analytics for all the links shared using a server-side Facebook application via the Facebook API?
I have a list of links that can be shared to Facebook using the appId defined in my server app. In order to refresh the share count of those items, I'm currently calling:
http://graph.facebook.com/{MY_URL}
whenever I want to update those values.
Obviously, this solution is not very scalable, because the number of items constantly grows so I can't call the method on all the URLs in sequence. Alternatively, this information can be fetched every time it needs to be visualized to the users. However, this can mean that the same request will be made to Facebook API in quick succession even though the chances of anything changing are small.
Ideally, I would like to get a list of all the links/items shared using my application with the share count for each of them. This way I can do a nightly update of all the values without going one by one.
I'm using the
me/links
API method to share the links to Facebook.
Analytics of a post, shared by a page can be accessed by the Insights API
Below id the Graph API call to access the count of clicks sent to your domain by a certain post.
/v2.4/<object-id>/insights/domain_feed_clicks?period=lifetime
If this is not what you're looking for, please refer to the permalink mentioned above and find the metric which best suits your need.
I would like to get a list of all the links/items shared using my application
The API does not provide that kind of list.
To reduce the number of API requests you have to make, you can request the data for several URLs in one go though: https://developers.facebook.com/docs/graph-api/using-graph-api/v2.4#multirequests
https://graph.facebook.com/?ids=http://example.com/foo,http://example.com/bar,…
(You should properly URL-encode any URLs you use a parameter values here of course.)

Facebook API - Looking for details on individual posts

I'm looking to see if it's possible to pull data from individual posts; listed below. I'm looking to pull this data daily for a business page. From the daily data I want to make a weekly report comparing the last weeks set of data.
The data I'm looking to get is:
Activity / How many times was each indidual post viewed
Posts that lead to a subscription / like
Posts that lead to unsubscribe / unlike
The number of people that have hidden an individual post
Facebook provides api access to the Insights of a page (or application).
You have two ways to access it: the Insights object or the Insights fql table.
Using that you can load statistics about your page using specific metrics, in the fql table doc. the ones that you care about (based on your question) starts in Page Posts and then you have Stories and People talking about this, Impressions and Engagement.
According to the fql table doc:
To read insights you need
read_insights permissions for all apps, Pages and domains owned by the current session user
Which means that you won't be able to just run a program once a day to collect this data since you'll need an active token for a user that has access to the insights data for the page and has authorized your app and granted the "read_insights" permission.
You can make sure that the user use your app while you authenticate him using the Server-Side auth flow, which will results in 60 days token, save that and you can run that program daily for the next 60 days.
When the token has expired the user will have to again use your app to authenticate and create a new valid token.