2016-03-01 54 views
-1

我正在尝试将消息发布到商业页面的墙上。我遵循以下steps和一切工作正常,但我不以管理员身份在商务墙上发布消息。将内容作为页面发布

graph = facebook.GraphAPI(access_token='xxx') 

如果我使用graph.put_wall_post(message='test')我在我的个人墙上发布文本。

随着业务页面的配置文件ID,graph.put_wall_post(message='test', profile_id='5537xx')我张贴类似Me > business page

如果我尝试使用业务页面来创建应用程序,我得到以下错误:

Users not logged into their personal account cannot access developers.facebook.com 

哪有我将邮件作为文本帖子直接发布到我的商家页面上,没有错误?

回答

1

您应该为页面获得access-token。您可能正在为您的个人帐户获取访问令牌。

如图表API文档指出,herehere

With the Pages API, people using your app can post to Facebook as a Page (...)
Before your app can make calls to read, update, or post to Pages you need to get a page access token. With this token you can view Page settings, make updates to page information and manage a Page.

因此,你基本上应该得到的令牌对应于您的网页

To get the Page access token for a single page call the API endpoint /{page-id} using an user access token and asking for the field access_token. You need the permission pages_show_list or manage_pages to successfully execute this call.

然后发出请求发布内容,例如,消息

To post text to a Page's feed, provide a message parameter with the text along with the Page ID:

POST https://graph.facebook.com/546349135390552/feed?message=Hello 

如果成功,图形API包含JSON页面

ID and the ID for the post:

{ "id": "546349135390552_1116689038356556" }

阅读上面的链接,你就会有更多的相关信息进行响应。

相关问题