How to share someone's post using Facebook Graph API - 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?

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.

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

Related

Realtime Updates from FB API

I have a working Azure function that receives updates when I use the Graph API Explorer.
All I want to be able to do is submit a UserId to an endpoint and have any Posts they make sent to my WebHooks. We want to do this without the users always having to give permission. Unfortunately, I find the FB docs very confusing as most pages only have partial examples and the majority of the online SO or blog examples are far out of date.
On the FB WebHooks page it says
For example, if you subscribed to the user object's photos field and one of your app's Users posted a Photo, we would send you a POST request that would look something like this
They then say
You can also do this programmatically by using the /{app-id}/subscriptions endpoint for all Webhooks
On the Subscriptions page they have this example
POST /v12.0/{app-id}/subscriptions HTTP/1.1
object=page&callback_url=http%3A%2F%2Fexample.com%2Fcallback%2F&fields=about%2C+picture&include_values=true&verify_token=thisisaverifystring
But then its says this under Permissions
Subscriptions for the object type user will only be valid for users
who have installed the app.
This is not for a mobile app..so I'm confused
The above is to show that I have made all attempts to get this working without first posting here.
Now, I have to ask. Do anyone have experience or a existing code that demonstrates how to Subscribe to a User so that when they Post, I receive Notifications via webhooks?
Or, this this entirely the wrong way to use the Webhooks?

Extract my timeline posts from Facebook Graph API

I am trying to extract my posts, via Graph API from facebook. I used some basic code snippets but they don't work. I can not get my feed even in the Graph Explorer. It always says that I don;t have the permission and I have to submit my App for review and provide a video tutorial on how I use the extracted posts.
But I want to extract just my posts, I don't care for anybody elses. Do I seriously need FB App review to do that?
This is what I get with my token from my app:
user/posts requires additional contract signing:
Use /me/posts with your own App, with your User Token and authorize with the user_posts permission. This works without any approval from Facebook - for your account and your App only, of course. I just tested if it still works in the Graph API Explorer and it did: https://developers.facebook.com/tools/explorer/108138225915615/?method=GET&path=me%2Fposts&version=v5.0

How to get media from clients Instagram and Facebook public page on the server side?

I know it's probably a common question but i couldn't find a solution for my specific case. We have created a Facebook App on our Business Facebook account and the client has given us page moderator permission on his page. Using this we have been able to generate a Never expiring page token and download the posts from the clients page. We would like to do the same for the clients Instagram posts.
After reading the GraphAPI docs i have concluded that we need "instagram_basic" permissions from the client but when i choose page in the Graph API Explorer and try adding "instagram_basic" permission the whole API Explorer disappears.
We do not have the Instagram Business account but the client has. His posts are all public and we need only his posts. I'm confused by the docs what tokens can we use. Page token seemed appropriate for Facebook but not for Instagram. This is all downloaded server side and mashed together with the clients other blog posts and similar feeds. There is no App involved so no Facebook, IG login.

FB does not allow using FB share dialog with Posting through Graph api

Whe I am trying to get permission for publish_actions for my facebook app, it asks few points. One of those points is -
My app does not use the Facebook Feed Dialog or the Facebook Share Dialog to publish content
This means that If I want to get the publish_actions permission for using graph api to post on a user's wall I will have to remove all the FB share dialogs used in every place of my site.
After reading above I decided not to use publish_actions permission at all. But then I got a chance to look into change.org website. They are actually using both kynd of sharing. On the campaigns, they post to your wall via Facebook Graph API and on their blogs they are using facebook share dialog. So I am bit confused that can we use both simultaneously or not? And if not, how the change.org is able to do it?

Facebook Graph api - post to friends timeline issue

when I tried to post to my friends timeline using facebook graph api, I got
{"error":{"message":"(#200) Feed story publishing to other users is disabled for this application","type":"OAuthException","code":200}}
Enabling something while creating access_token will resolve this problem ?
If so what should I enable.
Thanks,
Padmaprasad G
This feature has been removed the 6th February : http://developers.facebook.com/roadmap/completed-changes/
Look here how to do it Facebook App: Will fb.api method post on friend's wall?
Yes, this was announced few months back and took effect on Feb 6th - http://developers.facebook.com/roadmap/completed-changes
Removing ability to post to friends walls via Graph API
We will remove the ability to post to a user's friends' walls via the Graph API. Specifically, posts against [user_id]/feed where [user_id] is different from the session user, or stream.publish calls where the target_id user is different from the session user, will fail. If you want to allow people to post to their friends' timelines, invoke the feed dialog. Stories that include friends via user mentions tagging or action tagging will show up on the friend’s timeline (assuming the friend approves the tag). For more info, see this blog post.
The workaround is to use the Feed Dialog which allows users to post the same content, but choose the user they want to post it to.