{
  "name": "13 · Traffic Spike Alert",
  "nodes": [
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "hours"
            }
          ]
        }
      },
      "name": "Every Hour",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.3,
      "position": [
        0,
        96
      ]
    },
    {
      "parameters": {
        "operation": "list"
      },
      "name": "Get Workspace Analytics",
      "type": "n8n-nodes-lindo.lindo",
      "typeVersion": 1,
      "position": [
        224,
        96
      ],
      "credentials": {
        "lindoApi": {
          "id": "EZiHryOUuVuxcDYQ",
          "name": "Lindo account"
        }
      }
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "a1",
              "name": "current_visits",
              "value": "={{ $json.total_requests || $json.list?.length || 0 }}",
              "type": "number"
            },
            {
              "id": "a2",
              "name": "threshold",
              "value": 100,
              "type": "number"
            },
            {
              "id": "a3",
              "name": "is_spike",
              "value": "={{ ($json.total_requests || 0) > 100 }}",
              "type": "boolean"
            },
            {
              "id": "a4",
              "name": "summary",
              "value": "={{ JSON.stringify({ visits: $json.total_requests || 0, top_pages: $json.top_pages || [], websites: ($json.list || []).length }) }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "name": "Evaluate Traffic",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        448,
        96
      ]
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 3
          },
          "conditions": [
            {
              "id": "s1",
              "leftValue": "={{ $json.is_spike }}",
              "rightValue": true,
              "operator": {
                "type": "boolean",
                "operation": "equals",
                "name": "filter.operator.equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "name": "Spike Detected?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.3,
      "position": [
        672,
        96
      ]
    },
    {
      "parameters": {
        "text": "=📈 Traffic spike detected! {{ $json.current_visits }} visits in the last hour (threshold: {{ $json.threshold }}). Details: {{ $json.summary }}",
        "otherOptions": {}
      },
      "name": "Slack: Traffic Alert",
      "type": "n8n-nodes-base.slack",
      "typeVersion": 2.4,
      "position": [
        896,
        0
      ],
      "webhookId": "f76fdcf8-96ba-41a4-a2f4-e541d5f8c32f",
      "credentials": {
        "slackApi": {
          "id": "sXUjiMVMx3RPbSTG",
          "name": "Slack account"
        }
      }
    },
    {
      "parameters": {},
      "name": "No Spike (Silent)",
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [
        896,
        192
      ]
    },
    {
      "parameters": {
        "content": "### 13 · Traffic Spike Alert\n\n**How it works:** Runs every hour → fetches workspace analytics from Lindo → evaluates if traffic exceeds threshold (default 100 visits/hour) → if spike detected, posts alert to Slack with visit count and top pages. Silent if no spike.\n\n**Setup:** Connect Lindo API credentials. Connect Slack credentials. Adjust threshold value in Evaluate Traffic node.\n\n**Customisation:** Change polling frequency (default hourly). Adjust spike threshold. Add PagerDuty or email alerts. Include per-website breakdown. Add historical comparison logic.",
        "height": 216,
        "width": 1196,
        "color": 2
      },
      "name": "Sticky Note b07282fb",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        48,
        352
      ]
    },
    {
      "parameters": {
        "content": "## Data & Evaluation\nFetches workspace analytics hourly and evaluates against configurable threshold.",
        "height": 104,
        "width": 604
      },
      "name": "Sticky Note a09eca60",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        32,
        -48
      ]
    },
    {
      "parameters": {
        "content": "## Alert Routing\nIf spike detected → Slack alert. Otherwise silent (no-op).",
        "height": 120,
        "width": 412
      },
      "name": "Sticky Note e0d812b7",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        880,
        -144
      ]
    }
  ],
  "connections": {
    "Every Hour": {
      "main": [
        [
          {
            "node": "Get Workspace Analytics",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Workspace Analytics": {
      "main": [
        [
          {
            "node": "Evaluate Traffic",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Evaluate Traffic": {
      "main": [
        [
          {
            "node": "Spike Detected?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Spike Detected?": {
      "main": [
        [
          {
            "node": "Slack: Traffic Alert",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "No Spike (Silent)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "meta": {
    "templateCredsSetupCompleted": false
  }
}