微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

使用 FB javascript SDK 发布时出现错误“预定发布时间无效”?

如何解决使用 FB javascript SDK 发布时出现错误“预定发布时间无效”?

我正在使用以下代码将其发布到 Facebook 页面,它可以正常工作并将其发布到某个页面。 使用 9.0 Javascript SDK。

但我也希望能够安排帖子的时间,但是一旦我添加scheduled_publish_time,它就会停止工作。

我正在像这样转换日期。

the_schedule_time = '2021-02-24 09:30'
converted_time=new Date(the_schedule_time).getTime()
console.log('UNIX numbers is '+converted_time) - this writes 1614154440000

//convert it back to a date to check if it is right
convert_back_to_date=new Date(converted_time)
console.log('convert back to date '+convert_back_to_date) - this writes Wed Feb 24 2021 09:30:00 GMT+0100 (centraleuropean normaltime)

    FB.api('/' + pageId + '/photos','post',{
        message :facebooktexten,link : lanken,url : bildUrl,access_token : aToken,published: false,scheduled_publish_time: converted_time
        },function(response) {
        console.log('photo id '+response.id)
        console.log('post id '+response.post_id)
    }
    })

所以即使 converted_time一个 UNIX 数字,我仍然会收到此错误

{"error":{"message":"(#100) The specified scheduled publish time was invalid.","type":"OAuthException","code":100,"fbtrace_id":"AtpOeMeoPlQ6uXCA1Nsm84L"}}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。