Ultimately, I am trying to create a Web (laravel) app that allows me to edit / monitor / manage various Facebook Ad accounts. I have tried a few different things to get the token but haven't had any luck. From what I can tell it seems that I have a token that only has permission to "Pages". (A Pages token?)
I tried following these instructions here, although a little outdated. I have a development account and I understand that I can't submit it until it meets a certain criteria.
I am not sure if the development account is why I can't create a system user account. I have tried creating a System User but the page just endlessly loads. As you can see below.
I was thinking that maybe it could be something with the way I set up my Advertising Accounts but they look correct.
So basically I have no ideas on why I keep getting these errors. Additionally here is an example of a token I generated with all the allowed permissions:
And finally my code:
use FacebookAds\Api;
use FacebookAds\Object\AdAccount;
use FacebookAds\Object\Fields\AdAccountFields;
public function createFBAd( Request $request )
{
// Initialize a new Session and instanciate an Api object
$api = Api::init(env('FB_APP_ID'), env('FB_APP_SECRET'), env('FB_ACCESS_TOKEN'));
$account = (new AdAccount($act_id))->read(array(
AdAccountFields::ID,
AdAccountFields::NAME,
AdAccountFields::ADLABELS, //Throws error
AdAccountFields::AMOUNT_SPENT, //Throws error
AdAccountFields::SPEND_CAP, //Throws error
AdAccountFields::MIN_DAILY_BUDGET, //Throws error
));
}
If I remove the fields:
AdAccountFields::ADLABELS, //Throws error
AdAccountFields::AMOUNT_SPENT, //Throws error
AdAccountFields::SPEND_CAP, //Throws error
AdAccountFields::MIN_DAILY_BUDGET, //Throws error
I get a return of Id and Name.
I am developing using laravel, on a local machine, installed the Facebook Marketing API SDK through composer, and the facebook app is set to development mode in the facebook developers account.
Any help with this would be appreciated!
The issue turned out to be as I suspected, the Systems Users tab not loading. I tried contacting Facebook and reaching out through their community help but I was unable to get a response. Ultimately, I ended up submitting the app, requesting for ads_management permissions, and then checking the System Users tab. To my surprise, the System Users tab then loaded. I don't know if the app will be approved (since I haven't built it). I am just beginning the development phase, but a "fake" submit seems to be what did the trick. This could be a total coincidence but that was my solution.