Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I can't create ad group! #72

Closed
airdomain opened this issue Feb 25, 2015 · 4 comments
Closed

I can't create ad group! #72

airdomain opened this issue Feb 25, 2015 · 4 comments
Assignees

Comments

@airdomain
Copy link

With Facebook Ad Api, I can't create ad(group) although I have created the Campaign, AdSet, and AdCreative. I have followed instruction of facbook guide(with the all required parameters). I can't find the answer by any googling.... What's wrong? (I just found the change that ADGROUP_STATUS is required now.)

------------ PHP Codes ------------------

use FacebookAds\Object\AdGroup;
use FacebookAds\Object\Fields\AdGroupFields;

$adgroup = new AdGroup(null, $account->id);
$adgroup->setData(array(
AdGroupFields::CREATIVE => array('creative_id' => $creative->id),
AdGroupFields::NAME => 'My First AdGroup',
AdGroupFields::CAMPAIGN_ID => $adset->id,
AdGroupFields::ADGROUP_STATUS => 'ACTIVE',
));

$adgroup->create();

@minhlt82
Copy link
Contributor

Can you tell me the error message? Have you enter a valid credit card in facebook billing form?

@pruno
Copy link
Contributor

pruno commented Feb 25, 2015

Hi @airdomain,

as mentioned by @minhsepteni, the details of the error you are facing are necessary to understand the issue. Few notes:

  • in order to create an AdGroup, the parent AdAccount needs to have a valid payment method associated with it:
  • to fully understand issues you need to catch the RequestException that the SDK throws:
use FacebookAds\Http\Exception\RequestException;

try {

// Your code here

} catch (RequestException $e) {
  echo 'Caught Exception: '.$e->getMessage().PHP_EOL
    .'Code: '.$e->getCode().PHP_EOL
    .'HTTP status Code: '.$e->getHttpStatusCode().PHP_EOL
    .'Error Subcode: '.$e->getErrorSubcode().PHP_EOL
    .'Error User Title: '.$e->getErrorUserTitle().PHP_EOL
    .'Error User Message: '.$e->getErrorUserMessage().PHP_EOL;
}

@pruno pruno self-assigned this Feb 25, 2015
@airdomain
Copy link
Author

Ok, Thanks for your attention and wonderful answers.

I show you error codes as following,

Caught Exception : Invalid parameter
Code : 100
HTTP status Code : 500
Error Subcode:1359101
Error User Title : Add Payment Method
Error User Message : You need to have a valid payment method associated with your ad account
before you can create ads.

@pruno
Copy link
Contributor

pruno commented Feb 27, 2015

@airdomain, as mentioned above, you need to setup a payment method for your ad account.
You can do it here: https://www.facebook.com/ads/manager/billing/payment_methods/

@pruno pruno closed this as completed Feb 27, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants