{
  "id": "PnHpEx6RLOUq1OxL",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Monitor daily HR actions, blockers, and risks using Monday.com and AI",
  "tags": [],
  "nodes": [
    {
      "id": "d8e51aa5-4e2e-43ae-b9b8-1609433235c7",
      "name": "Daily Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        912,
        48
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 8,
              "triggerAtMinute": 30
            }
          ]
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "02da8712-1458-4ecb-8f29-7db9acd82d4e",
      "name": "Get HR Tasks",
      "type": "n8n-nodes-base.mondayCom",
      "position": [
        1104,
        48
      ],
      "parameters": {
        "boardId": "5025720609",
        "groupId": "new_group29179",
        "resource": "boardItem",
        "operation": "getAll",
        "returnAll": true
      },
      "credentials": {
        "mondayComApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "6990340d-bbba-4b76-8112-822c4460721d",
      "name": "Filter Active Tasks",
      "type": "n8n-nodes-base.code",
      "position": [
        1312,
        48
      ],
      "parameters": {
        "jsCode": "return items.filter(item => {\n  const status = item.json.column_values.find(c => c.type === 'status')?.text;\n  return status && status !== 'Done';\n});"
      },
      "typeVersion": 2
    },
    {
      "id": "67dc4656-f58a-4cf3-96ed-bdf9055fa910",
      "name": "Transform Tasks",
      "type": "n8n-nodes-base.code",
      "position": [
        1504,
        48
      ],
      "parameters": {
        "jsCode": "return [{\n  json: {\n    tasks: items.map(i => ({\n      name: i.json.name,\n      owner: i.json.column_values[1]?.text || null,\n      status: i.json.column_values.find(c => c.type === 'status')?.text,\n      due_date: i.json.column_values.find(c => c.type === 'date')?.text\n    }))\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "1d9a50e7-6027-448b-a4c6-38bb8faf8821",
      "name": "Build HR Metrics",
      "type": "n8n-nodes-base.code",
      "position": [
        1712,
        48
      ],
      "parameters": {
        "jsCode": "const today = new Date();\nlet overdue = [], stuck = [], unassigned = [];\n\nfor (const t of items[0].json.tasks) {\n  if (!t.owner) unassigned.push(t);\n  if (t.status === 'Stuck') stuck.push(t);\n  if (t.due_date) {\n    const due = new Date(t.due_date);\n    const days = Math.floor((today - due) / 86400000);\n    if (days > 2) overdue.push({ ...t, days_overdue: days });\n  }\n}\n\nreturn [{\n  json: {\n    tasks: items[0].json.tasks,\n    metrics: {\n      overdue_count: overdue.length,\n      stuck_count: stuck.length,\n      unassigned_count: unassigned.length,\n      overdue,\n      stuck,\n      unassigned\n    }\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "f63f0bc6-b7c1-4d53-ab33-29a6e9e81ceb",
      "name": "Any HR Risks?",
      "type": "n8n-nodes-base.if",
      "position": [
        1936,
        48
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 1,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "da3369d0-08b8-4183-88d4-372b6546ac5a",
              "operator": {
                "type": "number",
                "operation": "gt"
              },
              "leftValue": "={{ $json.metrics.overdue_count + $json.metrics.stuck_count + $json.metrics.unassigned_count }}",
              "rightValue": 0
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "17b4f20f-50e8-4037-833f-a4c8f9d5ae5f",
      "name": "AI Risk Report",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        2176,
        -80
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "GPT-4O-MINI"
        },
        "options": {},
        "responses": {
          "values": [
            {
              "role": "system",
              "content": "You are an HR operations analyst."
            },
            {
              "content": "=Generate an HR Risk Report with:\n1. Critical blockers\n2. Overdue tasks with days overdue\n3. Unassigned tasks\n4. Recommended HR actions\n\nData:\n{{ JSON.stringify($json.metrics, null, 2) }}"
            }
          ]
        },
        "builtInTools": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "04ff3e39-4eb5-46af-9573-ec843d641108",
      "name": "AI Daily Summary",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        2176,
        160
      ],
      "parameters": {
        "modelId": "gpt-4o-mini",
        "options": {},
        "responses": {
          "values": [
            {
              "role": "system",
              "content": "You are an HR operations assistant."
            },
            {
              "content": "Create a concise HR daily standup summary grouped by status.\n\nTasks:\n{{ JSON.stringify($json.tasks, null, 2) }}"
            }
          ]
        },
        "builtInTools": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "69f0cb86-e9e9-47af-839a-d270f876e242",
      "name": "Escalation Email",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2480,
        -80
      ],
      "parameters": {
        "sendTo": "user@example.com",
        "message": "={{ $json.output[0].content[0].text }}",
        "options": {},
        "subject": "\ud83d\udea8 HR Risks Detected \u2013 Immediate Action Required",
        "emailType": "text"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "da374b3a-f617-40e2-b58a-7c208ec7f2ad",
      "name": "Daily HR Summary Email",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2512,
        160
      ],
      "parameters": {
        "sendTo": "user@example.com",
        "message": "={{ $json.output[0].content[0].text }}",
        "options": {},
        "subject": "Daily HR Action Summary",
        "emailType": "text"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "e8fd7108-f951-4946-945d-1af775737e37",
      "name": "Workflow overview",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        112,
        -848
      ],
      "parameters": {
        "width": 572,
        "height": 652,
        "content": "## Workflow Overview\n\n\n## How it works\n\nThis workflow monitors active HR tasks from Monday.com and turns them into actionable daily intelligence. It runs on a schedule and fetches all ongoing HR-related items, excluding completed work.\n\nEach task is analyzed to detect operational risks such as overdue deadlines, blocked work, or missing ownership. Based on these signals, the workflow calculates daily HR metrics and decides how the results should be handled.\n\nIf any risks are detected, an escalation report is generated highlighting critical blockers, overdue tasks, and recommended next actions. If no risks are found, a concise daily HR standup summary is created instead.\n\nThe final output is delivered automatically via email, ensuring the HR team and leadership stay aligned on priorities without manual follow-ups.\n\n## Setup steps\n\n1. Connect your Monday.com account and update the board and column IDs.\n2. Ensure task status values include \u201cDone\u201d and \u201cStuck\u201d.\n3. Connect OpenAI credentials for report generation.\n4. Configure email recipients for normal updates and escalations.\n5. Adjust the schedule trigger timing if needed.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "15c8975f-f533-4237-a645-ce6c9427a4ca",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        880,
        -160
      ],
      "parameters": {
        "color": 7,
        "width": 384,
        "height": 384,
        "content": "### Trigger and Data Source\n\nThis workflow runs daily and fetches active HR tasks from Monday.com.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "2949157a-5500-41f1-860b-35deee4e59af",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1280,
        -160
      ],
      "parameters": {
        "color": 7,
        "width": 352,
        "height": 384,
        "content": "### Task filtering and preparation\n\nFilters out completed tasks and prepares HR task data for analysis.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "20d6f166-3740-49c6-8565-40e080cc4434",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1648,
        -160
      ],
      "parameters": {
        "color": 7,
        "width": 448,
        "height": 384,
        "content": "### Risk Detection and Metrics\n\nChecks for overdue, stuck, and unassigned tasks and builds HR risk metrics.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "6f93321d-5c99-43ee-9a2d-88ad3906dd93",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2128,
        -272
      ],
      "parameters": {
        "color": 7,
        "width": 544,
        "height": 624,
        "content": "### AI analysis and decision\n\nUses AI to decide whether there are HR risks or a normal daily update. And \nsends escalation emails if risks exist or a daily summary if everything is on track."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "b879fc3a-785b-4ea1-8659-0e1be4293c8a",
  "connections": {
    "Get HR Tasks": {
      "main": [
        [
          {
            "node": "Filter Active Tasks",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Any HR Risks?": {
      "main": [
        [
          {
            "node": "AI Risk Report",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "AI Daily Summary",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Daily Trigger": {
      "main": [
        [
          {
            "node": "Get HR Tasks",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Risk Report": {
      "main": [
        [
          {
            "node": "Escalation Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Transform Tasks": {
      "main": [
        [
          {
            "node": "Build HR Metrics",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Daily Summary": {
      "main": [
        [
          {
            "node": "Daily HR Summary Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build HR Metrics": {
      "main": [
        [
          {
            "node": "Any HR Risks?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter Active Tasks": {
      "main": [
        [
          {
            "node": "Transform Tasks",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}