{
  "name": "Email a weekly digest of hiring manager feedback on your shortlists",
  "nodes": [
    {
      "name": "About this template",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "parameters": {
        "content": "## A weekly email of what hiring managers said about your shortlists\n\nHiring managers review the shortlists you share from SourceGeek: a yes, a no or a maybe per candidate, with a comment. Every Friday afternoon this workflow collects the verdicts of the past seven days across your recent shortlists and emails you one digest, so nothing waits in a shared link.\n\nSet your address in the **Email the digest** node.\n\nCredits: none.\n\n### Set up\n1. Install the community node **n8n-nodes-sourcegeek** (Settings → Community nodes).\n2. In SourceGeek, create an API key under Settings → Connected apps → API keys, and add it as a **SourceGeek API** credential. No account yet? [Start a free 14-day trial](https://chat.sourcegeek.com/sign-up?utm_source=n8n&utm_medium=template&utm_campaign=n8n_templates&utm_content=shortlist-feedback-digest-email).\n\nMore SourceGeek templates: https://www.sourcegeek.com/en/templates#shortlist-feedback-digest-email",
        "height": 460,
        "width": 440,
        "color": 5
      },
      "id": "d88284ad-626e-480f-ac50-5cf178829401",
      "position": [
        0,
        120
      ]
    },
    {
      "name": "Every Friday at 16:00",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "weeks",
              "triggerAtDay": [
                5
              ],
              "triggerAtHour": 16
            }
          ]
        }
      },
      "id": "c4dde3ac-9226-45ee-a53b-b5710d5ef421",
      "position": [
        520,
        300
      ]
    },
    {
      "name": "Recent shortlists",
      "type": "n8n-nodes-sourcegeek.sourcegeek",
      "typeVersion": 2,
      "parameters": {
        "resource": "sheet",
        "operation": "list_artifacts",
        "additionalFields": {
          "kind": "text",
          "limit": 20
        }
      },
      "id": "6055275a-f232-4d8b-a4e0-a0aa0f1bd76a",
      "position": [
        760,
        300
      ]
    },
    {
      "name": "One item per shortlist",
      "type": "n8n-nodes-base.splitOut",
      "typeVersion": 1,
      "parameters": {
        "fieldToSplitOut": "artifacts",
        "options": {}
      },
      "id": "b63e9575-8031-4da8-aac8-53429ba92753",
      "position": [
        1000,
        300
      ]
    },
    {
      "name": "Read the feedback",
      "type": "n8n-nodes-sourcegeek.sourcegeek",
      "typeVersion": 2,
      "parameters": {
        "resource": "sheet",
        "operation": "read_shortlist_feedback",
        "additionalFields": {
          "artifactId": "={{ $json.id }}"
        }
      },
      "onError": "continueRegularOutput",
      "id": "787f7af6-e2f2-48d8-a2d8-f8a13b46ce45",
      "position": [
        1240,
        300
      ]
    },
    {
      "name": "Write the digest",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "parameters": {
        "jsCode": "// Keeps the verdicts given in the last seven days and writes one digest.\nconst since = Date.now() - 7 * 24 * 60 * 60 * 1000;\nconst sections = [];\nfor (const { json } of $input.all()) {\n  const lines = [];\n  for (const entry of json.feedback ?? []) {\n    for (const review of entry.reviews) {\n      if (review.updatedAt < since) continue;\n      const comment = review.comment ? `: \"${review.comment}\"` : \"\";\n      lines.push(`- ${entry.candidate}: ${review.decision} (${review.author})${comment}`);\n    }\n  }\n  if (lines.length) sections.push(`${json.title}\\n${json.url}\\n${lines.join(\"\\n\")}`);\n}\nif (!sections.length) return [];\nreturn [{ json: { count: sections.length, body: sections.join(\"\\n\\n\") } }];"
      },
      "id": "4f20fb8c-df07-4c24-a6d8-60e06c58ab09",
      "position": [
        1480,
        300
      ]
    },
    {
      "name": "Email the digest",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.1,
      "parameters": {
        "sendTo": "you@example.com",
        "subject": "=Shortlist feedback this week ({{ $json.count }} shortlists)",
        "emailType": "text",
        "message": "=Here is what hiring managers said about your shortlists this week.\n\n{{ $json.body }}",
        "options": {}
      },
      "id": "908d784a-8b82-465f-af47-a7f4ffda705a",
      "position": [
        1720,
        300
      ]
    }
  ],
  "pinData": {},
  "connections": {
    "Every Friday at 16:00": {
      "main": [
        [
          {
            "node": "Recent shortlists",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Recent shortlists": {
      "main": [
        [
          {
            "node": "One item per shortlist",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "One item per shortlist": {
      "main": [
        [
          {
            "node": "Read the feedback",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read the feedback": {
      "main": [
        [
          {
            "node": "Write the digest",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Write the digest": {
      "main": [
        [
          {
            "node": "Email the digest",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "meta": {
    "templateCredsSetupCompleted": false
  },
  "tags": []
}
