Post to Facebook page (not user page) using Koala

How to send to user page using Koala? I don't want to post on the User's wall, but on the User's page (User can manage many pages).

The code I have right now:

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

      

And I know that you can do it

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

      

If self.token is already in the manage_pages scope but I don't even think it is necessary. So how would you post to a specific page a user who has a Koala access token? How can I find out which pages a particular user has and their corresponding IDs?

+3


source to share


1 answer


Taken from the Koala README, this will post on the user's wall:

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

      

So, the following post will post on the page wall (in your context):

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

      

Make sure the token you are using is a user token (if you want to publish as a user) or a page token if you want to publish as a page.

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



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

EDIT: due to comment

Get user pages

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

      

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

+6


source







All Articles