access page's notes via app token - facebook

according to fb's documentation (https://developers.facebook.com/docs/reference/api/page/) i don't need a user_access_token to retrieve the notes of a public page, an app_access_token should be enough. however, when i sent request like https://graph.facebook.com/starbucks/notes?access_token=my_app_token, i got the reply that a user access token is required.
my questions are:
did i misinterpret the documentation?
anyone else has the same problem?
anything i can do about it?
thanks!

Indeed there's something wrong in the notes connection. I honestly don't think that there's a wrong info in the documentation (but a bug in this specific connection).
I see a reported bug about this issue (reported by you?), but with a funny response from Facebook! Obviously the guy is just copy/pasting this "standard" official response and closing bugs randomly!
EVERYONE READING THIS DO THE FOLLOWING:
Create a public page (or use an existing one)
If the Notes app is not added to your page, Edit Page -> Apps -> Locate the Notes app and Edit Settings -> Add tab
Now add a test note
Go to the Graph API Explorer
Choose one of your apps and GET the page's notes to see the current note: /page_id/notes
Go the to the Access Token Tool, copy that app access_token and replace the one in the explorer with it
Result:
{
"error": {
"message": "A user access token is required to request this resource.",
"type": "OAuthException"
}
}
If this was reproducible, then subscribe to the bug and confirm by clicking on "Yes" for the reproducible question.

Access to certain Pages may be restricted based on demographic information such as the current user's age or location. Access may
also be restricted to only a Page's administrators.
Based upon your findings above, as well as this quote from the documentation link you shared above, this tells me that maybe Starbucks is only allowing their page admins access to the notes connection of their page.
Try creating a page yourself, play around with the various settings and see what is available with and without tokens. Shouldn't take you too much time.

Related

Using m.me links with ref param

I'm trying to deeplink users into my facebook messenger bot, and I need to pass some data in at the same time. Supposedly this can be done by using m.me links, along with a query param.
My bot's page is https://www.facebook.com/Willy-1610141399078870/
The m.me url would be something like this. https://m.me/Willy-1610141399078870?ref=somedatagoeshere
The m.me link works to a degree on desktop, but the data isn't passed to the bot. I don't particularly need it to work on desktop.
However, when I try to open that link on ios or android, I get an error message.
Android
This user name doesn't exist. Try another code or link
iOS
Username was not found
The bot hasn't been published yet, so it won't be visible to anyone else. I need to be able to test this functionality before I publish, so I hope that's not what is causing the failure.
Has anyone else been able to use this feature?
It seems that the facebook-generated username can't be used for m.me links. It requires you to register an explicit username.
My page's generated name was Willy-1610141399078870, so https://m.me/Willy-1610141399078870 wasn't a valid url.
To register a username for your page, go to your page > About > Create Page #username.
Then, you can attempt to pick a username that isn't already taken. Somehow, #willy-the-test-page is already taken (?), so I got this incredibly confusing error message:
Taking the error message at face value, I decided to create another page and try again. This time, realizing that the message didn't mean what it said. Picking an available username clears the error message, and allows registration.
Just kidding! It will tell you again that the page isn't eligible.
The solution was to create a totally new page, and go through the #username creation flow again. It worked for me on the second attempt.
It's rumored that a page needs at least 25 likes to become eligible for an #username, but this isn't true in all cases.

ColdFusion - OAuthException - This authorization code has expired. [code=100]

I am having a go at trying to get the Facebook API SDK for ColdFusion working.
https://github.com/affinitiz/facebook-cf-sdk
I have followed all the steps and it seems to work well (using only server-side login).
However, if I leave the page for say, an hour, when I return and refresh the page (which was showing my profile name and friends list) it shows up with an error that I am unable to get rid of, unless I clear the cookies.
Is there something I am missing with this FB login? Am I meant to be checking against something manually in order to persist the session?
Looking at my cookies, I have the following stored:
fbm_155030275875
fbsr_155030275875
CFID
CFTOKEN
It's all new to me, so I'm a bit lost. I can't see anything in the docs for the SDK about this and Googling the error brings nothing.
I have attached a screenshot of the error.
I'd appreciate any help you can offer!
Thanks,
Michael.
I'm not familiar enough with that particular project, but in general, your code should be requesting the various Graph API calls, and requesting the token as necessary. If the token has expired, you request a new one. I'd expect the facebook-cf-sdk product to do this, but again, I'm unfamiliar with it.
Good news is, the Facebook Graph API is just a series of HTTP calls. See my talk at NC DevCon for an example of logging in and making some graph calls: (a bit long; go to about the 1:42:00 mark)
http://textiles.online.ncsu.edu/online/Play/61d0900d63fd4c1cb862622d1c8e13521d?catalog=35211b84-031b-4a18-8875-506f09b9b3a7
GitHub repo:
https://github.com/bdcravens/ncdevcon2012-handson-auth (note the branches - check out the step4 branch)
These don't answer your question 100%, but they may be a good starting point for you.
Ok, I figured out how to solve this issue using a solution someone provided on Github. I just wanted to post this here in case someone else encountered the issue and wasn't sure how to solve it. In my case however, after I applied the solution from that post was I need to do a page refresh. Link below.
https://github.com/affinitiz/facebook-cf-sdk/issues/31

Is there ANY way to remove photo tags with facebook API?

There are some old posts related to this topic but the API has since changed, so I wanted to ask again. Is there any way to remove photo tags with the Facebook API?
I saw this documentation about deleting photo tags with the graph API.
https://developers.facebook.com/docs/reference/api/photo/#tags
You can delete a tag for a particular user in the photo by issuing a HTTP DELETE request to /PHOTO_ID/tags/USER_ID or PHOTO_ID/tags?to=USER_ID.
Deleting a tag on a photo requires the publish_stream permission and supports the following parameters.
Parameter Description Type Required
to USER_ID of the User to tag; can also be string yes
provided in URL path (see above).
If the deletion is successful, you get the following return.
Description Type
If the deletion succeeded boolean
It did not work when I tried it. Instead, I always get the following error:
{
"error": {
"message": "(#3) Application does not have the capability to make this API call.",
"type": "OAuthException",
"code": 3
}
}
I submitted a bug report to Facebook and they seemed to acknowledge a bug by putting it into "triaged" status. Then a few weeks later, although several other developers had subscribed to the bug report, they closed the case with this explanation:
We are prioritizing bugs based on impact to the developer community. As this bug report has not received much attention from other developers, we are closing it so as to better focus on the top issues. There is a good chance your issue is due to an implementation problem in which case you can try to find help on Stack Overflow.
The bug report is here: https://developers.facebook.com/bugs/122135101317762
Can anyone help me figure out how to untag via the API? My app is currently written as a Web app, not as a mobile one.
Thank you in advance for any help on this.
Update: As Christopher Blizzard explains in the accepted answer, this isn't in fact a bug, but intentional behaviour that was previously badly documented.
Before this was known, back when this answer was first posted, I investigated a little to try and figure out if there was any way around this restriction. The answer is no. I've left the detail of my findings below in case they are of interest to anybody in the future, but Christopher Blizzard's input makes most of this obsolete.
I'm reasonably confident that the answer is no, there's no way at all. I've exhausted all possible lines of investigation I can think of, and come up blank. Let me list my findings:
1) The bug affects both ways of deleting photo tags listed in the documentation.
Sending a delete request to https://graph.facebook.com/PHOTO_ID/tags/USER_ID/ and sending one to https://graph.facebook.com/PHOTO_ID/tags?to=USER_ID should both work, according to the documentation. However, in reality, both approaches fail with the following error, as you've already observed:
{
"error": {
"message": "(#3) Application does not have the capability to make this API call.",
"type": "OAuthException",
"code": 3
}
}
2) It's got nothing to do with your app's permissions
Using Graph Explorer you can easily test this stuff out using an access token that grants you all possible permissions, and deleting tags still fails.
3) It's got nothing to do with the user's privacy settings
I tried creating a new user on Facebook and setting every single privacy setting in the settings menu to the most lenient option available. It made no difference.
4) It's not to do with the photo's owner or how the original tag was created
Even when the person whose access token you're using owns the photo that the tag is on and created the tag themselves, you still get the same error when trying to delete the tag. This applies whether they created the photo and tag through the normal Facebook user interface, or with your app through the Graph API.
5) There's no workaround using APIs other than Graph
FQL only allows data retrieval, not insertion, modification or deletion. Open Graph has no methods relating to photos or photo tags. The deprecated REST API - which is still functional, but which Facebook instructs us not to use, and whose documentation has been taken down - has functioning methods for getting and adding tags, but none for deleting them, as you can see in a a cached version of the documentation, via the Wayback Machine.
6) There doesn't seem to be any way to delete a tag using POST requests.
You can change the location of an existing tag, but that's it. Specifying an invalid location throws an error and doesn't affect the existing tag. Specifying the to field twice in a post request to try and change the target of a tag throws an error and has no effect.
7) Others have tried to solve the same problem before, and they have not succeeded.
I haven't found many posts about this issue, but there are these two, neither of which are helpful:
Delete photo tag from Graph API
http://queforum.com/facebook-applications/78655-facebook-untag-user-photo-via-facebook-graph-api.html
After testing all the points above, I'm out of ideas. Of course, there's no way I can say with certainty that this is impossible - we don't know what's going on on Facebook's back end or why the bug exists. I think these tests represent a pretty thorough examination of the problem, though, and they haven't revealed any solution.
I just updated the documentation on developers.facebook.com, but the short version is that the delete tag API is whitelisted only for certain apps.

Facebook Graph Api - Adding new Tab to Page not working

In the Facebook graph api explorer I am trying to add a new Tab to a fanpage according to the documentation.
So I make a POST to /pageId/tabs with the field app_id and my app's ID as value using the page access token I got when querying userId/accounts. The access token includes the manage_pages permission.
I get the result true which is supposed to mean, the create was successful. But if I run a GET on pageId/tabs the newly created tab is nowhere to be found.
Am I missing something? Shouldn't it have created the Tab if it says "true"? Has anyone done this and can tell me how it worked for you?
Thanks!
I created a specific bug report
And this one seems to be related
Wow, so this is a perfect example of how important a meaningful error message or in this case ANY error message at all is.. Dear Facebook API developers, please get your act together, this is just one of many examples of inconsistency!
What the error message should have told me is "This app is not designed to be added as a tab" (As btw is the error message when trying to add it with
http://www.facebook.com/dialog/pagetab?app_id=YOUR_APP_ID&next=YOUR_URL
Because when I set the app settings to "tab" instead of "app on facebook", everything works fine! Sigh! Admittedly I could have done this right initially but who is infallible?!
The Graph API call simply should not return true if the request fails!

How do I transfer Comments from one Facebook App ID to Another?

Is there any way to transfer comments from a "deleted" Facebook app (that is still receiving comments) to a new app id? The app was deleted by accident quite some time ago but we now have thousands of comments that have been entered using it. I'm afraid I will lose all of the comments if I simply switch to a new app. The app id seems to function just fine with the commenting mechanism, but I can't manage it or use it in any other way.
AFAIK, there is no automated way of doing this. However, you can read them programatically from your deleted app (provided you have the permissions) and then post it again on your new app.
You can get the original app's feed using the following (PHP) code:
$response=file_get_contents("https://graph.facebook.com/".$id."/feed&access_token=".$facebook_access_token);
$response_array=json_decode($response,true);
// $id: ID of the page where the comments are
You can also customize this query by adding pagination parameters like since,limit,until etc. Please refer to https://developers.facebook.com/docs/reference/api/ for documentation.
And can be reposted to your app by HTTP POSTing to the same URL. See https://developers.facebook.com/docs/reference/api/page/#posts for details.
Please understand that you can't post as the original author - so you can only post the text and perhaps manually add the context of the original author. so i.e:
"Shreeni: 'This is a cool app' "
will have to become
"App: 'Shreeni said: 'This is a cool app' ' "