I am using facebook business sdk of nodejs to create campaigns and adsets. But creating adsets is not being successful.
I tried the following example code:
const bizSdk = require('facebook-nodejs-business-sdk');
const AdAccount = bizSdk.AdAccount;
const AdSet = bizSdk.AdSet;
const access_token = '<ACCESS_TOKEN>';
const app_secret = '<APP_SECRET>';
const app_id = '<APP_ID>';
const id = '<AD_ACCOUNT_ID>';
const api = bizSdk.FacebookAdsApi.init(access_token);
const showDebugingInfo = true; // Setting this to true shows more debugging info.
if (showDebugingInfo) {
api.setDebug(true);
}
const logApiCallResult = (apiCallName, data) => {
console.log(apiCallName);
if (showDebugingInfo) {
console.log('Data:' + JSON.stringify(data));
}
};
let fields, params;
fields = [
];
params = {
'name' : 'Mobile App Installs Ad Set',
'daily_budget' : '10000',
'bid_amount' : '2000',
'billing_event' : 'IMPRESSIONS',
'optimization_goal' : 'APP_INSTALLS',
'campaign_id' : '<adCampaignAppInstallsID>',
'promoted_object' : {'application_id':'<appID>','object_store_url':'<appLink>'},
'targeting' : {'device_platforms':['mobile'],'facebook_positions':['feed'],'geo_locations':{'countries':['US']},'publisher_platforms':['facebook','audience_network'],'user_os':['IOS']},
'status' : 'PAUSED',
};
const adsets = (new AdAccount(id)).createAdSet(
fields,
params
);
logApiCallResult('adsets api call complete.', adsets);
and got the following output:
message: 'Budget Is Too Low: Your ad set budget must be more than Rs218.14 or your ads may not deliver.',
status: 400,
response: {
error: {
message: 'Invalid parameter',
type: 'OAuthException',
code: 100,
error_data: '{"blame_field_specs":[["daily_budget"]]}',
error_subcode: 1885272,
is_transient: false,
error_user_title: 'Budget Is Too Low',
error_user_msg: 'Your ad set budget must be more than Rs218.14 or your ads may not deliver.',
fbtrace_id: 'xxxxxxxxxxxxxxxx'
}
}
seems like budget is too low. but I've given more than minimum, I am not being able to figure out what is the problem. By the way, I'm using a sandbox account.
Thanks!