最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Facebook Error 100: You cannot specify a scheduled publish time on a published post - Stack Overflow

programmeradmin3浏览0评论

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.

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.

Share Improve this question edited May 21, 2015 at 20:04 Simon 3,7271 gold badge37 silver badges50 bronze badges asked Apr 11, 2014 at 2:40 ChainFuseChainFuse 8272 gold badges11 silver badges26 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 8

"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.

The docs at https://developers.facebook./docs/graph-api/mon-scenarios#scheduledposts are saying that scheduled_publish_time

should be a UNIX timestamp that is the between 10 minutes and 6 months from the time of publish

As you're only adding 120 seconds, I guess this could be the reason why it doesn't work. Try adding at least 600 seconds and test it again.

https://developers.facebook./docs/graph-api/reference/page/feed/#pubfields says this as well.

As @Sahil mentioned, you also need to use a Page Access Token, which needs to be set manually as he described.

发布评论

评论列表(0)

  1. 暂无评论