{
  "name": "AI \uc774\uba54\uc77c \ubd84\ub958\uae30",
  "nodes": [
    {
      "parameters": {
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "simple": false,
        "filters": {},
        "options": {}
      },
      "id": "gmail-trigger-node",
      "name": "\uc0c8 \uc774\uba54\uc77c \uc218\uc2e0",
      "type": "n8n-nodes-base.gmailTrigger",
      "typeVersion": 1,
      "position": [
        250,
        300
      ],
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "resource": "text",
        "operation": "message",
        "modelId": "gpt-4o-mini",
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "\ub2e4\uc74c \uc774\uba54\uc77c\uc744 \ubd84\uc11d\ud558\uc5ec \uce74\ud14c\uace0\ub9ac\ub97c \ubd84\ub958\ud558\uc138\uc694: \uae34\uae09, \uc77c\ubc18, \ud64d\ubcf4, \uc2a4\ud338. JSON\uc73c\ub85c \uc751\ub2f5: {\"category\": \"\uae34\uae09\"|\"\uc77c\ubc18\"|\"\ud64d\ubcf4\"|\"\uc2a4\ud338\", \"summary\": \"\uac04\ub7b5\ud55c \uc694\uc57d\", \"priority_score\": 1-10}"
            },
            {
              "role": "user",
              "content": "=\uc81c\ubaa9: {{ $json.subject }}\n\n\ubc1c\uc2e0\uc790: {{ $json.from }}\n\n\ubcf8\ubb38:\n{{ $json.textPlain || $json.textHtml }}"
            }
          ]
        },
        "options": {
          "temperature": 0.3
        }
      },
      "id": "openai-node",
      "name": "AI \ubd84\ub958",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 1.3,
      "position": [
        470,
        300
      ],
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "jsCode": "const aiResponse = $input.item.json.message?.content || '{}';\nlet parsed;\ntry {\n  parsed = JSON.parse(aiResponse);\n} catch (e) {\n  parsed = { category: '\uc77c\ubc18', summary: '\ubd84\ub958 \uc2e4\ud328', priority_score: 5 };\n}\n\nconst emailData = $('\uc0c8 \uc774\uba54\uc77c \uc218\uc2e0').item.json;\n\nreturn {\n  json: {\n    category: parsed.category || '\uc77c\ubc18',\n    summary: parsed.summary || '',\n    priority_score: parsed.priority_score || 5,\n    subject: emailData.subject,\n    from: emailData.from,\n    date: emailData.date,\n    messageId: emailData.id\n  }\n};"
      },
      "id": "code-node",
      "name": "\uc751\ub2f5 \ud30c\uc2f1",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        690,
        300
      ]
    },
    {
      "parameters": {
        "mode": "expression",
        "output": "multipleOutputs",
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "caseSensitive": false,
                  "leftValue": ""
                },
                "conditions": [
                  {
                    "leftValue": "={{ $json.category }}",
                    "rightValue": "\uae34\uae09",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "\uae34\uae09"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": false,
                  "leftValue": ""
                },
                "conditions": [
                  {
                    "leftValue": "={{ $json.category }}",
                    "rightValue": "\uc77c\ubc18",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "\uc77c\ubc18"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": false,
                  "leftValue": ""
                },
                "conditions": [
                  {
                    "leftValue": "={{ $json.category }}",
                    "rightValue": "\ud64d\ubcf4",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "\ud64d\ubcf4"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": false,
                  "leftValue": ""
                },
                "conditions": [
                  {
                    "leftValue": "={{ $json.category }}",
                    "rightValue": "\uc2a4\ud338",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "\uc2a4\ud338"
            }
          ]
        },
        "options": {}
      },
      "id": "switch-node",
      "name": "\uce74\ud14c\uace0\ub9ac\ubcc4 \ubd84\uae30",
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3,
      "position": [
        910,
        300
      ]
    },
    {
      "parameters": {
        "authentication": "oAuth2",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "value": "C12345URGENT",
          "mode": "id"
        },
        "text": "=\ud83d\udea8 \uae34\uae09 \uc774\uba54\uc77c \ub3c4\ucc29\n\n*\uc81c\ubaa9:* {{ $json.subject }}\n*\ubc1c\uc2e0\uc790:* {{ $json.from }}\n*\uc694\uc57d:* {{ $json.summary }}\n*\uc6b0\uc120\uc21c\uc704:* {{ $json.priority_score }}/10\n*\uc218\uc2e0 \uc2dc\uac01:* {{ $json.date }}",
        "otherOptions": {}
      },
      "id": "slack-node",
      "name": "Slack \uae34\uae09 \uc54c\ub9bc",
      "type": "n8n-nodes-base.slack",
      "typeVersion": 2.1,
      "position": [
        1130,
        100
      ],
      "credentials": {
        "slackOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "operation": "appendOrUpdate",
        "documentId": {
          "__rl": true,
          "value": "placeholder-spreadsheet-id",
          "mode": "id",
          "cachedResultName": "\uc774\uba54\uc77c \ub85c\uadf8"
        },
        "sheetName": {
          "__rl": true,
          "value": "gid=0",
          "mode": "id",
          "cachedResultName": "Sheet1"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "\ub0a0\uc9dc": "={{ $json.date }}",
            "\ubc1c\uc2e0\uc790": "={{ $json.from }}",
            "\uc81c\ubaa9": "={{ $json.subject }}",
            "\uc694\uc57d": "={{ $json.summary }}",
            "\uc6b0\uc120\uc21c\uc704": "={{ $json.priority_score }}"
          },
          "matchingColumns": [],
          "schema": []
        },
        "options": {
          "cellFormat": "USER_ENTERED",
          "useAppend": true
        }
      },
      "id": "sheets-node",
      "name": "\uad6c\uae00 \uc2dc\ud2b8 \uae30\ub85d",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.4,
      "position": [
        1130,
        300
      ],
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {},
      "id": "noop-node",
      "name": "\ubb34\uc2dc",
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [
        1130,
        500
      ]
    }
  ],
  "connections": {
    "\uc0c8 \uc774\uba54\uc77c \uc218\uc2e0": {
      "main": [
        [
          {
            "node": "AI \ubd84\ub958",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI \ubd84\ub958": {
      "main": [
        [
          {
            "node": "\uc751\ub2f5 \ud30c\uc2f1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\uc751\ub2f5 \ud30c\uc2f1": {
      "main": [
        [
          {
            "node": "\uce74\ud14c\uace0\ub9ac\ubcc4 \ubd84\uae30",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\uce74\ud14c\uace0\ub9ac\ubcc4 \ubd84\uae30": {
      "main": [
        [
          {
            "node": "Slack \uae34\uae09 \uc54c\ub9bc",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "\uad6c\uae00 \uc2dc\ud2b8 \uae30\ub85d",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "\ubb34\uc2dc",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "\ubb34\uc2dc",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1",
    "saveManualExecutions": true,
    "callerPolicy": "workflowsFromSameOwner",
    "errorWorkflow": "",
    "timezone": "Asia/Seoul",
    "saveExecutionProgress": true,
    "saveDataErrorExecution": "all",
    "saveDataSuccessExecution": "all"
  },
  "staticData": null,
  "tags": [
    {
      "createdAt": "2026-02-14T00:00:00.000Z",
      "updatedAt": "2026-02-14T00:00:00.000Z",
      "id": "ai-automation",
      "name": "AI \uc790\ub3d9\ud654"
    },
    {
      "createdAt": "2026-02-14T00:00:00.000Z",
      "updatedAt": "2026-02-14T00:00:00.000Z",
      "id": "email-processing",
      "name": "\uc774\uba54\uc77c \ucc98\ub9ac"
    }
  ],
  "triggerCount": 1,
  "updatedAt": "2026-02-14T00:00:00.000Z",
  "versionId": "1"
}