I am using graph api.
Two facebook accounts who are friends.
First guy posts( id of post be : postid1) and is visible to second guy. Secondy guy likes(suceeds).
Now when second guy tries to unlike what he liked before facebook throws me the below error.
{
"error":{
"message":"(#200) Feed story publishing to other users is disabled for this application",
"type":"OAuthException",
"code":200
}
}
I am making the below http request for unlike
Delete https://graph.facebook.com:443/postid1/likes?access_token=abc
Can some one point me what's the mistake I am doing.
Related
I have an element on my website which shows facebook posts from a page and the amount of views/likes/comments. This stopped working all of a sudden and I have no idea why.
If I make the request with the graph api tester tool I get:
{
"error": {
"message": "An unknown error has occurred.",
"type": "OAuthException",
"code": 1,
"fbtrace_id": "CIHVxFhXIv/"
}
}
This is the request link I use with file_get_contents:
https://graph.facebook.com/v3.0/idofmypage/posts?fields=comments,full_picture,likes,message,picture,story,permalink_url,updated_time,from,insights.metric(post_impressions)&access_token=myaccesstoken
Did something change again with permissions or maybe a field is deprecated?
According to this fb new the Pages API and others have changed, and now you can only access the data if it's a page of your own.
Pages API: Until today, any app could use the Pages API to read posts or comments from any Page. This let developers create tools for Page owners to help them do things like schedule posts and reply to comments or messages. But it also let apps access more data than necessary. We want to make sure Page information is only available to apps providing useful services to our community. So starting today, all future access to the Pages API will need to be approved by Facebook.
Today I've started a project wich, in the begging, I need to recollect data and that's what I've found about it..
I am trying to make bot using facebook messenger api. My bot is working perfectly for direct messages. Now i want to add a feature called comment bot. Like when someone comments on my page post. I would like my bot to reply to the person. I added a webhook url for feeds. When some one comments in a post i get a respone similar to the following:
{"changes":[{"field":"feed","value":{"item":"comment","sender_name":"6sense","comment_id":"127569201201434_137925500165804","sender_id":126557694635918,"post_id":"126557694635918_127569201201434","verb":"add","parent_id":"12655769463
5918_127569201201434","created_time":1507031347,"message":".."}}],"id":"126557694635918","time":1507031349}
Now from that webhook, i am trying to reply back to user using the sender_id. But i am getting a long error which is in short
{ error:
{ message: '(#100) No matching user found',
type: 'OAuthException',
code: 100,
error_subcode: 2018001,
fbtrace_id: 'EmEDxfdcnyF' } } }
I saw some sites implementing this feature. So i guess its possible. But i am not sure why its not working. I am using the same app for this.
Try private_replies API with comment_id to send private replies to user.
To use this API you need read_page_mailboxes permission.
I am trying to fetch a Facebook page's events. I have before, but it doesnt work any more. I used this scriptto fetch the events.
$string = file_get_contents("https://graph.facebook.com/?$pageids&fields=events.limit($fblimit)&access_token=$token&method=GET");
$json_a=json_decode($string,true);
$pageids was a lot of different facebook ids (id1,id2,id2 ...)
I get this error message:
{
"error": {
"message": "(#100) Unknown fields: events.",
"type": "OAuthException",
"code": 100
}
}
Does anyone know what is wrong with my script? Is there a another way to fetch Facebook events?
The actual URL to get a page's events is something like this :
https://graph.facebook.com/PAGE_ID/events
I'm not sure how old the code is that you are fixing, but this is the correct method as stated in the documentation. events is a connection of the page object.
Reference: https://developers.facebook.com/docs/reference/api/page/#connections
Facebook has had restricted access of Events in API recently.
You have to do app review to have access to Pages API, Events API.
Please check section "Apps that Require App Review, Business Verification, and Supplemental Terms" of this url: https://developers.facebook.com/docs/apps/review
I created and APP on the Facebook.
Now I am trying to post a comment on the user's timeline using the Graph API but I cannot undestand what I need to do.
I already authorized the Application (I authorized this permissions: 'user_status,publish_stream,user_photos,email').
If I look on my profile -> privacy I can see that the APP can:
This app can: Post on your behalf
This app may post on your behalf, including status updates, photos and more.
Last data access:
Basic InformationToday
See details ยท Learn more
Posts on your behalf:
Who can see posts this app makes for you on your Facebook timeline?
Public
Notifications:
When to notify you?
The app sends you a notification
So this part seems OK.
On my application I do the following to try to post somenthing on my timeline (I need to post it when I am off line).
1) GET : https://graph.facebook.com/oauth/access_token?client_id=APPID&client_secret=*APP_SECRET*&grant_type=client_credentials
RESPONSE:
access_token = 422828347771671|UdQELQIf0N7krF4JUo7VwtPLTkk
2) GET: https://graph.facebook.com/search?q=myemail&type=user
RESPONSE:
_"error":_{
______"message":_"A_user_access_token_is_required_to_request_this_resource_",
______"type":_"OAuthException",
______"code":_102
___}
But reading the documentation (https://developers.facebook.com/docs/reference/api/#searching) it seems that this request does not need any kind of access token.
I also tried to add the access token, but the result is still the same.
3) I know my facebookid so I tried to use it directly:
POST: https://graph.facebook.com/100001139132403/feed
ARGUMENT:
access_token=422828347771671|UdQELQIf0N7krF4JUo7VwtPLTkk,
message=Hello
RESPONSE:
"error": {
"message": "(#200) This API call requires a valid app_id.",
"type": "OAuthException",
"code": 200
}
}
So I tried to add client_id=APPID and app_id=APPID, I tried to put one, the other and also both arguments as GET or POST but nothing changed.
I checked the APPId ad it is correct.
Do someone have any idea?
Thank you!
You cant simply generate a user access_token by querying to a URL. What you did gives the App access token and as the error say, you are trying to do something, that needs user access_token.
Refer and implement this : https://developers.facebook.com/docs/howtos/login/server-side-login/
And use that access_token for the rest of the processes.
I'm making a simple Facebook app that posts updates to the user's timeline using node.js and Facebook's Open Graph API. Even though I can see the posts I make using the OG API on my timeline (and it has the globe icon identifying that it's a public post, see pic below), none in my FB friend network can see it.
Here's a screenie of a public post I made via OG API showing up on my timeline, along with a post from a 3rd party app (Pool practice) for comparison:
Now here's the screenie of my friend's timeline showing only the Pool Practice post, the post from my app is nowhere to be seen...
I've checked the app settings and permissions as well as the OG API options, but haven't seen anything that points to how I can solve this problem. Here's the node.js code I'm using to post the updates:
// app permissions set to 'publish_actions' and 'publish_stream'
// I do the auth dance here to get the access_token and store it in session as fb_token
var request = require( 'superagent' ); // module from TJ Holowaychuk similar to "request"
request
.post( 'https://graph.facebook.com/me/feed?access_token=' + req.session.fb_token )
.send( { message: 'posting via node.js' } )
.set( 'Content-Type', 'application/x-www-form-urlencoded' )
.end( function( response ) {
log( response );
});
The code above works and the post shows up on my timeline, but no one else is able to see it.
Anyone know a way out of this?
you need to submit each action for Facebook validation before your friends can view it. Only users defined as developpers for the app are allowed to view those timeline messages.