{
  "name": "Track Azure API and Service Bus failures with Application Insights correlation",
  "nodes": [
    {
      "id": "sticky-main-overview",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        240,
        240
      ],
      "parameters": {
        "width": 480,
        "height": 460,
        "content": "## How it works\n\nThis workflow queries Azure Application Insights to track failed API calls across APIM, Service Bus, and exceptions. It makes three KQL queries to the Application Insights API, then c"
      }
    },
    {
      "id": "sticky-config",
      "name": "Sticky Note - Config",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        800,
        240
      ],
      "parameters": {
        "width": 340,
        "height": 180,
        "content": "## Configuration\n\nSet your Application Insights Application ID and time range filter. Ensure OAuth2 credentials are configured in n8n. Time range options: 24h, 7d, 30d."
      }
    },
    {
      "id": "sticky-processing",
      "name": "Sticky Note - Processing",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1660,
        240
      ],
      "parameters": {
        "width": 340,
        "height": 180,
        "content": "## Processing & Reporting\n\nCorrelates data using operationId, calculates statistics, identifies top errors and slow requests, then generates Markdown and HTML reports."
      }
    },
    {
      "id": "trigger-manual",
      "name": "Manual Trigger",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        780,
        460
      ]
    },
    {
      "id": "config-settings",
      "name": "Set Configuration",
      "type": "n8n-nodes-base.set",
      "position": [
        1000,
        460
      ]
    },
    {
      "id": "sticky-data-collection",
      "name": "Sticky Note - Data Collection",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1220,
        240
      ],
      "parameters": {
        "width": 340,
        "height": 180,
        "content": "## Data Collection\n\nMakes three Application Insights API calls in one node: APIM requests, Service Bus traces, and exceptions. Handles OAuth2 authentication internally."
      }
    },
    {
      "id": "query-all-data",
      "name": "Query Application Insights",
      "type": "n8n-nodes-base.code",
      "position": [
        1220,
        460
      ]
    },
    {
      "id": "correlate-data",
      "name": "Correlate and Analyze Data",
      "type": "n8n-nodes-base.code",
      "position": [
        1440,
        460
      ]
    },
    {
      "id": "generate-report",
      "name": "Generate Report",
      "type": "n8n-nodes-base.code",
      "position": [
        1660,
        560
      ]
    },
    {
      "id": "check-has-data",
      "name": "Check If Data Exists",
      "type": "n8n-nodes-base.if",
      "position": [
        1880,
        560
      ]
    },
    {
      "id": "output-report",
      "name": "Output Report",
      "type": "n8n-nodes-base.set",
      "position": [
        2100,
        460
      ]
    },
    {
      "id": "no-data-found",
      "name": "No Data Found",
      "type": "n8n-nodes-base.set",
      "position": [
        2100,
        660
      ]
    },
    {
      "id": "export-excel",
      "name": "Export to Excel",
      "type": "n8n-nodes-base.spreadsheetFile",
      "position": [
        2320,
        360
      ]
    },
    {
      "id": "respond-webhook",
      "name": "Respond to Webhook",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        2320,
        560
      ]
    },
    {
      "id": "sticky-outputs",
      "name": "Sticky Note - Outputs",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2100,
        240
      ],
      "parameters": {
        "width": 340,
        "height": 180,
        "content": "## Output Options\n\nExport to Excel or return JSON via webhook. Both nodes are disabled by default—enable as needed."
      }
    }
  ],
  "connections": {
    "Output Report": {
      "main": [
        [
          {
            "node": "Export to Excel",
            "type": "main",
            "index": 0
          },
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Manual Trigger": {
      "main": [
        [
          {
            "node": "Set Configuration",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Report": {
      "main": [
        [
          {
            "node": "Check If Data Exists",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Configuration": {
      "main": [
        [
          {
            "node": "Query Application Insights",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check If Data Exists": {
      "main": [
        [
          {
            "node": "Output Report",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "No Data Found",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Correlate and Analyze Data": {
      "main": [
        [
          {
            "node": "Generate Report",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Query Application Insights": {
      "main": [
        [
          {
            "node": "Correlate and Analyze Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}