starling
starling

Reputation: 271

How to share someone's post using Facebook Graph API

My Facebook App posts messages on user wall. I want to share this messages on my wall, same as I click share action under user message. How can I do it using Facebook Graph API?

Upvotes: 26

Views: 17118

Answers (2)

bobsterthe7th
bobsterthe7th

Reputation: 59

According to the permissions for accessing posts via the API, it would appear that you cannot do this as it would require accessing the post of another user's timeline that you don't have permissions/an access token for.

Edit From further reading of the documentation you definitely cannot do this: https://developers.facebook.com/docs/graph-api/reference/v2.2/object/sharedposts#publish

Upvotes: 2

Taylor Allred
Taylor Allred

Reputation: 4380

Yes, you can share using the graph2 api. The way you do it is to use /feed edge and pass the post's url that you want to share as the link.

POST /v2.2/{page-id}/feed HTTP/1.1
Host: graph.facebook.com

link=https://www.facebook.com/{page_id}/posts/{post_id}

Standard Fb permissions to the post you are sharing do apply.

https://developers.facebook.com/docs/graph-api/reference/v2.2/page/feed

This was done today, in a local rails app, using FbGraph2 gem, with the above method. enter image description here

Upvotes: 11

Related Questions