8
n8n 한국어amn8n.com

PDF 문서와 Google Drive 백업을 포함한 Telegram RAG 챗봇

고급

이것은Internal Wiki, AI RAG분야의자동화 워크플로우로, 24개의 노드를 포함합니다.주로 If, Code, Telegram, FormTrigger, GoogleDrive 등의 노드를 사용하며. Telegram, OpenAI, Google Drive PDF 백업을 사용하여 검색형 챗봇을 구축합니다.

사전 요구사항
  • Telegram Bot Token
  • Google Drive API 인증 정보
  • OpenAI API Key
워크플로우 미리보기
노드 연결 관계를 시각적으로 표시하며, 확대/축소 및 이동을 지원합니다
워크플로우 내보내기
다음 JSON 구성을 복사하여 n8n에 가져오면 이 워크플로우를 사용할 수 있습니다
{
  "id": "bsT84L413PRtrNtZ",
  "meta": {
    "instanceId": "4a2e6764ba7a6bc9890d9225f4b21d570ce88fc9bd57549c89057fcee58fed0f",
    "templateId": "5010",
    "templateCredsSetupCompleted": true
  },
  "name": "Telegram RAG Chatbot with PDF Document & Google Drive Backup",
  "tags": [
    {
      "id": "ow6eIe95VK6fRkyw",
      "name": "Chatbot",
      "createdAt": "2025-08-05T06:23:11.231Z",
      "updatedAt": "2025-08-05T06:23:11.231Z"
    },
    {
      "id": "JFZdpFVd2h3ZDZ7n",
      "name": "RAG",
      "createdAt": "2025-08-05T06:23:26.538Z",
      "updatedAt": "2025-08-05T06:23:26.538Z"
    },
    {
      "id": "84SlSTthTSHRbFGM",
      "name": "Telegram",
      "createdAt": "2025-08-05T06:23:21.764Z",
      "updatedAt": "2025-08-05T06:23:21.764Z"
    }
  ],
  "nodes": [
    {
      "id": "26d63e24-2592-41f9-9b4b-edab81e99f21",
      "name": "Embeddings OpenAI",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        1760,
        720
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "PPSwAKeLQYgAPobT",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "3a69c8a7-bf95-4de2-84b0-ae2cc3d2e4e7",
      "name": "기본 데이터 로더",
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "position": [
        1232,
        1112
      ],
      "parameters": {
        "options": {},
        "dataType": "binary"
      },
      "typeVersion": 1.1
    },
    {
      "id": "0f4185ea-d7a9-44a9-a824-98f9dc2c2a5d",
      "name": "저장소에 데이터 삽입",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreInMemory",
      "position": [
        1136,
        888
      ],
      "parameters": {
        "mode": "insert",
        "memoryKey": {
          "__rl": true,
          "mode": "list",
          "value": "vector_store_key",
          "cachedResultName": "vector_store_key"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "ce86b41b-7e1b-458f-ab13-d6b187854ae8",
      "name": "데이터 쿼리 도구",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreInMemory",
      "position": [
        1664,
        512
      ],
      "parameters": {
        "mode": "retrieve-as-tool",
        "toolName": "knowledge_base",
        "memoryKey": {
          "__rl": true,
          "mode": "list",
          "value": "vector_store_key"
        },
        "toolDescription": "Use this knowledge base to answer questions from the user"
      },
      "typeVersion": 1.2
    },
    {
      "id": "d43cf585-4192-4f53-9532-4677923289ba",
      "name": "OpenAI 채팅 모델",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1536,
        512
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "PPSwAKeLQYgAPobT",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "8d4c68cf-64d1-4b3a-bb19-2f003303c1df",
      "name": "스티키 노트3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1920,
        688
      ],
      "parameters": {
        "color": 4,
        "width": 320,
        "height": 224,
        "content": "### Embeddings\n\nThe Insert and Retrieve operation use the same embedding node.\n\nThis is to ensure that they are using the **exact same embeddings and settings**.\n\nDifferent embeddings might not work at all, or have unintended consequences.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "d4227342-0a19-420e-b088-2e37186ad074",
      "name": "Telegram 트리거",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        912,
        696
      ],
      "webhookId": "aac0aa6a-c86e-4b4d-8f81-daacfd20f2c8",
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "paNoPvnV5Wzt4Lhv",
          "name": "Telegram account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "7470655a-650a-48ca-98e0-b248cf99d18e",
      "name": "텍스트 메시지 확인",
      "type": "n8n-nodes-base.if",
      "position": [
        1224,
        696
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "2439fbb6-c093-4b33-aabd-db08ebfd53b2",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "fda67b3b-9844-40e4-aa53-252d2e36e667",
      "name": "사용자에게 응답 전송",
      "type": "n8n-nodes-base.telegram",
      "position": [
        2064,
        496
      ],
      "webhookId": "bead9b9b-6410-4fe7-a36c-05bd069e3a02",
      "parameters": {
        "text": "={{ $json.output }}",
        "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "paNoPvnV5Wzt4Lhv",
          "name": "Telegram account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "62ae0117-0d2c-47dd-a772-7c4cd70885ec",
      "name": "지원되지 않는 메시지 유형",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1688,
        896
      ],
      "webhookId": "724418e9-e7ef-4aa2-8722-028683cadb2f",
      "parameters": {
        "text": "Sorry, I can’t read files or images right now. Just send me your question about uploaded document, and I’ll help you answer it!",
        "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "paNoPvnV5Wzt4Lhv",
          "name": "Telegram account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "0039537b-558c-4fe8-9716-f8aa13676f4a",
      "name": "Telegram 문서 쿼리 에이전트",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1552,
        288
      ],
      "parameters": {
        "text": "={{ $json.message.text }}",
        "options": {
          "systemMessage": "The output should not exceed 3000 characters after entities parsing."
        },
        "promptType": "define"
      },
      "typeVersion": 2
    },
    {
      "id": "0608a9d7-db7b-4a18-b8fb-26b936da919a",
      "name": "스티키 노트6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1104,
        512
      ],
      "parameters": {
        "width": 272,
        "height": 144,
        "content": "### 2. Is Text Message?  \n**Description**: Checks whether the incoming Telegram message is a text message. If not, the workflow routes to an \"unsupported message type\" handler."
      },
      "typeVersion": 1
    },
    {
      "id": "40c8b84f-ed8a-4fdc-b04c-d778a2fdea0e",
      "name": "스티키 노트5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        544,
        688
      ],
      "parameters": {
        "width": 304,
        "height": 128,
        "content": "### 1. 📩 Telegram Trigger  \n**Description**: Listens for incoming messages from the user via the connected Telegram bot. This is the entry point of the workflow."
      },
      "typeVersion": 1
    },
    {
      "id": "91077637-5e75-4bb2-8419-235420bc5a96",
      "name": "코드",
      "type": "n8n-nodes-base.code",
      "position": [
        1224,
        1288
      ],
      "parameters": {
        "jsCode": "const data = $input.item.json;\nconst binaryData = $input.item.binary;\n\nlet output = [];\n\nObject.keys(binaryData)\n  .filter(label => label.startsWith(\"CV_\"))\n  .forEach(label => {\n    output.push({\n      json: data,\n      binary: { data: binaryData[label] }\n    });\n  });\n\nreturn output;"
      },
      "typeVersion": 2
    },
    {
      "id": "83ed351e-90e8-458f-a01b-73001ef1800f",
      "name": "PDF 문서 업로드",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        912,
        1140
      ],
      "webhookId": "82848bc4-5ea2-4e5a-8bb6-3c09b94a8c5d",
      "parameters": {
        "options": {},
        "formTitle": "Upload your data to test RAG",
        "formFields": {
          "values": [
            {
              "fieldType": "file",
              "fieldLabel": "Upload your file(s)",
              "requiredField": true,
              "acceptFileTypes": ".pdf"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "79a7f8b5-7af2-479c-883c-a4e02ce4bee8",
      "name": "Google Drive에 문서 백업",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        1688,
        1288
      ],
      "parameters": {
        "name": "=document-{{ $now.toFormat(\"yyyyLLdd-HHmmss\") }}-{{$binary.data.fileName}}",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive",
          "cachedResultUrl": "https://drive.google.com/drive/my-drive",
          "cachedResultName": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "list",
          "value": "1ObNNVJFR2vcKqP8p-ZnX_eaZy4gBHgha",
          "cachedResultUrl": "https://drive.google.com/drive/folders/1ObNNVJFR2vcKqP8p-ZnX_eaZy4gBHgha",
          "cachedResultName": "SmartIT"
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "fC471es5gk5Mm900",
          "name": "Google Drive account"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "c8f73ac1-eb95-4fa0-a1d8-8b6f5befe885",
      "name": "스티키 노트",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -752,
        -96
      ],
      "parameters": {
        "color": 7,
        "width": 1264,
        "height": 1856,
        "content": "# 📚 Telegram RAG Chatbot with PDF Document & Google Drive Backup\n- An upgraded Retrieval-Augmented Generation (RAG) chatbot built in **n8n** that lets users ask questions via Telegram and receive accurate answers from uploaded PDFs. It embeds documents using OpenAI and backs them up to Google Drive.\n\n## 👤 Who’s it for\n\nPerfect for:\n- Knowledge workers who want instant access to private documents\n- Support teams needing searchable SOPs and guides\n- Educators enabling course material Q&A for students\n- Individuals automating personal document search + cloud backup\n\n## ⚙️ How it works / What it does\n\n### 💬 Telegram Chat Handling\n1. **User sends a message**  \n   Triggered by the Telegram bot, the workflow checks if the message is text.\n\n2. **Text message → OpenAI RAG Agent**  \n   If the message is text, it's passed to a GPT-powered document agent.  \n   This agent:\n   - Retrieves relevant info from embedded documents using semantic search\n   - Returns a context-aware answer to the user\n\n3. **Send answer back**  \n   The bot sends the generated response back to the Telegram user.\n\n4. **Non-text input fallback**  \n   If the message is not text, the bot replies with a polite unsupported message.\n\n### 📄 PDF Upload and Embedding\n1. **User uploads PDFs manually**  \n   A manual trigger starts the embedding flow.\n\n2. **Default Data Loader**  \n   Reads and chunks the PDF(s) into text segments.\n\n3. **Insert to Vector Store (Embedding)**  \n   Text chunks are embedded using OpenAI and saved for retrieval.\n\n4. **Backup to Google Drive**  \n   The original PDF is uploaded to Google Drive for safekeeping.\n\n## 🛠️ How to set up\n\n1. **Telegram Bot**\n   - Create via [BotFather](https://t.me/botfather)\n   - Connect it to the Telegram Trigger node\n\n2. **OpenAI**\n   - Use your OpenAI API key\n   - Connect the Embeddings and Chat Model nodes (GPT-3.5/4)\n   - Ensure both embedding and querying use the same Embedding node\n\n3. **Google Drive**\n   - Set up credentials in n8n for your Google account\n   - Connect the “Backup to Google Drive” node\n\n4. **PDF Ingestion**\n   - Use the “Upload your PDF here” trigger\n   - Connect it to the loader, embedder, and backup flow\n\n## ✅ Requirements\n\n- Telegram bot token\n- OpenAI API key (GPT + Embeddings)\n- n8n instance (self-hosted or cloud)\n- Google Drive integration\n- PDF files to upload\n\n## 🧩 How to customize the workflow\n\n| Feature                        | How to Customize                                                  |\n|-------------------------------|-------------------------------------------------------------------|\n| Auto-ingest from folders       | Add Google Drive/Dropbox watchers for new PDFs                   |\n| Add file upload via Telegram   | Extend Telegram bot to receive PDFs and run the embedding flow   |\n| Track user questions           | Log Telegram usernames and questions to a database               |\n| Summarize documents            | Add summarization step on upload                                 |\n| Add Markdown or HTML support   | Format replies for better Telegram rendering                     |\n\nBuilt with 💬 Telegram + 📄 PDF + 🧠 OpenAI Embeddings + ☁️ Google Drive + ⚡ n8n"
      },
      "typeVersion": 1
    },
    {
      "id": "8ecf58dd-5beb-4f78-bd09-1238f25c623a",
      "name": "스티키 노트1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        704,
        1360
      ],
      "parameters": {
        "width": 464,
        "height": 80,
        "content": "### 1. Upload Your PDF Document Here  \n- A manual execution trigger for uploading and processing PDF documents into the knowledge base."
      },
      "typeVersion": 1
    },
    {
      "id": "2aefbbd3-1234-4843-bf34-430b229faa1f",
      "name": "스티키 노트2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1872,
        1296
      ],
      "parameters": {
        "width": 432,
        "height": 80,
        "content": "### 2.1 Backup Documents to Google Drive  \n- Uploads a copy of the original PDF file to a connected Google Drive folder for safekeeping and future reference."
      },
      "typeVersion": 1
    },
    {
      "id": "88a087f2-8656-4e82-b384-efdaf51ec021",
      "name": "스티키 노트4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1424,
        176
      ],
      "parameters": {
        "width": 560,
        "height": 96,
        "content": "### 3. Telegram Document Query Agent (GPT with RAG)  \n- Sends the user’s text message to OpenAI’s Chat Model. Uses embeddings to retrieve relevant document chunks and generate a context-aware response using Retrieval-Augmented Generation."
      },
      "typeVersion": 1
    },
    {
      "id": "38627375-43c0-47ad-87ab-a3ef94093c28",
      "name": "스티키 노트7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1360,
        1120
      ],
      "parameters": {
        "color": 4,
        "width": 496,
        "height": 96,
        "content": "### Default Data Loader  \nExtracts and chunks text from the uploaded PDF documents to prepare them for semantic embedding."
      },
      "typeVersion": 1
    },
    {
      "id": "8b2e116c-003f-4eb7-9cf1-30ac4cbd87d3",
      "name": "스티키 노트9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        688,
        896
      ],
      "parameters": {
        "width": 352,
        "height": 112,
        "content": "### 2.2 Insert Data to Store (Embeddings)  \nConverts document chunks into vector embeddings using OpenAI and inserts them into the vector store for future retrieval."
      },
      "typeVersion": 1
    },
    {
      "id": "2abc9178-add2-4d8e-b395-cc9713ed4a2e",
      "name": "스티키 노트10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2432,
        480
      ],
      "parameters": {
        "width": 540,
        "height": 580,
        "content": "![Alt text](https://wisestackai.s3.ap-southeast-1.amazonaws.com/Screenshot+2025-08-05+at+1.18.12%E2%80%AFPM.png \"Optional title text\")"
      },
      "typeVersion": 1
    },
    {
      "id": "1de83861-0a7d-4e0c-9ceb-beacbe84749b",
      "name": "스티키 노트8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2432,
        1088
      ],
      "parameters": {
        "width": 544,
        "height": 80,
        "content": "Sample document: https://ptgmedia.pearsoncmg.com/images/9780138203283/samplepages/9780138203283_Sample.pdf"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {},
  "versionId": "50ae16d0-7565-4f29-8f21-d769face925a",
  "connections": {
    "91077637-5e75-4bb2-8419-235420bc5a96": {
      "main": [
        [
          {
            "node": "79a7f8b5-7af2-479c-883c-a4e02ce4bee8",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ce86b41b-7e1b-458f-ab13-d6b187854ae8": {
      "ai_tool": [
        [
          {
            "node": "0039537b-558c-4fe8-9716-f8aa13676f4a",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "7470655a-650a-48ca-98e0-b248cf99d18e": {
      "main": [
        [
          {
            "node": "0039537b-558c-4fe8-9716-f8aa13676f4a",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "62ae0117-0d2c-47dd-a772-7c4cd70885ec",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "d4227342-0a19-420e-b088-2e37186ad074": {
      "main": [
        [
          {
            "node": "7470655a-650a-48ca-98e0-b248cf99d18e",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "26d63e24-2592-41f9-9b4b-edab81e99f21": {
      "ai_embedding": [
        [
          {
            "node": "0f4185ea-d7a9-44a9-a824-98f9dc2c2a5d",
            "type": "ai_embedding",
            "index": 0
          },
          {
            "node": "ce86b41b-7e1b-458f-ab13-d6b187854ae8",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "d43cf585-4192-4f53-9532-4677923289ba": {
      "ai_languageModel": [
        [
          {
            "node": "0039537b-558c-4fe8-9716-f8aa13676f4a",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "3a69c8a7-bf95-4de2-84b0-ae2cc3d2e4e7": {
      "ai_document": [
        [
          {
            "node": "0f4185ea-d7a9-44a9-a824-98f9dc2c2a5d",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "0f4185ea-d7a9-44a9-a824-98f9dc2c2a5d": {
      "main": [
        []
      ]
    },
    "fda67b3b-9844-40e4-aa53-252d2e36e667": {
      "main": [
        []
      ]
    },
    "0039537b-558c-4fe8-9716-f8aa13676f4a": {
      "main": [
        [
          {
            "node": "fda67b3b-9844-40e4-aa53-252d2e36e667",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "83ed351e-90e8-458f-a01b-73001ef1800f": {
      "main": [
        [
          {
            "node": "0f4185ea-d7a9-44a9-a824-98f9dc2c2a5d",
            "type": "main",
            "index": 0
          },
          {
            "node": "91077637-5e75-4bb2-8419-235420bc5a96",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
자주 묻는 질문

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

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

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

고급 - 내부 위키, AI RAG

유료인가요?

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

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

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

저자
Trung Tran

Trung Tran

@trungtran

Empowering small and medium businesses with smart automation and practical AI, no big tech team required. Reach out: lets@automatewith.me

외부 링크
n8n.io에서 보기

이 워크플로우 공유

카테고리

카테고리: 34