{
  "name": "Gmail smart auto-responder with GPT-4o and Google Drive context memory",
  "nodes": [
    {
      "id": "gmail-trigger-001",
      "name": "Gmail Trigger",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        560,
        400
      ]
    },
    {
      "id": "drive-download-001",
      "name": "Google Drive - Download Profile",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        760,
        260
      ]
    },
    {
      "id": "gmail-thread-001",
      "name": "Gmail - Fetch Thread",
      "type": "n8n-nodes-base.gmail",
      "position": [
        760,
        540
      ]
    },
    {
      "id": "profile-loader-001",
      "name": "Profile Document Loader",
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "position": [
        980,
        260
      ]
    },
    {
      "id": "thread-loader-001",
      "name": "Thread Document Loader",
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "position": [
        980,
        540
      ]
    },
    {
      "id": "profile-splitter-001",
      "name": "Profile Text Splitter",
      "type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
      "position": [
        1200,
        260
      ]
    },
    {
      "id": "thread-splitter-001",
      "name": "Thread Text Splitter",
      "type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
      "position": [
        1200,
        540
      ]
    },
    {
      "id": "openai-embeddings-001",
      "name": "OpenAI Embeddings",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        1420,
        400
      ]
    },
    {
      "id": "vector-store-001",
      "name": "Simple Vector Store",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreInMemory",
      "position": [
        1640,
        400
      ]
    },
    {
      "id": "prepare-context-001",
      "name": "Prepare Agent Context",
      "type": "n8n-nodes-base.set",
      "position": [
        1860,
        400
      ]
    },
    {
      "id": "openai-chat-001",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        2080,
        580
      ]
    },
    {
      "id": "simple-memory-001",
      "name": "Simple Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        2180,
        580
      ]
    },
    {
      "id": "vector-retriever-001",
      "name": "Vector Store Retriever",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreInMemory",
      "position": [
        2280,
        580
      ]
    },
    {
      "id": "email-agent-001",
      "name": "Email Reply Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        2080,
        400
      ]
    },
    {
      "id": "check-response-001",
      "name": "Check If Reply Needed",
      "type": "n8n-nodes-base.if",
      "position": [
        2400,
        400
      ]
    },
    {
      "id": "create-draft-001",
      "name": "Gmail - Create Draft",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2680,
        400
      ]
    },
    {
      "id": "error-handler-001",
      "name": "Error Handler",
      "type": "n8n-nodes-base.code",
      "position": [
        2400,
        600
      ]
    },
    {
      "id": "sticky-note-001",
      "name": "Workflow Instructions",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        200,
        200
      ],
      "parameters": {
        "width": 300,
        "height": 400,
        "content": "# Gmail Auto-Reply with AI\n\n## Setup Required:\n1. **Gmail OAuth2** credentials\n2. **Google Drive OAuth2** credentials  \n3. **OpenAI API** credentials\n4. **Profile Document**: Update YOUR_PROFILE_DOC_F"
      }
    }
  ],
  "connections": {
    "Gmail Trigger": {
      "main": [
        [
          {
            "node": "Google Drive - Download Profile",
            "type": "main",
            "index": 0
          },
          {
            "node": "Gmail - Fetch Thread",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "Email Reply Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Email Reply Agent": {
      "main": [
        [
          {
            "node": "Check If Reply Needed",
            "type": "main",
            "index": 0
          }
        ]
      ],
      "error": [
        [
          {
            "node": "Error Handler",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Email Reply Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Embeddings": {
      "ai_embedding": [
        [
          {
            "node": "Simple Vector Store",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Simple Vector Store": {
      "main": [
        [
          {
            "node": "Prepare Agent Context",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gmail - Create Draft": {
      "error": [
        [
          {
            "node": "Error Handler",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gmail - Fetch Thread": {
      "main": [
        [
          {
            "node": "Thread Document Loader",
            "type": "main",
            "index": 0
          }
        ]
      ],
      "error": [
        [
          {
            "node": "Error Handler",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Thread Text Splitter": {
      "ai_textSplitter": [
        [
          {
            "node": "Thread Document Loader",
            "type": "ai_textSplitter",
            "index": 0
          }
        ]
      ]
    },
    "Check If Reply Needed": {
      "main": [
        [
          {
            "node": "Gmail - Create Draft",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Agent Context": {
      "main": [
        [
          {
            "node": "Email Reply Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Profile Text Splitter": {
      "ai_textSplitter": [
        [
          {
            "node": "Profile Document Loader",
            "type": "ai_textSplitter",
            "index": 0
          }
        ]
      ]
    },
    "Thread Document Loader": {
      "ai_document": [
        [
          {
            "node": "Simple Vector Store",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "Vector Store Retriever": {
      "ai_tool": [
        [
          {
            "node": "Email Reply Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Profile Document Loader": {
      "ai_document": [
        [
          {
            "node": "Simple Vector Store",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "Google Drive - Download Profile": {
      "main": [
        [
          {
            "node": "Profile Document Loader",
            "type": "main",
            "index": 0
          }
        ]
      ],
      "error": [
        [
          {
            "node": "Error Handler",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}