Post via open graph to Company Page NOT user - facebook

As I am learning and getting familiar with the FB OG API I am finding that I am lacking some of the basics. For example I see here that I use the action type news.publishes to post an article. However the access_token is for the user owning the page and thus it will go to their news feed and not the page (in this case their company page). Correct?
If I understand correctly then how does one get it to post to a specific page. Is there an access_token collection you iterate through till you find the one for the company page?
TIA
JB

You should be able to use /PAGE_ID/feed? Where page id is the numerical assigned by facebook..or the text friendly name you used.

Related

Get restaurant menu from Page using Facebook Graph API

The problem is to get the link to menu from a Facebook official page of a restaurant.
Here is an example of such page: https://www.facebook.com/freshchoice.bb — there is a link to menu of the restaurant which leads to https://www.facebook.com/download/216155385221332/Facebook%20menu.pdf.
Actually, this link works well even if I remove the name of the file from it, and I understand, that 216155385221332 is an ID of some object. But how can I obtain this ID from the API?
I have already spent two days trying to find a solution for this task and have had no luck.
When I request data from Facebook Graph API, I get tons of information, and I can request any of the fields listed here: https://developers.facebook.com/docs/graph-api/reference/page but there is no 'menu', or 'downloads' field, and I have almost broke my brain trying to find out a way to solve this puzzle.
I don't think there's a way to reach this object if you didn't create it yourself.
There's the restaurant.menu OpenGraph object:
https://developers.facebook.com/docs/reference/opengraph/object-type/restaurant.menu/
but I think only the user who created it can access it programatically.
The page you're referring to probably just uploaded the menu via the Facebook website, and didn't create an OpenGraph object.
Se
https://www.facebook.com/help/533179700126832

Check if visitor of my website likes a facebook page

I am in the process of making a band website. I have a download of a song but I want it only to be available to the user if they have liked the bands Facebook page. I am aware there are similar questions to this already on here. I have tried some of them and they don't work, also none of them are very clear. Thank you for your help.
There are more than enough results which answer your question, for example Create Like-Gate for page
The most simple way to create this is using a Page Tab app (https://developers.facebook.com/docs/appsonfacebook/pagetabs/) and parsing the signed_request (https://developers.facebook.com/docs/reference/login/signed-request/) Facebook is sending when the page Tab is accessed.
The page object within the signed_request contains a field called liked which indicates whether the actual user liked the Page or not.

Facebook Graph API - Get list of id's and names that have liked a post

Using the Facebook Graph API, how do I get the list of people who have liked a specific item (say a post)? Doing a call like /ITEM_ID/?fields=likes using the Graph Explorer I'm able to see a list of names in the [data] array, but, when I call it from a website it doesn't display the names, it just shows the count value.
I'm thinking it's one of two things, but I'm not sure:
I'm using the wrong access token. I'm using the extended one for the fan page the post is on.
Facebook just doesn't give out that info to someone (or a fan page) that isn't the owner of the original post. (I'm the one who made the post.)
Is there a way to get the list of user names and user id's that have liked a post, and if so, what's required to do so?
There could be 2 reasons-
You access token is not correct. You need the read_stream permission for getting the posts.
You are not parsing the resulted JSON correctly.
/ITEM_ID?fields=likes.fields(id,name)
i have done this like this ( me/feed?fields=likes.fields(id,name) ) and it works

Facebook Open Graph Follows

Similar to the ability to subscribe to a user's posts on Facebook, users can since today, follow other users' Open Graph activities from a specific app. For example, on a movie review site, users can follow their favorite movie reviewers.
There's no example of this yet, but if you submit the new follow action you'll get the code and have an idea of how it goes. It's very easy: hit(GET) https://graph.facebook.com/me/og.follows with a token and a profile ID. What I don't get is the third_party_id.
I have read this sentence over and over and still can't decode it: "This tag is not required, and follow actions will succeed without it, though followers will not see activity in their News Feeds without this."
How to use the third_party_id? And most important, from now on, only the actions from the the people I subscribe to will been seen on my feed?
Full info here: https://developers.facebook.com/docs/opengraph/actions/builtin/follows/
What I don't get is the third_party_id.
If you’re posting a follow action not for a facebook profile, but for an URL (as in the example, profile=http://www.rottentomatoes.com/celebrity/tom_hanks/), then that page has to have a <meta property="fb:profile_id" …> element to tell Facebook what to actually follow.
To get the third_party_id, you query the Graph API for a user with /userid/?fields=third_party_id.
(I’m guessing using the third_party_id in this place instead of the actual user id is just recommended for the simple reason, that this way not everyone who looks into the HTML code of the rottentomatoes page can see what FB uid Tom Hanks actually has.)
If there is no corresponding user on Facebook for the URL that’s being followed – then there isn’t anything to follow at all, because there will be no posts on Facebook that could been shown in a user’s feed.
How to use the third_party_id?
This could have been explained better by Facebook. I think it works like this:
Lets say William followed Claudette in your app and that your app successfully published a follow action on facebook. Whether you provide Claudette's third_party_id or not, a story that William followed Claudette, will get published on William's News Feed.
However if Claudette's third_party_id is provided, then William will start getting stories about ALL of Claudette's actions published by your app. Now, thats pretty cool. But of course to do this, Facebook needs to know "who Claudette is" which is what third_party_id does.
To summarize, by not providing third_party_id the follow action gets shared on William's news feed and potentially to William's friends. But thats a one time thing. By providing the third_party_id you are extending the virality and ensuring a constant flow from Claudette to William for actions Claudette does on your app.

Pulling in 'like' url data from open graph

Just developed an app that asks for user permission and is pulling in a list of external "liked" products from a website. So querying the open graph against the user id and identifying the URL of the product they have liked to create a list of products. This no longer seems to be working? the URL string doesn't seem to be an option. Does anyone know if Facebook have changed anything?
I assume you've solved your problem by now, but a similar issue has come up so I'll leave some info here for other desperate searchers.
The field you are looking for is probably "website".
https://graph.facebook.com/user_id/likes?fields=website
I was using the "link" field for this, but over the past couple days there was a bug released by FB where the link field was no longer present in the returned link data. The bug was fixed and the link field is back, however now if you are an admin or otherwise own the thing that was liked, the link field contains a URL to a FB Page for the liked object. If you don't own the object, the URL is the same as website. It's very confusing and now I'm scared to use the website value in order to identify what has been liked because it's meaning could change.