3

如何使用考拉发布到用户页面?我不想发布到用户的墙上,而是发布到用户页面(用户可以管理许多页面)。

我现在的代码是这样的:

facebook_graph = Koala::Facebook::GraphAPI.new(self.token)
facebook_graph.put_wall_post(message)

我知道你能做到

facebook_graph.put_wall_post(message, profile_id="page.id")

self.token 已经在manage_pages的范围内,但我什至不认为这是必要的。那么,您将如何使用 Koala 发布到我拥有访问令牌的用户的特定页面?如何发现特定用户拥有的页面以及他们的通讯员 ID?

4

1 回答 1

6

Taken from the Koala README, this will post to a users wall:

@graph.put_object("me", "feed", :message => "I am writing on my wall!")

So, the following will post to the Wall of a page (in your context):

graph = Koala::Facebook::GraphAPI.new(self.token)
graph.put_object(page.id, "feed", :message => "I am writing on a page wall!")

Ensure, that the token you use is a user token (if you want to post as a user) or a page token if you want to post as the page itself.

More to read about Graph(Page): http://developers.facebook.com/docs/reference/api/page/

and Koala: https://github.com/arsduo/koala

EDIT: due to comment

To get Pages of a user

@graph.get_connections("me", "accounts")

Documentation: http://developers.facebook.com/docs/reference/api/user/

于 2012-04-05T22:56:21.990 回答