{
  "name": "VigilAI Competitor Monitoring",
  "nodes": [
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "hours",
              "triggerAtHour": 9
            }
          ]
        }
      },
      "name": "Schedule (9 AM)",
      "type": "n8n-nodes-base.cron",
      "typeVersion": 1,
      "position": [
        100,
        300
      ]
    },
    {
      "parameters": {
        "url": "http://backend:8000/api/v1/competitors/",
        "method": "GET",
        "authentication": "none"
      },
      "name": "Get Competitors",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        300,
        300
      ]
    },
    {
      "parameters": {
        "batchSize": 1
      },
      "name": "Split In Batches",
      "type": "n8n-nodes-base.splitInBatches",
      "typeVersion": 1,
      "position": [
        500,
        300
      ]
    },
    {
      "parameters": {
        "url": "=http://backend:8000/api/v1/competitors/{{$node[\"Split In Batches\"].json[\"id\"]}}/scrape",
        "method": "POST",
        "authentication": "none"
      },
      "name": "Trigger Scrape",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        700,
        300
      ]
    },
    {
      "parameters": {
        "amount": 2,
        "unit": "minutes"
      },
      "name": "Wait for Scrape",
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1,
      "position": [
        900,
        300
      ]
    },
    {
      "parameters": {
        "url": "=http://backend:8000/api/v1/competitors/{{$node[\"Split In Batches\"].json[\"id\"]}}/updates?limit=5",
        "method": "GET",
        "authentication": "none"
      },
      "name": "Get Recent Updates",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        1100,
        300
      ]
    },
    {
      "parameters": {
        "select": "channel",
        "channel": "competitive-intel",
        "text": "=\ud83d\ude80 *Scrape Complete for {{$node[\"Split In Batches\"].json[\"name\"]}}*\n\nFound {{$json.length}} updates.",
        "attachments": []
      },
      "name": "Slack Notification",
      "type": "n8n-nodes-base.slack",
      "typeVersion": 1,
      "position": [
        1300,
        300
      ]
    }
  ],
  "connections": {
    "Schedule (9 AM)": {
      "main": [
        [
          {
            "node": "Get Competitors",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Competitors": {
      "main": [
        [
          {
            "node": "Split In Batches",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split In Batches": {
      "main": [
        [
          {
            "node": "Trigger Scrape",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Trigger Scrape": {
      "main": [
        [
          {
            "node": "Wait for Scrape",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait for Scrape": {
      "main": [
        [
          {
            "node": "Get Recent Updates",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Recent Updates": {
      "main": [
        [
          {
            "node": "Slack Notification",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}