{
  "id": "jmDZtl6juC1EHMa5",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Competitor Facebook Ads Intelligence Agent",
  "tags": [],
  "nodes": [
    {
      "id": "fd11f05c-a1c6-42be-b4c5-e8a2e7e2b51d",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        32,
        0
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "weeks",
              "triggerAtHour": 19
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "44dccd7d-9a84-42b4-a7c2-f967b5e09b55",
      "name": "Query Facebook Ad Library",
      "type": "n8n-nodes-base.airtop",
      "position": [
        256,
        0
      ],
      "parameters": {
        "url": "https://www.facebook.com/ads/library/?active_status=active&ad_type=all&country=US&is_targeted_country=false&media_type=all&search_type=page&view_all_page_id=15087023444",
        "prompt": "This is a Facebook ad library. Extract up to 30 ads for each ad, extract:\nMessage summary (1\u20132 concise sentences)\n\nMain topic (e.g., Discount, Awareness, Product Launch, Testimonial)\n\nCall-to-Action (CTA)** (e.g., Learn More, Book Now, Shop Now)\n\nHow long the ad has been active (days active or start date, if displayed)\n\nAd Language (Eng, Esp, et..)\n\nReverse engineered target audience (hypothesis)\n\nReturn the results in as a nice, HTML formatted report",
        "resource": "extraction",
        "operation": "query",
        "sessionMode": "new",
        "additionalFields": {}
      },
      "credentials": {
        "airtopApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "a909ba2d-c1b2-4c89-ab6e-e788c44ccf56",
      "name": "Send Report",
      "type": "n8n-nodes-base.gmail",
      "position": [
        480,
        0
      ],
      "parameters": {
        "sendTo": "user@example.com",
        "message": "={{ $json.data.modelResponse }}",
        "options": {},
        "subject": "Facebook Ad Library Competitor Report:  "
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "602dc0cc-03ab-492b-a87b-23e65e42b7b9",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -912,
        -448
      ],
      "parameters": {
        "color": 6,
        "width": 896,
        "height": 944,
        "content": "README\n\n# Competitor Facebook Ads Intelligence Agent\n\n## Use Case\n\nMonitor a competitor\u2019s active Facebook ads and get a weekly HTML intelligence brief by email \u2014 saving time on manual research and helping you spot messaging, offers, and creative trends quickly.\n\n## What This Automation Does\n\n* Runs weekly on a set schedule.\n* Uses **Airtop** to visit the competitor\u2019s Facebook Ad Library page and extract up to 30 active ads.\n* Summarizes each ad with key points: message, topic, CTA, duration active, language, target audience.\n* Sends the compiled HTML report via Gmail.\n\n## How It Works\n\n1. **Schedule Trigger** \u2013 Fires once a week at the configured time.\n2. **Airtop Extraction** \u2013 Loads the Ad Library URL and runs a prompt to extract and format the ads into HTML.\n3. **Email Delivery** \u2013 Sends the HTML report to your specified recipient using Gmail.\n\n## Setup Requirements\n\n1. **Airtop API Key** \u2014 [Generate here](https://portal.airtop.ai/api-keys).\n2. **Airtop Credential in n8n** \u2014 Add your API key under \u201cAirtop\u201d in n8n.\n3. **Gmail OAuth2 Credential** \u2014 Connect the Gmail account to send reports.\n4. **Competitor\u2019s Ad Library URL** \u2014 Replace the default `view_all_page_id` in the workflow with your target.\n\n## Next Steps\n\n* Duplicate the Airtop step for multiple competitors.\n* Enrich reports by visiting ad landing pages for deeper analysis.\n* Send outputs to Slack or archive in a shared workspace.\n"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "c478d744-2601-41ea-86ed-fecc114d0067",
  "connections": {
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Query Facebook Ad Library",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Query Facebook Ad Library": {
      "main": [
        [
          {
            "node": "Send Report",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}