I am using Facebook as advertising platform to promote my application on Apple and Google stores. I would like to make windows service which will download daily report(s) about advertising status of my marketing campaign running one Facebook, preferably using 60 day token, or some permanent solution so that token is retrieved when required. I think that i understand everything to do this except how to generate access token to use it with Facebook Graph API. Which token for which Facebook account do I need and how to obtain it?
How to generate Facebook Marketing API access token to use it in Windows application
Asked Answered
You'll need a Facebook app and to grant that app the ads_read permission in order to retrieve reports about your advertising efforts via the API (source).
You'll want a long-lived token so that you don't have to re-authenticate very often. The access token documentation details the steps to exchange a short-lived token for a long-lived one.
You may also want to consider managing the app, ad account, and access tokens (via a business system user) with the FB Business Manager.
I need a FB app? Never made one, this is something that can be installed to some user profile and than he can do something inside browser? I don't see how to use Facebook app to automaticly download daily reports, i can only imagin someone clicking download report each day. Can you please explain this part please. –
Ascending
If you want to manually retrieve reports you can do so via the FB ads manager facebook.com/ads/manage or via the Power Editor facebook.com/ads/manage/powereditor. But to retrieve report data via the API you need an FB app. Authorize the app to read data from your ad account then setup code to automatically retrieve ad report data from the API and output. Checkout the FB guide developers.facebook.com/docs/marketing-api/guides/… –
Juliajulian
I was under impression that you could dl reports only from your sandboxed FB app running in browser, but if FB ap is just proxy that wires up FB infrastructure and enables you security credentials to invoke API from you native PC app than this is what I need. I'll check it some more. Thanks! –
Ascending
OMG I was using GET examples from FB documentation. All the time some strange authentication errors were coming, I was sure that I had something conceptually wrong. But now i tried same call 3 days later with short time token generated with Graph Explorer and everything is working OK. I just have to make 60 day token now. –
Ascending
- Create a facebook app.
- Go to the Graph API Explorer in Facebook's Tools & Support section.
- Pick your app from the drop down.
- Hit Get Token > Get User Access Token.
- In Select Permissions choose required permissions or select them from extended permissions.
- Use the user access token that will be presented to you in the access token form input field.
© 2022 - 2024 — McMap. All rights reserved.