Facebook Marketing API -- how to get records from campaigns, adsets, ads, server to server for many clients?

Hey all working on an app that needs to get a few clients facebook/google data every few hours for a unified dashboard.

I am super confused where to start accessing that data. It’s gota be server to server, I dont want the client to have to hit refresh.

Where to start?

You need to get a permission token to manage the page. An admin of the page must do that using your app and doing oauth authentication to facebook. Once you have the token, FB has a mechanism to get a token with a longer time limit or renew the token if it is already expired. You use the token for every api call on behalf of the page admin

Hey thanks, I’m kinda getting through it. Very painful to learn.

I’m now setting up accounts-facebook to login to my app. This would be the starting point right?

I am not using that package (so I am not that familiar). But the oauth mechanism it is using for the login should be the same. What is different is the scope of permissions allowed which will include the permissions required for you to acces the data from the page

Ah okay, so basically just oAuth with Facebook, get the permissions to my app.

But then, how does that give my server access to record their ad campaign data? CPC, CPA, Impressions, etc?

Do I need to manually add their ad accounts? Or does the permissions just enable this to happen?

If you have the permission token, you can access anything within the provided scope.

1 Like

When you oauth to facebook asking page-level permissions, the pages of the user to which he has admin access will be displayed. He can select which pages and which permissions are to be granted for your app. Those pages and permissions are tagged to the permission token that you will get

1 Like

You are the BEST, thank you man.

Working on this app :wink: