Facebook - posting scheduled posts on pages via Graph API - facebook

I've already read the facebook documentation which isn't quite clear. My question is, just like a page admin can manually add scheduled posts on their page, can my app, with the right access token, do the same? I've already tried using POST requests to set a 'created_time' on a future date but it just posts immediately.

Yes, use the scheduled_publish_time parameter when creating the post - this parameter is mentioned in the documentation you linked in multiple sections, where the parameters accepted when creating posts are listed, for example, in the 'Status Update' section:
https://developers.facebook.com/docs/reference/api/page/#statuses
Its value should be UNIX timestamp according to the documentation, though in many places in the Facebook API you can also use any date which is parseable by PHP's strtotime function so try that too.
Time when the page post should go live, this should be between 10 mins and 6 months from the time of publishing the post.
If you can't get this to work when specifying published to false, try setting it to 'true' at creation time

Contributing to the last answer (i'm not allowed to comment).
If you are trying to get the schedules post, you should use /{page-id}/promotable_posts. See https://developers.facebook.com/docs/graph-api/reference/page/feed/ for further details.

Related

Facebook Page Comments Using Graph API & Stream Filter

I have my site working using the Facebook Comments Plugin as you can see here http://www.amanzitravel.com/namibia-wildlife-sanctuary
I am trying to use the Graph API to retrieve the comments so they are on the page in a form that is beneficial for SEO (as outlined here https://developers.facebook.com/docs/plugins/comments/).
Ideally I want to see not only all comments, but replies to comments. According to the API (https://developers.facebook.com/docs/graph-api/reference/v2.0/object/comments) using filter=stream should do the trick.
However when I do that I only get the two most recent comments e.g. https://graph.facebook.com/comments/?ids=http://www.amanzitravel.com/namibia-wildlife-sanctuary&filter=stream as opposed to the default https://graph.facebook.com/comments/?ids=http://www.amanzitravel.com/namibia-wildlife-sanctuary where I get all the top level comments but none of the replies.
EDIT: Further to this, it appears to update itself some time later, but when another reply is added it goes back to displaying a subset of all the comments for a period of time. Its unfortunate because it means I can't rely on this to be accurate.
Is there anyway I can make this work properly?

Get old Facebook posts from public FB page

For a university research project I need to view some old posts on public Facebook pages from a specific date range (January 22-31 2014.) I was planning just to copy and paste each post but I have run into a problem with some of the pages that generate a very high volume of posts. Facebook will not display past a certain date. Even with scrolling down, at a certain point the posts stop displaying (this is true by month, so it jumps from January 25 directly to December 31 for example).
Here are the pages I am interested in:
https://www.facebook.com/Syrian.Revolution
https://www.facebook.com/Syrian.Truth
I have read about Facebook's Graph API but have had some trouble using it (I don't have a developer's background.) Also the posts are mostly in Arabic so that may be a problem.
I just need the pages' posts, not the comments sections.
Thanks anyone so much for your help, it is very appreciated.
Really depends on what language/environment you're using. As a simplest case, you can just use Graph API Explorer (https://developers.facebook.com/tools/explorer) and make a call:
{{page_id}}/posts
There are a lot of ways you can improve this call for your benefit. For example, you can use a limit parameter to increase the default number of results it retruns.
{{page_id}}/posts?limit=200
By default, this returns a lot of fields, you can limit the fields.
{{page_id}}/posts?limit=200&fields=id,message,created_time
You can visit https://developers.facebook.com/docs/graph-api/reference/page/feed/ to find out which fields are supported.
In order to get results during a certain time-range, you can use the created_time field to determine if a post belongs to a certain time interval.

Facebook Graph API Event Paging not working?

I am trying to access past event via Facebook's Graph API.
I am getting current events just right (the one I attended last month and the one in the future) with
https://graph.facebook.com/me/events?access_token=[ACCESS_TOKEN]
However, the paging components "previous" and "next" don't really work, "previous" actually points to a future event that's already been listed in "me/events". While "next" just returns an empty "data" struct.
I also tried "since" with different previous timestamps (such as "me/events?since=1304238280") and it didn't work, it will always return the events that are the same as the ones returned by "me/events". But I definitely have many more past events when I visit
https://www.facebook.com/events/past/
Am I not using the graph API correctly or what? I also noticed there are quite a few questions regarding Graph API's paging problem but there doesn't seem to be a definitive answer yet.
Any info/suggestion/reference would be greatly appreciated!
From what I've seen, it appears that about two weeks after an event ends, Facebook moves the event data out of the events table and into another one that isn't exposed via the API. The internal Facebook servers have access to this table, so you can see past events from within the Facebook webapp.
I'm assuming this is a privacy thing.
try to add the "before" query string with the ID of the first event ex:https://graph.facebook.com/me/events?&before=388551911259170.
you can refer to the following link: https://developers.facebook.com/docs/reference/api/pagination/

How to access links provided on one's timeline?

I would like to have access to the links one shared on their timeline.
Using the API Graph Explorer, I see there is a way to access "links". However, it returns empty data. I believe that this might have been used when posting links in FB was done in a special way, different than posting "usual" status.
Then, I thought, I should probably get all the stream and filter the data for links. But at that point, I'm a little confused:
There are THREE different actions that seem to provide the very same data:
- https://graph.facebook.com/me/feed
- .../me/posts
- .../me/statuses
Are they actually all the same?
In addition, all seem to provide me information that is not up to date, but is true for some point in the near past. Moreover, I would like to know how I can get the relevant data from the beginning of the FB usage, or at least, for a given period of time.
Do an HTTP Get to me/links to get the most recent links the user has shared.
To limit it to a timeframe, you can do me/links?since=YYY&until=ZZZ.
Or you can use the paging object to get the previous and next url to use to get that other page of data.

Getting old records from Facebook using the API

I want to fetch some historical data using the api. But when I access older and older pages, I suddenly hit one that's returning me empty data.
For example, call to this url: https://graph.facebook.com/kenderken/posts?limit=100&until=2010-06-01T09:10:53%2B0000 returns me empty data even that there are posts on my wall that are older then 2010-06-01... (here's the last one that API returns to me: http://www.facebook.com/kenderken/posts/134367776579392 and this one http://www.facebook.com/kenderken/posts/271650467287 is from January 2010, no way to get it via API)...
Any clues on that?
That is a fairly common bug with Facebook. If you search http://bugs.developers.facebook.net/ you will find many similar reports.