{
  "id": "Q5Nh2GJ5DX1oxdUR",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "ETL Monitoring & Alert Automation: Jira & Slack Integration",
  "tags": [],
  "nodes": [
    {
      "id": "d2758ac0-1d11-4457-ba1b-948d4c9d80de",
      "name": "Prepare ETL Logs",
      "type": "n8n-nodes-base.function",
      "position": [
        -2928,
        -80
      ],
      "parameters": {
        "functionCode": "// Prepare ETL logs\nconst data = $json.body;\nconst logContent = data.log || \"\";\nconst maxLength = 2000;\nconst logPreview = logContent.substring(0, maxLength);\nconst fullLogLink = \"https://s3.amazonaws.com/full-log/\" + data.job_id + \".log\";\nreturn [{ json: { job_id: data.job_id, pipeline_name: data.pipeline_name, error_message: data.error_message, logPreview, fullLogLink } }];"
      },
      "typeVersion": 1
    },
    {
      "id": "d980fe54-c902-4361-9ad3-ff02b1a95135",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -2864,
        112
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "f0e0adfb-371a-4890-87bd-e4b562048da0",
      "name": "Parse Output",
      "type": "n8n-nodes-base.code",
      "position": [
        -2416,
        -80
      ],
      "parameters": {
        "jsCode": "const raw = $json.output;\n\ntry {\n  const parsed = JSON.parse(raw);\n  return [{ json: parsed }];\n} catch (e) {\n  return [{ json: { error: true, message: \"Invalid JSON returned\", raw } }];\n}\n"
      },
      "typeVersion": 2
    },
    {
      "id": "c040fc8c-4c6c-40b6-90b3-7c483a7e6d3a",
      "name": "Create Jira Task",
      "type": "n8n-nodes-base.jira",
      "position": [
        -1744,
        -80
      ],
      "parameters": {
        "project": {
          "__rl": true,
          "mode": "list",
          "value": "10000",
          "cachedResultName": "n8n sample project"
        },
        "summary": "=[ETL FAILED] {{$json.pipeline_name}}",
        "issueType": {
          "mode": "list",
          "value": "10003"
        },
        "additionalFields": {
          "description": "=Job Id: {{ $('Prepare ETL Logs').item.json.job_id }}\nError Message: {{ $('Prepare ETL Logs').item.json.error_message}} \nlogPreview: {{ $('Prepare ETL Logs').item.json.logPreview }}\nSummary:{{ $json.summary }}\nrecommendation:{{ $json.recommendation }}\nlogLink: {{ $json.fullLogLink }}\n"
        }
      },
      "credentials": {
        "jiraSoftwareCloudApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "62a996cd-422a-4c42-918c-602bf619dbc9",
      "name": "ETL Failure Alert",
      "type": "n8n-nodes-base.slack",
      "position": [
        -1312,
        112
      ],
      "parameters": {
        "text": "=:warning: ETL Job Failed!\n**Pipeline:** {{ $('Prepare Data for logging').item.json.pipeline_name }}\n**Job ID:** {{ $('Prepare Data for logging').item.json.job_id }}\n**Summary:** {{ $('Prepare Data for logging').item.json.summary }}\n**Severity:** {{ $('Prepare Data for logging').item.json.severity }}\n**Jira Ticket:** https://mobile1wli.atlassian.net/browse/{{$json.key}}\n",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": "C09S57E2JQ2",
          "cachedResultName": "n8n"
        },
        "otherOptions": {
          "includeLinkToWorkflow": false
        }
      },
      "credentials": {
        "slackApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "b551342b-5e61-45f2-851d-73d092b4f90c",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3312,
        -208
      ],
      "parameters": {
        "color": 7,
        "width": 224,
        "height": 272,
        "content": "Starts the workflow whenever a new ETL error log is received."
      },
      "typeVersion": 1
    },
    {
      "id": "72ee4738-5a66-4a65-a968-b1559f2e3622",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1360,
        48
      ],
      "parameters": {
        "color": 7,
        "height": 224,
        "content": "Sends a Slack message to notify the team about the issue."
      },
      "typeVersion": 1
    },
    {
      "id": "53923033-a815-48f5-b69a-a23a00fab0bd",
      "name": "AI Severity Classification",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -2720,
        -80
      ],
      "parameters": {
        "text": "=You are an ETL failure analysis agent.\n\nYour job is to analyze the ETL failure details and determine severity, ticket creation logic, root cause, summary, and recommendation.\n\nHere are the inputs:\nerror_message: {{ $json.error_message }}\nlog_preview: {{ $json.logPreview }}\n\nReturn a JSON object with the following structure:\n\n{\n  \"severity\": \"Critical | High | Medium | Low\",\n  \"should_create_ticket\": true or false,\n  \"root_cause\": \"Short explanation of why the failure happened\",\n  \"summary\": \"Short title for Jira ticket or alert\",\n  \"recommendation\": \"Action the engineering team should take\"\n}\n\nRules:\n- If the log or error message indicates database failure, timeout, missing files, dependency failure, or broken pipeline \u2192 severity = Critical or High.\n- If it indicates retryable issues like minor API delay, partial failures, or network glitch \u2192 severity = Medium or Low.\n- should_create_ticket = true ONLY for High or Critical issues.\n- summary should be short and readable (max 10 words).\n- root_cause should be clear and technical.\n- recommendation should be actionable (e.g., \u201cRestart service\u201d, \u201cFix connection string\u201d, \u201cCheck credentials\u201d, etc.)\n\n\u26a0\ufe0f VERY IMPORTANT RULE:\n\ud83d\udc49 **Return ONLY pure JSON. No text, no formatting, no code blocks, no markdown.**\n",
        "options": {},
        "promptType": "define"
      },
      "typeVersion": 3
    },
    {
      "id": "1d8d29dc-93be-4381-9a5d-8f763965a135",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1392,
        -288
      ],
      "parameters": {
        "color": 7,
        "width": 256,
        "height": 224,
        "content": "Sends an email with full error details to the team."
      },
      "typeVersion": 1
    },
    {
      "id": "93377b90-5cad-4c8a-bca9-c9abe1efeb2d",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2240,
        -224
      ],
      "parameters": {
        "color": 7,
        "width": 720,
        "height": 336,
        "content": "## Save & Report the Issue\nThese steps organize the final error details, save them into Google Sheets for tracking, and automatically create a Jira ticket whenever the issue is important or needs attention."
      },
      "typeVersion": 1
    },
    {
      "id": "1fc9bbc4-35ae-4f63-9ce6-ecc74e0077e5",
      "name": "store ETL logs",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -1968,
        -80
      ],
      "parameters": {
        "columns": {
          "value": {},
          "schema": [
            {
              "id": "job_id",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "job_id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "pipeline_name",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "pipeline_name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "severity",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "severity",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "root_cause",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "root_cause",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "summary",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "summary",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "recommendation",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "recommendation",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "fullLogLink",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "fullLogLink",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "autoMapInputData",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 1283358891,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/14Arf4sTeFXzyKlpDzdibzqYGP2hvmQY6wtjlI1-ruZs/edit#gid=1283358891",
          "cachedResultName": "ETL log"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "14Arf4sTeFXzyKlpDzdibzqYGP2hvmQY6wtjlI1-ruZs",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/14Arf4sTeFXzyKlpDzdibzqYGP2hvmQY6wtjlI1-ruZs/edit?usp=drivesdk",
          "cachedResultName": "Untitled spreadsheet"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "c704fd97-5912-49ac-b2fa-ff7c052089f9",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3072,
        -256
      ],
      "parameters": {
        "color": 7,
        "width": 816,
        "height": 496,
        "content": "## Analyze & Classify the Error\nThese steps extract key error details, create a short preview and shareable log link, use AI to understand the issue and rate its severity, and then convert the AI\u2019s output into clean, structured fields."
      },
      "typeVersion": 1
    },
    {
      "id": "4c2e2034-6771-47ad-9fdc-87b3549628d1",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -4000,
        -688
      ],
      "parameters": {
        "width": 496,
        "height": 720,
        "content": "## How It Works\n\nThis workflow automatically processes ETL errors and organizes them in a clean, easy-to-review format. When an error occurs, the workflow extracts the important information, creates a short preview of the error, and generates a URL so you can quickly open the full log.\n\nNext, AI reviews the error to understand what went wrong, identifies the root cause, and classifies how serious the issue is. The workflow then converts the AI result into clean fields such as severity level, summary, and cause. Finally, the processed error is saved in Google Sheets, and if the issue is important or requires action, the workflow creates a Jira ticket for your team. This helps ensure every issue is documented, classified, and escalated without manual effort.\n\n## Setup steps\n\n**1.** Connect your webhook or error source to trigger the workflow.\n\n**2.** Add your AI/OpenAI credentials for error classification.\n\n**3** Update the parsing nodes with the keywords or fields you want to extract.\n\n**4.** Add your Google Sheets credentials and select the sheet for logging.\n\n**5.** Connect your Jira account and map fields like project, issue type, and summary.\n\n**6.** Test the workflow using a sample error log to confirm logging and ticket creation.\n\n**7.** Enable the workflow to start capturing and reporting errors automatically."
      },
      "typeVersion": 1
    },
    {
      "id": "641239c2-9a0e-40ee-a800-a4856a8532ec",
      "name": "Get ETL Error",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -3232,
        -80
      ],
      "parameters": {
        "path": "etl-failure",
        "options": {},
        "httpMethod": "POST",
        "responseMode": "lastNode"
      },
      "typeVersion": 1
    },
    {
      "id": "0b414b97-8249-410f-b445-c87202e042da",
      "name": "Prepare Data for logging",
      "type": "n8n-nodes-base.set",
      "position": [
        -2192,
        -80
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "5fd7d30a-dce8-409c-bbd1-0f544ee495bb",
              "name": "job_id",
              "type": "string",
              "value": "={{ $('Prepare ETL Logs').item.json.job_id }}"
            },
            {
              "id": "1e662c43-7b54-46e8-b2f8-b2360bb513c1",
              "name": "pipeline_name",
              "type": "string",
              "value": "={{ $('Prepare ETL Logs').item.json.pipeline_name }}"
            },
            {
              "id": "13d84211-e191-439d-96bd-be46a49d376e",
              "name": "severity",
              "type": "string",
              "value": "={{ $('Parse Output').item.json.severity }}"
            },
            {
              "id": "6a12d9c6-0f4c-44f3-9e06-e3a0e55f630f",
              "name": "root_cause",
              "type": "string",
              "value": "={{ $('Parse Output').item.json.root_cause }}"
            },
            {
              "id": "3b77cc15-5fa3-495e-b24d-46eaa62598d1",
              "name": "summary",
              "type": "string",
              "value": "={{ $('Parse Output').item.json.summary }}"
            },
            {
              "id": "bdb73baf-43b5-477a-894b-7a0c7411cb82",
              "name": "recommendation",
              "type": "string",
              "value": "={{ $('Parse Output').item.json.recommendation }}"
            },
            {
              "id": "dd1d7064-4db6-4bfe-82c6-92de3f99237e",
              "name": "fullLogLink",
              "type": "string",
              "value": "={{ $('Prepare ETL Logs').item.json.fullLogLink }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "3a2b8b08-1442-40ba-8290-a4751e9fee0c",
      "name": "ETL Failure Notify",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -1344,
        -224
      ],
      "parameters": {
        "sendTo": "user@example.com",
        "message": "=CRITICAL ETL Job Failed!  Pipeline: {{ $('Prepare Data for logging').item.json.pipeline_name }}\nJob ID: {{ $('Prepare Data for logging').item.json.job_id }}\nSummary:  {{ $('Prepare Data for logging').item.json.summary }}\nJira Ticket: https://mobile1wli.atlassian.net/browse/{{$json.key}}  \nPlease check immediately.",
        "options": {
          "appendAttribution": false
        },
        "subject": "=CRITICAL ETL Failure: {{ $('Prepare Data for logging').item.json.pipeline_name }}",
        "emailType": "text"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "807f2981-63e3-4f67-8bb2-8b306f16fab1",
  "connections": {
    "Parse Output": {
      "main": [
        [
          {
            "node": "Prepare Data for logging",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get ETL Error": {
      "main": [
        [
          {
            "node": "Prepare ETL Logs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "store ETL logs": {
      "main": [
        [
          {
            "node": "Create Jira Task",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Jira Task": {
      "main": [
        [
          {
            "node": "ETL Failure Alert",
            "type": "main",
            "index": 0
          },
          {
            "node": "ETL Failure Notify",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare ETL Logs": {
      "main": [
        [
          {
            "node": "AI Severity Classification",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Severity Classification",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Data for logging": {
      "main": [
        [
          {
            "node": "store ETL logs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Severity Classification": {
      "main": [
        [
          {
            "node": "Parse Output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}