facebook-nodejs-business-sdk
facebook-nodejs-business-sdk copied to clipboard
(#2635) You are calling a deprecated version of the Ads API. Please update to the latest version: v13.0.
Which SDK version are you using?
12.0.1
What's the issue?
The API version is 13, but the latest package version is 12.0.1
When I run it, it has the following error:
message: '(#2635) You are calling a deprecated version of the Ads API. Please update to the latest version: v13.0.',
status: 400,
response: {
error: {
message: '(#2635) You are calling a deprecated version of the Ads API. Please update to the latest version: v13.0.',
type: 'OAuthException',
code: 2635,
fbtrace_id: 'AsV7oIK5LAD8BdmpaKvu0Pk'
}
},
We have the same issue, is there any workaround?
We have the same issue, is there any workaround?
Not that I know of - all the SDKs have this problem right now
This is a breaking issue and needs to be critically addressed by the team / community ASAP
This can be addressed by overriding the SDK API version with the following (right after you require the package):
Object.defineProperty(FacebookAdsApi, 'VERSION', { get: () => 'v13.0' });
Hope this helps the many of you in trouble with this.
@vitorrd Would you mind clarifying how to apply this fix? I am not as fluent in programming jargon.
I am utilizing this SDK in Python. Wondering if I need to hardcode a fix in one of the SDKs files, or can I just add a line of code after import?
Thanks.
Edit:
To fix in Python, navigate to the file: (for me) ~\Python\Python39\Lib\site-packages\facebook_business\apiconfig.py
ads_api_config = {
'API_VERSION': 'v14.0',
'SDK_VERSION': 'v14.0.0',
'STRICT_MODE': False
}
...and change both versions from 14 to 15.
Also, if you utilized the "code builder" thing they have--that supposedly creates the .py for you--there's a chance it won't work. Code was nonfunctional for me. To get anyone started who maybe in a similar situation to me, try this:
from facebook_business.adobjects.adaccount import AdAccount
from facebook_business.adobjects.adsinsights import AdsInsights
from facebook_business.api import FacebookAdsApi
access_token = '' # Put yours here
ad_account_id = '' # Put yours here
app_secret = '' # Put yours here
app_id = '' # Put yours here
FacebookAdsApi.init(access_token=access_token)
fields = [
'impressions',
'clicks',
'spend',
'ad_name',
'adset_name',
'campaign_name'
]
params = {
'time_range': {'since':'2020-10-11','until':'2022-10-13'},
'filtering': [],
'level': 'ad'
}
print( AdAccount(ad_account_id).get_insights(
fields=fields,
params=params,
))
This can be addressed by overriding the SDK API version with the following (right after you require the package):
Object.defineProperty(FacebookAdsApi, 'VERSION', { get: () => 'v13.0' });
Hope this helps the many of you in trouble with this.
Thank you @vitorrd your fix worked for me in node js.
import {
Content,
CustomData,
DeliveryCategory,
EventRequest,
UserData,
ServerEvent,
FacebookAdsApi,
} from 'facebook-business-sdk-ts';
Object.defineProperty(FacebookAdsApi, 'VERSION', { get: () => 'v15.0' });
const FACEBOOK_PIXEL_ID = process.env.FACEBOOK_PIXEL_ID;
const FACEBOOK_PIXEL_TOKEN = process.env.FACEBOOK_PIXEL_TOKEN;
const api = FacebookAdsApi.init(FACEBOOK_PIXEL_TOKEN);
...