Category / Section
Step-by-Step Guide to Connecting Facebook Ads to ETL Using an Access Token
Published:
Configure Facebook Ads in ETL
Prerequisite
- Create a new app (if the app is not available).
- Generate Access Token
- Long-Lived Access Tokens
- Account ID
Create a new APP
- Log in to your developer account and click on
My Appslocated in the top right corner. - Click a
Create APP.
- Select an
OtherOption and Click aNext.
- Select an app type based on your requirement (Business) and click a
Next.
- Enter an App Name and Click
Create App.
Generate Access Token
-
Open Facebook Explorer https://developers.facebook.com/tools/explorer.
-
Select an existing app from the
Meta Appsection.
-
Obtain an access token with the necessary permissions for accessing the Facebook Ads data. You might need to add the below scopes and include any other related scopes if needed. Then, click
Generate Access Token.
- ads_management
- ads_read
- read_insights
- pages_show_list
- leads_retrieval
- pages_read_engagement
- pages_read_user_content
Long-Lived Access Tokens
If you need a long-lived user access token, you can generate one from a short-lived user access token. A long-lived token typically lasts around 60 days.
You will need the following:
- Valid User Access Token
- App ID
- App Secret
Query the GET oauth/access_token endpoint.
Account Id
-
Execute the URL below to retrieve the account ID.
me/adaccounts?fields=name, account_id
-
Pick up your
account IDfrom the response.
Configure the ETL to connect Facebook Ads
- Click a
Bold ETL.
- Click
Add Projectand provide the name for the new project.
- Select the newly created project and add the
Facebook Adstemplate.
- Updated the access token and account ID in the template. Also, Updated the resources on the
selectproperty.
The available resources are supported in Facebook Ads
- campaigns
- ads
- ad_creatives
- leads
- ad_sets
- The
Encrypt_Credentialsproperty should be set to false when updating the new access token on the template. If you have modified other properties, such as ‘select’ or ‘account id’, theEncrypt_Credentialsproperty must be set to true. - The default lifetime of the access token is 1 hour. Therefore, you need to convert it to a long-lived access token in order to use the same token for 60 days. Existing tables should be maintained even if the token has expired or is being used as an invalid token.
Schedule ETL Job
- Click
Schedulesand select the createdfacebookETLDSproject.
- For on-demand refresh, click
Run Now.
- After, Complete the on-demand refresh.
- To schedule the refresh hourly, please click the
Scheduleoption.
- The data source was created by ETL in Bold BI.
- Click
Edit DataSourceOption to view the created tables, such as ‘Campaigns’ and ‘Adsets’ tables.
Reference
- Facebook Ads using ETL - https://help.boldbi.com/working-with-data-sources/working-with-bold-etl/data-connectors/facebook-ads/
- Facebook Get Started - https://developers.facebook.com/docs/graph-api/get-started
- Long-Lived Access Token - https://developers.facebook.com/docs/facebook-login/guides/access-tokens/get-long-lived/