{
  "id": "c7a23a35-b929-4538-8497-0f06b48c788b",
  "name": "Draft-Only Email Triage",
  "nodes": [
    {
      "parameters": {
        "content": "# Reviewed Harshith.com template\n\nClassifies a sample email and drafts a reply for human review. It does not connect to an inbox or send email.\n\nAttach your own OpenAI credential. Replace the sample only with messages you are allowed to process, keep sensitive data out of prompts where possible, and verify every draft. This export contains no credentials, deployment-specific IDs, webhook IDs, or pinned data.",
        "height": 350,
        "width": 460,
        "color": 7
      },
      "id": "triage-note-001",
      "name": "Read Me First",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [-760, -330]
    },
    {
      "parameters": {},
      "id": "triage-trigger-001",
      "name": "Run Manually",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [-640, 60]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "triage-sender-field",
              "name": "sender",
              "type": "string",
              "value": "customer@example.com"
            },
            {
              "id": "triage-subject-field",
              "name": "subject",
              "type": "string",
              "value": "Question about the onboarding checklist"
            },
            {
              "id": "triage-body-field",
              "name": "body",
              "type": "string",
              "value": "Hi, could you clarify which documents I should prepare before our onboarding call? Thanks."
            }
          ]
        },
        "options": {}
      },
      "id": "triage-fixture-001",
      "name": "Provide Approved Email Text",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [-380, 60]
    },
    {
      "parameters": {
        "jsCode": "const email = $input.first().json;\nconst redact = (value) => String(value || '')\n  .replace(/[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,}/gi, '[email redacted]')\n  .replace(/\\+?\\d[\\d\\s().-]{7,}\\d/g, '[phone redacted]')\n  .slice(0, 5000);\n\nreturn [{ json: {\n  prompt: `Classify this email as one of: support, sales, scheduling, billing, or other. Then draft a concise reply. Do not promise an action, price, deadline, refund, or outcome that is not in the email. Return JSON with category, urgency, summary, and draftReply.\\n\\nSubject: ${redact(email.subject)}\\nBody: ${redact(email.body)}`,\n  status: 'draft_only'\n} }];"
      },
      "id": "triage-redact-001",
      "name": "Redact and Bound Input",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [-100, 60]
    },
    {
      "parameters": {
        "messages": {
          "values": [
            {
              "role": "user",
              "content": "={{ $json.prompt }}"
            }
          ]
        },
        "modelId": {
          "__rl": true,
          "value": "gpt-4o-mini",
          "mode": "list",
          "cachedResultName": "gpt-4o-mini"
        },
        "jsonOutput": true,
        "options": {
          "temperature": 0.2
        }
      },
      "id": "triage-openai-001",
      "name": "Draft Triage with OpenAI",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 1.8,
      "position": [180, 60]
    }
  ],
  "connections": {
    "Run Manually": {
      "main": [[{"node": "Provide Approved Email Text", "type": "main", "index": 0}]]
    },
    "Provide Approved Email Text": {
      "main": [[{"node": "Redact and Bound Input", "type": "main", "index": 0}]]
    },
    "Redact and Bound Input": {
      "main": [[{"node": "Draft Triage with OpenAI", "type": "main", "index": 0}]]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1",
    "saveDataErrorExecution": "none",
    "saveDataSuccessExecution": "none",
    "saveManualExecutions": false,
    "executionTimeout": 60
  },
  "tags": []
}
