Skip to content

feat: Integrate Meta/Facebook Business SDK#25

Open
GYFX35 wants to merge 1 commit intomainfrom
feat/facebook-sdk-integration
Open

feat: Integrate Meta/Facebook Business SDK#25
GYFX35 wants to merge 1 commit intomainfrom
feat/facebook-sdk-integration

Conversation

@GYFX35
Copy link
Copy Markdown
Owner

@GYFX35 GYFX35 commented Sep 10, 2025

This commit integrates the Meta/Facebook Business SDK into the application.

  • Adds facebook_business and gunicorn to requirements.txt.
  • Initializes the Facebook Ads API in app.py using environment variables.
  • Adds a new API endpoint /api/v1/facebook/adaccounts to fetch ad accounts and verify the integration.
  • Updates the .env file with placeholder environment variables for the Facebook App.

Summary by Sourcery

Integrate the Meta/Facebook Business SDK, configure it via environment variables, and expose an API endpoint to fetch ad accounts.

New Features:

  • Add Meta/Facebook Business SDK integration with initialization logic
  • Provide GET /api/v1/facebook/adaccounts endpoint to retrieve Facebook ad accounts

Enhancements:

  • Load Facebook Ads API credentials from environment at startup

Build:

  • Add facebook_business and gunicorn to project dependencies

Chores:

  • Add placeholder Facebook App environment variables to .env

This commit integrates the Meta/Facebook Business SDK into the application.

- Adds `facebook_business` and `gunicorn` to `requirements.txt`.
- Initializes the Facebook Ads API in `app.py` using environment variables.
- Adds a new API endpoint `/api/v1/facebook/adaccounts` to fetch ad accounts and verify the integration.
- Updates the `.env` file with placeholder environment variables for the Facebook App.
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai bot commented Sep 10, 2025

Reviewer's Guide

This PR integrates the Meta/Facebook Business SDK by adding necessary dependencies, initializing the SDK at startup, exposing an ad accounts API endpoint, and updating environment placeholders.

Class diagram for Facebook SDK integration in app.py

classDiagram
  class FacebookAdsApi {
    +init(app_id, app_secret, access_token)
  }
  class AdAccountUser {
    +get_ad_accounts()
  }
  class AdAccount {
    +export_all_data()
  }
  FacebookAdsApi <|.. AdAccountUser
  AdAccountUser "1" -- "*" AdAccount: owns
Loading

File-Level Changes

Change Details Files
Add Facebook SDK and Gunicorn dependencies
  • Add facebook_business to requirements
  • Add gunicorn to requirements
requirements.txt
Initialize Facebook Ads API on startup
  • Introduce initialize_facebook_api() to load env vars
  • Invoke FacebookAdsApi.init() when credentials present
  • Call init function at import time
app.py
Create ad accounts API endpoint
  • Define GET /api/v1/facebook/adaccounts route
  • Secure with require_api_key decorator
  • Fetch and return ad accounts or error
app.py
Add Facebook env var placeholders
  • Add META_APP_ID placeholder
  • Add META_APP_SECRET placeholder
  • Add META_ACCESS_TOKEN placeholder
.env

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey there - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@guardrails
Copy link
Copy Markdown

guardrails bot commented Sep 10, 2025

⚠️ We detected 3 security issues in this pull request:

Hard-Coded Secrets (1)
Severity Details Docs
Medium Title: Secret Keyword
META_APP_SECRET="YOUR_META_APP_SECRET_HERE"
📚

More info on how to fix Hard-Coded Secrets in General.


Vulnerable Libraries (2)
Severity Details
N/A pkg:pypi/flask@0.0.0 (t) upgrade to: 1.0
High pkg:pypi/gunicorn@0.0.0 upgrade to: 19.5.0

More info on how to fix Vulnerable Libraries in Python.


👉 Go to the dashboard for detailed results.

📥 Happy? Share your feedback with us.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant