facebook / facebook-php-business-sdk

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

Updating a Custom Audience's users produces an "Unsupported post request" #422

Closed elegos closed 6 years ago

elegos commented 6 years ago

Hello!

I've got a script which firstly creates a custom audience, then populates it with SHA256-hashed emails.

The custom audience exists and I can see / manage it in the Facebook's Business Manager (very same ID).

The error is the following: Unsupported post request. Object with ID 'xxxxxxxxxxxxx' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api.

This is the code which is being executed:

    private function uploadForConfiguration(...): void {
        // ...
        Api::init($this->appId, $this->appSecret, $configuration->getAccessToken());

        foreach ($customAudienceIds as $audienceId) {
            foreach (\array_chunk($emails, 10000) as $emailsChunk) {
                $audience = new CustomAudience($audienceId); // $audienceId exists as per Business Manager
                // Emails are already SHA256 hashed and lower-case transformed
                $audience->addUsers($emailsChunk, CustomAudienceTypes::EMAIL, [], true, false);
            }
        }
    }

Is this the right way to call the API? Or should I call it differently?

Thanks

jingping2015 commented 6 years ago

Hey, thanks for your comment! This is actually an api issue. Please report the issue on Devsite Bug Report channel: https://developers.facebook.com/support/bugs/ Thanks!