8
n8n 한국어amn8n.com

스마트 Gmail 라벨: OpenAI를 사용한 내용 의도별 메일 분류

고급

이것은Support, AI분야의자동화 워크플로우로, 18개의 노드를 포함합니다.주로 Set, Gmail, Merge, SplitOut, Aggregate 등의 노드를 사용하며인공지능 기술을 결합하여 스마트 자동화를 구현합니다. GPT-4 콘텐츠 분석 및 라벨을 활용한 Gmail 메일 자동 분류

사전 요구사항
  • Google 계정 및 Gmail API 인증 정보
  • OpenAI API Key

카테고리

워크플로우 미리보기
노드 연결 관계를 시각적으로 표시하며, 확대/축소 및 이동을 지원합니다
워크플로우 내보내기
다음 JSON 구성을 복사하여 n8n에 가져오면 이 워크플로우를 사용할 수 있습니다
{
  "id": "Yc9bgOEvpyO1En1Z",
  "meta": {
    "instanceId": "1af8a0dc0d2f537b7c08209af728c271b5a03806bdf309bedf99d668f2608ee6",
    "templateCredsSetupCompleted": true
  },
  "name": "Intelligent Gmail Labeling: Categorize Emails by Content Intent Using OpenAI",
  "tags": [],
  "nodes": [
    {
      "id": "7697a77b-7dc8-40e7-b8e2-859c724ed6d5",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2380,
        40
      ],
      "parameters": {
        "width": 452.48413953150185,
        "height": 347.0476323933831,
        "content": "### Aggregate labels and update to message\nCreate array of label IDs and add to the desired email message in Gmail."
      },
      "typeVersion": 1
    },
    {
      "id": "013c142d-eb86-4d62-bab3-9dc77fba7b3b",
      "name": "Gmail trigger",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        720,
        200
      ],
      "parameters": {
        "simple": false,
        "filters": {},
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        }
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "2pW13S2GyP5GCdoP",
          "name": "Gmail account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "78cf0980-b4ec-4ed0-9b49-014e4d5d63d3",
      "name": "메시지 내용 가져오기",
      "type": "n8n-nodes-base.gmail",
      "position": [
        980,
        200
      ],
      "webhookId": "b773894c-18c6-454d-9271-6de10be1b7c4",
      "parameters": {
        "simple": false,
        "options": {},
        "messageId": "={{ $json.id }}",
        "operation": "get"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "2pW13S2GyP5GCdoP",
          "name": "Gmail account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "1f07bb8a-0e12-47fd-bf4f-751befeea37c",
      "name": "메시지 라벨 지정",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        1240,
        200
      ],
      "parameters": {
        "text": "={{ $('Gmail trigger').item.json.text }}",
        "messages": {
          "messageValues": [
            {
              "message": "=As an AI Assistant, your task is to categorize the message according to the following labels\n\nQuotation - email on discussing new opportunities to work with existing / new client on a new project\nProject progress - email on discussing and confirming specifications, schedule and progress of projects\nInquiry - email about product / service support\nNotification - email that doesn't require response\n\nOne email can have more than one label. Return only label names in JSON format, nothing else. Do not make things up."
            }
          ]
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 1.5
    },
    {
      "id": "c0f1e702-25b5-4887-b112-7d0d1c239ea1",
      "name": "JSON Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1460,
        420
      ],
      "parameters": {
        "schemaType": "manual",
        "inputSchema": "{\n  \"type\": \"object\",\n  \"properties\": {\n    \"labels\": {\n      \"type\": \"array\",\n      \"items\": {\n        \"type\": \"string\",\n        \"enum\": [\"Inquiry\", \"Quotation\", \"Project progress\", \"Notification\"]\n      }\n    }\n  },\n  \"required\": [\"labels\"]\n}"
      },
      "typeVersion": 1.2
    },
    {
      "id": "979aad50-8e34-471e-9016-c412e470c81b",
      "name": "라벨 값 설정",
      "type": "n8n-nodes-base.set",
      "position": [
        1620,
        200
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "72d11a72-6693-447c-b7ca-4ba1a3579075",
              "name": "labels",
              "type": "array",
              "value": "={{ $json.output.labels }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "48e80f97-1679-40a5-860d-124d32c82316",
      "name": "모든 라벨 가져오기",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1840,
        80
      ],
      "webhookId": "dec6f574-f47c-4b5d-86b9-2b0f6c957145",
      "parameters": {
        "resource": "label",
        "returnAll": true
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "2pW13S2GyP5GCdoP",
          "name": "Gmail account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "e29e712a-7940-4ca3-9a82-525ac7d5f7bf",
      "name": "지정된 라벨 분리",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        1840,
        280
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "labels"
      },
      "typeVersion": 1
    },
    {
      "id": "95886e13-3412-4c27-8510-873bbaced52b",
      "name": "해당 라벨 병합",
      "type": "n8n-nodes-base.merge",
      "position": [
        2180,
        140
      ],
      "parameters": {
        "mode": "combine",
        "options": {},
        "advanced": true,
        "mergeByFields": {
          "values": [
            {
              "field1": "name",
              "field2": "labels"
            }
          ]
        }
      },
      "typeVersion": 3.1
    },
    {
      "id": "329cf5ff-7933-4c5e-bb63-cbb77689a194",
      "name": "라벨 ID 집계",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        2440,
        140
      ],
      "parameters": {
        "options": {},
        "fieldsToAggregate": {
          "fieldToAggregate": [
            {
              "renameField": true,
              "outputFieldName": "label_ids",
              "fieldToAggregate": "id"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "952aad99-6ae7-4639-8132-f51b1065468e",
      "name": "메시지에 라벨 추가",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2640,
        140
      ],
      "webhookId": "4f345fc9-2afd-478b-be3b-d3d28f0fbc82",
      "parameters": {
        "labelIds": "={{ $json.label_ids }}",
        "messageId": "={{ $('Gmail trigger').item.json[\"id\"] }}",
        "operation": "addLabels"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "2pW13S2GyP5GCdoP",
          "name": "Gmail account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "11244a40-d6df-475b-b900-bf8d386077d6",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        20,
        -140
      ],
      "parameters": {
        "color": 4,
        "width": 580,
        "height": 1041,
        "content": "## Intelligent Gmail Labeling: Categorize Emails by Content Intent Using OpenAI\n\n## Who is this for?\n\nThis workflow is ideal for Gmail users and teams who receive a high volume of emails and want to streamline inbox management. It suits professionals seeking to organize messages automatically, including sales teams, project managers, support staff, and anyone who benefits from automated email categorization.\n\n## What problem is this workflow solving? / Use case\n\nManually labeling emails is time-consuming and can lead to inconsistent organization. This automated n8n workflow uses Gmail and OpenAI to analyze incoming messages and apply the appropriate labels, such as \"Quotation\", \"Inquiry\", \"Project progress\", and \"Notification\", based on content—improving productivity and ensuring important messages are prioritized.\n\n## What this workflow does\n\nThe workflow retrieves new Gmail messages, analyzes their content with OpenAI, and automatically assigns pre-defined Gmail labels that match the email’s intent. This ensures emails are sorted efficiently using AI-powered content analysis and Gmail’s labeling system.\n\n## Setup\n\n- Ensure Gmail labels (e.g., \"Quotation\", \"Inquiry\") are created in your Gmail account.\n- Connect your Gmail and OpenAI accounts as credentials in n8n.\n- Import the workflow into your n8n instance and update node configurations to match your Gmail label names.\n\n## How to customize this workflow to your needs\n\n- Edit or add Gmail labels both in your Gmail account and within the workflow logic.\n- Adjust the prompt or parameters sent to OpenAI to better match your categorization style.\n- Expand or refine the list of label categories to fit your team’s or business’s requirements.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "1eca85f0-bfa4-431e-90e2-0ffe25844bdd",
      "name": "Sticky Note13",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        660,
        20
      ],
      "parameters": {
        "width": 238,
        "height": 349,
        "content": "### Gmail Trigger\nGet new incoming message from Gmail. \n\n⚠️ Set up the time (polling) interval based on your needs."
      },
      "typeVersion": 1
    },
    {
      "id": "a5dd9b23-0fd8-42a8-a334-2a0640750c52",
      "name": "Sticky Note14",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1400,
        400
      ],
      "parameters": {
        "width": 241.53974014153226,
        "height": 319.3323098457962,
        "content": "###\n\n\n\n\n\n\n\n\n\n\n### JSON schema\nEdit JSON schema and label names according to your needs.\n\n⚠️ **Label names in system prompt and JSON schema should be the same.**"
      },
      "typeVersion": 1
    },
    {
      "id": "c6a7af89-e307-4363-8d96-83c0f7c0e7b8",
      "name": "Sticky Note15",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2120,
        40
      ],
      "parameters": {
        "width": 226.14233872620645,
        "height": 347.0476323933831,
        "content": "### Merge labels\nCombine labels retrieved from Gmail account and assigned by AI together."
      },
      "typeVersion": 1
    },
    {
      "id": "afb1a124-f880-4d6c-987e-dabf2c3fb882",
      "name": "Sticky Note16",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        920,
        20
      ],
      "parameters": {
        "width": 238.4602598584674,
        "height": 348.5873725349161,
        "content": "### Get message content\nBased on Gmail message ID retrieve body content of the email and pass it to AI chain."
      },
      "typeVersion": 1
    },
    {
      "id": "44b4c579-538f-45fe-9cde-627ac7364013",
      "name": "Sticky Note17",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1180,
        20
      ],
      "parameters": {
        "width": 378.57661273793565,
        "height": 348.5873725349161,
        "content": "### Assign labels\nLet the AI decide which labels suit the best content of the message.\n\n⚠️ **Remember to edit system prompt** - modify label names and instructions according to your needs."
      },
      "typeVersion": 1
    },
    {
      "id": "e866b876-20a4-4a19-bd07-56c69eed82af",
      "name": "OpenAI GPT-4 Based",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1220,
        420
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4-turbo-preview",
          "cachedResultName": "gpt-4-turbo-preview"
        },
        "options": {
          "temperature": 0,
          "responseFormat": "json_object"
        }
      },
      "credentials": {
        "openAiApi": {
          "id": "8cWUJS0NExv35YHi",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.2
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "01528b99-a1ee-48df-b42f-c3717974161c",
  "connections": {
    "c0f1e702-25b5-4887-b112-7d0d1c239ea1": {
      "ai_outputParser": [
        [
          {
            "node": "1f07bb8a-0e12-47fd-bf4f-751befeea37c",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "013c142d-eb86-4d62-bab3-9dc77fba7b3b": {
      "main": [
        [
          {
            "node": "78cf0980-b4ec-4ed0-9b49-014e4d5d63d3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "48e80f97-1679-40a5-860d-124d32c82316": {
      "main": [
        [
          {
            "node": "95886e13-3412-4c27-8510-873bbaced52b",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "979aad50-8e34-471e-9016-c412e470c81b": {
      "main": [
        [
          {
            "node": "e29e712a-7940-4ca3-9a82-525ac7d5f7bf",
            "type": "main",
            "index": 0
          },
          {
            "node": "48e80f97-1679-40a5-860d-124d32c82316",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "e866b876-20a4-4a19-bd07-56c69eed82af": {
      "ai_languageModel": [
        [
          {
            "node": "1f07bb8a-0e12-47fd-bf4f-751befeea37c",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "329cf5ff-7933-4c5e-bb63-cbb77689a194": {
      "main": [
        [
          {
            "node": "952aad99-6ae7-4639-8132-f51b1065468e",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "78cf0980-b4ec-4ed0-9b49-014e4d5d63d3": {
      "main": [
        [
          {
            "node": "1f07bb8a-0e12-47fd-bf4f-751befeea37c",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "1f07bb8a-0e12-47fd-bf4f-751befeea37c": {
      "main": [
        [
          {
            "node": "979aad50-8e34-471e-9016-c412e470c81b",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "e29e712a-7940-4ca3-9a82-525ac7d5f7bf": {
      "main": [
        [
          {
            "node": "95886e13-3412-4c27-8510-873bbaced52b",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "95886e13-3412-4c27-8510-873bbaced52b": {
      "main": [
        [
          {
            "node": "329cf5ff-7933-4c5e-bb63-cbb77689a194",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
자주 묻는 질문

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

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

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

고급 - 지원, 인공지능

유료인가요?

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

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

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

외부 링크
n8n.io에서 보기

이 워크플로우 공유

카테고리

카테고리: 34