8
n8n 한국어amn8n.com

개발 완료 - Telegram을 통한 PDF 채팅

고급

이것은Document Extraction, AI RAG분야의자동화 워크플로우로, 25개의 노드를 포함합니다.주로 If, Code, Limit, Telegram, StopAndError 등의 노드를 사용하며. Google Gemini와 Pinecone을 사용한 Telegram 'PDF와 채팅' 봇 자동화

사전 요구사항
  • Telegram Bot Token
  • Google Gemini API Key
  • Pinecone API Key
워크플로우 미리보기
노드 연결 관계를 시각적으로 표시하며, 확대/축소 및 이동을 지원합니다
워크플로우 내보내기
다음 JSON 구성을 복사하여 n8n에 가져오면 이 워크플로우를 사용할 수 있습니다
{
  "id": "ibBeVW3tpY92HUpA",
  "meta": {
    "instanceId": "1a54c41d9050a8f1fa6f74ca858828ad9fb97b9fafa3e9760e576171c531a787",
    "templateCredsSetupCompleted": true
  },
  "name": "Development Done - Chat with PDF via Telegram",
  "tags": [
    {
      "id": "0BJmSFs6EfUsyTWo",
      "name": "AI Internal",
      "createdAt": "2025-10-13T09:18:40.187Z",
      "updatedAt": "2025-10-13T09:18:40.187Z"
    }
  ],
  "nodes": [
    {
      "id": "c2e95dd8-961b-42d0-89cd-c31e810da2e8",
      "name": "기본 데이터 로더",
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "position": [
        1584,
        944
      ],
      "parameters": {
        "options": {},
        "dataType": "binary"
      },
      "typeVersion": 1
    },
    {
      "id": "4ed51c5d-23e5-4836-ad13-1a5fb48a0317",
      "name": "재귀적 문자 텍스트 분할기",
      "type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
      "position": [
        1648,
        1104
      ],
      "parameters": {
        "options": {},
        "chunkSize": 3000,
        "chunkOverlap": 200
      },
      "typeVersion": 1
    },
    {
      "id": "61db0aad-53de-4655-af01-7389c603137f",
      "name": "중지 및 오류",
      "type": "n8n-nodes-base.stopAndError",
      "position": [
        1936,
        1664
      ],
      "parameters": {
        "errorMessage": "An error occurred"
      },
      "typeVersion": 1
    },
    {
      "id": "b525eb52-d03f-4b1c-83c1-54855c4f2701",
      "name": "질문 및 답변 체인",
      "type": "@n8n/n8n-nodes-langchain.chainRetrievalQa",
      "position": [
        1008,
        1488
      ],
      "parameters": {
        "text": "=**INSTRUCTIONS:**\nYou are an expert RAG system. Answer the user's question ONLY using the provided context.\n\n1.  **Format Mode:** Your response MUST be formatted for Telegram's **HTML Parse Mode**.\n2.  **Formatting:**\n    * Use the bold tag (<b>) for all titles and key benefits.\n    * **CRITICAL LINE BREAK RULE:** For all line breaks, lists, and spacing, use the **newline character (\\n)** instead of any HTML tags like <br/> or <br>.\n    * Ensure the list is clearly structured with a single newline after each key item.\n\n**CONTEXT:** (The retrieved information follows here)\nSearch the database with the retriever for information for the answer\n\n**USER QUESTION:**\n{{ $json.message.text }}",
        "options": {},
        "promptType": "define"
      },
      "typeVersion": 1.3
    },
    {
      "id": "666d4966-aa07-4b39-9f9f-6101f6f70b27",
      "name": "벡터 저장소 검색기",
      "type": "@n8n/n8n-nodes-langchain.retrieverVectorStore",
      "position": [
        1072,
        1680
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "2ea5294f-def8-43d6-84ca-5f4bbb4b8b4a",
      "name": "Pinecone 벡터 저장소1",
      "type": "@n8n/n8n-nodes-langchain.vectorStorePinecone",
      "position": [
        992,
        1872
      ],
      "parameters": {
        "options": {},
        "pineconeIndex": {
          "__rl": true,
          "mode": "list",
          "value": "telegram",
          "cachedResultName": "telegram"
        }
      },
      "credentials": {
        "pineconeApi": {
          "id": "Your_Pinecone_Credential_ID",
          "name": "PineconeApi account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "d9e88d5c-096b-4a8f-8f17-fb8d1887c95f",
      "name": "문서 여부 확인",
      "type": "n8n-nodes-base.if",
      "position": [
        288,
        1344
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 1,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "8839993b-9fe7-4e1e-a1cc-fe5de6b0bb62",
              "operator": {
                "type": "object",
                "operation": "exists",
                "singleValue": true
              },
              "leftValue": "={{ $json.message.document }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "18c639ce-3517-4f1f-b02a-a40ba4f1e14b",
      "name": "application/pdf로 변경",
      "type": "n8n-nodes-base.code",
      "position": [
        1072,
        1072
      ],
      "parameters": {
        "jsCode": "// Função para modificar os metadados do arquivo binário\nfunction modifyBinaryMetadata(items) {\n for (const item of items) {\n if (item.binary && item.binary.data) {\n // Modifica o tipo MIME\n item.binary.data.mimeType = 'application/pdf';\n \n // Garante que o nome do arquivo termine com .pdf\n if (!item.binary.data.fileName.toLowerCase().endsWith('.pdf')) {\n item.binary.data.fileName += '.pdf';\n }\n \n // Atualiza o contentType no fileType (se existir)\n if (item.binary.data.fileType) {\n item.binary.data.fileType.contentType = 'application/pdf';\n }\n }\n }\n return items;\n}\n\n// Aplica a modificação e retorna os itens atualizados\nreturn modifyBinaryMetadata($input.all());"
      },
      "typeVersion": 2
    },
    {
      "id": "9abd0d30-8bfd-4a9c-94a7-ddfe919f22df",
      "name": "Telegram 파일 가져오기",
      "type": "n8n-nodes-base.telegram",
      "position": [
        752,
        1072
      ],
      "webhookId": "911eeb6b-d6c2-4d35-9433-24b7ec4886ef",
      "parameters": {
        "fileId": "={{ $json.message.document.file_id }}",
        "resource": "file",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "Your_Telegram_Credential_ID",
          "name": "Telegram account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "f9af0cdd-7ea3-4e97-b53f-b65fdf4e9355",
      "name": "Telegram 응답",
      "type": "n8n-nodes-base.telegram",
      "onError": "continueErrorOutput",
      "position": [
        1552,
        1488
      ],
      "webhookId": "a5b324f8-649f-4a3a-b26f-57cd0eb341ec",
      "parameters": {
        "text": "={{ $json.response.text }}",
        "chatId": "={{ $('Telegram Message Trigger').item.json.message.chat.id }}",
        "additionalFields": {
          "parse_mode": "HTML",
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "Your_Telegram_Credential_ID",
          "name": "Telegram account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "048f9df4-1d15-4dcf-b853-52fe376434a0",
      "name": "Telegram 데이터베이스 관련 응답",
      "type": "n8n-nodes-base.telegram",
      "onError": "continueErrorOutput",
      "position": [
        2176,
        768
      ],
      "webhookId": "52437171-bdad-408c-bced-5ffec75b851d",
      "parameters": {
        "text": "={{ $json.metadata.pdf.totalPages }} pages saved on Pinecone",
        "chatId": "={{ $('Telegram Message Trigger').item.json.message.chat.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "Your_Telegram_Credential_ID",
          "name": "Telegram account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "36017ee3-5c44-469b-aad7-6a44faa57d32",
      "name": "중지 및 오류1",
      "type": "n8n-nodes-base.stopAndError",
      "position": [
        2448,
        864
      ],
      "parameters": {
        "errorMessage": "An error occurred."
      },
      "typeVersion": 1
    },
    {
      "id": "68b2dc90-c4a5-436f-9c17-e811974f333b",
      "name": "Pinecone 벡터 저장소",
      "type": "@n8n/n8n-nodes-langchain.vectorStorePinecone",
      "position": [
        1488,
        768
      ],
      "parameters": {
        "mode": "insert",
        "options": {},
        "pineconeIndex": {
          "__rl": true,
          "mode": "list",
          "value": "telegram",
          "cachedResultName": "telegram"
        }
      },
      "credentials": {
        "pineconeApi": {
          "id": "Your_Pinecone_Credential_ID",
          "name": "PineconeApi account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "fa712022-84c5-4c6d-aff1-dd71f73a7c20",
      "name": "1개로 제한",
      "type": "n8n-nodes-base.limit",
      "position": [
        1904,
        768
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "71e24d0d-1e70-4c59-acf8-c7b73b5d33c5",
      "name": "임베딩 Google Gemini",
      "type": "@n8n/n8n-nodes-langchain.embeddingsGoogleGemini",
      "position": [
        1456,
        992
      ],
      "parameters": {
        "modelName": "models/gemini-embedding-001"
      },
      "credentials": {
        "googlePalmApi": {
          "id": "Your_Gemini_Credential_ID",
          "name": "Your Google Gemini Credential Name"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "0e7c375a-1aaa-459f-b8c2-13659f71320a",
      "name": "임베딩 Google Gemini1",
      "type": "@n8n/n8n-nodes-langchain.embeddingsGoogleGemini",
      "position": [
        1024,
        2016
      ],
      "parameters": {
        "modelName": "models/gemini-embedding-001"
      },
      "credentials": {
        "googlePalmApi": {
          "id": "Your_Gemini_Credential_ID",
          "name": "Your Google Gemini Credential Name"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "77d57e70-ef74-49eb-9019-6103a09ae391",
      "name": "Google Gemini 채팅 모델",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        880,
        1696
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "googlePalmApi": {
          "id": "Your_Gemini_Credential_ID",
          "name": "Your Google Gemini Credential Name"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "92162e34-98e9-44ce-89a2-3ae058133a2d",
      "name": "Telegram 메시지 트리거",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -80,
        1344
      ],
      "webhookId": "b178f034-9997-4832-9bb4-a43c3015506e",
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "Your_Telegram_Credential_ID",
          "name": "Telegram account"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "01da8891-6cb5-444e-8848-b34ee5af095c",
      "name": "스티키 노트",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -224,
        1056
      ],
      "parameters": {
        "color": 5,
        "width": 368,
        "height": 272,
        "content": "## 1. **Trigger & Router**\n**Task:** This node is the starting point. It listens for *any* message on the configured Telegram bot.\n\n**Output:**\n- **Text:** User's question (goes to the RAG chain).\n- **Document:** Binary file data (goes to the indexing process).\n\n**Next Stop:** Routes the message to the **\"Check If is a document\"** node."
      },
      "typeVersion": 1
    },
    {
      "id": "246059a8-fbc0-4f33-8cfd-7b33c87c7c02",
      "name": "스티키 노트1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        176,
        1056
      ],
      "parameters": {
        "color": 6,
        "width": 384,
        "height": 256,
        "content": "## 2. **Router Node**\n**Task:** Determines the message type to route the workflow.\n\n**Condition:** Checks if `{{ $json.message.document }}` **exists**.\n- **TRUE (Top Branch):** A file was uploaded. Proceed to **Indexing** (download the file).\n- **FALSE (Bottom Branch):** It is a plain text question. Proceed to **Querying** (run the RAG Chain)."
      },
      "typeVersion": 1
    },
    {
      "id": "6e03fbfc-58e6-4cd5-9ce9-82b0942a85e2",
      "name": "스티키 노트2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1824,
        944
      ],
      "parameters": {
        "width": 336,
        "height": 272,
        "content": "## 5. **Text Splitter**\n**Task:** Breaks the large PDF text into small, manageable chunks for indexing.\n\n**Configuration:**\n- **Chunk Size:** 3000\n- **Chunk Overlap:** 200 (Ensures context overlaps between chunks for better retrieval).\n\n**Purpose:** This configuration is key for **Retrieval-Augmented Generation (RAG)** accuracy."
      },
      "typeVersion": 1
    },
    {
      "id": "dd26c4da-207a-4b8e-90a4-4d2db8f1c529",
      "name": "스티키 노트3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1408,
        544
      ],
      "parameters": {
        "color": 3,
        "width": 368,
        "height": 336,
        "content": "## 4. **Embeddings (Indexing)**\n**Task:** Converts the split text chunks into high-dimensional numerical **vectors**.\n\n**Model:** `models/gemini-embedding-001`\n\n**Purpose:** These vectors are what the Pinecone database stores and uses for fast, semantic similarity searches when a user asks a question."
      },
      "typeVersion": 1
    },
    {
      "id": "ed22ea85-0803-4926-b118-fb4100bbf937",
      "name": "스티키 노트4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1248,
        1776
      ],
      "parameters": {
        "color": 2,
        "width": 368,
        "height": 256,
        "content": "## 6. **Vector Store: Indexing**\n**Task:** **Inserts** the Gemini embeddings and their associated text content into the configured Pinecone index (`telegram`).\n\n**Mode:** **`insert`**\n\n**Result:** The PDF is now fully indexed and searchable. The workflow then sends a confirmation to the user via **\"Telegram Response about Database\"**."
      },
      "typeVersion": 1
    },
    {
      "id": "a8cada20-ac48-4c8b-ab0f-de9b56d7d4a2",
      "name": "스티키 노트5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        912,
        1232
      ],
      "parameters": {
        "color": 3,
        "width": 416,
        "height": 368,
        "content": "## 7. **Core RAG Engine**\n**Task:** Generates the final, context-based answer.\n\n**Connections:**\n- **LLM:** Google Gemini Chat Model (for generation).\n- **Retriever:** Vector Store Retriever (for context lookup).\n\n**CRITICAL PROMPT:** The prompt strictly enforces:\n1.  Answer **ONLY** using provided context.\n2.  Response must be in **Telegram HTML Parse Mode** (`<b>` and `\\n`)."
      },
      "typeVersion": 1
    },
    {
      "id": "2688705d-3dae-4235-84b0-8b880bf4cdeb",
      "name": "스티키 노트6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1376,
        1264
      ],
      "parameters": {
        "color": 4,
        "width": 432,
        "height": 336,
        "content": "## 8. **Final Telegram Response**\n**Task:** Sends the RAG result back to the user.\n\n**Text Input:** `={{ $json.response.text }}`\n\n**CRITICAL SETTING:**\n- **Parse Mode:** **HTML**\nThis is required to properly display the bold tags (`<b>`) and newline characters (`\\n`) formatted by the Question and Answer Chain."
      },
      "typeVersion": 1
    }
  ],
  "active": true,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "40963e46-0c2a-4887-9aaf-b9fafff20ab6",
  "connections": {
    "fa712022-84c5-4c6d-aff1-dd71f73a7c20": {
      "main": [
        [
          {
            "node": "048f9df4-1d15-4dcf-b853-52fe376434a0",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "f9af0cdd-7ea3-4e97-b53f-b65fdf4e9355": {
      "main": [
        [],
        [
          {
            "node": "61db0aad-53de-4655-af01-7389c603137f",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "9abd0d30-8bfd-4a9c-94a7-ddfe919f22df": {
      "main": [
        [
          {
            "node": "18c639ce-3517-4f1f-b02a-a40ba4f1e14b",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "c2e95dd8-961b-42d0-89cd-c31e810da2e8": {
      "ai_document": [
        [
          {
            "node": "68b2dc90-c4a5-436f-9c17-e811974f333b",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "68b2dc90-c4a5-436f-9c17-e811974f333b": {
      "main": [
        [
          {
            "node": "fa712022-84c5-4c6d-aff1-dd71f73a7c20",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "d9e88d5c-096b-4a8f-8f17-fb8d1887c95f": {
      "main": [
        [
          {
            "node": "9abd0d30-8bfd-4a9c-94a7-ddfe919f22df",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "b525eb52-d03f-4b1c-83c1-54855c4f2701",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "2ea5294f-def8-43d6-84ca-5f4bbb4b8b4a": {
      "ai_vectorStore": [
        [
          {
            "node": "666d4966-aa07-4b39-9f9f-6101f6f70b27",
            "type": "ai_vectorStore",
            "index": 0
          }
        ]
      ]
    },
    "666d4966-aa07-4b39-9f9f-6101f6f70b27": {
      "ai_retriever": [
        [
          {
            "node": "b525eb52-d03f-4b1c-83c1-54855c4f2701",
            "type": "ai_retriever",
            "index": 0
          }
        ]
      ]
    },
    "71e24d0d-1e70-4c59-acf8-c7b73b5d33c5": {
      "ai_embedding": [
        [
          {
            "node": "68b2dc90-c4a5-436f-9c17-e811974f333b",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "77d57e70-ef74-49eb-9019-6103a09ae391": {
      "ai_languageModel": [
        [
          {
            "node": "b525eb52-d03f-4b1c-83c1-54855c4f2701",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "92162e34-98e9-44ce-89a2-3ae058133a2d": {
      "main": [
        [
          {
            "node": "d9e88d5c-096b-4a8f-8f17-fb8d1887c95f",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "18c639ce-3517-4f1f-b02a-a40ba4f1e14b": {
      "main": [
        [
          {
            "node": "68b2dc90-c4a5-436f-9c17-e811974f333b",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "0e7c375a-1aaa-459f-b8c2-13659f71320a": {
      "ai_embedding": [
        [
          {
            "node": "2ea5294f-def8-43d6-84ca-5f4bbb4b8b4a",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "b525eb52-d03f-4b1c-83c1-54855c4f2701": {
      "main": [
        [
          {
            "node": "f9af0cdd-7ea3-4e97-b53f-b65fdf4e9355",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "048f9df4-1d15-4dcf-b853-52fe376434a0": {
      "main": [
        [],
        [
          {
            "node": "36017ee3-5c44-469b-aad7-6a44faa57d32",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "4ed51c5d-23e5-4836-ad13-1a5fb48a0317": {
      "ai_textSplitter": [
        [
          {
            "node": "c2e95dd8-961b-42d0-89cd-c31e810da2e8",
            "type": "ai_textSplitter",
            "index": 0
          }
        ]
      ]
    }
  }
}
자주 묻는 질문

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

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

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

고급 - 문서 추출, AI RAG

유료인가요?

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

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

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

저자
Intuz

Intuz

@intuz

Workflow automation can help automate your routine activities and help saves $$$, as well as hours of time. As a boutique tech consulting company, Intuz help businesses with custom AI/ML, AI Workflow Automations, and software development. Automate your business workflow for: Sales Marketing Accounting Finance Operations E-Commerce Customer Support Admin & Backoffice Logistics & Supply Chain

외부 링크
n8n.io에서 보기

이 워크플로우 공유

카테고리

카테고리: 34