是否可以从Facebook页面发布动作? [英] Is it possible to publish action from a Facebook Page?

查看:87
本文介绍了是否可以从Facebook页面发布动作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用很棒的Facebook OpenGraph和publish_actions权限.我的用户可以通过我们的网站发布操作,并且它直接与Facebook-Timeline连接.高度集成,非常易于开发:非常感谢您的工作!

I've been using the great facebook OpenGraph and the publish_actions permission. My users can publish actions through our website, and it's directly connected to there Facebook-Timeline. Great integration, very simple to be developped : thanks a lot for your work!

但是,我还有一个问题:

But, I have one more question :

是否可以不是从特定用户而是直接从Facebook页面使用publish_actions? (如此处为用户所述: https://developers.facebook.com/docs/opengraph/actions/#create )

Is it possible to use publish_actions not from a specific user but directly from a Facebook Page? (as described here for a user: https://developers.facebook.com/docs/opengraph/actions/#create)

例如,用户John Smith拥有一个Facebook页面(名为"John Smith Advocate"),并希望不是从John Smith本人而是从Facebook页面"John Smith Advocate"发布动作.

For example, User John Smith has one Facebook Page (named "John Smith Advocate"), and wants to publish action, not from John Smith himself, but from the Facebook Page "John Smith Advocate".

我想知道是否有可能.

I wonder if it's possible.

非常感谢你们!

推荐答案

要发布为页面,您需要获取该页面的身份验证令牌.为此,您需要按照以下步骤操作(对不起,由于缺少详细信息,希望这会为您指明正确的方向):

In order to publish as a page, you need to obtain an authentication token for that page. To do this you need to follow these steps (sorry for the lack of detail, hopefully this will point you in the right direction):

1)作为您页面管理员的用户需要通过您的应用进行身份验证,并且您需要为其获得"manage_pages"扩展权限

1) A user who is an administrator of your page needs to be authenticated with your app, and you need to get the "manage_pages" extended permission for them

2)获取用户作为管理员的所有帐户的列表: https://graph.facebook.com/me/accounts

2) get a list of all the accounts the user is an admin of: https://graph.facebook.com/me/accounts

3)您将获得用户所属的页面的json数组,以及每个页面的访问令牌-提取相关的访问令牌

3) you'll get a json array of pages the user is an admin of, and also an access token for each page - extract the relevant access token

4)使用访问令牌将信息发布到相关的相册ID(该页面拥有)-这是一些实现该功能的php代码;

4) Use the access token to post to the relevant album ID (owned by the page) - here is some php code that does it;

<?php
$args = array('message' => 'Caption');
$args['image'] = '/path/to/image.jpg';
$args['access_token'] = $page_access_token;

$data = $facebook->api('/'. $album_id . '/photos', 'post', $args);

这篇关于是否可以从Facebook页面发布动作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆