I'm using the Facebook php sdk to try to get posts of a users wall.
When I use the following code I only get some reaction on events and some mentions, but but not the messages, photos's etc. I actually posted on my wall?
What can be the problem?
$result = $facebook->api('/me/feed/',array('access_token' => $facebook->access_token,'limit'=>100));
How are you authenticating and what permissions are you asking for in your access_token? If you aren't authenticating your user, you'll be limited to public posts only. You also need to make sure you request read_stream permission when you authenticate your user.
Related
All mutual friends request made from my app server (node) (also tried the Facebook API explorer) suddenly started returning an empty array for the data field. I confirmed and validated my access token and appsecret_proof on the API explorer. Do you know what has changed or what the request below is missing?
Note: both users use the app and have granted user_friends permission.
I am using v2.12
request
{
url: 'https://graph.facebook.com/v2.12/{user-facebookid}?fields=context.fields(all_mutual_friends.limit(5000))',
qs: {access_token: 'XXXXX'
,
appsecret_proof: crypto.createHmac('sha256', clientSecret).update(accessToken).digest('hex')
}
Yep. Facebook has taken down the Graph API for page access tokens. The only way to retrieve data (or was a week or so ago), was a temporary user token that lasts about 2 hours. It's totally broken my band's schedule page. I've been through every avenue and even spoke with a facebook ad team employee on the phone that was aware of it. She seemed to empathize but had no solution for me. I would count on it being down for a while.
I have finally figured out a work around for this. On your fb application, you have to disable the secret key requirement. This can be found under the advance settings of your fb application console. It's called "
Require App Secret".
Once you generate a fb PAGE access token, you get a fb page token, and then extend it.
here is the token debugger:
https://developers.facebook.com/tools/explorer/
You can extend the access token programmatically as explained here:
https://developers.facebook.com/docs/facebook-login/access-tokens/expiration-and-extension
AND
https://developers.facebook.com/docs/facebook-login/access-tokens/#pagetokens
There is also an extend tool in the access token debugger.
I'm making an application in angular 4. I get posts from a group in my app and I want people to comment on those posts. Problem is, you need a page access token but the api return an empty array!
https://graph.facebook.com/me/accounts?access_token={user_access_token}
I searched for days and looked through all the questions on stack but didn't find anything.
Keep in mind, it is for facebook workplace so the graph explorer doesn't work for this problem!
You have to give impersonate account permissions to your Workplace integration.
Then, you have to impersonate the account:
https://graph.facebook.com/{userId}?fields=impersonate_token
once you have the user token, you can use it to comment a post on behalf of the user. It is a POST call
https://graph.facebook.com/{postId}/comments
with in the payload
{
'message':'test'
}
I have a problem while getting the list of facebook fan pages using the graph api.
I am using:
https://graph.facebook.com/{userfacebookid}/accounts?access_token={access_token}&scope=manage_pages
But I am getting empty result like this:
{
"data": [
]
}
ONE: You should start by reading the authentication flow. Here's the Server-Side Authentication document
https://www.facebook.com/dialog/oauth?
client_id=YOUR_APP_ID
&redirect_url=YOUR_REDIRECT_URI
&scope=COMMA_SEPARATED_LIST_OF_PERMISSION_NAMES
&state=SOME_ARBITRARY_BUT_UNIQUE_STRING
Here you should ask for the manage_pages permission
TWO: Once you have the user access token with this permission you can retrieve the pages the user administer:
https://graph.facebook.com/{userfacebookid}/accounts?access_token={access_token}
THREE: This won't retrieve the pages the user is fan of!
I am also faced same problem while getting our pages(i.e., created by us) and i tried but at last i got the solution
While authentication time u have to pass permissions like below
https://graph.facebook.com/oauth/authorize?client_id=YOUR_APP_ID&redirect_url=YOUR_REDIRECT_URI&scope=manage_pages,user_subscriptions
Hi I'm developing management system for Facebook pages.
All Facebook pages are changed to sytle of timeline by the end of March, they will come to receive message from users.
So I want to add to read inbox of Facebook page, but I can't find how to read it by Graph API. ("/inbox" method is not worked with page access token.)
Please let me know how to do if you know.
Thanks,
Ogawa
I have suffered alot to find the correct url. It is totally different url compare to Profile messaging.
You can read the messages for a page by issuing an HTTP GET request to http://graph.facebook.com/PAGE_ID/conversations with a Page Access Token and read_mailbox permission.
Surprisingly you can reply for page messages also.
You can reply to a user's message by issuing an HTTP POST to http://graph.facebook.com/CONVERSATION_ID/messages
Note that a page can only reply to a user's message. It cannot initiate a private message with a user. Also, a page can respond not more than twice to a user's message before the user has replied back.
Hope that helps.
Graph api explore use this script after authenticating user, permission required
permission script:
$loginUrl = $facebook->getLoginUrl(array(
'scope'=>'email,read_mailbox,read_requests',
));
READ INBOX:
<?php
$user_mail=$facebook->api('/me?fields=id,name,inbox.limit(10)');
echo'<pre>',print_r($user_mail),'</pre>';
?>
I need to get the facebook friends email ids of a user providing his login email id and password. That is, if we enter the facebook login email id and password we need to get the friends from facebook. So far i was only able to get the examples which uses Api_Key and Api_Secret. Even the Graph api is using Access Token. Is there any way to access the friends using email id and password? Please help.
This is against Facebook's Terms of Service. Specifically policy I.2:
You must not include functionality that proxies, requests or collects
Facebook usernames or passwords.
Also, you would be required to use the Facebook API which does not provide access to friends email addresses.
You'll need to ask your users to authenticate using the Facebook API. You shouldn't be collecting email and passwords on behalf of users. However, if you ask for offline access, then when you do this, you can access the data any time.
Facebook uses oAuth, so you and your application will never see the password of the user that you are getting permission for. oAuth (used by Twitter and Google as well) requires a bit of a handshake to get authenticated, but once you do, you can get permission from the user to do whatever you want, as long as they accept.
Check out https://developers.facebook.com/docs/guides/web/#login for more on how Facebook does authentication.