How to determine why a facebook page URL will not return a facebook id? - facebook-graph-api

For the most part, using the graph api, passing in a Facebook page's encoded URL returns the normal facebook id.
For instance, using the Graph API Explorer and passing in https%3A%2F%2Fwww.facebook.com%2Fkendalljenner returns
{
"name": "Kendall Jenner",
"id": "173567062703796"
}
However, for some (pretty rare) FB pages, like http%3A%2F%2Fwww.facebook.com%2Fmargotrobbie, I get
{ "id": "http://www.facebook.com/margotrobbie" }
The question, Why do some Facebook urls not return their Facebook page id through graph api?, suggests that the issue may be that the page is restricted somehow (like for alcohol content). I believe this may be the case, because the Harley Quinn videos in the posts are a bit graphic, but I searched all the info for the page and it doesn't say anything about the content being restricted. In addition, I am using a User access token that is allowed to see the page via normal FB web interface without any apparent restriction.
BTW, for anyone who hasn't seen this before, the id set to the url seems to be the result when facebook doesn't know anything about the URL. Obviously this shouldn't be the case for facebook's own URL.

Not sure what the reason for the apparent difference with the two page URLs indicated, but I did solve the underlying problem of getting the facebook id of the page!
First of all, I had tried the process described here: How to get page id of facebook page, however it wasn't working for me. In my effort to permute all options, I had changed the access token to a "user access token". Turns out, you HAVE to have an "application access token" as is well-documented in said article.
Thanks to CBroe for making me question how I was calling the API...no matter how long I was calling it this way.

Related

Django and Post to Facebook (no authentication)

OK, I need some help understanding the process behind Facebook's website integration process and how I can integrate it into my web app....
In its most basic form, my site stores and displays users' comments about products (there's more to it than that, but that's all that's relevant for this question). What I'd like to do is allow them to post that comment, together with the name of the product (and my site), to their Facebook wall by clicking a button.
I do not need the users to log in to my site at all, either with Facebook or any other authentication system and the Post to Facebook part is optional.
Obviously if they decide they do want to post their comment to Facebook, then they'll need to login, but I'd rather temporarily take them away from the page to login, post and then be brought back to my site.
What I need to know is how much of Facebook's APIs, Open Graph and Auth systems do I actually need to integrate?
I had hoped that I might be able to generate a simple link to Facebook with their comment embedded as a POST element...?
I'd be really grateful if someone could point me in the right direction!!
(P.S. I need a similar solution for Twitter, but I think that's easier!?!)
The Feed Dialog doesn’t allow including of a pre-set message any more, so you’d have to make that post via the Graph API if you want to pre-fill the message (and even then, you should only do so, if you’ve given the user the possibility to edit the pre-filled message first).
See here for how to make a post on a user’s behalf via Graph API, https://developers.facebook.com/docs/reference/api/user/#posts
You can do that all client-side, if you embed the JavaScript SDK into your page.
You need to set up an app on FB, then have the user connect to it (using FB.login), ask for the necessary permission (publish_stream) while doing so, and after successful login use FB.api to make the Graph API call.

Facebook custom graph action not appearing

I found a very similar question here: Actions do not appear on timeline, but the solutions offered there are not working for me.
I created a custom graph action and a custom graph object through my Facebook application, and the process of publishing seems to be working fine. When I post the data using the JavaScript SDK with my access token and the object ID, the Facebook API returns the ID of the action, which I can then access on the graph. This side of things is clearly working, since accessing the object via the graph with my app's access token returns all the information it is supposed to.
However, I see no record of this action on Facebook itself; not on my app's timeline, not on the aggregation I set up for this action. The solutions offered in the link above entail double-checking the validity of the meta tags, which I did using the debugger, and also ensuring that there are no URLs within the meta tags that are inaccessible, which is also not the case. Is there anything else that could prevent these actions from showing up on the timeline?
Thanks!
There can be some permission error for facebook (and thus global users) for some url. If you get the action response id, it has to be in your facebook timeline at least (not in others excluding the developers and testers of your app) and it really occurs almost real time.
PS: If you found a similar questions elsewhere, please try to go on with the discussion there instead of creating a duplicate question.

Unable to publish to facebook feed

I operate a website, http://www.plingo.com.br/
I have created a like button for that webpage, as well as specified opengraph tags that point back to the same URL and included a video.
I have set the og:type tag to 'blog'.
When someone clicks Like, the video and URL get posted to the users feed as expected.
However, my issue revolves around being able to publish to users of my feed.
As you can see in my opengraph tags, I have associated my URL to a facebook application that I own.
I have followed the instructions at developers.facebook.com/docs/opengraph/ on how to publish to my feed directly, however when I run the PHP script, I receive this error:
"error": {
"message": "(#100) (the url) does not resolve to a valid user ID",
"type": "OAuthException"
}
However, the opengraph at the URL points both to my facebook account as well as my application.
I have no idea why I am unable to do this.
However, to try to diagnose the issue, I made a similar webpage at http://www.plingo.com.br/ogtest.php and set all the attributes of the opengraph tags the same, except for the og:url and the youtube video. Running the publish script using that URL however, works fine, and facebook even generated an administrative page for publishing to facebook.
I am wondering why this is not working with my root URL. Is there any way to get Facebook to give me an Administrative Page? Why can't I publish, even though I have associated the opengraph IDs properly?
I would GREATLY appreciate any input as I have tried countless different things, changes, etc to see where the issue lies.
Thank you

Some feed messages return false in graph

I have tried posting to some different friends feeds. Sometimes the message does not show up on feed even if a get a "good" response back with a new graph api ID.
100002842168248_146917358746335 does not work for example
I don't get any errors or similar only a new ID for the post and when I try to access via graph api (developer console on FB) it return simply false?
https://graph.facebook.com/100002842168248_146917358746335
Using the same call but for another user is showing up on facebook feed without problems. Is there any more action I can take or should I simply take my "false" and give up.
It's probably a privacy/permission settings issue. If the user who's Wall you are posting too has it set so only Friends can view their Wall, you will not be able to view the post (via the Graph or otherwise) - even though your App made the post.
You can also get 'false' if, although the post is visible on Facebook.com with no problems, the user who posted it has opted out of Facebook Platform. This is a privacy setting which disables any apps from accessing any information about a user, their posts, etc.
Even if their posts are 'Public' on facebook.com, the API won't return anything about such users.

How can I allow my users, who create pages on my website, to communicate back to those people who click the Facebook "Like" button on their pages?

OK, apologies for the verbose title. Let me give the background in a bit more detail.
My website allows my registered users to create new pages, each of which has its own unique URL. Each page has a Facebook "Like" button on it. I've already implemented Facebook Open Graph API meta tags so that the pages are proper open graph objects, and when some other visiting Facebook user "likes" the registered user's page, a post appears on that Facebook user's wall saying they have liked the page. The Facebook Like widget also displays the number of "likes" that page has received as normal. So far, so good.
What I want to do is allow my registered users to be able to communicate back to the Facebook users who have liked their page. The community of "likers" for a page is a potentially valuable social media resource to the registered user, if only they could communicate back.
I am aware of the "admin page" link you get beside the Like button, which can be used to post to these people, but that is not an option for my registered users as they have no privileges in relation to the Like button.
What I want to do, if possible, is setup a form to capture the registered user's message back to the Facebook users, and then my website sends the message on their behalf, without having to ask for any extra privileges from the Facebook users.
The following Facebook documentation pages seem to say this is possible, but having followed the Open Graph API documentation, I can't get it to work as described - http://developers.facebook.com/blog/post/465/ and http://developers.facebook.com/docs/reference/api/ ("Publishing" subsection). I can get the access token correctly in the first request, and plug that into the second request to do the post, but that doesn't seem to do anything and doesn't return any error.
Since it doesn't work for me, I'm wondering if this is possible as described, or do I need to get some sort of extra permission to do this? I've seen reference to offline_access permission but as I'm new to this stuff I am not sure how it would fit in. If I have to get the Facebook users to grant permissions, this is not going to work as envisaged.
Any thoughts would be most helpful.
The short answer: No, You will never been able to post on someones wall as another user.
The long answer:
You could try to ask for offline access but then you are asking the user to hand over all their facebook data and give you access todo whatever you like their accound, so that is not likely to happend.
The next problem is that they have to be friends to be able to post on each others walls.
Thats why Pages was implemented, so that organisations could announce/talk with the people interested.
However if you have created the like button correctly and give the pages correct meta data, you are able to post to user who have liked it.
Scroll down to Publishing:
http://developers.facebook.com/docs/opengraph/
Just add a form for your user and let your system publish to the correct page, you probably will need a offline token from your own account or similar to use on the server.
Another more complex way could be to generate a facebook page for each page you have on your server.
When the user creates a page on your system a page is created on facebook but as your app as admin.
And when another user likes the page they like the facebook page, hence you have the possibility to post in that page and speak to the user who liked it. (whooa thats a mouthfull).