{
  "name": "Automate email responses with GPT-4o-mini and human review in Gmail",
  "nodes": [
    {
      "id": "8129d250-e99b-48ea-a3a5-e9fb4728a623",
      "name": "Send for Review",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1840,
        1536
      ]
    },
    {
      "id": "7e7642e7-0635-43e0-a608-f2262717a9fb",
      "name": "✅ Send to Customer",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2336,
        1360
      ]
    },
    {
      "id": "41f86e19-ffba-49aa-b83a-bbd62a648171",
      "name": "IF Approved?",
      "type": "n8n-nodes-base.if",
      "position": [
        2048,
        1536
      ]
    },
    {
      "id": "bfed408e-b2ba-4a17-9260-d8a4c3dfc12c",
      "name": "Gmail Trigger1",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        864,
        1552
      ]
    },
    {
      "id": "6e872edb-3a18-42d3-8c15-af2e1d92eee8",
      "name": "No Operation, do nothing1",
      "type": "n8n-nodes-base.noOp",
      "position": [
        1296,
        1744
      ]
    },
    {
      "id": "29cbeac3-9b59-4dce-82d0-3a74e343c662",
      "name": "OpenAI Chat Model (for Classifier)",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1088,
        1744
      ]
    },
    {
      "id": "c444e590-b47d-4b90-aa8b-68a0e81ad61c",
      "name": "Classify Potential Leads",
      "type": "@n8n/n8n-nodes-langchain.textClassifier",
      "position": [
        1088,
        1552
      ]
    },
    {
      "id": "e3610bb3-ce48-4c4b-aa0c-f1004f02a85b",
      "name": "Basic LLM Chain",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        1488,
        1536
      ]
    },
    {
      "id": "12714d3d-ee8a-4daa-a9e1-717404404c6a",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1632,
        1744
      ]
    },
    {
      "id": "9df68f69-8cc9-46a5-869d-5f03310381a4",
      "name": "OpenAI Chat Model (for LLM Chain)",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1488,
        1744
      ]
    },
    {
      "id": "e6f54c9a-d971-460d-8549-d3369a19c52f",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        848,
        1296
      ],
      "parameters": {
        "width": 540,
        "height": 220,
        "content": "### Phase 1: Email Intake & Classification\n\n1.  **Gmail Trigger**: Watches for new emails.\n2.  **Classify Potential Leads**: Uses AI to check if the email is a potential lead. If not, the workflow sto"
      }
    },
    {
      "id": "0d8ac3be-a67b-4835-9430-8c20141b655a",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1440,
        1104
      ],
      "parameters": {
        "width": 540,
        "height": 400,
        "content": "### Phase 2: AI Draft Generation\n\n-   **Basic LLM Chain**: The core AI agent. It receives the customer's email (and human feedback if it's a revision) and generates a reply.\n\n-   **OpenAI Chat Model**"
      }
    },
    {
      "id": "5062a472-a4f6-49a5-8664-d62153579b38",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1800,
        1040
      ],
      "parameters": {
        "width": 540,
        "height": 460,
        "content": "### Phase 3: Human Review & Loop\n\n1.  **Send for Review**: Sends the AI-generated draft to a human for approval. The workflow **pauses** here until a reply is received.\n\n2.  **IF Approved?**: Checks t"
      }
    },
    {
      "id": "5fa2379e-4a6f-474c-83b5-4b533e54b6d0",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2296,
        1120
      ],
      "parameters": {
        "width": 540,
        "height": 200,
        "content": "### Phase 4: Final Action\n\n-   **✅ Send to Customer**: Once approved, this node sends the final, polished email to the original customer."
      }
    }
  ],
  "connections": {
    "IF Approved?": {
      "main": [
        [
          {
            "node": "✅ Send to Customer",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Basic LLM Chain",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gmail Trigger1": {
      "main": [
        [
          {
            "node": "Classify Potential Leads",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Basic LLM Chain": {
      "main": [
        [
          {
            "node": "Send for Review",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send for Review": {
      "main": [
        [
          {
            "node": "IF Approved?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Classify Potential Leads": {
      "main": [
        [
          {
            "node": "Basic LLM Chain",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "No Operation, do nothing1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Basic LLM Chain",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model (for LLM Chain)": {
      "ai_languageModel": [
        [
          {
            "node": "Basic LLM Chain",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model (for Classifier)": {
      "ai_languageModel": [
        [
          {
            "node": "Classify Potential Leads",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    }
  }
}