I'm implementing an application using Facebook Marketing API's SDK (python), I'm a newbie to this, yet I read the documentation and I was able to create campaigns, and ad sets. But not for ad creatives. The error was that my app is in dev mode and I need to switch it to be public.
Status: 400
Response:
{
"error": {
"message": "Invalid parameter",
"type": "OAuthException",
"code": 100,
"error_subcode": 1885183,
"is_transient": false,
"error_user_title": "Ads creative post was created by an app that is in development mode",
"error_user_msg": "Ads creative post was created by an app that is in development mode. It must be in public to create this ad.",
"fbtrace_id": "Dxgr83ugqSu"
}
}
Once I did, another error occurred stating that an extended permission should be granted:
Status: 403
Response:
{
“error”: {
“message”: “(#294) Managing advertisements requires an access token with the extended permission for ads_management”,
“type”: “OAuthException”,
“code”: 294,
“fbtrace_id”: “HZ8N55VciZg”
}
}
What I did understand is that I need to submit my app for review before trying to push the ad. However, I was wondering if it is possible by anyway to push an ad without doing so? for the sake of testing my script?
Note: it is the same case for sandbox mode.
apologize if this sound like a naive question.
Related
I am building a dedicated CRM solution and it is supposed to show the list of Facebook leads of the client and then convert manually it to internal lead . I am managed to setup a websocket client and Facebook is sending me lead details including leadgen_id.
{
"object":
"page" ,
"entry": [{
"id": "*****" ,
"time": 1627211279 ,
"changes": [{
"value": {
"form_id": "******" ,
"leadgen_id": "******" ,
"created_time": 1627211277 ,
"page_id": "******"} ,
"field": "leadgen"}
]}
]}
Then i have created an user access_token using Facebook's graph api and requested for the details of the leadgen_id using api endpoint
https://graph.facebook.com/v11.0/<LEADGEN_ID>?access_token=<ACCESS_TOKEN>
I was able to get the details of the test lead I created with the Facebook 's lead testing tool. But when accessing the production leadgen_id I am getting an exception with following as response.
{
"error": {
"message": "Unsupported get request. Object with ID '<LEADGEN_ID' 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": "*********"
}
}
Then I have tried using a system user token and its not even working for the test leads. In some part of documentation it is saying that I need to complete App review to access live data using lead_retrieval and in some other part of documentation its quoted that I don't need app review to use API for internal users . And I don't get the point of creating a 'login with Facebook' for this internal app specific for one user .
Is there anyway other way than completing app review to access lead details using leadgen_id ?
Its turns out I need to complete the app review specifying it as a 'Server to server app' on the review description, which doesn't need any Login with facebook button . Got the idea from https://developers.facebook.com/docs/app-review/resources/sample-submissions/server-to-server/
Three weeks ago (around 15/05/17) , I was able to use the Facebook API explorer to read my own inbox.
me/inbox
The version that I used was v2.3 which is currently deprecated for public usage but still worked properly when I use it with my own account.
Today, I get this error:
{
"error": {
"message": "(#298) You must be a developer of the application",
"type": "OAuthException",
"code": 298,
"fbtrace_id": "DfFysTKlP/9"
}
}
The message of this error is a bit confusing because obviously, the API explorer is not a my application. Is this a bug or a facebook update?
I am using Facebook ads api to read campaign from other account. I have created the application, got app_id and app_secret. In graph explorer, I am using other person's access token and account id to get his campaigns. But facebook gives me following error:
{
"error": {
"message": "(#274) The ad account is not enabled for usage in Ads API. Please add it in developers.facebook.com/apps -> select your app -> settings -> advanced -> advertising accounts -> Ads API. Account 1817273581872129 not enabled for this application.",
"type": "OAuthException",
"code": 274,
"fbtrace_id": "GW38TMsIi1v"
}
}
I did followed error instructions but still the same problem.
here is the url i am using in graph explorer:
act_12345566654/campaigns
However, when I use facebook ads api in python:
I get the following error:
FacebookRequestError:
Message: Call was not successful
Method: GET
Path: https://graph.facebook.com/v2.8/act_1817273581872129/campaigns
Params: {'summary': 'true'}
Status: 400
Response:
{
"error": {
"message": "Invalid appsecret_proof provided in the API argument",
"code": 100,
"type": "GraphMethodException",
"fbtrace_id": "FRdlngO8f04"
}
}
Here is the code:
session = FacebookSession(self.app_id, self.app_secret, self.access_token)
ads_api = FacebookAdsApi(session)
adaccount = AdAccount(self.account_id, api=ads_api)
campaigns = adaccount.get_campaigns()
Where am I going wrong ? Kindly assist me
Most likely, the app secret that you have provided doesn't belong to the app id or the access token that you are using doesn't belong to the right app.
Check the following:
1) The app id
2) The app secret (should be of the specific app)
3) The access token (should be for the app specified above)
In case you still need it - in the explorer you must haven't selected the app. This is on the top right corner. By default, it sets the app to Graph Api Explorer, click on the drop down menu, and choose your actual app.
Cheers!
I'm trying to create an ad creative in Facebook from my test app with the following request (pretty much taken from the Python SDK Docs here):
Message: Call was not successful
Method: POST
Path: https://graph.facebook.com/v2.4/act_somenumber/adcreatives
Params: {'object_story_spec': '{"link_data":{"caption":"www.example.com","image_hash":"existing_hash","link":"http://example.com","message":"try it out"},"page_id":"some_page_id"}', 'name': 'AdCreative for Link Ad'}
However, I get the following response:
Status: 500
Response:
{
"error": {
"code": 100,
"is_transient": false,
"error_subcode": 1885183,
"error_user_msg": "Ads creative post was created by an app that is in development mode. It must be in public to create this ad.",
"error_user_title": "Ads creative post was created by an app that is in development mode",
"message": "Invalid parameter",
"type": "FacebookApiException"
}
}
Now, I've seen a similar question, which states:
If you want to create ads from an app which is in development mode, this is possible, but the post you're going to promote must have been created by an app which isn't in development mode - i.e if your app is in development mode it's OK provided you're promoting existing page posts from a page's /promotable_posts endpoint and the app that created those posts is not itself in development mode
I'm not trying to create an ad; I'm merely trying to create an ad creative and then later update the ad to use that creative. What is the correct way of creating a new creative with link data from a development app? I have no problem creating ad creatives that correspond to right hand column ads, it's the newsfeed / feeds ads whose objectives are "Website Clicks". The ad in question was actually created through the ad manager, not through an app.
The work-around is simply to create a dummy app and set it publicly visible.
In business manager it's possible to create a Link Ad with a Facebook Event url. I like to do the same with Facebook Ads API but facing a permissions error.
The Ad Creative of an Ad created in business manager looks like this one:
{
"object_story_spec": {
"page_id": "24188824589????",
"link_data": {
"link": "https://www.facebook.com/events/25595316793????/",
"message": "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
"image_hash": "cbb1f226fd5fe47c826dd1cad117????"
}
}
}
When I am trying to create the same Ad Creative via Ads Api I get an error message like the following:
{
"error": {
"message": "Invalid parameter",
"type": "FacebookApiException",
"code": 100,
"error_subcode": 1349118,
"is_transient": false,
"error_user_title": "Disallowed Post Link",
"error_user_msg": "One or more of the given URLs is not allowed by the Stream post URL security app setting. It must match the Website URL or Canvas URL, or the domain must be a subdomain of one of the App's domains. Read https://developers.facebook.com/docs/facebook-login/security/ to learn more about app settings related to security."
}
}
I get the same error if I try to create a Link Post with Graph API separately to use as object_story_id.
We really need this kind of Ads for our business. In stream ads perform much better than display ads. Is there anyway to create ads like this one via Ads API?
You should check the migration settings for your app to see if "Steam post URL security" is enabled.
This prevents URLs being posted by your app which do not link to a domain listed in your app settings.