{
  "name": "LeadInboxTriageBot_GT",
  "nodes": [
    {
      "parameters": {
        "content": "# Phase 1 \u00b7 Workflow Foundation & Gmail Trigger\n## Lead Inbox Triage Bot \u2014 Grootan Internal Training (batch `batch-may-2026`)\n\n**Trainee:** `<initials = GT>`\n\n**This phase builds:** Gmail credentials, a polling Gmail Trigger on the test INBOX label (marks emails as read after capture), and a `Config` Set node holding tenant settings. No classification yet \u2014 that lands in Phase 2.\n\n_See `docs/PHASES.md` for the acceptance criteria for this phase._",
        "height": 160,
        "width": 1180,
        "color": 7
      },
      "id": "5f373d38-da65-47a7-860f-300e9aa70f2a",
      "name": "Section_PhaseBanner",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        40,
        40
      ]
    },
    {
      "parameters": {
        "content": "# \ud83d\udfe1 Trigger\nGmail polls INBOX every 1 min and marks captured emails as read so they aren't re-processed on retry.",
        "height": 160,
        "width": 300,
        "color": 5
      },
      "id": "395ad2d3-3985-490b-af56-c9d6e470cb7b",
      "name": "Section_Trigger",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        400,
        220
      ]
    },
    {
      "parameters": {
        "content": "# \ud83e\ude77 Config\nSingle source of truth for spreadsheetId, Slack channels, model, signature, batch name.",
        "height": 160,
        "width": 300,
        "color": 4
      },
      "id": "131b490f-211b-40c6-aef4-a07eb1ab6829",
      "name": "Section_Config",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        400,
        420
      ]
    },
    {
      "parameters": {
        "content": "# Future sections (built in Phases 2\u20135)\n\u2192 **Prompts** | **Pre-process** | **Classify** | **Route** | **Log** | **Draft & Notify** | **Errors**",
        "height": 120,
        "width": 420,
        "color": 3
      },
      "id": "311d63e8-dfb9-4885-b6b6-bc4565123713",
      "name": "Section_Future",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        800,
        220
      ]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "caf90cc3-4e37-40c8-9737-c47e76a44e0e",
              "name": "spreadsheetId",
              "type": "string",
              "value": "REPLACE_WITH_YOUR_GOOGLE_SHEET_ID"
            },
            {
              "id": "0ac22a8f-95da-4383-a04d-a0cbb2b83b39",
              "name": "slackChannel",
              "type": "string",
              "value": "#training-leads"
            },
            {
              "id": "a116ee9f-0d5b-4dd2-a2af-d8afc9d9e783",
              "name": "slackErrorChannel",
              "type": "string",
              "value": "#training-leads-errors"
            },
            {
              "id": "a4f6c6c3-49ac-4685-9514-25a0cda89792",
              "name": "model",
              "type": "string",
              "value": "gpt-4o-mini"
            },
            {
              "id": "c19f6047-e83f-4c37-a91b-06f84919d657",
              "name": "temperature",
              "type": "number",
              "value": 0.1
            },
            {
              "id": "18e3596e-7f32-4480-99fe-91b557beb001",
              "name": "signature",
              "type": "string",
              "value": "\u2014 Grootan Team\n+91-44-XXXX-XXXX | grootan.com"
            },
            {
              "id": "88bd98c1-34d1-4ed0-b807-5f6c684f0e19",
              "name": "batch",
              "type": "string",
              "value": "batch-may-2026"
            }
          ]
        },
        "options": {}
      },
      "id": "3fc5eb98-1ac8-4677-9214-d7ae469b3680",
      "name": "Config",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3,
      "position": [
        800,
        460
      ],
      "notes": "Tenant-style settings. Point spreadsheetId / Slack channels / model / signature here. Prompts live in the separate 'Prompts' Set node.",
      "notesInFlow": true
    },
    {
      "parameters": {
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "simple": false,
        "filters": {
          "labelIds": [
            "INBOX"
          ],
          "readStatus": "unread"
        },
        "options": {
          "downloadAttachments": false,
          "markAsRead": true
        }
      },
      "id": "7be4d5f0-99b8-41a0-a2ba-000c7d2e0e6b",
      "name": "Watch inbox",
      "type": "n8n-nodes-base.gmailTrigger",
      "typeVersion": 1,
      "position": [
        800,
        280
      ],
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "notes": "Polls INBOX every 1 minute. options.markAsRead=true so the same email is not re-processed on retry. continueOnFail=false; Gmail Triggers do not support n8n-level retries (see RUNBOOK \u00a73).",
      "notesInFlow": true
    }
  ],
  "connections": {
    "Watch inbox": {
      "main": [
        [
          {
            "node": "Config",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1",
    "timezone": "Asia/Kolkata",
    "saveExecutionProgress": true,
    "saveManualExecutions": true,
    "saveDataErrorExecution": "all",
    "saveDataSuccessExecution": "all"
  },
  "tags": [
    {
      "name": "training"
    },
    {
      "name": "lead-triage"
    },
    {
      "name": "phase-1"
    },
    {
      "name": "batch-may-2026"
    }
  ],
  "meta": {
    "templateCredsSetupCompleted": true,
    "description": "Lead Inbox Triage Bot \u2014 production-style n8n automation. Watches a test Gmail inbox every minute, classifies each new email with an LLM into LEAD/SUPPORT/SPAM/OTHER (strict JSON), logs to a Google Sheets CRM with idempotent appends, drafts (NEVER sends) a personalised reply for genuine sales leads, and posts a Block-Kit lead card to Slack. Failures route to a separate ErrorTrigger sub-workflow that logs to an 'errors' tab and pings Slack.\n\nPhase 1 \u2014 Gmail trigger and Config only."
  }
}