where is the “Recently Used”,“In Active Adverts”, "Action Needed", "Shared" filtering based from facebook custom audience data? - facebook

If you go to business manager of facebook, then go to the "All Audiences", then under the "Audiences" tab, you will see a "Filters" button right beside the "Create Audience" button. Now my question is, which part the json data being provided by the facebook apis should I based the data that I should pull out based from these filters ?
- Recently Used
- In Active Adverts
- Action Needed
- Shared
Because unlike the "ready" and "not ready" status, those four filters that I mentioned are not straight forward where I can just look for the numbers from the returned json data. so how ?

Most likely, not all of this information is available through the API.
However, if you take a look at the following doc, you can see some reelvant fields that may help:
https://developers.facebook.com/docs/marketing-api/reference/custom-audience
Most likely you can use the field operation_status to look at whether an audience needs action.
For whether it's shared, take a look ad the edge adaccounts which will let you see the ad accounts this audience has been shared with.
For recently used, you'll probably have to look at the edge ads and review the status of the ads.
To save having to make multiple requests, you can take a look at field expansion in the Graph API, which will let you query for fields of objects in results using a single request:
https://developers.facebook.com/docs/graph-api/using-graph-api#fieldexpansion

Related

Google Calendar REST API does not return title and other event fields

Google calendar REST API GET method (https://developers.google.com/calendar/v3/reference/events/get) should return this structure (https://developers.google.com/calendar/v3/reference/events#resource), unless I'm missing something.
I need to get event title and description to use in my application. I 'm getting below response instead.
I've tried to change event visibility (public/private) and availability (free/busy). Actually, API does not show events with Free availability, for which I don't have solution either.
Here is event edit screen screenshot:
https://www.screencast.com/t/X8bRS8kJDT
{
"kind":"calendar#event",
"etag":"\"3145149995624000\"",
"id":"5fnlvcl2msab46p8roqbahhb6g",
"status":"confirmed",
"htmlLink":"https://www.google.com/calendar/event?eid=NWZubHZjbDJtc2FiNDZwOHJvcWJhaGhiNmcgZWQtYWRtaW4uY29tXzMwOHNycjdzdjdiM28xazRpdjZ2cm9mb3Y0QGc",
"updated":"2019-11-01T02:23:17.812Z",
"start":{
"dateTime":"2019-11-11T09:30:00+11:00"
},
"end":{
"dateTime":"2019-11-11T10:00:00+11:00"
},
"visibility":"private",
"iCalUID":"5fnlvcl2msab46p8roqbahhb6g#google.com"
}
Are there other methods to get calendar events details with REST API, including ones with free availability?
Thanks.
04/02/2020:
I actually made it work for "ordinary" Google account - add project, add API, add service account and allocate service account email to the calendar. But I still not sure how to change access level for G Suite account. It allows only to see Free/Busy status.
I've changed default access in Admin Console as this article suggests, but it does not help:
https://www.macworld.com/article/2980005/the-mystery-of-the-unsharable-google-apps-calendar.html
You could try specifying the fields you want to retrieve like the image below:
Or you could put a " * " as the image below to retrieve all values:
fields is a standard Query parameter, which specifies what values you want to include in your response. To learn more about it, you can check Here.

building a list in "actions on google"

I'm doing a project where the Google Assistant generates a list of cards about information on research articles. Each card on the list would have the title and URL to the research article. The Google Assistant would ask what subject you wants to research about and the user would reply with the subject matter in one or two words. I have the following questions
I understand that the app.buildList() command requires an alias and key variable. Could I level them as blank or null in my code because I don't think I need them
If the user clicks on the URL in a card, will the browser automatically open the link? I remember reading that Google must filter and approve URLs in Google assistant apps
Any help would be appreciated
You should probably populate the relevant fields for each API call in order to handle various types of user inputs. The key is used to identify the item that is being said. If a list is shown, you will need to use the key to identify which is clicked. The user may click on the list item to select it. However, they could also say the thing they want. That is where the aliases are useful.
Let's say you were grabbing a list of scholarly articles. While long articles may not lend themselves well to voice, it could be designed like:
function list () {
const app = new DialogflowApp({request, response});
app.askWithList('Alright! Here are some articles about memristors! Which do you want?',
// Build a list
app.buildList('Memristor Research')
// Add the first item to the list
.addItems(app.buildOptionItem('TITLE_OF_FIRST_PAPER',
['title of first paper', 'first'])
.setTitle('Title of First Paper')
.setDescription('S. Smith, Ph. D')
// Add the second item to the list
.addItems(app.buildOptionItem('TITLE_OF_SECOND_PAPER',
['title of second paper', 'second'])
.setTitle('Title of Second Paper')
.setDescription('H. Paul, Ph. D')
)
);
}
In this snippet, if I say I want the first article, it will give me that one without me having to give the full title while still keeping the interaction hands-free. The key will let me identify the article that should be read.
You can use the title of the paper or perhaps the link URL in order to handle it and present a card with more information including the URL.
You do not need to have each URL manually approved. The documentation states:
Links to sites outside the developer's domain are allowed.
Link text cannot be misleading. This is checked in the approval process.
As long as you are being straightforward about it, users will be able to directly open the paper in a browser by clicking on the link in the card.
More information is available in the documentation
You can create list in action on google should have minimum of two values and maximum of 30 values.
For sample code here :
https://developers.google.com/actions/assistant/responses#sample_code_2

Why is the Graph API for querying a group URL simply returning the group ID?

When I GET /{group-id}?fields=link I get just get back {group-id}, rather than a full URL like in the case of /{album-id}?fields=link, /{photo-id}?fields=link, etc. Sample request and response for a group:
GET /v2.5/1685218945065439?fields=link
{
"id": "1685218945065439"
}
whereas an album looks like this:
GET /v2.5/1685219628398704?fields=link
{
"link": "https://www.facebook.com/media/set/?set=oa.1685219628398704&type=1",
"id": "1685219628398704"
}
According to the docs link is a valid field on the Group object. I'm using a token that has user_managed_groups. I see the same result when querying OPEN and CLOSED groups.
Just looking at the URLs of my groups by loading them in my web browser, I see that they all use the format https://www.facebook.com/groups/{group-id}/, so it's easy enough to build a URL from the {group-id}, but is that URL format something I can actually count on?
Using Graph API v2.5.
This is a field that is kept around for historical reasons. Back in the day you were able to actually set a website for a group, for example https://example.com.
This functionality has since been removed from the UI on facebook.com but the field in the API is present as older groups might have this value set, but newer groups won't have it anymore.
There has been a bug report about this as well which has been closed as 'By Design' for the reasons mentioned above https://developers.facebook.com/bugs/1495489670770155/
I filed a bug report to which the Facebook team responded that this is the intended behavior (also noted by Bjorn in his answer). See Bjorn's answer for more details.
The good news is that, according to the Facebook dev on that bug report, the format of the Group URL will always be https://www.facebook.com/groups/GROUP_ID, so there's really no need to query the API for the Group URL anyways.

Facebook Marketing API some field are not shown

I have a development level access to Marketing API and it looks like I cannot read some fields of specific objects.
For example I try the following call:
You can see that promoted_object, link_url and object_url are not displayed in the result. And I should have one of those three value as the Ads was ad to promote "web site click".
Is it a bug or a limitation of the development acces or I am doing something wrong?
It is true that not all fields are readable by all apps, however in the case above it is most likely that these fields are empty on that object and therefore not returned in the response.
Promoted object, for example, is required on the adset level now, however it may be the case the adset you are trying to read is very old and therefore does not have one specified.
In regards to the creative fields, again not all creatives have these fields and in the case they are empty, are not returned in the response. You should check the promoted_story_id to see if this contains what you're looking for.

OpenGraph: how can i specify a filter in FB.api?

I have built a Facebook app using OpenGraph that permits the users to write reviews on concerts, so that I've defined a concert_id attribute on which the user can insert a review.
Now I would like to show all the reviews inserted for a certain concert_id but cannot find a way. If I do (in JS)
FB.api('/me/MY_APP:action', { limit: 0}, function(response) {
console.log(response);
});
I get all items. This app has to be consumed by mobile, I think it is bad to get all items and, then, filtering only the concert_id i need. What do I have to do to apply a where condition in OpenGraph to a custom action?
As far as I can tell from the API and the Facebook developer pages, it's not possible to filter a call by custom action property using the public Open Graph API.
Two options I can think of:
Option 1:
Implement the category filter by creating custom category objects:
if "review" is a custom action and
GET https://graph.facebook.com/me/[name_space]:review
returns all review actions then
GET https://graph.facebook.com/me/[name_space]:review/scifi_movie
GET https://graph.facebook.com/me/[name_space]:review/action_movie
return actions specific to movie type, where scifi_movie and action_movie are custom objects. You would need to create one object type for each category.
Option 2:
Implement a custom action for each category, e.g.
review_scifi_movie
review_action_movie
These are not particularly elegant solutions but perhaps useful as a hack if nothing else works and you really don't want to do filtering on client side.
The Facebook API will not return individual published objects for a particular action, but that's not your only problem. By the look of it, you're trying to bring in ALL the reviews given for a concert, right? (Meaning those by other users too).
The "/me/" part of the Facebook API call will only return those published actions made by the user that is currently logged in. That won't work for you, as you want those of all your users
The only suggestion I can give is to create a simple web service, where you store all the reviews given for the various concerts. Use this service to pull in reviews given for a particular concert. (I use a similar methodology for reviews in an app of my own).
I dont understand javascript or opengraph..
But when I required in JAVA to fetch reviews made by any user I have used FQL for that and It retrived me all the reviews and FQL also used to fetch all the tables related to Facebook.
I don't think that you can pull that off with the JS SDK.
You can do that in your server though, and since this is a mobile app (or has a mobile version) then that's another good reason to remove this from the client responsibility.
In the server side you can ask facebook for the published actions as you posted, filter them and then return the response.
Another thing that you can do is to save each published action in your db (on each action post you should get an id back from facebook, just persist that) and then you can easily filter the published actions according to what ever criteria you want/need (since you are no longer restricted by the facebook api).
The open graph thing is still pretty new and not tat mature, for example you can't use FQL with it, something that could have been handy for your case.
Regardless though I think that a server solution is best for calculations when mobile is concerned.
i don't know exactly but try this
if (session.authResponse) {
FB.api('/me', {
fields: 'name, picture' // here mention your fields
},
function(response) {
if (!response.error) {
//here response value
});