{
  "name": "ABM trigger orchestration",
  "nodes": [
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "cronExpression",
              "expression": "0 6 * * 1"
            }
          ]
        }
      },
      "id": "cron-monday",
      "name": "Mondays 6am",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1,
      "position": [
        240,
        320
      ]
    },
    {
      "parameters": {
        "fileSelector": "data/abm_q3.csv"
      },
      "id": "read-list",
      "name": "Read ABM list",
      "type": "n8n-nodes-base.readBinaryFile",
      "typeVersion": 1,
      "position": [
        460,
        320
      ]
    },
    {
      "parameters": {
        "url": "=https://api.github.com/orgs/{{$json[\"github_org\"]}}/events",
        "options": {
          "response": {
            "response": {
              "neverError": true
            }
          }
        }
      },
      "id": "gh-events",
      "name": "GitHub org events",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.1,
      "position": [
        680,
        320
      ]
    },
    {
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{$json.find(e => new Date(e.created_at) > new Date(Date.now()-7*86400e3))?.type}}",
              "operation": "isNotEmpty"
            }
          ]
        }
      },
      "id": "any-activity",
      "name": "New activity last 7d?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [
        900,
        320
      ]
    },
    {
      "parameters": {
        "command": "=cd /opt/gtm-engineering && python automations/04-abm-orchestrator/orchestrator.py --accounts data/abm_q3.csv --campaign Q3-FY26-Refresh --out outputs/abm_refresh/"
      },
      "id": "refresh-packets",
      "name": "Refresh ABM packets",
      "type": "n8n-nodes-base.executeCommand",
      "typeVersion": 1,
      "position": [
        1120,
        240
      ]
    },
    {
      "parameters": {
        "channel": "#abm",
        "text": "=ABM packets refreshed. New activity detected this week \u2014 check outputs/abm_refresh/."
      },
      "id": "slack",
      "name": "Notify ABM channel",
      "type": "n8n-nodes-base.slack",
      "typeVersion": 2,
      "position": [
        1340,
        240
      ],
      "credentials": {
        "slackApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {},
      "id": "noop",
      "name": "No activity",
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [
        1120,
        400
      ]
    }
  ],
  "connections": {
    "Mondays 6am": {
      "main": [
        [
          {
            "node": "Read ABM list",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read ABM list": {
      "main": [
        [
          {
            "node": "GitHub org events",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "GitHub org events": {
      "main": [
        [
          {
            "node": "New activity last 7d?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "New activity last 7d?": {
      "main": [
        [
          {
            "node": "Refresh ABM packets",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "No activity",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Refresh ABM packets": {
      "main": [
        [
          {
            "node": "Notify ABM channel",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "abm-orchestration-v1",
  "tags": [
    "abm",
    "github",
    "weekly"
  ]
}