facebook / facebook-php-business-sdk

PHP SDK for Meta Marketing API
https://developers.facebook.com/docs/business-sdk
Other
837 stars 519 forks source link

I want group id but it says Error: (#100) Missing permissions #613

Open ManojPadhiyar1993 opened 2 months ago

ManojPadhiyar1993 commented 2 months ago

My goal is to fetch leads data

$app_id = 'YOUR_APP_ID'; $app_secret = 'YOUR_APP_SECRET'; $access_token = 'YOUR_ACCESS_TOKEN'; $ad_account_id = 'act_YOUR_AD_ACCOUNT_ID'; Api::init($app_id, $app_secret, $access_token);

// Optional: Enable curl logging to debug requests $api = Api::instance(); $api->setLogger(new CurlLogger());

try { // Create a new AdAccount object with the Ad Account ID $adAccount = new AdAccount($ad_account_id);

// Fetch ad sets (ad group IDs) for this ad account
$adsets = $adAccount->getAdSets([
    'id',         // Fetch Ad Set ID
    'name',       // Fetch Ad Set Name
    'campaign_id' // Fetch Campaign ID (optional)
]);

// Loop through the results and print the Ad Set IDs
foreach ($adsets as $adset) {
    echo 'Ad Set ID: ' . $adset['id'] . "\n";
    echo 'Ad Set Name: ' . $adset['name'] . "\n";
    echo 'Campaign ID: ' . $adset['campaign_id'] . "\n";
}

} catch (Exception $e) { // Handle error echo 'Error: ' . $e->getMessage(); }

bostin commented 1 month ago

I have the same issue.