user749798
user749798

Reputation: 5380

using Facebook koala gem to like a post

when using the koala gem, how do I like the current page?

I thought it would be something like this...but it's not working

@graph.put_like("http://www.currentpage.com")

@graph is an authenticated object, I have it working for put_connections, put_wall, etc...However, put_like keeps returning false.

Upvotes: 2

Views: 1715

Answers (4)

Daniel Bonnell
Daniel Bonnell

Reputation: 4997

Facebook just updated their docs on this matter on November 17, 2016. Liking an object through the API is only possible now if you are using a page access token.

You can do this with the Koala gem like so:

client.put_connections(object_id, 'likes')

Upvotes: 0

JZC
JZC

Reputation: 470

Facebook won't let you create a custom like action for your application. You have to use their common like action without the application namespace:

@graph.put_connections("me", "og.likes", object: "http://www.currentpage.com")

I believe .put_like only works by referring to specific object names or IDs. If you are simply liking a URL, use the above snippet.

Upvotes: 0

CrazyCoderMonkey
CrazyCoderMonkey

Reputation: 433

Will this like the fan page and increase the follower count or just like the fan page url?

Upvotes: 0

spas
spas

Reputation: 1934

I don't think that there is a put_like method in the koala or facebook api. like is a opengraph action. So you could do something like:

@graph.put_connections("me", "your_app_namespace:like", :object => "http://www.currentpage.com")

You have to create the like action in your facebook application and set a namespace for your app.

You can read more about opengraph actions here.

Upvotes: 1

Related Questions