I can't read from group wall - facebook-graph-api

I can read users feeds or posts
https://developers.facebook.com/tools/explorer?method=GET&path=me%2Fposts
but when I try to reach a groups feed or posts, I can't. I added auth part but it returns empty JSON. From the groups I tried, one was closed and 2 other are open groups.
https://graph.facebook.com/228955270470492
The above returns this:
{
"id": "228955270470492",
...
"name": "ADI BİLİM",
"privacy": "OPEN",
...
}
Requesting this feed
https://graph.facebook.com/228955270470492/feed?access_token=AAACEdEose0cBAACgceqTZCBg0YA7MifDP02MKVXpZCipHJNHmHqK5OTzDvJaNke2JDxhOxKOTFl6bPOoZCZAdUZAQFFV6lD8GCMTxQHigUQZDZD
results in empty:
{
"data": [
]
}
What I am doing wrong?

This is working fine for me, is your access token for a user who's a member of the group?
If not, the group needs to have visiblity OPEN. You may also need user_groups permission for the user, but I'm guessing you already have that if you're accessing the user's list of groups

Even this group is public I need to auth app "read_stream" from extended permissions. Now I can see feeds :)

Related

Get proper usernames to populate on Superset with Azure SSO instead of ID string

I've finally gotten Azure Single Sign-On (SSO) connected to Apache Superset running via docker-compose, following the Flask docs. Users in my company's Azure group can create and access Superset accounts by logging in with Azure and they are assigned roles based on their identity. This is good.
The usernames they get assigned, however, are long Azure ID strings. These are undesirable in displays. Here's what my account looks like on the List Users screen and on my profile:
How can I modify either my Azure application SSO setup or my Superset config to have Superset populate usernames like SFirke for the account usernames, instead of values like 3ee660ff-a274 ... ?
The security part of my config.py looks like this, almost identical to the Flask template:
OAUTH_PROVIDERS = [
{
"name": "azure",
"icon": "fa-windows",
"token_key": "access_token",
"remote_app": {
"client_id": "CLIENT_ID",
"client_secret": "CLIENT_SECRET",
"api_base_url": "https://login.microsoftonline.com/TENANT_ID/oauth2",
"client_kwargs": {
"scope": "User.read name preferred_username email profile upn groups",
"resource": "RESOURCE_ID",
},
"request_token_url": None,
"access_token_url": "https://login.microsoftonline.com/TENANT_ID/oauth2/token",
"authorize_url": "https://login.microsoftonline.com/TENANT_ID/oauth2/authorize",
},
},
]
EDIT: Looks like the way to go is writing a custom userinfo retrieval method, there's a template on the Flask page linked above and an example used for Superset in this Github comment. I think I would use a line like "id": me["preferred_username"] or "id": me["upn"], based on the field names in the Microsoft docs.
But Microsoft notes that this value can change over time and should not be used for authorization changes. Since the oid value is immutable, and it is hardly visible to the typical user, I plan to just stick to it.

update display name of a member with GAM or admin sdk api

I would like to set or to modify display names of members subscribed to groups I'm managing (see attached picture).
I need to do that by Groups Migration API or GAM. But members object don't include that information!
I try to execute following command:
gam update group test-group add member user "Pippo Paperino" pippo.paperino#email.-it
this don't work. :-(
Does anybody knows how to do that?
{
"kind": "admin#directory#member",
"etag": "\"enlFCt4L0xxxzRNl5h_fsrc/PLoDCCsd1WkZFMzGD8Xvw7uzSCQ\"",
"id": "109503944206647999229",
"email": "pippo.paperino#email.it",
"role": "MEMBER",
"type": "USER",
"status": "ACTIVE",
"delivery_settings": "ALL_MAIL"
}
enter image description here
A member of a Group can be a user or another group.
If the member of the group is a user, the display name corresponds to the name the user has in the Google Account (the fullName, which is formed by concatenating the givenName and the familyName): check User resource . You cannot update the display name in Groups directly. If you want that display name to change, you would have to call Users.update in Admin SDK > Directory API, and provide a new user's familyName and givenName. But bear in mind that this will change the user's name everywhere, not just the display name in that group.
If the member of the group is another group, the display name corresponds to the name property in the Group resource. If you want to update that display name, you would have to call Groups.update and provide your desired display name. Of course, this will change the display name not just in that group, but everywhere.
Reference:
Members
Groups
Users
I hope this is of any help.

Facebook-marketing api - need access to type of creative format

I have a requirement in which I need to access the creative format type for each adCreative.
I explored the API and figured that this information is stored in Ad Creative Object Story Spec, however, I am not able to query this object.
This is the request I am making
https://graph.facebook.com/v2.11/<account_id>/adcreatives?fields=id,adset_id,name,creative,image_crops,object_story_id,image_url,image_hash,object_type,object_id,object__story_id,object_url&limit=500&access_token=<access_token>
This is not returning object_story_id and object_story_spec field only.
What am I missing here?
Thanks in advance.
Request those fields on the adcreative edge itself. ie your first call will return a list of adcreative ids.
{
"data": [
{
"id": "23842732907210427"
},
{
"id": "23842732907020427"
}]}
So you would call graph.facebook.com/23842732907210427?fields=object_story_id&access_token=USERACCESSTOKEN to retrieve the spec for that ad creative.
You can also nest queries so you may be able to retrieve the spec in a single call but I have been unsuccessful attempting this. https://developers.facebook.com/docs/graph-api/using-graph-api

Facebook graph api. how to list all pages that my app is subscribed to?

So I am aware of how to check each page to get a list of all subscribed apps.
But I would like to get a list of all pages my app has real time update subscriptions for?
so i have tried this
https://graph.facebook.com/v2.5/$app_id/subscriptions?access_token=$app_token
but this just brings back basic info on the app.
I would like a list of pages that it has subscriptions to already?
Can anyone help?
This doesn't look to be possible.
Endpoint you're using - https://developers.facebook.com/docs/graph-api/reference/v2.8/app/subscriptions - is to get list of application webhooks (callback_url and type of changes), which are called subscriptions for some reason. It's not about pages that subscribed to this webhook (or this app in general).
Overall, even in https://developers.facebook.com/apps/ for your app, under e.g. Messenger tab, you will only see subset of all pages that subscribed to this app. The visible subset is limited by your facebook user account permissions, presumably only show pages that you're either Admin or Editor.
Therefore, if such call would be possible, it would be somehow tied to User Access Token as well, not only app token.
You can do this here: https://developers.facebook.com/tools/explorer
Once logged, you can click on right button and select "Get User Access Token". You will need at least manage_pages or pages_show_list permission to accomplish this.
Now, all you have to do is call this endpoint: /me/accounts.
It should list all subscribed pages on your app.
Hope it helps.
As per
https://developers.facebook.com/docs/facebook-login/access-tokens/#apptokens
it is possible (graph api):
GET /oauth/access_token
?client_id={app-id}
&client_secret={app-secret}
&grant_type=client_credentials
And then /<app_id>/subscriptions
which returns something like:
{
"data": [
{
"object": "application",
"callback_url": "https:...",
"active": true,
"fields": [
{
"name": "ads_rules_engine",
"version": "v2.9"
}
]
},
{
"object": "page",
"callback_url": "https://...",
"active": true,
"fields": [
{
"name": "leadgen",
"version": "v2.5"
}
]
}
]
}

Understanding id returned by Facebook search

If in a web browser I enter:
https://graph.facebook.com/search?q=watermelon
the data returned begins:
{
"data": [
{
"id": "100000079215099_345415575486050",
"from": {
"name": "Synthia Stephen",
"id": "100000079215099"
},
My question relates to the id field. The value returned contains two numbers separated by an underscore character.
1) I believe the first number (100000079215099) is the id of a facebook user, is this always the case?
2) What does the second number (345415575486050) represent?
3) Once I have the full id (100000079215099_345415575486050) is it possible to use this id in another Facebook Graph API to retrieve the data associated with this id? If so, what would that url look like?
On facebook Evry user has ID and every event associated with it may be a status or photo also has an ID.
100000079215099_345415575486050
The first part of it represents the user id and second part represents the Event(Activity like a status or post) Id.
To Understand Better go to https://developers.facebook.com/graph-academy
Answers to your question:
1) First one will always be user id.
2) Mentioned above this is specific event related id. (Status or pic)
3) Yes, you can use this id everywhere in other APIs.
1) Yes the first number is the ID.
2) I'm not sure, I think it may be something to track where the view came from and who the viewer is. Perhaps an access token.
3) https://graph.facebook.com/100000079215099
https://graph.facebook.com/100000079215099_49874987249823749283
{
"error": {
"message": "(#803) Some of the aliases you requested do not exist: 100000079215099_49874987249823749283",
"type": "OAuthException"
}
}
https://graph.facebook.com/100000079215099_345415575486052
false
https://graph.facebook.com/100000079215099
returns her data, but I'm omitting it