This project is a simple Flask web application that demonstrates how to integrate with the Facebook Marketing API, including the Audience Network.
- Python 3.6+
- A Facebook Developer account
- An App ID, App Secret, and Access Token from your Facebook App.
Clone the repository and install the dependencies:
git clone <repository_url>
cd <repository_name>
pip install -r requirements.txtOpen the app.py file and replace the placeholder values for APP_ID, APP_SECRET, and ACCESS_TOKEN with your actual credentials from the Facebook Developer portal.
# --- Facebook SDK Initialization ---
# PLEASE REPLACE WITH YOUR OWN CREDENTIALS
APP_ID = 'YOUR_APP_ID'
APP_SECRET = 'YOUR_APP_SECRET'
ACCESS_TOKEN = 'YOUR_ACCESS_TOKEN'To start the Flask development server, run the following command:
python app.pyThe application will be available at http://localhost:8080.
GET /: The main landing page.GET /audience_network_adsets: Retrieves a list of ad sets from your ad account that are specifically targeted to run on the Facebook Audience Network. This demonstrates how to use the Marketing API to query for Audience Network-related assets.