문서 대리인 템플릿
고급
이것은Document Extraction, AI Chatbot분야의자동화 워크플로우로, 36개의 노드를 포함합니다.주로 If, Set, Code, Switch, GoogleDrive 등의 노드를 사용하며. Gemini와 Google Drive를 사용하여 템플릿에서 맞춤형 PDF 문서를 생성하세요
사전 요구사항
- •Google Drive API 인증 정보
- •대상 API의 인증 정보가 필요할 수 있음
- •Google Gemini API Key
- •PostgreSQL 데이터베이스 연결 정보
사용된 노드 (36)
워크플로우 미리보기
노드 연결 관계를 시각적으로 표시하며, 확대/축소 및 이동을 지원합니다
워크플로우 내보내기
다음 JSON 구성을 복사하여 n8n에 가져오면 이 워크플로우를 사용할 수 있습니다
{
"id": "94ZTfrnyRHFV3xxr",
"meta": {
"instanceId": "a0abdc0b77c415ea268f7f162cb1411f29a01e7656935f2ebce0ae66e8df8e13"
},
"name": "DocAgentForTemplate",
"tags": [],
"nodes": [
{
"id": "d6dae967-cee4-4c8b-9f80-a1eb8279b2a0",
"name": "Google Gemini 채팅 모델",
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"position": [
-20,
300
],
"parameters": {
"options": {},
"modelName": "models/gemini-2.5-pro"
},
"credentials": {
"googlePalmApi": {
"id": "M4luDvdaNUQojgwm",
"name": "Google Gemini(PaLM) Api account"
}
},
"typeVersion": 1
},
{
"id": "514e6233-fe2d-4031-9ea6-ad046d2d1479",
"name": "메타데이터 가져오기",
"type": "n8n-nodes-base.httpRequestTool",
"position": [
420,
300
],
"parameters": {
"url": "https://script.google.com/macros/s/<YOUR_DEPLOY_ID>/exec",
"options": {},
"sendQuery": true,
"sendHeaders": true,
"authentication": "predefinedCredentialType",
"queryParameters": {
"parameters": [
{
"name": "mode",
"value": "meta"
},
{
"name": "id",
"value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters1_Value', `The id of the template requested by the user comes here.`, 'string') }}"
}
]
},
"headerParameters": {
"parameters": [
{
"name": "accept",
"value": "application/json"
}
]
},
"nodeCredentialType": "googleDriveOAuth2Api"
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "G5mimUj7FOKYpMol",
"name": "Google Drive-n8n"
}
},
"typeVersion": 4.2
},
{
"id": "c2d0ed01-0b5f-4e92-89a1-c140990b6998",
"name": "채팅 메시지 수신 시",
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
"position": [
-60,
-20
],
"webhookId": "6c3d3341-4e58-40c9-b399-96c67481ed4a",
"parameters": {
"public": true,
"options": {},
"initialMessages": "Merhaba! 👋\nMy name is DocAgent. "
},
"typeVersion": 1.1
},
{
"id": "74c575a0-6523-47d5-834e-a0c388d06676",
"name": "문서 에이전트",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
240,
-20
],
"parameters": {
"options": {
"systemMessage": "=You are “Legal-Doc Agent”, an expert that drafts professional Turkish\ndocuments from fixed Google Docs templates.\n\n<templateCatalog>\n{{ YOUR_MANUAL_TO_ADD_TEMPLATE_LIST }}\n</templateCatalog> \n\n#TOOLS AND USAGE RULES\nGetMetaData(id) → { placeholders\\[], conditionals\\[] }\nDocProcess(user_choice_name, user_choice_id, data{}) → \n\n(Call a tool by replying ONLY with\n{\"tool\":\"ToolName\",\"params\":{...}} )\n\n\n#FLOW\nstep-1 Determine which document in the templateCatalog the user wants to create.\nstep-2 Call GetMetaData with the identified id. \n → You get back:\n • metadata.placeholders (global/static placeholders)\n • metadata.conditionals[] (each has flag, label, help, placeholders[])\n\nstep-3 Request the necessary information from the user:\n a) For each name in metadata.placeholders, ask “What is <PLACEHOLDER>? ”\n b) For each item in metadata.conditionals:\n i. Ask “Would you like to include the <label> section? <help>”\n ii. Record in blocks[KEY].include = true/false\n iii. If include===true, then for each p in placeholders[] ask “What is <p>? ”\n → Build up a `data` object:\n {\n /* static values from 3a */,\n blocks: {\n KEY1: { include: true, P1: val1, P2: val2… },\n KEY2: { include: false },\n …\n }\n }\n\nstep-4 After collecting all the required information, submit the information provided by the user to the user for approval as a whole.\nstep-5 Using the `docId` and that `data` object, call the DocProcess (FillDocument) tool.\n\nstep-6 If there are no errors, return the new document’s download URL (or ID) to the user indicating success.\n\n\n#STYLE\n• Speak concise, formal Turkish.\n• Never guess data; always ask.\n• Only tool-call messages may contain JSON blocks.\n\n#RULES\nWhen calling DocProcess, DO NOT CHANGE/TRANSLATE the placeholder names and conditional flag names/structure returned by GetMetaData. Only place the answers you obtained from the user next to them.\n"
}
},
"retryOnFail": true,
"typeVersion": 2
},
{
"id": "753c8e8c-18f3-4a54-80a5-af1b5256a656",
"name": "문서 처리",
"type": "@n8n/n8n-nodes-langchain.toolWorkflow",
"position": [
600,
300
],
"parameters": {
"workflowId": {
"__rl": true,
"mode": "id",
"value": "<YOUR_WORKFLOW_ID>"
},
"description": "Call this tool for Doc Process",
"workflowInputs": {
"value": {
"data": "={{ $fromAI('data') }}",
"user_choice_id": "={{ $fromAI('user_choice_id') }}",
"user_choice_name": "={{ $fromAI('user_choice_name') }}"
},
"schema": [
{
"id": "user_choice_name",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "user_choice_name",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "user_choice_id",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "user_choice_id",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "data",
"type": "object",
"display": true,
"removed": false,
"required": false,
"displayName": "data",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
}
},
"typeVersion": 2.2
},
{
"id": "25b8e0ed-90ed-4e14-a042-a36a2cb6ec15",
"name": "Postgres 채팅 메모리",
"type": "@n8n/n8n-nodes-langchain.memoryPostgresChat",
"position": [
200,
300
],
"parameters": {},
"credentials": {
"postgres": {
"id": "S6crn2oCuGjvhvVO",
"name": "DocAgentMemory"
}
},
"typeVersion": 1.3
},
{
"id": "806c4fa9-6276-4066-b2ca-f0432c4ef228",
"name": "템플릿 목록",
"type": "n8n-nodes-base.httpRequest",
"position": [
-500,
440
],
"parameters": {
"url": "https://www.googleapis.com/drive/v3/files?q='%3CYOUR_PARENT_ID%3E'+in+parents+and+trashed=false&fields=files(id,name,description)&pageSize=1000",
"options": {},
"sendHeaders": true,
"authentication": "predefinedCredentialType",
"headerParameters": {
"parameters": [
{
"name": "Accept",
"value": "application/json"
}
]
},
"nodeCredentialType": "googleDriveOAuth2Api"
},
"credentials": {
"googleDocsOAuth2Api": {
"id": "wIHEgJhIzXR9CFKm",
"name": "Google Docs account"
},
"googleDriveOAuth2Api": {
"id": "G5mimUj7FOKYpMol",
"name": "Google Drive-n8n"
}
},
"typeVersion": 4.2
},
{
"id": "5a5f198e-b611-492e-a194-0cdfc6d8a3de",
"name": "스티커 노트",
"type": "n8n-nodes-base.stickyNote",
"position": [
-560,
260
],
"parameters": {
"color": 4,
"width": 260,
"height": 360,
"content": "## Manual Template List Retrieval\n**The response returned from this API request is manually added to the system prompt.\n\n"
},
"typeVersion": 1
},
{
"id": "0ff8e732-1497-45af-b8a6-b29287d72f5f",
"name": "스티커 노트1",
"type": "n8n-nodes-base.stickyNote",
"position": [
160,
260
],
"parameters": {
"width": 180,
"height": 320,
"content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n**It is preferred for more consistent memory management. Other alternatives can also be tried."
},
"typeVersion": 1
},
{
"id": "656dedde-5074-412b-ab5b-d6ee9980d8d9",
"name": "스티커 노트2",
"type": "n8n-nodes-base.stickyNote",
"position": [
380,
260
],
"parameters": {
"width": 180,
"height": 320,
"content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n**Metadata of the template selected by the user is dynamically retrieved."
},
"typeVersion": 1
},
{
"id": "79633aef-0d8e-4f85-93f4-af4a13f47a7a",
"name": "스티커 노트3",
"type": "n8n-nodes-base.stickyNote",
"position": [
-60,
260
],
"parameters": {
"width": 180,
"height": 320,
"content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n**Prioritized due to free API-Key trial."
},
"typeVersion": 1
},
{
"id": "839584c8-ce14-4c66-aee2-aa6572345fcc",
"name": "스티커 노트4",
"type": "n8n-nodes-base.stickyNote",
"position": [
-2000,
-60
],
"parameters": {
"color": 6,
"width": 1280,
"height": 4140,
"content": "## Description \n\n## 1 — What Does It Do / Which Problem Does It Solve?\n\nThis workflow turns Google Docs-based contract & form templates into **ready-to-sign PDFs in minutes**—all from a single chat flow.\n\n- **Automates repetitive document creation.** Instead of copying a rental, sales, or NDA template and filling it by hand every time, the bot asks for the required values and fills them in.\n- **Eliminates human error.** It lists every mandatory field so nothing is missed, and removes unnecessary clauses via conditional blocks.\n- **Speeds up approvals.** The final draft arrives as a direct PDF link—one click to send for signing.\n- **One template → unlimited variations.** Every new template you drop in Drive is auto-listed with **zero workflow edits—**it scales effortlessly.\n- **100 % no-code.** Runs on n8n + Google Apps Script—no extra backend, self-hosted or cloud.\n\n---\n\n## 2 — How It Works (Detailed Flow)\n\n1. 📝 **Template Discovery**\n \n 📂 The **TemplateList** node scans the Drive folder you specify via the `?mode=meta` endpoint and returns an `id / title / desc` list. The bot shows this list in chat.\n \n2. 🎯 **Selection & Metadata Fetch**\n \n The user types a template name.\n \n 🔍 **GetMetaData** opens the chosen Doc, extracts `META_JSON`, placeholders, and conditional blocks, then lists mandatory & optional fields.\n \n3. 🗣 **Data-Collection Loop**\n - The bot asks for every **placeholder** value.\n - For each **conditional block** it asks 🟢 **Yes** / 🔴 **No**.\n \n Answers are accumulated in a `data` JSON object.\n \n4. ✅ **Final Confirmation**\n \n The bot summarizes the inputs → when the user clicks **Confirm**, the *DocProcess* sub-workflow starts.\n \n5. ⚙️ **DocProcess Sub-Workflow**\n \n \n | 🔧 Step | Node | Task |\n | --- | --- | --- |\n | 1 | **User Choice Match Check** | Verifies name–ID match; throws if wrong |\n | 2 | **GetMetaData (renew)** | Gets the latest placeholder list |\n | 3 | **Validate JSON Format** | Checks for missing / unknown fields |\n | 4 | **CopyTemplate** | Copies the Doc via Drive API |\n | 5 | **FillDocument** | Apps Script fills placeholders & removes blocks |\n | 6 | **Generate PDF Link** | Builds an `export?format=pdf` URL |\n6. 📎 **Delivery**\n \n The master agent sends **🔗 Download PDF** & **✏️ Open Google Doc** links.\n \n7. 🚫 **Error Paths**\n - `status:\"ERROR\", missing:[…]` → bot lists missing fields and re-asks.\n - `unknown:[…]` → template list is outdated; rerun *TemplateList*.\n - Any Apps Script error → the returned `message` is shown verbatim in chat.\n\n---\n\n## 3 — 🚀 Setup Steps (Full Checklist)\n\n> Goal: Get a flawless PDF on the first run.\n> \n> \n> Mentally **tick** the ☑️ in front of every line as you go.\n> \n\n### ☁️ A. Google Drive Preparation\n\n| Step | Do This | Watch Out For |\n| --- | --- | --- |\n| 1 | Create a `Templates/` folder → put every template Doc inside | Exactly **one** folder; **no** sub-folders |\n| 2 | Placeholders in every Doc are **`{{UPPER_CASE}}`** | No Turkish chars or spaces |\n| 3 | Wrap optional clauses with **`[[BLOCK_NAME:START]]…[[BLOCK_NAME:END]]`** | The `START` tag must have a **blank line above** |\n| 4 | Add a `META_JSON` block at the very end | Script deletes it automatically after fill |\n| 5 | Right-click Doc > **Details ▸ Description** = 1-line human description | Shown by the bot in the list |\n| 6 | Create a second `Generated/` folder (for copies) | Keeps Drive tidy |\n\n> 🔑 Folder ID (long alphanumerical) = <TEMPLATE_PARENT_ID>\n> \n> \n> We’ll paste this into the TemplateList node next.\n> \n\n[Simple sample template → Template Link](https://www.notion.so/Simple-sample-template-Template-Link-22b3f8a1e57f8070beacd034ba6f557f?pvs=21)\n\n---\n\n### 🛠 B. Import the Workflow into n8n\n\n```bash\nSettings ▸ Import Workflow ▸ DocAgent.json\n\n```\n\nIf nodes look **Broken** afterwards → no community-node problem; you only need to select credentials.\n\n---\n\n### 📑 C. Customize the TemplateList Node\n\n1. Open **Template List** node ⚙️ → replace\n \n `'%3CYOUR_PARENT_ID%3E' in parents`\n \n with the real **folder ID** in the **URL**.\n \n2. Right-click node > **Execute Node**.\n3. Copy the entire JSON response.\n4. In the editor paste it into:\n - **DocAgent** → *System Prompt* (top)\n - **User Choice Match Check** → *System Prompt* (top)\n \n Save.\n \n\n> ⚠️ Why manual? Caching the list saves LLM tokens. Whenever you add a template, rerun the node and update the prompts.\n> \n\n---\n\n### 🔗 D. Deploy the Apps Script\n\n| Step | Screen | Note |\n| --- | --- | --- |\n| 1 | Open Gist files **GetMetaData.gs** + **FillDocument.gs** → *File ▸ Make a copy* | Both files may live in one project |\n| 2 | *Project Settings* > enable **Google Docs API** ✔️ & **Google Drive API** ✔️ | Otherwise you’ll see 403 errors |\n| 3 | *Deploy ▸ New deployment ▸ Web app* | |\n| • Execute as | **Me** | |\n| • Who has access | **Anyone** | |\n| 4 | On the consent screen allow scopes:• `…/auth/documents`• `…/auth/drive` | Click **Advanced › Go** if Google warns |\n| 5 | Copy the **Web App URL** (e.g. `https://script.google.com/macros/s/ABC123/exec`) | If this URL changes, update n8n |\n\n[Apps Script source code → Notion Link](https://www.notion.so/Apps-Script-source-code-Notion-Link-22b3f8a1e57f8015a280d90de16c031f?pvs=21)\n\n---\n\n### 🔧 E. Wire the Script URL in n8n\n\n| Node | Field | Action |\n| --- | --- | --- |\n| **GetMetaData** | *URL* | `<WEB_APP_URL>?mode=meta&id={{ $json[\"id\"] }}` |\n| **FillDocument** | *URL* | `<WEB_APP_URL>` |\n\n> 💡 Prefer using an .env file? Add GAS_WEBAPP_URL=… and reference it as {{ $env.GAS_WEBAPP_URL }}.\n> \n\n---\n\n### 🔐 F. Add Credentials\n\n- **Google Drive OAuth2** → *Drive API (v3) Full Access*\n- **Google Docs OAuth2** → same account\n- **LLM key** (OpenAI / Gemini)\n- (Optional) **Postgres Chat Memory** credential for the corresponding node\n\n---\n\n### 🧪 G. First Run (Smoke Test)\n\n1. Switch the workflow **Active**.\n2. In the chat panel type `/start`.\n3. Bot lists templates → pick one.\n4. Fill mandatory fields, optionally toggle blocks → **Confirm**.\n5. **🔗 Download PDF** link appears → ☑️ setup complete.\n\n---\n\n### ❌ H. Common Errors & Fixes\n\n| 🆘 Error | Likely Cause | Remedy |\n| --- | --- | --- |\n| `403: Apps Script permission denied` | Web app access set to *User* | Redeploy as **Anyone**, re-authorize scopes |\n| `placeholder validation failed` | Missing required field | Provide the listed values → rerun DocProcess |\n| `unknown placeholders: …` | Template vs. agent mismatch | Check placeholder spelling (UPPER_CASE ASCII) |\n| `Template ID not found` | Prompt list is old | Rerun **TemplateList** → update both prompts |\n| `Cannot find META_JSON` | No meta block / wrong tag | Add `[[META_JSON_START]] … [[META_JSON_END]]`, retry |\n\n---\n\n### ✅ Final Checklist\n\n- [ ] Drive folder structure & template rules ready\n- [ ] Workflow imported, folder ID set in node\n- [ ] TemplateList output pasted into both prompts\n- [ ] Apps Script deployed, URL set in nodes\n- [ ] OAuth credentials & LLM key configured\n- [ ] `/start` test passes, PDF link received\n\n---\n\n## 🙋♂️ Need Help with Customizations?\n\nReach out for consulting & support on LinkedIn: [**Özgür Karateke**](https://www.linkedin.com/in/%C3%B6zg%C3%BCr-karateke-130514147/)\n\n[Simple sample template → Template Link](https://www.notion.so/Simple-sample-template-Template-Link-22b3f8a1e57f8070beacd034ba6f557f?pvs=21)\n\n[Apps Script source code → Notion Link](https://www.notion.so/Apps-Script-source-code-Notion-Link-22b3f8a1e57f8015a280d90de16c031f?pvs=21)"
},
"typeVersion": 1
},
{
"id": "69000a74-eba7-41a8-8c93-635e8664a1ce",
"name": "스티커 노트5",
"type": "n8n-nodes-base.stickyNote",
"position": [
-100,
660
],
"parameters": {
"color": 4,
"width": 3640,
"height": 1040,
"content": "## DocProcess (Subworkflow)"
},
"typeVersion": 1
},
{
"id": "d5f08f8a-d45c-4a6b-9223-b98aafe7b6a3",
"name": "다른 워크플로우에 의해 실행 시",
"type": "n8n-nodes-base.executeWorkflowTrigger",
"position": [
80,
1020
],
"parameters": {
"workflowInputs": {
"values": [
{
"name": "user_choice_name"
},
{
"name": "user_choice_id"
},
{
"name": "data",
"type": "object"
}
]
}
},
"typeVersion": 1.1
},
{
"id": "709b08c4-7c8c-4d63-a8c2-3e8d96df40ce",
"name": "조건문",
"type": "n8n-nodes-base.if",
"position": [
660,
1020
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "a78bfdab-11cc-4ef1-8074-1fdcd6f14275",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
},
"leftValue": "={{ $json.output.eslesme }}",
"rightValue": "true"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "2dd91c47-fefb-4715-a3ce-4a9f411d569d",
"name": "Google Gemini 채팅 모델1",
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"position": [
1620,
1140
],
"parameters": {
"options": {},
"modelName": "models/gemini-2.5-pro"
},
"credentials": {
"googlePalmApi": {
"id": "M4luDvdaNUQojgwm",
"name": "Google Gemini(PaLM) Api account"
}
},
"typeVersion": 1
},
{
"id": "eac6b3cd-eb34-476d-a500-71bce8d5c29a",
"name": "구조화된 출력 파서",
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"position": [
440,
1240
],
"parameters": {
"jsonSchemaExample": "{\n\t\"eslesme\": true,\n\t\"user_choice_name\": \"SATIŞ SÖZLEŞMESİ\",\n \"user_choice_id\": \"<EXAMPLE_TEMPLATE_ID>\"\n}"
},
"typeVersion": 1.3
},
{
"id": "76be9549-a482-496a-b11c-ddf8a958f39a",
"name": "필드 편집",
"type": "n8n-nodes-base.set",
"position": [
1320,
920
],
"parameters": {
"options": {},
"assignments": {
"assignments": []
},
"includeOtherFields": true
},
"typeVersion": 3.4
},
{
"id": "011d9a1a-3841-4fbd-84f6-99b4ad4eb782",
"name": "조건문1",
"type": "n8n-nodes-base.if",
"position": [
2340,
920
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "91055448-6534-40ca-939b-dfbdf2974ab1",
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $('Format Control').item.json.output.docId }}",
"rightValue": "={{ $json.id }}"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "1f537d7f-d6d1-463b-999c-73fcba2b5024",
"name": "기타 오류",
"type": "n8n-nodes-base.set",
"position": [
3220,
1420
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "cb4572fd-8cc7-4e85-860b-aabbb6b1038d",
"name": "Belge oluşturulamama sebebi:",
"type": "string",
"value": "=Please consult the user to resolve the following error.\n{{ $('FillDocument').item.json.message }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "b0790f5f-256e-4559-926d-9ab45f1cad96",
"name": "스위치",
"type": "n8n-nodes-base.switch",
"position": [
3000,
1120
],
"parameters": {
"rules": {
"values": [
{
"outputKey": "Template Technical Error",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "c35889e4-f027-49b9-9b59-69cf996f0e9c",
"operator": {
"type": "array",
"operation": "notEmpty",
"singleValue": true
},
"leftValue": "={{ $('FillDocument').item.json.unknown }}",
"rightValue": ""
}
]
},
"renameOutput": true
},
{
"outputKey": "Incomplete Information Error",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "08a43597-51af-4632-82c5-ff54505bae13",
"operator": {
"type": "array",
"operation": "notEmpty",
"singleValue": true
},
"leftValue": "={{ $('FillDocument').item.json.missing }}",
"rightValue": ""
}
]
},
"renameOutput": true
},
{
"outputKey": "Other Errors",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "b42acb05-8237-46c2-80f4-27cfb1232710",
"operator": {
"type": "string",
"operation": "notEquals"
},
"leftValue": "={{ $('FillDocument').item.json.message }}",
"rightValue": " Placeholder validation failed"
}
]
},
"renameOutput": true
}
]
},
"options": {}
},
"typeVersion": 3.2
},
{
"id": "26c8978f-4f18-4026-994a-4c3b2b0dfeed",
"name": "템플릿 복사",
"type": "n8n-nodes-base.googleDrive",
"position": [
2120,
920
],
"parameters": {
"name": "={{ $now.toFormat('dd.MM.yyyy') }} tarihli {{ $('GetMetaData2').item.json.metadata.title }} belgesi",
"fileId": {
"__rl": true,
"mode": "id",
"value": "={{ $json.docId }}"
},
"driveId": {
"__rl": true,
"mode": "list",
"value": "My Drive"
},
"options": {},
"folderId": {
"__rl": true,
"mode": "id",
"value": "=<YOUR_FOLDER_ID>"
},
"operation": "copy",
"sameFolder": false
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "G5mimUj7FOKYpMol",
"name": "Google Drive-n8n"
}
},
"typeVersion": 3
},
{
"id": "9ff9e7e9-1455-4d0b-8191-79b0c74b363b",
"name": "문서 채우기",
"type": "n8n-nodes-base.httpRequest",
"position": [
2560,
1020
],
"parameters": {
"url": "https://script.google.com/macros/s/<YOUR_DEPLOY_ID>/exec",
"method": "POST",
"options": {},
"sendBody": true,
"bodyParameters": {
"parameters": [
{
"name": "docId",
"value": "={{ $json.id }}"
},
{
"name": "data",
"value": "={{ $('Formatting Correction').item.json.data }}"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "ce49d769-0a53-40d0-b05c-25b071994aff",
"name": "Google Gemini 채팅 모델2",
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"position": [
320,
1240
],
"parameters": {
"options": {},
"modelName": "models/gemini-2.5-pro"
},
"credentials": {
"googlePalmApi": {
"id": "M4luDvdaNUQojgwm",
"name": "Google Gemini(PaLM) Api account"
}
},
"typeVersion": 1
},
{
"id": "cec0fdb3-0d86-47d5-9393-7718f20c5cf1",
"name": "사용자 선택 매칭 오류",
"type": "n8n-nodes-base.set",
"position": [
880,
1120
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "0bd79b8c-66b5-4a4e-9888-6a0af9276061",
"name": "pdf_id",
"type": "string",
"value": "The template name selected by the user does not match the template matched by the agent. Please check if the template name selected by the user matches its id."
}
]
}
},
"typeVersion": 3.4
},
{
"id": "bbb55fdb-6f7c-404c-8f00-c5d9da4e4803",
"name": "사용자 선택 정확 매칭",
"type": "n8n-nodes-base.set",
"position": [
880,
920
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "0a616fd3-6227-4902-9d1d-1ca09f14412e",
"name": "output.user_choice_id",
"type": "string",
"value": "={{ $json.output.user_choice_id }}"
}
]
},
"includeOtherFields": true
},
"typeVersion": 3.4
},
{
"id": "e47a0291-ffa1-4cf5-850d-f882849eb917",
"name": "사용자 선택 매칭 확인",
"type": "@n8n/n8n-nodes-langchain.chainLlm",
"position": [
300,
1020
],
"parameters": {
"text": "=The reference point is the document name chosen by the user.\n\n<document_name_and_id>\n{{ $json.user_choice_name }}\n{{ $json.user_choice_id }}\n</document_name>\n\n<guide_template_list>\n{{ YOUR_MANUAL_TO_ADD_TEMPLATE_LIST }}\n</guide_template_list>\n\nA match of id information is given according to the document name. Examine this match according to the guide list given to you.\n\nIf match is correct\n\n{\n\"match\": true,\n\"user_choice_name\":\"{{ $json.user_choice_name }}\" ,\n\"user_choice_id\": {{ $json.user_choice_id }}\n}\n\nIf match is incorrect:\n{\n\"match\": false,\n\"user_choice_name\":\"{{ $json.user_choice_name }}\" ,\n\"user_choice_id\": {{ $json.user_choice_id }},\n\"correct_id\":\"WRITE THE ID YOU NEED HERE\"\n}",
"batching": {},
"messages": {
"messageValues": [
{
"message": "Cevaplarını JSON formatında ver."
}
]
},
"promptType": "define",
"hasOutputParser": true
},
"typeVersion": 1.7
},
{
"id": "6c13dece-f397-4d12-b60f-64890848889e",
"name": "메타데이터 가져오기2",
"type": "n8n-nodes-base.httpRequest",
"position": [
1100,
920
],
"parameters": {
"url": "https://script.google.com/macros/s/<YOUR_DEPLOY_ID>/exec",
"options": {},
"sendQuery": true,
"sendHeaders": true,
"queryParameters": {
"parameters": [
{
"name": "mode",
"value": "meta"
},
{
"name": "id",
"value": "={{ $json.output.user_choice_id }}"
}
]
},
"headerParameters": {
"parameters": [
{
"name": "accept",
"value": "application/json"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "a9303653-7510-4fb7-b16c-14e49e7de89b",
"name": "형식 제어",
"type": "@n8n/n8n-nodes-langchain.chainLlm",
"position": [
1540,
920
],
"parameters": {
"text": "=Place the actual user answers according to the rules using the metadata information of the document given to you.\n\nMatch only the original metadata placeholder and conditional flags with the answers given by the user. DO NOT change the placeholder and conditional flag texts in the metadata.\n\n<metadata>\n{{ $json.metadata.toJsonString() }}\n</metadata>\n\n<user_answers>\n\n{{ $('When Executed by Another Workflow').item.json.data.toJsonString() }}\n</user_answers>\n\nFormat example of the output you should give:\n\n{\n\"docId\": \"<EXAMPLE_TEMPLATE_ID>\",\n\"data\": {\n// — Static (mandatory) placeholders —\n\"SELLER_NAME\": \"Özgür Mözgür\",\n\"BUYER_NAME\": \"Ali Veli\",\n\"PRODUCT_NAME\": \"Computer\",\n\"PRICE\": \"10000\",\n\"DELIVER_DATE\": \"12.06.2025\",\n\"TODAY_DATE\": \"02.07.2025\",\n\n// — Conditional blocks in the “blocks” object —\n\"blocks\": {\n\"MADATE_INSTALLMENT\": {\n\"include\": false\n// INSTALLMENT_PLAN is not sent because include:false\n},\n\"GUARANTEE\": {\n\"include\": true,\n\"GUARANTEE_PERIOD\": \"24\"\n}\n}\n}\n}",
"batching": {},
"promptType": "define",
"hasOutputParser": true
},
"typeVersion": 1.7
},
{
"id": "ad6cfa0a-d879-465c-8fec-26f3bc281f4c",
"name": "형식 수정",
"type": "n8n-nodes-base.code",
"position": [
1900,
920
],
"parameters": {
"jsCode": "// 1) We get the raw text with $input.first() (direct JS instead of Expression)\n// $input provides access to each item as n8n's global variable.\nconst raw = $input.first().json.text;\n\n// 2) Regex to catch ```json … ``` block\nconst match = raw.match(/```json\\s*([\\s\\S]*?)```/i);\n\n// 3) Extract block or use full text\nconst jsonString = match ? match[1] : raw;\n\n// 4) Trim + parse\nconst clean = jsonString.trim();\nlet parsed;\ntry {\n parsed = JSON.parse(clean);\n} catch (e) {\n throw new Error(`JSON parse hatası: ${e.message}\\n\\nRaw içerik:\\n${clean}`);\n}\n\n// 5) Return a single item output\nreturn [{ json: parsed }];\n"
},
"typeVersion": 2
},
{
"id": "faeaad9d-e23c-429b-bff9-bb277dcf677f",
"name": "문서 ID 매칭 오류",
"type": "n8n-nodes-base.set",
"position": [
2560,
820
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "4dec2470-f7cb-4b0a-92a8-31cf88581921",
"name": "Belge oluşturulamama sebebi:",
"type": "string",
"value": "=The document id to be filled with the copied document does not match"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "2dba1518-f4ce-4d85-95a3-40245b3226bc",
"name": "조건문",
"type": "n8n-nodes-base.if",
"position": [
2780,
1020
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "fc031e6c-6bc6-445b-9cd5-f8e749156f88",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.status }}",
"rightValue": "OK"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "ca0de06e-d55a-4243-94ff-55cd742c28a8",
"name": "다운로드 링크 생성",
"type": "n8n-nodes-base.httpRequest",
"position": [
3000,
820
],
"parameters": {
"url": "=https://www.googleapis.com/drive/v3/files/{{ $('CopyTemplate').item.json.id }}?fields=webContentLink,exportLinks ",
"options": {},
"authentication": "predefinedCredentialType",
"nodeCredentialType": "googleDriveOAuth2Api"
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "G5mimUj7FOKYpMol",
"name": "Google Drive-n8n"
}
},
"typeVersion": 4.2
},
{
"id": "9deae9c7-8b62-475d-bff8-b04295df2e35",
"name": "다운로드 링크 형식",
"type": "n8n-nodes-base.set",
"position": [
3220,
820
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "9af065e4-ec39-480b-b577-99351ed48228",
"name": "download_link",
"type": "string",
"value": "={{ $json.exportLinks['application/pdf'] }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "3a2bbdb7-a69c-4b5f-8050-b75cfaed6d2e",
"name": "불완전 정보 오류",
"type": "n8n-nodes-base.set",
"position": [
3220,
1020
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "4dec2470-f7cb-4b0a-92a8-31cf88581921",
"name": "Belge oluşturulamama sebebi:",
"type": "string",
"value": "={{ $('FillDocument').item.json.status }}\nError description:\n{{ $('FillDocument').item.json.message }}\n\n\nLütfen buradaki eksik belgeleri user'dan isteyiniz. Tüm bilgileri tamamladıktan sonra tekrar DocProcess aracını çağırabilirsiniz. {{ $('FillDocument').item.json.missing.toJsonString() }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "132e6eb0-6630-4cd2-b490-b5033bf1782a",
"name": "템플릿 기술 오류",
"type": "n8n-nodes-base.set",
"position": [
3220,
1220
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "cb4572fd-8cc7-4e85-860b-aabbb6b1038d",
"name": "Belge oluşturulamama sebebi:",
"type": "string",
"value": "=This is a technical error, you can send the following text to the user: \"Please consult your institution or organization for this issue. The draft that the document you requested was created from is incorrect.\""
}
]
}
},
"typeVersion": 3.4
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "8d310631-7990-4ed7-b18a-2c351cee1768",
"connections": {
"2dba1518-f4ce-4d85-95a3-40245b3226bc": {
"main": [
[
{
"node": "ca0de06e-d55a-4243-94ff-55cd742c28a8",
"type": "main",
"index": 0
}
],
[
{
"node": "b0790f5f-256e-4559-926d-9ab45f1cad96",
"type": "main",
"index": 0
}
]
]
},
"011d9a1a-3841-4fbd-84f6-99b4ad4eb782": {
"main": [
[
{
"node": "faeaad9d-e23c-429b-bff9-bb277dcf677f",
"type": "main",
"index": 0
}
],
[
{
"node": "9ff9e7e9-1455-4d0b-8191-79b0c74b363b",
"type": "main",
"index": 0
}
]
]
},
"b0790f5f-256e-4559-926d-9ab45f1cad96": {
"main": [
[
{
"node": "132e6eb0-6630-4cd2-b490-b5033bf1782a",
"type": "main",
"index": 0
}
],
[
{
"node": "3a2bbdb7-a69c-4b5f-8050-b75cfaed6d2e",
"type": "main",
"index": 0
}
],
[
{
"node": "1f537d7f-d6d1-463b-999c-73fcba2b5024",
"type": "main",
"index": 0
}
]
]
},
"753c8e8c-18f3-4a54-80a5-af1b5256a656": {
"ai_tool": [
[
{
"node": "74c575a0-6523-47d5-834e-a0c388d06676",
"type": "ai_tool",
"index": 0
}
]
]
},
"76be9549-a482-496a-b11c-ddf8a958f39a": {
"main": [
[
{
"node": "a9303653-7510-4fb7-b16c-14e49e7de89b",
"type": "main",
"index": 0
}
]
]
},
"514e6233-fe2d-4031-9ea6-ad046d2d1479": {
"ai_tool": [
[
{
"node": "74c575a0-6523-47d5-834e-a0c388d06676",
"type": "ai_tool",
"index": 0
}
]
]
},
"26c8978f-4f18-4026-994a-4c3b2b0dfeed": {
"main": [
[
{
"node": "011d9a1a-3841-4fbd-84f6-99b4ad4eb782",
"type": "main",
"index": 0
}
]
]
},
"9ff9e7e9-1455-4d0b-8191-79b0c74b363b": {
"main": [
[
{
"node": "2dba1518-f4ce-4d85-95a3-40245b3226bc",
"type": "main",
"index": 0
}
]
]
},
"6c13dece-f397-4d12-b60f-64890848889e": {
"main": [
[
{
"node": "76be9549-a482-496a-b11c-ddf8a958f39a",
"type": "main",
"index": 0
}
]
]
},
"a9303653-7510-4fb7-b16c-14e49e7de89b": {
"main": [
[
{
"node": "ad6cfa0a-d879-465c-8fec-26f3bc281f4c",
"type": "main",
"index": 0
}
]
]
},
"25b8e0ed-90ed-4e14-a042-a36a2cb6ec15": {
"ai_memory": [
[
{
"node": "74c575a0-6523-47d5-834e-a0c388d06676",
"type": "ai_memory",
"index": 0
}
]
]
},
"ad6cfa0a-d879-465c-8fec-26f3bc281f4c": {
"main": [
[
{
"node": "26c8978f-4f18-4026-994a-4c3b2b0dfeed",
"type": "main",
"index": 0
}
]
]
},
"ca0de06e-d55a-4243-94ff-55cd742c28a8": {
"main": [
[
{
"node": "9deae9c7-8b62-475d-bff8-b04295df2e35",
"type": "main",
"index": 0
}
]
]
},
"e47a0291-ffa1-4cf5-850d-f882849eb917": {
"main": [
[
{
"node": "2dba1518-f4ce-4d85-95a3-40245b3226bc",
"type": "main",
"index": 0
}
]
]
},
"d6dae967-cee4-4c8b-9f80-a1eb8279b2a0": {
"ai_languageModel": [
[
{
"node": "74c575a0-6523-47d5-834e-a0c388d06676",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"eac6b3cd-eb34-476d-a500-71bce8d5c29a": {
"ai_outputParser": [
[
{
"node": "e47a0291-ffa1-4cf5-850d-f882849eb917",
"type": "ai_outputParser",
"index": 0
}
]
]
},
"2dd91c47-fefb-4715-a3ce-4a9f411d569d": {
"ai_languageModel": [
[
{
"node": "a9303653-7510-4fb7-b16c-14e49e7de89b",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"ce49d769-0a53-40d0-b05c-25b071994aff": {
"ai_languageModel": [
[
{
"node": "e47a0291-ffa1-4cf5-850d-f882849eb917",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"bbb55fdb-6f7c-404c-8f00-c5d9da4e4803": {
"main": [
[
{
"node": "6c13dece-f397-4d12-b60f-64890848889e",
"type": "main",
"index": 0
}
]
]
},
"c2d0ed01-0b5f-4e92-89a1-c140990b6998": {
"main": [
[
{
"node": "74c575a0-6523-47d5-834e-a0c388d06676",
"type": "main",
"index": 0
}
]
]
},
"d5f08f8a-d45c-4a6b-9223-b98aafe7b6a3": {
"main": [
[
{
"node": "e47a0291-ffa1-4cf5-850d-f882849eb917",
"type": "main",
"index": 0
}
]
]
}
}
}자주 묻는 질문
이 워크플로우를 어떻게 사용하나요?
위의 JSON 구성 코드를 복사하여 n8n 인스턴스에서 새 워크플로우를 생성하고 "JSON에서 가져오기"를 선택한 후, 구성을 붙여넣고 필요에 따라 인증 설정을 수정하세요.
이 워크플로우는 어떤 시나리오에 적합한가요?
고급 - 문서 추출, AI 챗봇
유료인가요?
이 워크플로우는 완전히 무료이며 직접 가져와 사용할 수 있습니다. 다만, 워크플로우에서 사용하는 타사 서비스(예: OpenAI API)는 사용자 직접 비용을 지불해야 할 수 있습니다.
관련 워크플로우 추천
시각화 참조 라이브러리에서 n8n 노드를 탐색
可视化 참조 라이브러리에서 n8n 노드를 탐색
If
Ftp
Set
+
If
Ftp
Set
113 노드I versus AI
기타
컨텍스트 혼합 RAG AI 콘텐츠
Google Drive에서 Supabase 상황 벡터 데이터베이스로 동기화, RAG 애플리케이션 사용
If
Set
Code
+
If
Set
Code
76 노드Michael Taleb
AI RAG
AI이메일分诊与GPT-4警报系统及Telegram알림
AI이메일分诊与GPT-4警报系统及Telegram알림
If
Set
Gmail
+
If
Set
Gmail
104 노드Peter Joslyn
지원
LinkedIn 및 X 바이럴 콘텐츠 자동 엔진
사용AI생성및게시자동생성LinkedIn및X의病毒콘텐츠
If
Set
Wait
+
If
Set
Wait
156 노드Diptamoy Barman
콘텐츠 제작
비즈니스 AI 지휘 센터: Google Workspace 모듈화 대리자, 벡터 검색 및 다중 채널 보고
상업 AI 지휘 센터: Google Workspace 모듈화 대리자, 벡터 검색 및 다중 채널 보고
Set
Gmail
Slack
+
Set
Gmail
Slack
80 노드Paul
문서 추출
반려동물 가게 4
🐶 펫 샵 예약 AI 대리자
If
Set
Code
+
If
Set
Code
187 노드Bruno Dias
인공지능