8
n8n 한국어amn8n.com

Gmail 인공지능 자동 답변기, GPT-4o와 Google Drive 상황 기억 포함

고급

이것은Personal Productivity, AI Chatbot분야의자동화 워크플로우로, 18개의 노드를 포함합니다.주로 If, Set, Code, Gmail, GoogleDrive 등의 노드를 사용하며. Gmail 지능형 자동 답변기, GPT-4o와 Google Drive 상황 기억 포함

사전 요구사항
  • Google 계정 및 Gmail API 인증 정보
  • Google Drive API 인증 정보
  • OpenAI API Key
워크플로우 미리보기
노드 연결 관계를 시각적으로 표시하며, 확대/축소 및 이동을 지원합니다
워크플로우 내보내기
다음 JSON 구성을 복사하여 n8n에 가져오면 이 워크플로우를 사용할 수 있습니다
{
  "meta": {
    "instanceId": "074f90e2bb5206c5f405a8aac6551497c72005283a5405fb08207b1b3a78c2b8",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "gmail-trigger-001",
      "name": "Gmail 트리거",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        560,
        400
      ],
      "parameters": {
        "simple": false,
        "filters": {
          "q": "-from:me"
        },
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        }
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "YOUR_GMAIL_CRED_ID"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "drive-download-001",
      "name": "Google Drive - 프로필 다운로드",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        760,
        260
      ],
      "parameters": {
        "fileId": "YOUR_PROFILE_DOC_FILE_ID",
        "operation": "download"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "YOUR_GOOGLE_DRIVE_CRED_ID"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "gmail-thread-001",
      "name": "Gmail - 스레드 가져오기",
      "type": "n8n-nodes-base.gmail",
      "position": [
        760,
        540
      ],
      "parameters": {
        "threadId": "={{ $json.threadId }}",
        "operation": "getAll"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "YOUR_GMAIL_CRED_ID"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "profile-loader-001",
      "name": "프로필 문서 로더",
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "position": [
        980,
        260
      ],
      "parameters": {
        "options": {
          "metadata": {
            "metadataValues": [
              {
                "name": "type",
                "value": "user_profile"
              }
            ]
          }
        },
        "jsonData": "={{ $json.content }}",
        "jsonMode": "expressionData"
      },
      "typeVersion": 1
    },
    {
      "id": "thread-loader-001",
      "name": "스레드 문서 로더",
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "position": [
        980,
        540
      ],
      "parameters": {
        "options": {
          "metadata": {
            "metadataValues": [
              {
                "name": "type",
                "value": "email_thread"
              }
            ]
          }
        },
        "jsonData": "={{ JSON.stringify($json.messages) }}",
        "jsonMode": "expressionData"
      },
      "typeVersion": 1
    },
    {
      "id": "profile-splitter-001",
      "name": "프로필 텍스트 분할기",
      "type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
      "position": [
        1200,
        260
      ],
      "parameters": {
        "chunkSize": 1000,
        "chunkOverlap": 100
      },
      "typeVersion": 1
    },
    {
      "id": "thread-splitter-001",
      "name": "스레드 텍스트 분할기",
      "type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
      "position": [
        1200,
        540
      ],
      "parameters": {
        "chunkSize": 2000,
        "chunkOverlap": 200
      },
      "typeVersion": 1
    },
    {
      "id": "openai-embeddings-001",
      "name": "OpenAI 임베딩",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        1420,
        400
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "YOUR_OPENAI_CRED_ID"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "vector-store-001",
      "name": "심플 벡터 스토어",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreInMemory",
      "position": [
        1640,
        400
      ],
      "parameters": {
        "mode": "insert",
        "memoryKey": "email_context_{{ $('Gmail Trigger').item.json.threadId }}"
      },
      "typeVersion": 1
    },
    {
      "id": "prepare-context-001",
      "name": "에이전트 컨텍스트 준비",
      "type": "n8n-nodes-base.set",
      "position": [
        1860,
        400
      ],
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "context-text",
              "name": "text",
              "type": "string",
              "value": "=Please analyze this incoming email and generate an appropriate reply based on the user profile and email thread context.\n\nIncoming Email Subject: {{ $('Gmail Trigger').item.json.subject }}\nIncoming Email From: {{ $('Gmail Trigger').item.json.headers.from }}\nIncoming Email Body: {{ $('Gmail Trigger').item.json.textAsHtml }}\n\nInstructions:\n1. If this appears to be a newsletter, automated notification, or spam, respond with exactly 'NO_REPLY_NEEDED'\n2. If this requires a response, generate a professional and contextual reply\n3. Use the knowledge from the vector store to inform your response\n4. Keep responses concise but helpful"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "openai-chat-001",
      "name": "OpenAI 채팅 모델",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        2080,
        580
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {
          "temperature": 0.3
        }
      },
      "credentials": {
        "openAiApi": {
          "id": "YOUR_OPENAI_CRED_ID"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "simple-memory-001",
      "name": "심플 메모리",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        2180,
        580
      ],
      "parameters": {
        "sessionKey": "=email_{{ $('Gmail Trigger').item.json.threadId }}",
        "maxTokenLimit": 4000,
        "sessionIdType": "customKey"
      },
      "typeVersion": 1.3
    },
    {
      "id": "vector-retriever-001",
      "name": "벡터 스토어 검색기",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreInMemory",
      "position": [
        2280,
        580
      ],
      "parameters": {
        "mode": "retrieve-as-tool",
        "limit": 5,
        "toolName": "email_context",
        "memoryKey": "email_context_{{ $('Gmail Trigger').item.json.threadId }}",
        "toolDescription": "Retrieve context about the user profile and email thread history"
      },
      "typeVersion": 1
    },
    {
      "id": "email-agent-001",
      "name": "이메일 응답 에이전트",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        2080,
        400
      ],
      "parameters": {
        "text": "={{ $json.text }}",
        "options": {
          "systemMessage": "You are an intelligent email assistant. Your job is to analyze incoming emails and generate appropriate responses based on:\n\n1. User profile information (from vector store)\n2. Email thread context (from vector store)\n3. The specific incoming email content\n\nGuidelines:\n- For newsletters, promotions, automated messages: respond with exactly 'NO_REPLY_NEEDED'\n- For legitimate emails requiring responses: generate professional, contextual replies\n- Keep responses concise but helpful\n- Use the user's communication style from their profile\n- Reference relevant context from previous emails when appropriate\n- Always be polite and professional"
        },
        "promptType": "define"
      },
      "typeVersion": 1.9
    },
    {
      "id": "check-response-001",
      "name": "응답 필요 여부 확인",
      "type": "n8n-nodes-base.if",
      "position": [
        2400,
        400
      ],
      "parameters": {
        "conditions": {
          "combinator": "and",
          "conditions": [
            {
              "operator": {
                "type": "notContainsText"
              },
              "leftValue": "={{ $json.output }}",
              "rightValue": "NO_REPLY_NEEDED"
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "create-draft-001",
      "name": "Gmail - 초안 작성",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2680,
        400
      ],
      "parameters": {
        "message": "={{ $json.output.replace(/\\n/g, \"<br />\\n\") }}",
        "options": {
          "sendTo": "={{ $('Gmail Trigger').item.json.headers.from }}",
          "threadId": "={{ $('Gmail Trigger').item.json.threadId }}"
        },
        "subject": "=Re: {{ $('Gmail Trigger').item.json.subject }}",
        "resource": "draft",
        "emailType": "html"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "YOUR_GMAIL_CRED_ID"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "error-handler-001",
      "name": "오류 핸들러",
      "type": "n8n-nodes-base.code",
      "position": [
        2400,
        600
      ],
      "parameters": {
        "jsCode": "// Log error details for debugging\nconst errorData = {\n  timestamp: new Date().toISOString(),\n  error: $input.all(),\n  workflow: 'Gmail Auto Reply',\n  threadId: $('Gmail Trigger').item?.json?.threadId || 'unknown'\n};\n\nconsole.log('Workflow Error:', JSON.stringify(errorData, null, 2));\n\nreturn [{ json: errorData }];"
      },
      "typeVersion": 2
    },
    {
      "id": "sticky-note-001",
      "name": "워크플로 지침",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        200,
        200
      ],
      "parameters": {
        "color": 5,
        "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_FILE_ID\n\n## How it works:\n1. Monitors Gmail for new emails\n2. Downloads user profile from Google Drive\n3. Fetches email thread context\n4. Creates vector embeddings for context\n5. Uses AI agent to generate appropriate replies\n6. Creates draft if reply is needed\n\n## Features:\n- Smart filtering (ignores newsletters/spam)\n- Context-aware responses\n- Memory of conversation history\n- Professional tone matching"
      },
      "typeVersion": 1
    }
  ],
  "active": true,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "3",
  "connections": {
    "gmail-trigger-001": {
      "main": [
        [
          {
            "node": "drive-download-001",
            "type": "main",
            "index": 0
          },
          {
            "node": "gmail-thread-001",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "simple-memory-001": {
      "ai_memory": [
        [
          {
            "node": "email-agent-001",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "email-agent-001": {
      "main": [
        [
          {
            "node": "check-response-001",
            "type": "main",
            "index": 0
          }
        ]
      ],
      "error": [
        [
          {
            "node": "error-handler-001",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "openai-chat-001": {
      "ai_languageModel": [
        [
          {
            "node": "email-agent-001",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "openai-embeddings-001": {
      "ai_embedding": [
        [
          {
            "node": "vector-store-001",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "vector-store-001": {
      "main": [
        [
          {
            "node": "prepare-context-001",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "create-draft-001": {
      "error": [
        [
          {
            "node": "error-handler-001",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "gmail-thread-001": {
      "main": [
        [
          {
            "node": "thread-loader-001",
            "type": "main",
            "index": 0
          }
        ]
      ],
      "error": [
        [
          {
            "node": "error-handler-001",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "thread-splitter-001": {
      "ai_textSplitter": [
        [
          {
            "node": "thread-loader-001",
            "type": "ai_textSplitter",
            "index": 0
          }
        ]
      ]
    },
    "check-response-001": {
      "main": [
        [
          {
            "node": "create-draft-001",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "prepare-context-001": {
      "main": [
        [
          {
            "node": "email-agent-001",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "profile-splitter-001": {
      "ai_textSplitter": [
        [
          {
            "node": "profile-loader-001",
            "type": "ai_textSplitter",
            "index": 0
          }
        ]
      ]
    },
    "thread-loader-001": {
      "ai_document": [
        [
          {
            "node": "vector-store-001",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "vector-retriever-001": {
      "ai_tool": [
        [
          {
            "node": "email-agent-001",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "profile-loader-001": {
      "ai_document": [
        [
          {
            "node": "vector-store-001",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "drive-download-001": {
      "main": [
        [
          {
            "node": "profile-loader-001",
            "type": "main",
            "index": 0
          }
        ]
      ],
      "error": [
        [
          {
            "node": "error-handler-001",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
자주 묻는 질문

이 워크플로우를 어떻게 사용하나요?

위의 JSON 구성 코드를 복사하여 n8n 인스턴스에서 새 워크플로우를 생성하고 "JSON에서 가져오기"를 선택한 후, 구성을 붙여넣고 필요에 따라 인증 설정을 수정하세요.

이 워크플로우는 어떤 시나리오에 적합한가요?

고급 - 개인 생산성, AI 챗봇

유료인가요?

이 워크플로우는 완전히 무료이며 직접 가져와 사용할 수 있습니다. 다만, 워크플로우에서 사용하는 타사 서비스(예: OpenAI API)는 사용자 직접 비용을 지불해야 할 수 있습니다.

워크플로우 정보
난이도
고급
노드 수18
카테고리2
노드 유형14
난이도 설명

고급 사용자를 위한 16+개 노드의 복잡한 워크플로우

외부 링크
n8n.io에서 보기

이 워크플로우 공유

카테고리

카테고리: 34