简体   繁体   English

如何使用Facebook JavaScript SDK将其发布到墙上,如页面管理员?

[英]How to post to the wall like the admin of a page using the Facebook JavaScript SDK?

I have a JavaScript function which have been used to post something to the wall of the current user. 我有一个JavaScript函数,该函数用于将某些内容发布到当前用户的墙上。 But when I go to a Page (Fanpage), which I am the admin of, it's: 但是,当我进入由我管理的Page(Fanpage)时,它是:

function postToWall(id, title, desc, href, image, caption)
{
    FB.ui(
        {
            method: 'feed',
            app_id: social_app_id,
            name: title,
            link: href+'?ref='+social_user_id,
            picture: image,
            caption: caption,
            description: desc
        },
        function(response) {
            // nothing to do here
        }
    );
}

But I got the error: 但是我得到了错误:

An error occurred with My App Name. 我的应用名称发生错误。 Please try again later. 请稍后再试。

How can I post to the admin wall to include tile, desc, image, and caption? 如何张贴到管理墙以包括图块,说明,图像和标题?

You should specify both from and to parameters for Feed Dialog . 您应该为Feed Dialog指定fromto参数。

FB.ui({
  method: 'feed',
  name: title,
  link: href,
  picture: image,
  caption: caption,
  description: desc,
  from: 'ID_OF_PAGE_ADMIN_OR_PAGE',
  to: 'ID_OF_PAGE'
}, function(response) {
  // nothing to do here
});

If from and to is the same id to can be skipped since it's defaults to from value. 如果fromto是相同的id to则可以跳过,因为它的默认值为from值。

Update : 更新
You can fill from and to with id of your Facebook Page and post as Page itself, not just Admin of Page 您可以使用Facebook页面的ID来回填写fromto页面本身的形式发布,而不仅仅是页面的Admin。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM