Like post at Facebook via API
Solution 1
Ok, I found answer here: https://developers.facebook.com/docs/graph-api/reference/v2.6/object/likes
Permission publish_action is needed.
Solution 2
According to the docs you can like
an object (post, photo, etc) only if you are using a page access token. This appears to be new behavior as of November 17, 2016.
hya
Updated on June 28, 2022Comments
-
hya almost 2 years
I'm working currently on messenger bot which will perform like and share action on fb posts.
My question is: Does Facebook allows application to like and share posts for user via Graph API?
I found some Open Graph documentation about og.likes, but I don't know if it's deprecated or not. (link: https://developers.facebook.com/docs/opengraph/guides/og.likes/). I've made some sample requests and created open graph object of like, but post isn't liked. I didn't see any action on my account.
Request that was made:
fb.api('me/og.likes', 'post', {object: https://www.facebook.com/permalink.php?story_fbid=55431741576&id=38441731099'}, ...);
Object that was created:
{ end_time: '2016-06-17T07:14:48+0000', start_time: '2016-06-17T07:14:48+0000', type: 'og.likes', application: { category: 'Utilities', link: 'https://apps.facebook.com/messenger-bot/', name: 'Test1', namespace: 'messenger-bot', id: '173992418' }, comments: { data: [], can_comment: true, comment_order: 'chronological', count: 0 }, from: { name: 'Bartłomiej Pasik', id: '122387551' }, likes: { data: [], can_like: true, count: 0, user_likes: false }, no_feed_story: false, publish_time: '2016-06-17T07:14:48+0000', data: { object: { id: '95990823123', type: 'website', url: 'https://www.facebook.com/permalink.php?story_fbid=55431741576&id=38441731099' } }, id: '1210344228' }