Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
54
rated 0 times [  59] [ 5]  / answers: 1 / hits: 7945  / 10 Years ago, fri, april 11, 2014, 12:00:00

I just had to do this.
Absolutely every question I looked up questions regarding this issue but none of their answers helped me solve it.



I am trying to post on my Facebook page.



Here is the issue:



Error:
(#100) You cannot specify a scheduled publish time on a published post



Code:



FB.api(
/100177680105780/feed,
POST,
{

message: This is a test message,
scheduled_publish_time: Math.round(new Date().getTime() / 1000) + 120

},
function (response) {
console.log(response);
if (response && !response.error) {
/* handle the result */
}
});


I have no idea why this is giving me this error. It doesn't work even if I add the object:{} around the content of the post. I tried changing the UNIX time stamp, I tried changing the message, I tried setting published: false and no luck.



Any guidance would be amazing.


More From » facebook

 Answers
16

published: false should be set in order to publish the scheduled posts. If you carefully see the error after you set this parameter, it says:




(#200) Unpublished posts must be posted to a page as the page itself.




The scheduled posts can be published only using the page access token - logical enough since those who have the permission to manage the pages can schedule the post.



Also, with your code (where you are using a normal user access token), the post is published as yourself not on behalf of the page. And these posts are visible on the side bar not on the main wall- that's not what you are looking for right? :)



So, use the page access token. To get the page access token, get the new user token first with manage_pages permission and make the call-



GET /{page-id}?fields=access_token


Use this token and make the call to schedule the post-



FB.api(
/{page-id}/feed,
POST,
{
message: This is a test message,
scheduled_publish_time: Math.round(new Date().getTime() / 1000) + 120,
published: false,
access_token: {page-access-token}
},
function (response) {
console.log(response);
if (response && !response.error) {
/* handle the result */
}
});


I'm not sure about what exactly your application does, but if getting a never-expiring page access token helps you you can see my answer here for the same.



Hope that helps!



Edit:



As @Tobi has mentioned, also make sure UNIX timestamp is between 10 minutes and 6 months from the time of publish. Since you are using 2 minutes, that may also create problem.


[#46116] Thursday, April 10, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
breap

Total Points: 606
Total Questions: 96
Total Answers: 108

Location: Djibouti
Member since Sun, Feb 27, 2022
2 Years ago
breap questions
Thu, Jun 24, 21, 00:00, 3 Years ago
Wed, Mar 18, 20, 00:00, 4 Years ago
Mon, Oct 7, 19, 00:00, 5 Years ago
;