{
  "name": "[공무원] 1일차 08 입력 폼으로 실제 접수받기",
  "nodes": [
    {
      "parameters": {
        "formTitle": "민원 접수",
        "formDescription": "민원이 있는 경우 이곳에서 신고하세요.",
        "formFields": {
          "values": [
            {
              "fieldLabel": "이름",
              "fieldType": "text",
              "requiredField": true
            },
            {
              "fieldLabel": "연락처",
              "fieldType": "text",
              "requiredField": true
            },
            {
              "fieldLabel": "이메일",
              "fieldType": "email",
              "requiredField": true
            },
            {
              "fieldLabel": "종류",
              "fieldType": "dropdown",
              "fieldOptions": {
                "values": [
                  { "option": "생활" },
                  { "option": "음식물" },
                  { "option": "대형" }
                ]
              },
              "requiredField": true
            },
            {
              "fieldLabel": "상세설명",
              "fieldType": "textarea",
              "requiredField": true
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.formTrigger",
      "typeVersion": 2.5,
      "position": [0, 0],
      "webhookId": "3dd98627-feac-46dd-93aa-6cb5795cd96a",
      "id": "d1-form",
      "name": "민원 입력 폼"
    },
    {
      "parameters": {
        "operation": "append",
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "여기에_본인_시트_ID"
        },
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "시트1"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "이름": "={{ $json.이름 }}",
            "연락처": "={{ $json.연락처 }}",
            "이메일": "={{ $json.이메일 }}",
            "종류": "={{ $json.종류 }}",
            "상세설명": "={{ $json.상세설명 }}",
            "등록일": "={{ $now.format('yyyy-MM-dd') }}"
          },
          "schema": [
            { "id": "이름", "displayName": "이름", "type": "string", "display": true, "required": false, "defaultMatch": false, "canBeUsedToMatch": true },
            { "id": "연락처", "displayName": "연락처", "type": "string", "display": true, "required": false, "defaultMatch": false, "canBeUsedToMatch": true },
            { "id": "이메일", "displayName": "이메일", "type": "string", "display": true, "required": false, "defaultMatch": false, "canBeUsedToMatch": true },
            { "id": "종류", "displayName": "종류", "type": "string", "display": true, "required": false, "defaultMatch": false, "canBeUsedToMatch": true },
            { "id": "상세설명", "displayName": "상세설명", "type": "string", "display": true, "required": false, "defaultMatch": false, "canBeUsedToMatch": true },
            { "id": "등록일", "displayName": "등록일", "type": "string", "display": true, "required": false, "defaultMatch": false, "canBeUsedToMatch": true }
          ],
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [460, -300],
      "id": "d1-sheets",
      "name": "시트에 기록"
    },
    {
      "parameters": {
        "sendTo": "={{ $json.이메일 }}",
        "subject": "민원 접수",
        "emailType": "text",
        "message": "=담당팀께,\n\n아래와 같이 민원이 접수되었습니다.\n\n- 접수자명: {{ $json.이름 }}\n- 연락처: {{ $json.연락처 }}\n- 이메일: {{ $json.이메일 }}\n- 민원 종류: {{ $json.종류 }}\n- 상세 설명: {{ $json.상세설명 }}\n- 등록일: {{ $now.format('yyyy년 MM월 dd일 HH시 mm분') }}\n\n내용 확인 후 신속한 처리 바랍니다.\n\n감사합니다.",
        "options": {}
      },
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.2,
      "position": [460, -150],
      "id": "d1-gmail-send",
      "name": "접수 메일 보내기"
    },
    {
      "parameters": {
        "resource": "event",
        "operation": "create",
        "calendar": {
          "__rl": true,
          "mode": "id",
          "value": "본인이메일@example.com"
        },
        "start": "={{ $now.plus(3,'days').toISO() }}",
        "end": "={{ $now.plus(3,'days').plus(1,'hour').toISO() }}",
        "additionalFields": {
          "summary": "=민원 처리 마감 - {{ $json.이름 }}"
        }
      },
      "type": "n8n-nodes-base.googleCalendar",
      "typeVersion": 1.3,
      "position": [460, 0],
      "id": "d1-calendar",
      "name": "처리 마감 일정"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=당신은 친절한 시청 민원 담당 공무원입니다.\n아래 민원 접수 내용을 바탕으로, 민원인에게 보낼 정중한 '접수 확인 안내문'을 작성해 주세요.\n\n[작성 규칙]\n- 존댓말을 사용하고, 4~6문장으로 작성합니다.\n- 민원이 정상적으로 접수되었음을 안내합니다.\n- 처리에는 다소 시간이 걸릴 수 있음을 부드럽게 안내합니다.\n- 마지막은 '감사합니다.'로 끝맺습니다.\n\n[민원 접수 내용]\n- 접수자명: {{ $json.이름 }}\n- 민원 종류: {{ $json.종류 }}\n- 상세 설명: {{ $json.상세설명 }}",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "typeVersion": 1.9,
      "position": [460, 150],
      "id": "d1-ai-chain",
      "name": "AI 안내문 작성"
    },
    {
      "parameters": {
        "modelName": "models/gemini-2.5-flash",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "typeVersion": 1,
      "position": [400, 300],
      "id": "d1-gemini-model",
      "name": "Google Gemini Chat Model"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "c1",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.종류 }}",
              "rightValue": "생활"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.3,
      "position": [460, 450],
      "id": "d1-if",
      "name": "생활인가?"
    },
    {
      "parameters": {
        "sendTo": "본인이메일@example.com",
        "subject": "[생활 관련] 민원",
        "message": "=생활 관련 민원: {{ $json.이름 }}",
        "options": {}
      },
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.2,
      "position": [700, 380],
      "id": "d1-gmail-lifestyle",
      "name": "생활 담당자"
    },
    {
      "parameters": {
        "sendTo": "본인이메일@example.com",
        "subject": "[일반] 민원",
        "message": "=일반 민원: {{ $json.이름 }}",
        "options": {}
      },
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.2,
      "position": [700, 520],
      "id": "d1-gmail-general",
      "name": "일반 담당자"
    }
  ],
  "connections": {
    "민원 입력 폼": {
      "main": [
        [
          { "node": "시트에 기록", "type": "main", "index": 0 },
          { "node": "접수 메일 보내기", "type": "main", "index": 0 },
          { "node": "처리 마감 일정", "type": "main", "index": 0 },
          { "node": "AI 안내문 작성", "type": "main", "index": 0 },
          { "node": "생활인가?", "type": "main", "index": 0 }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [[{ "node": "AI 안내문 작성", "type": "ai_languageModel", "index": 0 }]]
    },
    "생활인가?": {
      "main": [
        [{ "node": "생활 담당자", "type": "main", "index": 0 }],
        [{ "node": "일반 담당자", "type": "main", "index": 0 }]
      ]
    }
  },
  "settings": { "executionOrder": "v1" }
}
