Getting the privacy setting of a status message? - facebook-graph-api

Does anyone know if it's possible to query the privacy settings for status updates? I know you can get them for photo albums, but for my application it would be useful to be able to pull up a random status message from a while back and say "You shared this post with everyone, would you still do this today?" to see how people's attitudes to sharing online change.
I'm not after anything fancy, just "friends", "public" or "custom" would be great.
Cheers

If it's a user's own status updates (i.e the person who's using your app) this is easily obtained, there's a privacy field on the Post objects, and example from my /feed connection is:
"privacy": {
"description": "Friends; Except: Restricted",
"value": "CUSTOM",
"friends": "ALL_FRIENDS",
"deny": "< ID of my restricted list >"
}
If it's on a friend of the current user's wall i'm not sure if/how to retrieve the same data

Related

Can't recover details from a Instagram Post recovered via Hashtag Search - error_subcode 33

I'm trying to retrieve updated info about some Instagram Posts, recovered via Hashtag Search.
When I request the data of any of them, e.g. https://graph.facebook.com/v11.0/{ig-media-id}, I receive an error:
{
"error": {
"message": "Unsupported get request. Object with ID 'xxxxxxxxxxxxxx' does not exist,
cannot be loaded due to missing permissions, or does not support this operation.
Please read the Graph API documentation at
https://developers.facebook.com/docs/graph-
api",
"type": "GraphMethodException",
"code": 100,
"error_subcode": 33,
"fbtrace_id": "xxxxxxxxxxxxx"
}
}
I know that there are some restrictions for posts recovered via hashtag search, as privacy of the post owner. But the Id that is returned with each of the posts seems "fake", or have a completely different role in this case.
If I try to recover the posts of my Business Account, I can use the Ids associated with the medias returned normally in the request above, and the details are returned.
So my questions are: what is the Id in a Instagram Media returned from Graph API' Instagram Hashtag search, if not the Media Id itself? And how can I get recent versions of the post with this Id? I need it to update the media_url property, when it expires.
Thanks in advance!
Having the same issue. I think it is because you basically can not get information about posts found using hashtag search. They are anonymized.

How can I add contact by Account ID with Google People API?

I have a bunch of people I would like to add as Google Contact.
For each of them, I have the google account ID.
I would like to use Google People API, but so far I've failed.
Here's what I've tried :
-provide Google Id as ResourceName (pre-formating people/id). I got a 400 error with message : "Request person should not have a resource name."
-provide Google Id as a metadata, formating it properly in sources[0].id. I also got a 400 error with message : "Request contains an invalid argument."
I'm kinda stuck here, does anyone have an idea ? Thanks a lot !
I also wanted to add contacts using the people API, based on the directory profile. I got this working by using the following body:
body = {
"names": [{"familyName": "Doe"}],
"emailAddresses": [
{"metadata": {"primary": True}, "value": "doe#domain.com"}
],
}
The contact was added and when I compared the contact with another contact that I created manually based on the directory, the properties were the same.
My conclusion is that, by adding the G Suite primary address, Google will figure it out on its own.

How do we can get story insights of Instagram with graph api?

I want to get Instagram stories insights which published in the last 24 hours. I currently only access to story basic details alike, story image, owner id, etc with this api:
https://graph.facebook.com/story_id/?fields=id,media_type,media_url,owner,timestamp,caption&access_token={access_token}
Actually i want to get all details which is that: exits,impressions,reach,replies,taps_forward,taps_back
but when I try this with this api:
https://graph.facebook.com/story_id/insights?metric=exits,impressions,reach,replies,taps_forward,taps_back&access_token={access_token}
it show me that error. always.
{
"error": {
"message": "(#10) Not enough viewers for the media to show insights",
"type": "OAuthException",
"code": 10,
"fbtrace_id": "AvZdhqaXB1_Dij7B1DD-pSR"
}
}
even that on reference of graph api they tell us do same like :
Reference: https://developers.facebook.com/docs/instagram-api/reference/media/insights#create
I dont know how to fill butt it shows me error always
https://i.stack.imgur.com/55rBy.png
You need to set up a webhook for it:
https://developers.facebook.com/docs/instagram-api/guides/webhooks/
https://developers.facebook.com/docs/graph-api/webhooks/getting-started
Your webhook URL will get the insights of a story (or media object, to be specific) right when it disappears, with a POST request from Instagram.
Careful though, you cannot access the story details anymore if you get the webhook, so you have to get the stories when they exist (for example, with a cron job that runs at least every 23h to get all stories) and add the insights data later by matching the media id.

Facebook Reach Estimate - not suficient permissions

I am trying to follow an example on Reach Estimate in facebook API documentation here. However I am getting an error:
{
"error": {
"message": "(#10) You do not have sufficient permissions to perform this action",
"type": "OAuthException",
"code": 10
}
}
My approach is to open https://developers.facebook.com/tools/explorer, generate a token giving all permissions including ads_management.
And perform call:
act_ID/reachestimate?currency=EUR&targeting_spec={'countries':['US']}
Where I obtain ad account ID by going to my ads manager and reading it off URL (or by visiting power editor).
It looks simple, but I have no idea at this point what I am missing, I am also getting the same error while using PHP API.
All ideas are much appreciated. Thank you.
If you are using your own app to generate the access token, you are likely on the Standard or Basic tier of the Marketing API. For these tiers, you need to specify each AdAccount you are going to use.
In the developer too, select your app and go to Apps > Settings > Advanced. Under "Advertising Accounts" click the "Ads API" button on the right hand side, and list all the accounts you want to use.
For more info, see:
https://developers.facebook.com/docs/marketing-api/access#standard_accounts

why does posting to facebook page yield "user hasn't authorized the application"

I have read the fb docs and written code to publish a message to a facebook "page", however I am getting an error that I don't expect to see:
(#200) The user hasn't authorized the application to perform this action
Here's what I've done:
I set up a facebook application, which provides my APP_ID and
APP_SECRET.
I set up a test facebook "page". Let us refer to its fb id as PAGE_ID.
Used OAuth to get a USER_ACCESS_TOKEN with scope "publish_actions,manage_pages" for the user. I accepted the permissions requested by my app when redirected to the facebook auth page.
I did a GET on https://graph.facebook.com/me/accounts using the USER_ACCESS_TOKEN, and I get back a list of pages I administrate, including the one I want to post to.
This block of data for my page looks like:
{
"data": [
{
"category": "Community",
"name": "My Generic Test Page",
"access_token": PAGE_ACCESS_TOKEN,
"id": PAGE_ID,
"perms": [
"ADMINISTER",
"EDIT_PROFILE",
"CREATE_CONTENT",
"MODERATE_CONTENT",
"CREATE_ADS",
"BASIC_ADMIN"
]
},
....
]
}
Then I use the PAGE_ACCESS_TOKEN to post a message to the page:
I did a POST on https://graph.facebook.com/PAGE_ID/feed with a field message equal to This is a test post.
Facebook returns:
{
"error": {
"message": "(#200) The user hasn't authorized the application to perform this action",
"type": "OAuthException",
"code": 200
}
}
Using the token debugger, I can confirm that my PAGE_ACCESS_TOKEN is valid, and has scopes: manage_pages and publish_actions.
Where am I missing authorizing the application? Do I need additional scopes? Did I miss clicking something on the facebook authorization screen? Is there a setting on the app I am missing? After days of debugging this, I must be blind to the problem. :-|
You should add permission called status_update, for example
https://www.facebook.com/dialog/permissions.request?_path=permissions.request&app_id=145634995501895&redirect_uri=https%3A%2F%2Fwww.facebook.com%2Fconnect%2Flogin_success.html%3Fdisplay%3Dpage&response_type=token&fbconnect=1&perms=status_update&from_login=1&m_sess=1&rcount=1
and i'm able post to page i liked with the access token i get just now:
If you want to post as the admin of the page, you're require both manage_pages and status_update permissions, for example
https://www.facebook.com/dialog/permissions.request?_path=permissions.request&app_id=145634995501895&redirect_uri=https%3A%2F%2Fwww.facebook.com%2Fconnect%2Flogin_success.html%3Fdisplay%3Dpage&response_type=token&fbconnect=1&perms=manage_pages%2Cstatus_update&from_login=1&m_sess=1&rcount=1
Cheers
status_update is not used anymore. To publish on pages, I had to use both manage_pages and publish_pages.
Well, this seems to be a common mistake that most of us make while trying to do an activity in social netwroks. Before trying to put up an open graph action,You need to set the permissions in your initial authorization request . By default you only gain 'read-only' access to their basic information.
Settintg up permisson at teh time of authetication is a must for Facebook and LinkedIn APIs..
See the public_actions section in Facebook open graph permissions here and make relevant changes in the authorization code , and get your issue solved.
I found the best way to get a valid token and check permissions was via the Graph API Explorer BUT while Facebook's documentation is extensive it is not always the easiest to follow.
In the explorer you have to look at both:
The Application Currently at the top and quite subtle, I missed this for ages.
Get Token Dropdown What you click to get a Token, when you click the arrow you can choose pages and other items you have access to for selecting a token for.