{
  "name": "[공무원] 1일차 06 AI 안내문 자동 생성",
  "nodes": [
    {
      "parameters": {},
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [0, 0],
      "id": "d1-trigger",
      "name": "수동 실행"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "s1",
              "name": "이름",
              "value": "김기태",
              "type": "string"
            },
            {
              "id": "s2",
              "name": "연락처",
              "value": "010-1111-2222",
              "type": "string"
            },
            {
              "id": "s3",
              "name": "이메일",
              "value": "본인이메일@example.com",
              "type": "string"
            },
            {
              "id": "s4",
              "name": "종류",
              "value": "생활",
              "type": "string"
            },
            {
              "id": "s5",
              "name": "상세설명",
              "value": "집 앞에 쓰레기가 무단 투기되어 있습니다.",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [220, 0],
      "id": "d1-sample",
      "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"
    }
  ],
  "connections": {
    "수동 실행": {
      "main": [[{ "node": "샘플 민원", "type": "main", "index": 0 }]]
    },
    "샘플 민원": {
      "main": [
        [
          { "node": "시트에 기록", "type": "main", "index": 0 },
          { "node": "접수 메일 보내기", "type": "main", "index": 0 },
          { "node": "처리 마감 일정", "type": "main", "index": 0 },
          { "node": "AI 안내문 작성", "type": "main", "index": 0 }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [[{ "node": "AI 안내문 작성", "type": "ai_languageModel", "index": 0 }]]
    }
  },
  "settings": { "executionOrder": "v1" }
}
