jjzjj

javascript - Facebook 错误 100 : You cannot specify a scheduled publish time on a published post

coder 2025-02-01 原文

我只是不得不这样做。 绝对每个问题我都查找了有关此问题的问题,但他们的答案都没有帮助我解决问题。

我正在尝试在我的 Facebook 页面上发帖。

问题是:

错误: “(#100)您不能在已发布的帖子上指定预定的发布时间”

代码:

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 */
        }
    });

我不知道为什么会出现这个错误。即使我在帖子内容周围添加“object”:{},它也不起作用。我尝试更改 UNIX 时间戳,尝试更改消息,尝试设置 "published": false 但没有成功。

任何指导都会很棒。

最佳答案

"published": false 应该被设置以发布预定的帖子。如果您在设置此参数后仔细查看错误,它会显示:

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

只能使用页面访问 token 发布预定的帖子 - 这很合乎逻辑,因为有权管理页面的人可以安排帖子。

此外,使用您的代码(您使用普通用户访问 token 的地方),帖子是以您自己的身份发布的,而不是代表页面。这些帖子在侧边栏上可见,而不是在主墙上——这不是您要找的,对吧? :)

因此,请使用页面访问 token 。要获取页面访问 token ,请先获取具有 manage_pages 权限的新用户 token ,然后调用 -

\GET /{page-id}?fields=access_token

使用此 token 并进行调用以安排发布-

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 */
    }
});

我不确定您的应用程序到底做了什么,但是如果获得永不过期的页面访问 token 对您有帮助,您可以查看我的 answer这里也是一样。

希望对您有所帮助!

编辑:

正如@Tobi 所提到的,还要确保 UNIX 时间戳在发布时间后的 10 分钟到 6 个月之间。由于您使用的是 2 分钟,这也可能会产生问题。

关于javascript - Facebook 错误 100 : You cannot specify a scheduled publish time on a published post,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23002547/

有关javascript - Facebook 错误 100 : You cannot specify a scheduled publish time on a published post的更多相关文章

随机推荐