8
n8n 한국어amn8n.com

Gemini 2.5 Pro AI 분류를 사용한 Gmail 메일 자동 태깅

중급

이것은Miscellaneous, AI Summarization, Multimodal AI분야의자동화 워크플로우로, 9개의 노드를 포함합니다.주로 Set, Code, Gmail, Aggregate, GmailTrigger 등의 노드를 사용하며. Gemini 2.5 Pro AI 분류를 사용하여 Gmail 메일 자동 라벨링

사전 요구사항
  • Google 계정 및 Gmail API 인증 정보
워크플로우 미리보기
노드 연결 관계를 시각적으로 표시하며, 확대/축소 및 이동을 지원합니다
워크플로우 내보내기
다음 JSON 구성을 복사하여 n8n에 가져오면 이 워크플로우를 사용할 수 있습니다
{
  "meta": {
    "instanceId": "58a9e858b82757a75629d435ec0da2448ad5d9e906a9ce3b7dcbb64c90fda9fe",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "f5583750-3712-45ab-b80d-e6ef59e1e6dd",
      "name": "Gmail 트리거",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        -384,
        -80
      ],
      "parameters": {
        "filters": {
          "readStatus": "unread"
        },
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        }
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "DMM81jCjgMwmkeIf",
          "name": "N8N Automations Google Credential"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "39fb0933-4c78-4209-aa47-4bc2b76aac83",
      "name": "모델에 메시지 전송",
      "type": "@n8n/n8n-nodes-langchain.googleGemini",
      "position": [
        416,
        -80
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "models/gemini-2.5-pro",
          "cachedResultName": "models/gemini-2.5-pro"
        },
        "options": {
          "systemMessage": "=You are an email classifier assistant.\nOnly respond with the most suitable existing Gmail label for this email from the following list: {{ $json.labelList }}.\nNever invent a label—not in the list. Respond with multiple matching label names which are seperated with single comma's make sure every labels are seperated using a comma, and nothing else."
        },
        "messages": {
          "values": [
            {
              "content": "=Below is a new email.\nSubject: {{ $('Gmail Trigger').item.json.Subject }}\nBody: {{ $('Gmail Trigger').item.json.snippet }}\nWhich Gmail label does this email belong to?"
            }
          ]
        }
      },
      "credentials": {
        "googlePalmApi": {
          "id": "GrbWNcmNxQFQaJje",
          "name": "Gemini API n8n-automation"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "4a2fcba6-5e5e-4fea-8a87-94f774a18e54",
      "name": "메시지에 라벨 추가",
      "type": "n8n-nodes-base.gmail",
      "position": [
        976,
        -80
      ],
      "webhookId": "fe713b17-a055-40d5-9e3d-1ef22940d963",
      "parameters": {
        "labelIds": "={{ $json.labelIds }}",
        "messageId": "={{ $('Gmail Trigger').item.json.id }}",
        "operation": "addLabels"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "DMM81jCjgMwmkeIf",
          "name": "N8N Automations Google Credential"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "4838c10e-bda2-4d72-ad5e-f50090ec4f9d",
      "name": "여러 라벨 가져오기",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -176,
        -80
      ],
      "webhookId": "4d911551-faee-4329-a67a-9a2ee147088a",
      "parameters": {
        "resource": "label",
        "returnAll": true
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "DMM81jCjgMwmkeIf",
          "name": "N8N Automations Google Credential"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "310a8233-f123-473b-90ad-0df5417c66e1",
      "name": "필드 편집",
      "type": "n8n-nodes-base.set",
      "position": [
        240,
        -80
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "9628092d-b702-4543-a3ab-e225641f4b21",
              "name": "labelList",
              "type": "string",
              "value": "={{ $json.labels.map(item => item.name).join(', ') }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "3c2c6444-2a70-414e-92fc-df97b3d2ca27",
      "name": "집계",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        32,
        -80
      ],
      "parameters": {
        "options": {},
        "aggregate": "aggregateAllItemData",
        "destinationFieldName": "labels"
      },
      "typeVersion": 1
    },
    {
      "id": "5d4dea5a-6117-416a-bbf3-5c9595e479dd",
      "name": "코드",
      "type": "n8n-nodes-base.code",
      "position": [
        768,
        -80
      ],
      "parameters": {
        "jsCode": "// Get all input items (your AI output should be in items[0], and label map in items[0].json.labels)\nconst items = $input.all();\n\n// 1. Parse comma-separated label names returned by the AI node\nlet resultLabels = items[0].json.content.parts[0].text\n  .split(\",\")\n  .map((label) => label.trim())\n  .filter((label) => label.length > 0);\n\n// 2. Get the label mapping array from aggregate node (should be in items[0].json.labels)\nconst labelObjects = $('Aggregate').first().json.labels || [];\nconsole.log(\"LABEL\", labelObjects);\n\n// 3. Map label names to IDs using the mapping array\nconst labelIds = resultLabels\n  .map((lName) => {\n    const match = labelObjects.find((obj) => obj.name === lName);\n    return match ? match.id : null;\n  })\n  .filter(Boolean); // remove nulls\n\n// 4. Output as n8n expects\nreturn [\n  {\n    json: {\n      labelIds,\n    },\n  },\n];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "2691c250-40e4-41b8-9b5e-f553cd842a2f",
      "name": "스티커 노트",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1008,
        -256
      ],
      "parameters": {
        "width": 496,
        "height": 480,
        "content": "## 📨 AI Gmail Auto-Labeler: How it Works\n\n#### Trigger:\nWatches for new unread emails.\n\n#### Label Sync:\nFetches all your current Gmail labels (label name + ID).\n\n#### AI Classification:\nSends each new email’s subject & body to Gemini AI,\nPrompt: “Which Gmail label(s) does this email belong to?”\nAI only uses labels from your real account list.\n\n#### Label Name → ID Mapping:\nMaps AI-predicted Gmail label names to their label IDs.\n\n#### Label Application:\nAutomatically assigns one or more valid labels to each new email."
      },
      "typeVersion": 1
    },
    {
      "id": "0409c111-441c-4ff5-99e6-39098ca775a8",
      "name": "스티커 노트1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1248,
        -192
      ],
      "parameters": {
        "width": 464,
        "height": 336,
        "content": "## 🛠️ How to Use\n- Connect your Gmail and Gemini API credentials.\n- Customize your allowed Gmail labels in your mailbox (no need to update nodes).\n- AI will NEVER suggest a label not present in your Gmail.\n- Works best if label names are clear and differ from system labels.\n- Monitors for unread emails only (edit trigger if you want all).\n- AI can assign multiple labels (comma-separated, mapped automatically).\n- Everything is dynamic and needs no manual updating of label lists for new labels.\n- You may add filters or extra conditions as desired before/after AI classification."
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "5d4dea5a-6117-416a-bbf3-5c9595e479dd": {
      "main": [
        [
          {
            "node": "4a2fcba6-5e5e-4fea-8a87-94f774a18e54",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "3c2c6444-2a70-414e-92fc-df97b3d2ca27": {
      "main": [
        [
          {
            "node": "310a8233-f123-473b-90ad-0df5417c66e1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "310a8233-f123-473b-90ad-0df5417c66e1": {
      "main": [
        [
          {
            "node": "39fb0933-4c78-4209-aa47-4bc2b76aac83",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "f5583750-3712-45ab-b80d-e6ef59e1e6dd": {
      "main": [
        [
          {
            "node": "4838c10e-bda2-4d72-ad5e-f50090ec4f9d",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "4838c10e-bda2-4d72-ad5e-f50090ec4f9d": {
      "main": [
        [
          {
            "node": "3c2c6444-2a70-414e-92fc-df97b3d2ca27",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "39fb0933-4c78-4209-aa47-4bc2b76aac83": {
      "main": [
        [
          {
            "node": "5d4dea5a-6117-416a-bbf3-5c9595e479dd",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
자주 묻는 질문

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

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

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

중급 - 기타, AI 요약, 멀티모달 AI

유료인가요?

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

워크플로우 정보
난이도
중급
노드 수9
카테고리3
노드 유형7
난이도 설명

일정 경험을 가진 사용자를 위한 6-15개 노드의 중간 복잡도 워크플로우

외부 링크
n8n.io에서 보기

이 워크플로우 공유

카테고리

카테고리: 34