{
  "name": "Proactive SLA monitoring & ticket escalation with Zendesk, Slack and Google Sheets",
  "nodes": [
    {
      "id": "5bbf4343-9879-42b5-b16e-c24c6c48d882",
      "name": "Trigger Every Hour",
      "type": "n8n-nodes-base.cron",
      "position": [
        -1904,
        608
      ]
    },
    {
      "id": "61005911-1ea7-4e84-afe1-e394909fe306",
      "name": "⏰ SLA Monitoring Overview",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2240,
        496
      ],
      "parameters": {
        "width": 280,
        "height": 300,
        "content": "⏰ WORKFLOW START\n\nThis workflow monitors Zendesk tickets and ensures SLAs are met by:\n\n• Running every hour automatically\n• Fetching all open tickets\n• Calculating time remaining\n• Escalating tickets "
      }
    },
    {
      "id": "dbe9f15d-4e00-4018-ac5e-8ee35473c310",
      "name": "Fetch Open Tickets from Zendesk",
      "type": "n8n-nodes-base.zendesk",
      "position": [
        -1680,
        608
      ]
    },
    {
      "id": "c5eb8fbd-4837-437a-ba29-1b7e236d19dd",
      "name": "📥 Zendesk Fetch",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1792,
        272
      ],
      "parameters": {
        "width": 280,
        "height": 300,
        "content": "📥 ZENDESK DATA RETRIEVAL\n\nFetches all tickets from Zendesk:\n• Uses Zendesk REST API\n• Retrieves all records (returnAll: true)\n• Returns: ticket ID, status, created_at, sla_due, priority\n\nRequired tick"
      }
    },
    {
      "id": "ff9333b9-b761-4ae7-8d1d-af38d44dc30e",
      "name": "Filter: Open Tickets Only",
      "type": "n8n-nodes-base.if",
      "position": [
        -1456,
        608
      ]
    },
    {
      "id": "b5a5e4bc-c62f-4093-bc6f-4ee998868cf8",
      "name": "🔍 Filter Open",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1600,
        784
      ],
      "parameters": {
        "width": 280,
        "height": 280,
        "content": "🔍 OPEN TICKET FILTER\n\nFilters results to include only:\n✓ Tickets with status = 'open'\n\nRejected:\n✗ Closed tickets\n✗ On-hold tickets\n✗ Pending tickets\n\nOnly open tickets need SLA monitoring"
      }
    },
    {
      "id": "988815d0-084f-411a-9fc7-5d3d4510030b",
      "name": "Notify: No Open Tickets",
      "type": "n8n-nodes-base.slack",
      "position": [
        -1232,
        704
      ]
    },
    {
      "id": "d97ef397-098e-4310-a6aa-742990d45a54",
      "name": "✅ Clear Alert",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1216,
        864
      ],
      "parameters": {
        "width": 280,
        "height": 280,
        "content": "✅ NO TICKETS ALERT\n\nSent when no open tickets found:\n• Channel: general-information\n• Confirms all tickets resolved\n• Provides status update\n\nHelps team stay informed of workload status"
      }
    },
    {
      "id": "6d07f0c0-c2f8-491f-b6b0-677d658ce8b4",
      "name": "Calculate SLA Time Remaining",
      "type": "n8n-nodes-base.function",
      "position": [
        -1232,
        512
      ]
    },
    {
      "id": "c90f88a5-4da2-4ff0-a7a8-e3b06629d817",
      "name": "⏱️ SLA Calculation",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1408,
        144
      ],
      "parameters": {
        "width": 280,
        "height": 340,
        "content": "⏱️ SLA CALCULATION\n\nFor each ticket, calculates:\n\n1. Total SLA Duration:\n   slaTotal = sla_due - created_at\n\n2. Time Remaining:\n   timeRemainingMs = sla_due - now\n   timeRemainingMinutes = timeRemaini"
      }
    },
    {
      "id": "6235fdfa-6f4f-4d05-a81f-3e5fce7b8f41",
      "name": "Prepare Escalation Payload",
      "type": "n8n-nodes-base.set",
      "position": [
        -1008,
        512
      ]
    },
    {
      "id": "0103cb4e-c5da-48e8-bd30-6d69b79a9347",
      "name": "🚨 Escalation",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1056,
        160
      ],
      "parameters": {
        "width": 280,
        "height": 300,
        "content": "🚨 ESCALATION PAYLOAD\n\nPrepares data for high-urgency tickets:\n\nSets priority to: 'High'\nAdds note: 'Auto-prioritised due to SLA nearing breach'\n\nThis payload is sent to:\n→ Update Zendesk ticket\n→ Trig"
      }
    },
    {
      "id": "1ecaf93c-d3ac-454d-a39e-9ef12bf4c13c",
      "name": "🔴 90% Threshold",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -720,
        -160
      ],
      "parameters": {
        "width": 280,
        "height": 280,
        "content": "🔴 CRITICAL THRESHOLD\n\nCondition: percentElapsed ≥ 90%\n\nMeans:\n• 90% of SLA time consumed\n• Only ~10% time remaining\n• Ticket at risk of breach\n• CRITICAL priority\n\nAction: Route to escalation & Zendes"
      }
    },
    {
      "id": "cc40c04a-de71-41fa-9477-ab36fb883b60",
      "name": "🟡 75% Threshold",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -416,
        592
      ],
      "parameters": {
        "width": 280,
        "height": 280,
        "content": "🟡 WARNING THRESHOLD\n\nCondition: percentElapsed ≥ 75%\n\nMeans:\n• 75% of SLA time consumed\n• ~25% time remaining\n• Ticket needs attention\n• WARNING level\n\nAction: Send warning message to Slack for team a"
      }
    },
    {
      "id": "f629e9ff-e0e5-4c28-a804-b4ff35b2452f",
      "name": "Update Zendesk: Warning Priority",
      "type": "n8n-nodes-base.zendesk",
      "position": [
        -784,
        512
      ]
    },
    {
      "id": "e0571751-f696-4dce-9334-c496fc8e4ab7",
      "name": "🔄 Zendesk Update",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -880,
        720
      ],
      "parameters": {
        "width": 280,
        "height": 280,
        "content": "🔄 ZENDESK UPDATE (75%+)\n\nUpdates ticket in Zendesk:\n• Uses ticket ID for targeting\n• Sets priority to 'High'\n• Adds internal note\n• Triggers Zendesk automations\n\nNext: Routes to both escalation and wa"
      }
    },
    {
      "id": "ac4530cf-eed4-4577-b32e-83b720039cac",
      "name": "Update Zendesk: Escalate (90%+)",
      "type": "n8n-nodes-base.zendesk",
      "position": [
        -224,
        160
      ]
    },
    {
      "id": "8334235e-e73e-4e1e-a869-05ea55dcd696",
      "name": "🚨 Zendesk Escalate",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -320,
        -192
      ],
      "parameters": {
        "width": 280,
        "height": 280,
        "content": "🚨 ZENDESK UPDATE (90%+)\n\nUpdates ticket in Zendesk:\n• Uses escalation payload\n• Sets priority to 'High'\n• Adds breach warning note\n• May trigger escalation rules\n\nAction: Notifies support to take imme"
      }
    },
    {
      "id": "67393b6d-e097-45fc-916b-c4367efdc5db",
      "name": "Alert Slack: SLA Warning",
      "type": "n8n-nodes-base.slack",
      "position": [
        -240,
        384
      ]
    },
    {
      "id": "2ff470b8-7e28-436d-b046-9d5eee814001",
      "name": "⚠️ Slack Alert",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -32,
        352
      ],
      "parameters": {
        "width": 280,
        "height": 300,
        "content": "⚠️ SLACK WARNING ALERT\n\nSends to: general-information channel\n\nContains:\n• Ticket ID\n• Time remaining\n• Percentage of SLA elapsed\n• Priority level\n• Action required\n\nTriggers for 75%+ elapsed tickets\n"
      }
    },
    {
      "id": "98d57cf4-7748-4c6a-a459-ba0c0bf7900f",
      "name": "📊 Compliance Log",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -544,
        1056
      ],
      "parameters": {
        "width": 280,
        "height": 300,
        "content": "📊 COMPLIANCE LOGGING\n\nPrepares audit log for each ticket:\n\nData points:\n✓ Ticket ID\n✓ Percentage elapsed\n✓ Time remaining (minutes)\n✓ Timestamp (ISO)\n\nPurpose:\n• Compliance tracking\n• SLA history\n• Au"
      }
    },
    {
      "id": "e786ac7c-4d1b-45ce-ab4e-8103364357f3",
      "name": "Log to Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -144,
        896
      ]
    },
    {
      "id": "c4f11e00-5027-4e1f-b544-f9d444fed3fd",
      "name": "📈 Sheets Logging",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -192,
        1072
      ],
      "parameters": {
        "width": 280,
        "height": 300,
        "content": "📈 GOOGLE SHEETS LOGGING\n\nAppends compliance records to:\nSheet: \"Stripe Data\" (Sheet1)\n\nColumns recorded:\n• ticket_id\n• percent_elapsed\n• time_remaining_minutes\n• timestamp\n\nUsed for:\n✓ Historical anal"
      }
    },
    {
      "id": "6e465ec5-cccd-42a1-8a99-b70a1a9f5737",
      "name": "If ≥ 90% (Escalate)1",
      "type": "n8n-nodes-base.if",
      "position": [
        -560,
        176
      ]
    },
    {
      "id": "0ff34295-27aa-4411-8f06-9d1c5c33ec84",
      "name": "If ≥ 75% (Warn)1",
      "type": "n8n-nodes-base.if",
      "position": [
        -560,
        512
      ]
    },
    {
      "id": "670ef417-71e2-4683-b107-c6e14bc7001e",
      "name": "Prepare Compliance Log1",
      "type": "n8n-nodes-base.function",
      "position": [
        -480,
        896
      ]
    }
  ],
  "connections": {
    "If ≥ 75% (Warn)1": {
      "main": [
        [
          {
            "node": "Alert Slack: SLA Warning",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Trigger Every Hour": {
      "main": [
        [
          {
            "node": "Fetch Open Tickets from Zendesk",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If ≥ 90% (Escalate)1": {
      "main": [
        [
          {
            "node": "Update Zendesk: Escalate (90%+)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Compliance Log1": {
      "main": [
        [
          {
            "node": "Log to Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter: Open Tickets Only": {
      "main": [
        [
          {
            "node": "Calculate SLA Time Remaining",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Notify: No Open Tickets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Escalation Payload": {
      "main": [
        [
          {
            "node": "Update Zendesk: Warning Priority",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Calculate SLA Time Remaining": {
      "main": [
        [
          {
            "node": "Prepare Escalation Payload",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Open Tickets from Zendesk": {
      "main": [
        [
          {
            "node": "Filter: Open Tickets Only",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Zendesk: Warning Priority": {
      "main": [
        [
          {
            "node": "If ≥ 90% (Escalate)1",
            "type": "main",
            "index": 0
          },
          {
            "node": "If ≥ 75% (Warn)1",
            "type": "main",
            "index": 0
          },
          {
            "node": "Prepare Compliance Log1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}