I am an student and trying to use Facebook marketing api for one of my school project. I am trying to write a program in python to create custom audience in Facebook. I am really confused on how I should be going forward with this.
I created an Ads App. I used this app credentials to connect.
my_app_id = 'my_app_id'
my_app_secret = 'my_app_secret'
my_access_token = 'my_access_token'
FacebookAdsApi.init(my_app_id, my_app_secret, my_access_token)
audience = CustomAudience(parent_id='act_my_app_id')
audience[CustomAudience.Field.subtype] = CustomAudience.Subtype.custom
audience[CustomAudience.Field.name] = 'Test'
audience.remote_create()
Token access was generated for ads_management and ads_read. However, I get this error
Application does not have the capability to make this API call.
Then I created a Sandbox Ad Account and used its credentials to create the custom audience. I did not get any error but I do not know where I should go to see the custom audience I created. I understand that Sandbox account is not for production but I think I should be able to see my custom audience somewhere.
I am not sure whether the approach I took is correct or not and I highly appreciate if someone could provide me a direction on what should I do to create a custom audience on Facebook. Also, if you find my documentation unclear, please let me know and I will try to add more relevant stuffs. Thank you.
First thing to notice is that you should be using your Ad Account as the parent of the Audience, i.e.:
my_adaccount = 'act_1234';
audience = CustomAudience(parent_id=my_adaccount);
instead of
audience = CustomAudience(parent_id='act_my_app_id');
Another thing is that your app may not have those permissions, you have to ask for Ads Management Basic Access. For more, check the section "Apply for Basic" here: https://developers.facebook.com/docs/marketing-api/access
Related
I’ve built a google action that talks to my bespoke web Api.
The actions code currently has personal details hard coded into it. I need to make it so that when someone uses it for the first time it asks them for a username password and URL.
Is there a way to do this? Or maybe there is a way for a user to add those details to there google account in some way that the action can read them.
Alternatively is there a way to publish an action so only specific users can access it?
In general, asking for a username and password is a bad approach for Actions, for several reasons, and asking for a URL can be quite a mess. Particularly if you're expecting the user to access the Action via voice or a device that doesn't support a keyboard.
The better approach is to use Account Linking to connect their Google Account to an account they have created on your system. If you need additional one-time configuration information, you can have them provide this information for their account via a webapp, store it in a datastore of some sort, and then access it when they contact your webhook via the Action.
There is no way to have the Assistant enforce access to a production Action. You can publish an Alpha release to up to 20 accounts, but this is still treated as a "test" version.
I'm trying to create, add users, remove users to custom audiences and then share those audiences with other accounts. I have gotten all of these working except for the sharing part.
The api docs seem very vague on how to actually do this. Here is what it says:
Share your custom audience with business objects at
'/custom-audience/share_with_objects'
Does anyone know how to do this through the API? I imagine you'd need the AD_ACCOUNT_ID and the CUSTOM_AUDIENCE_ID in some capacity.
for reference that quoted line above is from here https://developers.facebook.com/docs/marketing-api/audiences-api
under the header Building a Custom Audience
Thanks for the help.
I am not entirely sure what you want to do but the documentation says how you can Create and Share a custom audience with other advertiser accounts.Reference here. You have to POST on this endpoint /{custom_audience_id}/adaccounts and specify the owner ad account and the recipient ad account. Please, check the documentation for more information. Hope this helped.
As of 2018; Custom Audiences can now be shared only between Businesses (it is mandatory for both parties to have BusinessManager)
How to Share Custom Audience Lists
Both entities must have a Business Manager
Share Custom Audiences between Business Managers
Since 2018, in order to share a Custom Audience between Business
Managers, such businesses should establish an audience sharing
relationship as follows. You need Business Manager admin permission to
request a relationship to share an audience. If two Business Managers
have already established the relationship, then an advertiser can
directly share the audience with the other business. See also
Reference, Custom Audience and Reference, Custom Audience Shared
Account Info.
And while marketing-api docs have improved a bit, but still completely lack the get-started-in-5-min crispness
To create a relationship, make this call, to a specific custom_audience_id:
POST https://graph.facebook.com/v7.0/{custom_audience_id}/adaccounts?adaccounts=[<ad_account_id>]&relationship_type=[<relationship_type>]
and while nowhere they've specified what is this relationship_type, I peeked into their java-business-sdk and found this
public static enum EnumRelationshipType {
#SerializedName("AD_MANAGER")
VALUE_AD_MANAGER("AD_MANAGER"),
#SerializedName("AGENCY")
VALUE_AGENCY("AGENCY"),
#SerializedName("AGGREGATOR")
VALUE_AGGREGATOR("AGGREGATOR"),
#SerializedName("AUDIENCE_MANAGER")
VALUE_AUDIENCE_MANAGER("AUDIENCE_MANAGER"),
#SerializedName("OTHER")
VALUE_OTHER("OTHER"),
;
..
The API lacks some clear explanations on retrieving the reachestimate for either an ad account or an ad. I have made sure that:
I am an admin/ or added to a Facebook app
I have a paid advertising campaign
The adaccount ID is added in the Settings Advanced panel of the Developer App page
I've been trying to:
In Graph API Explorer, retrieve the data by query expansion: me?fields=adaccounts{campaigns{adsets{ads{reachestimate}}}}. However, I always get one of the following (randomly):
Still in the explorer, retrieve it by direct access: act_{adaccount_id}/reachestimate I get this, even if I am 100% sure the ad account is added in the Advanced Settings panel:
Both of 1 and 2 in the iOS project. I get this: com.facebook.sdk.core error 8
Test it by curl with the example from here. I get this (the same with the one from point 2): The ad account is not enabled for usage in Ads API.
Just as a further note, for point 1 that's not the whole query, but I didn't write the adjacent fields because they would've been redundant for the purpose of this question.
I simply need to retrieve the ad accounts, the campaigns, the ad sets and the reach estimate simultaneously in the same query. It seems like a dead spot for me. Do you have any suggestions? Can you show me a Graph API explorer working example? Or, if what I'm asking is impossible, can you simply show some code that works?
Are you app and ad account owned by the same person?
Facebook Ads API has tiered access. https://developers.facebook.com/docs/marketing-api/access
A newly registered app is in Development Tier and can only access the user's own ad accounts. You need to make some API calls on your own ad account for testing in order to get promoted to Basic Tier and manage other people's ad account.
Apparently, I got:
Please reduce the amount of data you're asking for, then retry your request.
Because the query was to broad. Those 'adjacent' fields actually triggered a massive query, so the solution was to either:
Put a limit(1) on the campaigns.
Individually retrieve the reachestimate for each adset.
I chose the latter because it suited my needs, but it's up to you which solution works better.
I am implementing espn api, but having some issue, most api gives me this response.
{"timestamp" :"2013-02-25T11:19:02Z","message" :"This action is forbidden for the requested resource at your permission level. Please review the documentation for account level access.","status" :"error","code" :403}
I am using this api Espn MLB Standing
I want to know that where to review the documentation, i is there any need to purchase some api or anything else?
[EDIT]
One more thing there is ?apikey=:yourkey , so this key is same for all user or we have to get this according to user login.
I think you are using the wrong apikey or there is some issue in your URL query.
Your app will have a unique apikey. This key is same for all users who are using the app.
You should get a apikey by registering to their site and use it for development purpose.
My rep doesn't allowing commenting, but I thought I'd add the following here:
A small amount of ESPN API data is free, but much requires payment.
You probably don't want to publicly share your personal API key for security reasons.
Go to http://developer.espn.com/io-docs and plug in your API key and use the GUI to generate an API call/response. It's a good way to see a valid, working syntax that you can then drop into your app and edit as necessary.
I'm making a application for facebook that will be used for academic research. Right now when the user goes to install the application I'll request additional information which is stated in the extended permissions.
I would perfectly understand someone not wanting to give out certain aspects of this information (It's just used to gather statistics about people taking part , education, religion etc.)
Does anyone know the best way to filter the permissions? For instance maybe someone is willing to give their age but not education. Therefore can I remove the education request from my application install request dynamically?
If you want to ask the user for only those permissions that he wants to give, you can take input from him before redirecting to Facebook login. You can generate the url for requesting permissions based on this custom set of permissions using the 'perms' attribute of the <fb:loginbutton /> tag or pass the list of permissions you want to the $facebook->getLoginUrl(array('req_perms' => $perms)) call.
To keep track of permission changes, you can use the realtime updates offered. You can know more about it here.
You certainly could build an up-front permissions matrix that the user could cherry-pick from. And that would probably be the way to do it, since you can't do anything to customize the permission challenge that the Facebook Platform generates.
The trick would be keeping track of which permissions the user granted in the given access token you'll receive from back from the Platform. Especially since users can change the permissions granted to your application w/o visiting the application itself - so you'll want to be hooked in to that info via the Real Time Updates.