How to retrieve specific user's posts on a page using graph api - facebook-graph-api

I want to retrieve the posts on a page's wall but only of a particular user. I am unable to query the graph api with filter. Please help

There is no such filtering available. If you need this, you will have to do the filtering on your end.
You will either have to go through the page's feed and check the from field of the posts for the user id, or through the user's posts (requires that you get user_posts permission from the user first) checking the to field for the page id.

Related

Facebook Graph API Search Posts for specific text in message field

Is there a way with graph facebook to search specific text content in the message of a user's posts? The assumption here is that the user id and access token is already available as well as all applicable permissions (ie. the user_posts permissions, etc..).
I read through the search feature on graph:
Facebook Graph Docs-Advanced
The following graph explorer example was provided:
GET graph.facebook.com/search?
q={your-query}&
type={object-type}
The table that lists the available types in the link provided is very limited (place, placetopic, ad_*). Is that the full list of possible types? Can we use POSTS or user posts as a type. I couldn't find the right syntax anywhere.
My goal is to retrieve a user's posts based on a specific message tag or text in their post message. Currently, the only way I know how to do this is highly inefficient. I would have to do the following:
Get user's full list of posts
https://graph/facebook/com/{version}/{userID}/?fields=posts&access_token={token}
Run a coded query to get the posts I need and discard the rest
Thanks in advance.

Facebook Page Likes over time

I'm not the owner of a facebook page (eg. TESLA) but I'm trying to use graph api to get the number of user that liked the pages over time. Based on graphi api documentation (insight/page_fans), I'm just getting empty json documents. Any ideas how I can get this data?
Only two page-related metrics are available publicly, page_fans_country and page_storytellers_by_country.
Everything else is only accessible to an admin user of the page, resp. using a page access token.
You can not get the data you want for pages you do not have admin access to.

Get list just of visitor posts / shared events etc

We have a public Facebook page for our dance group. Friends and strangers will post to our Timeline (sharing events etc) – you can see them all under Visitor's Posts, which opens in a modal on the page.
I want to be able to pull all Visitor's posts with the graph api.
The Visitor's posts are not included in the basic {page-id}/feed request, so i cannot filter for them post-retrieval.
I have tried the {page-id}/tagged/ Edge, but for some reason this excludes certain posts.
Graph request with page ID 93039009689/tagged/
https://developers.facebook.com/tools/explorer/391224331052795?method=GET&path=93039009689%2Ftagged%2F&version=v2.5
Compare to Visitors Posts feed here: https://www.facebook.com/contactinsydney/posts_to_page/
Any ideas?
Using the Graph Explorer with the User access token should not retrieve all visitors posts. Did you try with the Page access token? It worked for me.

Montreal Canadiens Facebook Graph API returns no posts

I'm using the Graph API to return Facebook posts from all NHL teams. Every team returns the posts fine except for the Montreal Canadiens, which returns no posts. I verified that there are posts on their wall, and that the Facebook ID that I used is correct(see here)
I get back an empty JSON list when I try using this link for the Canadiens:
https://graph.facebook.com/110877132302973/posts?access_token=(my access token)&limit=10
Any help would be appreciated! Thanks.
Haotian
The posts on that page all have a custom privacy setting - you need to make sure you're attempting to access them using a User access token for a user that meets whatever restrictions they've applied.
App or page access tokens won't be able to see the posts, nor will user tokens for users who don't meet the restrictions

Tagging users in user feed post using graph API

On the Graph API page it shows a table showing the arguments we can use to create a new post to a feed
/PROFILE_ID/feed
Publish a new post on the given profile's feed/wall
message, picture, link, name, caption, description, source, place, tags
We want to be able to post to a users wall and tag their friends.
i.e. User 1 is doing something with User 2 and 5 others
What format should the tag attribute take?
For those who are interested:
tags is sent as an array of FB user ids
tags can only be added if there is a place associated with the post also
you have to post a Checkin to add place and tag friends
On Graph API Explorer you can use the below parameters:
/me/feed?message=<text-message-after-encoded>&place=<page-ID-of-location>&tags=<facebook-user-id,facebook-user-id,...>