Articles in this section
Category / Section

Step-by-Step Guide to Connecting Facebook Ads to ETL Using an Access Token

Published: Feb 22, 2024

Configure Facebook Ads in ETL

Prerequisite

  1. Create a new app (if the app is not available).
  2. Generate Access Token
  3. Long-Lived Access Tokens
  4. Account ID
Create a new APP
  1. Log in to your developer account and click on My Apps located in the top right corner.
  2. Click a Create APP.
    image.png
  3. Select an Other Option and Click a Next.
    image.png
  4. Select an app type based on your requirement (Business) and click a Next.
    image.png
  5. Enter an App Name and Click Create App.
    image.png
Generate Access Token
  • Open Facebook Explorer https://developers.facebook.com/tools/explorer.

  • Select an existing app from the Meta App section.
    image.png

  • 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.

    image.png

  1. ads_management
  2. ads_read
  3. read_insights
  4. pages_show_list
  5. leads_retrieval
  6. pages_read_engagement
  7. 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:

  1. Valid User Access Token
  2. App ID
  3. App Secret

Query the GET oauth/access_token endpoint.

image.png

Account Id
  • Execute the URL below to retrieve the account ID.

    me/adaccounts?fields=name, account_id

  • Pick up your account ID from the response.
    image.png

Configure the ETL to connect Facebook Ads

  1. Click a Bold ETL.
    image.png
  2. Click Add Project and provide the name for the new project.
    image.png
  3. Select the newly created project and add the Facebook Ads template.
    image.png
  4. Updated the access token and account ID in the template. Also, Updated the resources on the select property.
    image.png
The available resources are supported in Facebook Ads 
- campaigns 
- ads 
- ad_creatives 
- leads 
- ad_sets 
  1. The Encrypt_Credentials property 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’, the Encrypt_Credentials property must be set to true.
  2. 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

  1. Click Schedules and select the created facebookETLDSproject.
    image.png
  2. For on-demand refresh, click Run Now.
    image.png
  3. After, Complete the on-demand refresh.
    image.png
  4. To schedule the refresh hourly, please click the Scheduleoption.
    image.png
  5. The data source was created by ETL in Bold BI®.
    image.png
  6. Click Edit DataSource Option to view the created tables, such as ‘Campaigns’ and ‘Adsets’ tables.
    image.png
Reference
  1. Facebook Ads using ETL - https://help.boldbi.com/working-with-data-sources/working-with-bold-etl/data-connectors/facebook-ads/
  2. Facebook Get Started - https://developers.facebook.com/docs/graph-api/get-started
  3. Long-Lived Access Token - https://developers.facebook.com/docs/facebook-login/guides/access-tokens/get-long-lived/
Was this article useful?
Like
Dislike
Help us improve this page
Please provide feedback or comments
BK
Written by Baskaran K
Updated Feb 22, 2024
Comments (0)
Please  to leave a comment
Access denied
Access denied