facebook / facebook-nodejs-business-sdk

Node.js SDK for Meta Marketing APIs
https://developers.facebook.com/docs/business-sdk
Other
489 stars 226 forks source link

Sending wrong params when creating campaign #255

Open pelly-ryu opened 1 year ago

pelly-ryu commented 1 year ago

Which SDK version are you using?

17.0.1

What's the issue?

(I think this is a known issue for contributors, because it is a general behaviour of AbstractCrudObject, but couldn't find an existing issue)

Steps/Sample code to reproduce the issue

const user = new User("me");
const adAccounts = await user.getAdAccounts(["id", "name"]);
adAccounts[0].createCampaign(["id"], {
  objective: "OUTCOME_LEADS",
  special_ad_categories: [],
  name: "Campaign Name",
  bid_strategy: "LOWEST_COST_WITHOUT_CAP",
  buying_type: "AUCTION",
  status: "ACTIVE",
  spend_cap: 10000000,
  daily_budget: 5000,
}

Observed Results:

200 POST https://graph.facebook.com/v17.0/act_<acct id>/campaigns?access_token=<token> {"objective":"OUTCOME_LEADS","special_ad_categories":[],"name":"Simba Ryu","bid_strategy":"LOWEST_COST_WITHOUT_CAP","buying_type":"AUCTION","status":"ACTIVE","spend_cap":10000000,"daily_budget":5000,"fields":"id","id":"act_<acct id>"}

Expected Results:

200 POST https://graph.facebook.com/v17.0/act_<acct id>/campaigns?access_token=<token> {"objective":"OUTCOME_LEADS","special_ad_categories":[],"name":"Campaign Name","bid_strategy":"LOWEST_COST_WITHOUT_CAP","buying_type":"AUCTION","status":"ACTIVE","spend_cap":10000000,"daily_budget":5000,"fields":"id","id":"act_<acct id>"}