Alert when support tickets wait too long

Every 30 minutes, find open tickets past their response target and post them to your support channel.

Easy Saves ~3 hours/month Customer SupportBy Flowngn team

Works with n8n · Make · Zapier

How it works

Trigger: Schedule — every 30 minutes
  1. Read the Tickets sheet (id, subject, status, priority, created at, assignee).
  2. Compare each open ticket's age with its target: 1h urgent, 4h high, 24h normal.
  3. Post the late tickets to Slack, oldest first.

Diagram

Every 30 minutesSchedule TriggerGRead ticketsGoogle Sheets{ }Past response targetCodeSAlert supportSlack
Trigger App Code

Code

JavaScript used in the Code step — already included in the template below.

Past response target · Code node
// Tickets sheet columns: id | customer | subject | status | priority | created_at (ISO) | assignee
// Finds open tickets older than their response target.
const TARGET_HOURS = { urgent: 1, high: 4, normal: 24, low: 48 };
const HOUR = 60 * 60 * 1000;

const late = $input.all()
  .map((item) => item.json)
  .filter((t) => ["open", "new"].includes(String(t.status).toLowerCase()))
  .map((t) => {
    const priority = String(t.priority || "normal").toLowerCase();
    const hours = Math.floor((Date.now() - new Date(t.created_at)) / HOUR);
    return { ...t, priority, hours, target: TARGET_HOURS[priority] ?? 24 };
  })
  .filter((t) => t.hours >= t.target)
  .sort((a, b) => b.hours - a.hours);

if (!late.length) return [];

const message =
  `⏰ ${late.length} ticket${late.length > 1 ? "s" : ""} past the response target:\n` +
  late.map((t) => `• #${t.id} ${t.subject} (${t.priority}, ${t.hours}h, ${t.assignee || "unassigned"})`).join("\n");

return [{ json: { message } }];

Build it

Pick your tool — same automation, step by step.

Copy and paste straight into an n8n canvas (Ctrl+V), or download and use Import from File. Then connect your own credentials and replace every YOUR_… placeholder.

Workflow JSON
Show code (140 lines)
{
  "name": "Alert when support tickets wait too long (Flowngn)",
  "nodes": [
    {
      "parameters": {
        "content": "## Alert when support tickets wait too long\nEvery 30 minutes, find open tickets past their response target and post them to your support channel.\n\n**Setup**\n1. Open each node and connect your own credentials.\n2. Replace every YOUR_… placeholder.\n3. Test once, then activate.\n\nFree template from Flowngn",
        "height": 260,
        "width": 340
      },
      "id": "45821f1c-7a2a-4a1b-a1b8-08dd9ee50303",
      "name": "Setup notes",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -420,
        -60
      ]
    },
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "minutes",
              "minutesInterval": 30
            }
          ]
        }
      },
      "id": "45821f1c-7a2a-4a1b-a1b8-08dd9ee50303",
      "name": "Every 30 minutes",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [
        0,
        0
      ]
    },
    {
      "parameters": {
        "operation": "read",
        "documentId": {
          "__rl": true,
          "value": "YOUR_SPREADSHEET_ID",
          "mode": "id"
        },
        "sheetName": {
          "__rl": true,
          "value": "Tickets",
          "mode": "name"
        },
        "options": {}
      },
      "id": "45821f1c-7a2a-4a1b-a1b8-08dd9ee50303",
      "name": "Read tickets",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.5,
      "position": [
        300,
        0
      ]
    },
    {
      "parameters": {
        "jsCode": "// Tickets sheet columns: id | customer | subject | status | priority | created_at (ISO) | assignee\n// Finds open tickets older than their response target.\nconst TARGET_HOURS = { urgent: 1, high: 4, normal: 24, low: 48 };\nconst HOUR = 60 * 60 * 1000;\n\nconst late = $input.all()\n  .map((item) => item.json)\n  .filter((t) => [\"open\", \"new\"].includes(String(t.status).toLowerCase()))\n  .map((t) => {\n    const priority = String(t.priority || \"normal\").toLowerCase();\n    const hours = Math.floor((Date.now() - new Date(t.created_at)) / HOUR);\n    return { ...t, priority, hours, target: TARGET_HOURS[priority] ?? 24 };\n  })\n  .filter((t) => t.hours >= t.target)\n  .sort((a, b) => b.hours - a.hours);\n\nif (!late.length) return [];\n\nconst message =\n  `⏰ ${late.length} ticket${late.length > 1 ? \"s\" : \"\"} past the response target:\\n` +\n  late.map((t) => `• #${t.id} ${t.subject} (${t.priority}, ${t.hours}h, ${t.assignee || \"unassigned\"})`).join(\"\\n\");\n\nreturn [{ json: { message } }];"
      },
      "id": "45821f1c-7a2a-4a1b-a1b8-08dd9ee50303",
      "name": "Past response target",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        600,
        0
      ]
    },
    {
      "parameters": {
        "select": "channel",
        "channelId": {
          "__rl": true,
          "value": "#support",
          "mode": "name"
        },
        "text": "={{ $json.message }}",
        "otherOptions": {}
      },
      "id": "45821f1c-7a2a-4a1b-a1b8-08dd9ee50303",
      "name": "Alert support",
      "type": "n8n-nodes-base.slack",
      "typeVersion": 2.2,
      "position": [
        900,
        0
      ]
    }
  ],
  "connections": {
    "Every 30 minutes": {
      "main": [
        [
          {
            "node": "Read tickets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read tickets": {
      "main": [
        [
          {
            "node": "Past response target",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Past response target": {
      "main": [
        [
          {
            "node": "Alert support",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "meta": {
    "templateCredsSetupCompleted": false
  },
  "tags": []
}

Open in the playground to edit →

Tips

  • Change the targets in the Code step to match your promises to customers.

Related flows