{
  "id": "6kWGpj8iVL3bcWJf",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Weekly hiring\u2011manager snapshot from Breezy HR to email (pipeline, next\u2011week interviews, stuck)",
  "tags": [],
  "nodes": [
    {
      "id": "3383267a-a4b5-42b6-9579-d180e67999a4",
      "name": "Trigger Weekly",
      "type": "n8n-nodes-base.cron",
      "position": [
        336,
        352
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "39cd0585-618f-45ec-a8de-7b18563f313c",
      "name": "Set Config",
      "type": "n8n-nodes-base.set",
      "position": [
        688,
        352
      ],
      "parameters": {
        "values": {
          "string": [
            {
              "name": "BREEZY_API_BASE",
              "value": "https://api.breezy.hr/v3"
            },
            {
              "name": "COMPANY_ID",
              "value": "your-company-id"
            },
            {
              "name": "TIMEZONE",
              "value": "Asia/Kolkata"
            },
            {
              "name": "INCLUDE_ONLY_OPEN",
              "value": "true"
            },
            {
              "name": "USE_BREEZY_HM_DETECTION",
              "value": "true"
            },
            {
              "name": "HM_FALLBACK_MAP_JSON",
              "value": "{\"Default\": \"user@example.com\"}"
            },
            {
              "name": "STUCK_AFTER_DAYS",
              "value": "7"
            },
            {
              "name": "INTERVIEW_EVENT_KEYWORDS_CSV",
              "value": "interview"
            },
            {
              "name": "SMTP_FROM",
              "value": "user@example.com"
            },
            {
              "name": "SUBJECT_TEMPLATE",
              "value": "Weekly HM snapshot {{range}} \u2014 {{positions_count}} roles, {{candidates_count}} candidates"
            },
            {
              "name": "INTRO_TEMPLATE",
              "value": "Here\u2019s your weekly snapshot as of {{now}}."
            },
            {
              "name": "OUTRO_TEMPLATE",
              "value": "Reply to this email if you\u2019d like to adjust your snapshot."
            },
            {
              "name": "DRY_RUN",
              "value": "false"
            },
            {
              "name": "RATE_LIMIT_EMAIL_SECONDS",
              "value": "5"
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "fd336f65-d640-4a4a-ae1d-0c113699582f",
      "name": "Fetch Positions",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1008,
        352
      ],
      "parameters": {
        "url": "={{$json.BREEZY_API_BASE}}/company/{{$json.COMPANY_ID}}/positions",
        "options": {},
        "authentication": "headerAuth"
      },
      "typeVersion": 1
    },
    {
      "id": "76f6ec82-2fe6-45ee-b669-b9384aa93f67",
      "name": "Loop Positions",
      "type": "n8n-nodes-base.function",
      "position": [
        1344,
        352
      ],
      "parameters": {
        "functionCode": "// This is a stub node. You will implement looping over positions here\nreturn items;"
      },
      "typeVersion": 1
    },
    {
      "id": "e2532a5b-fbcc-4f3d-8ede-0ce6894e4a23",
      "name": "Aggregate & Compose Email",
      "type": "n8n-nodes-base.function",
      "position": [
        1696,
        352
      ],
      "parameters": {
        "functionCode": "// Group by HM, aggregate email body\n// Respect DRY_RUN config and return preview or send signal\nreturn items;"
      },
      "typeVersion": 1
    },
    {
      "id": "9ca889ca-ab59-4a7f-926d-ea5c4b4e5c4c",
      "name": "IF Dry Run",
      "type": "n8n-nodes-base.if",
      "position": [
        2064,
        352
      ],
      "parameters": {
        "conditions": {
          "boolean": [
            {
              "value1": "={{$json.DRY_RUN}}",
              "operation": "is true"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "7610ece7-de22-4d33-8099-312c3d7af55a",
      "name": "Preview Output",
      "type": "n8n-nodes-base.function",
      "position": [
        2400,
        224
      ],
      "parameters": {
        "functionCode": "// Output preview summary\nreturn items;"
      },
      "typeVersion": 1
    },
    {
      "id": "dc47930e-847c-44e6-87c3-284f14ab3643",
      "name": "Send Email",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        2400,
        448
      ],
      "parameters": {
        "html": "={{$json.html}}",
        "text": "={{$json.text}}",
        "options": {},
        "subject": "={{$json.subject}}",
        "toEmail": "={{$json.hm_email}}",
        "fromEmail": "={{$json.SMTP_FROM}}"
      },
      "typeVersion": 1
    },
    {
      "id": "a326a809-ea9f-4759-82aa-7598ad8f3acf",
      "name": "Main Overview",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -240,
        -256
      ],
      "parameters": {
        "color": "yellow",
        "width": 448,
        "height": 496,
        "content": "## How it works\n\nThis workflow automatically sends weekly email snapshots to hiring managers with their open positions, upcoming interviews, and stuck candidates. It runs on a schedule, fetches data from Breezy HR, processes each position to identify hiring managers and calculate metrics, then groups everything by hiring manager and sends personalized emails.\n\n## Setup steps\n\n1. Configure the cron trigger for your preferred schedule\n2. Update \"Set Config\" with your Breezy HR API credentials, company ID, and SMTP settings\n3. Set your timezone, hiring manager fallback mapping, and email templates\n4. Test with DRY_RUN=true first, then set to false to enable actual email sending\n5. Configure your SMTP credentials in n8n credentials"
      },
      "typeVersion": 1
    },
    {
      "id": "88c05a18-aad6-4bbf-a98c-c428d9728dd1",
      "name": "Section - Configuration",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        496,
        112
      ],
      "parameters": {
        "color": 7,
        "width": 400,
        "height": 584,
        "content": "## Configuration\n\nSet up your API credentials, company ID, timezone, email templates, and other workflow settings."
      },
      "typeVersion": 1
    },
    {
      "id": "225f4572-d79e-4135-80a6-d5d65b3db7a5",
      "name": "Section - Data Collection",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        944,
        112
      ],
      "parameters": {
        "color": 7,
        "width": 608,
        "height": 584,
        "content": "## Data Collection\n\nFetch all open positions from Breezy HR, then loop through each to extract candidates and identify hiring managers."
      },
      "typeVersion": 1
    },
    {
      "id": "9c90767c-77b4-4d11-bc26-51b4822afce8",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1600,
        112
      ],
      "parameters": {
        "color": 7,
        "width": 1040,
        "height": 592,
        "content": "## Email Delivery\n\nGroup data by hiring manager, compose emails, then either preview (dry run) or send via SMTP.\n"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "26162fdf-404c-4e6c-9ed3-18e42c413a70",
  "connections": {
    "IF Dry Run": {
      "main": [
        [
          {
            "node": "Preview Output",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Config": {
      "main": [
        [
          {
            "node": "Fetch Positions",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Positions": {
      "main": [
        [
          {
            "node": "Aggregate & Compose Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Trigger Weekly": {
      "main": [
        [
          {
            "node": "Set Config",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Positions": {
      "main": [
        [
          {
            "node": "Loop Positions",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate & Compose Email": {
      "main": [
        [
          {
            "node": "IF Dry Run",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}