8
n8n 한국어amn8n.com

RAG 기반 Telegram AI 학습 어시스턴트(MongoDB와 Google Drive 사용)

고급

이것은자동화 워크플로우로, 17개의 노드를 포함합니다.주로 Telegram, FormTrigger, GoogleDrive, Agent, TelegramTrigger 등의 노드를 사용하며. RAG, Gemini, Telegram과 MongoDB로 사실 학습 어시스턴트 생성

사전 요구사항
  • Telegram Bot Token
  • Google Drive API 인증 정보
  • Google Gemini API Key
  • MongoDB 연결 문자열

카테고리

-
워크플로우 미리보기
노드 연결 관계를 시각적으로 표시하며, 확대/축소 및 이동을 지원합니다
워크플로우 내보내기
다음 JSON 구성을 복사하여 n8n에 가져오면 이 워크플로우를 사용할 수 있습니다
{
  "name": "RAG-based AI Learning Assistant for Telegram using MongoDB and Google Drive",
  "tags": [],
  "nodes": [
    {
      "name": "기본 데이터 로더",
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "position": [
        -160,
        256
      ],
      "parameters": {
        "options": {},
        "dataType": "binary"
      },
      "typeVersion": 1.1,
      "id": "--0"
    },
    {
      "name": "채팅 메시지 수신 시",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        96,
        -32
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.3,
      "id": "--1"
    },
    {
      "name": "파일 업로드됨",
      "type": "n8n-nodes-base.googleDriveTrigger",
      "position": [
        -672,
        128
      ],
      "parameters": {
        "event": "fileCreated",
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "triggerOn": "specificFolder",
        "folderToWatch": {
          "__rl": true,
          "mode": "list",
          "value": "<GOOGLE_DRIVE_FOLDER_ID_WATCH>",
          "cachedResultUrl": "https://drive.google.com/drive/folders/<GOOGLE_DRIVE_FOLDER_ID_WATCH>",
          "cachedResultName": "YT"
        }
      },
      "credentials": {},
      "typeVersion": 1,
      "id": "--2"
    },
    {
      "name": "MongoDB Atlas Vector Store - 삽입",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreMongoDBAtlas",
      "position": [
        -240,
        48
      ],
      "parameters": {
        "mode": "insert",
        "options": {},
        "mongoCollection": {
          "__rl": true,
          "mode": "list",
          "value": "<MONGO_ATLAS_COLLECTION_NAME>",
          "cachedResultName": "<MONGO_ATLAS_COLLECTION_NAME>"
        },
        "vectorIndexName": "<MONGO_ATLAS_VECTOR_INDEX_NAME_INSERT>",
        "embeddingBatchSize": 10
      },
      "credentials": {},
      "typeVersion": 1.3,
      "id": "MongoDB-Atlas-Vector-Store----3"
    },
    {
      "name": "MongoDB Atlas Vector Store - 검색",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreMongoDBAtlas",
      "position": [
        544,
        224
      ],
      "parameters": {
        "mode": "retrieve-as-tool",
        "options": {},
        "mongoCollection": {
          "__rl": true,
          "mode": "list",
          "value": "<MONGO_ATLAS_COLLECTION_NAME>",
          "cachedResultName": "<MONGO_ATLAS_COLLECTION_NAME>"
        },
        "toolDescription": "Tool for AI Agent: Use this to search and retrieve relevant documents from the vector store to answer questions or analyze or fulfill tasks.",
        "vectorIndexName": "<MONGO_ATLAS_VECTOR_INDEX_NAME_RETRIEVE>"
      },
      "credentials": {},
      "typeVersion": 1.3,
      "id": "MongoDB-Atlas-Vector-Store----4"
    },
    {
      "name": "Google Gemini 채팅 모델",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        272,
        256
      ],
      "parameters": {
        "options": {},
        "modelName": "models/gemini-2.5-flash-lite"
      },
      "credentials": {},
      "typeVersion": 1,
      "id": "Google-Gemini--5"
    },
    {
      "name": "파일 다운로드",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        -480,
        128
      ],
      "parameters": {
        "fileId": {
          "__rl": true,
          "mode": "list",
          "value": "<GOOGLE_DRIVE_FILE_ID_DOWNLOAD>",
          "cachedResultUrl": "https://docs.google.com/document/d/<GOOGLE_DRIVE_FILE_ID_DOWNLOAD>/edit?usp=drivesdk",
          "cachedResultName": "History of modern India Spectrum 2"
        },
        "options": {},
        "operation": "download"
      },
      "credentials": {},
      "typeVersion": 3,
      "id": "--6"
    },
    {
      "name": "RAG 에이전트",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        384,
        32
      ],
      "parameters": {
        "text": "={{ $json.message.text }}{{ $json.chatInput }}",
        "options": {
          "systemMessage": "You are an Expert UPSC Examination Analyst and Study Assistant. Your primary function is to accurately, comprehensively, and analytically answer user queries related to the Union Public Service Commission (UPSC) Civil Services Examination (CSE).\n\nCore Directives and Persona\nExpertise: You are a master of the UPSC syllabus, exam patterns, current affairs relevance, and interdisciplinary analysis required for the Mains and Prelims examinations.\n\nRAG Mandate: You must utilize the context retrieved from the uploaded documents/knowledge base via the Retrieval-Augmented Generation (RAG) system to formulate your answers.\n\nSource Usage: Answer the query based primarily on the provided documents. Do not hallucinate or introduce information from your general training knowledge if it is contradicted by the documents.\n\nResponse Rules\nComprehensiveness & Depth: Provide answers that are deep, well-structured, and suitable for a high-level competitive exam like UPSC.\n\nAnalytical Approach: If the query asks for analysis, evaluation, comparison, or critical assessment, you must not simply restate facts. Instead, synthesize and analyze the information from the documents to provide a nuanced, insightful, and well-reasoned argument, as an expert would.\n\nSynthesis over Quotation: Do not use direct quotes or phrases like \"according to the document,\" \"the knowledge base states,\" or \"as per the database.\" Integrate the information naturally into a coherent and original answer.\n\nFormatting: Structure your response using clear headings, subheadings, and bullet points where appropriate to enhance readability for an examiner.\n\nLanguage and Tone: Maintain a formal, objective, and authoritative tone suitable for an academic and expert-level response.\n\nQuery Handling Procedure\nAnalyze Query: Determine the core subject, key concepts, and the type of response required (e.g., factual, analytical, comparative).\n\nRetrieve Context: Use the RAG tool to fetch the most relevant and complete information from the indexed documents.\n\nDraft Response: Synthesize the retrieved context and your domain expertise to craft a complete answer that adheres to all the above rules. "
        },
        "promptType": "define"
      },
      "typeVersion": 2.2,
      "id": "RAG--7"
    },
    {
      "name": "파일 업로드 시",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -672,
        -32
      ],
      "parameters": {
        "options": {},
        "formTitle": "file upload",
        "formFields": {
          "values": [
            {
              "fieldType": "file",
              "fieldLabel": "file",
              "acceptFileTypes": ".pdf, .csv, .jpg, .jpeg, .png"
            }
          ]
        }
      },
      "typeVersion": 2.3,
      "id": "--8"
    },
    {
      "name": "사용자 질문 수신 대기",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        96,
        96
      ],
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {
          "chatIds": "@educationalch"
        }
      },
      "credentials": {},
      "typeVersion": 1.2,
      "id": "--9"
    },
    {
      "name": "Telegram를 통한 답변 전송",
      "type": "n8n-nodes-base.telegram",
      "position": [
        752,
        32
      ],
      "parameters": {
        "text": "={{ $json.output }}",
        "chatId": "=<TELEGRAM_CHAT_ID>",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {},
      "retryOnFail": false,
      "typeVersion": 1.2,
      "id": "Telegram--10"
    },
    {
      "name": "문서를 임베딩으로 변환",
      "type": "@n8n/n8n-nodes-langchain.embeddingsGoogleGemini",
      "position": [
        -384,
        416
      ],
      "parameters": {},
      "credentials": {},
      "typeVersion": 1,
      "id": "--11"
    },
    {
      "name": "임베딩에서 문서 검색",
      "type": "@n8n/n8n-nodes-langchain.embeddingsGoogleGemini",
      "position": [
        656,
        384
      ],
      "parameters": {},
      "credentials": {},
      "typeVersion": 1,
      "id": "--12"
    },
    {
      "name": "단순 메모리",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        400,
        240
      ],
      "parameters": {},
      "typeVersion": 1.3,
      "id": "--13"
    },
    {
      "name": "스티키 노트",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1440,
        -112
      ],
      "parameters": {
        "width": 672,
        "height": 1344,
        "content": "Who's it for?\nThis template is perfect for educational institutions, coaching centers (like UPSC, GMAT, or specialized technical training), internal corporate knowledge bases, and SaaS companies that need to provide instant, accurate, and source-grounded answers based on proprietary documents.\n\nIt's designed for users who want to leverage **Google Gemini's** powerful reasoning but ensure its answers are strictly factual and based only on their verified knowledge repository.\n\n## How it works / What it does\nThis workflow establishes a **Retrieval-Augmented Generation (RAG) pipeline** to build a secure, fact-based AI Agent. It operates in two main phases:\n\n**Knowledge Ingestion:** When a new document (e.g., a PDF, lecture notes, or policy manual) is uploaded via a **form** or **Google Drive**, the **Embeddings Google Gemini** node converts the content into numerical vectors. These vectors are then stored in a secure **MongoDB Atlas Vector Store**, creating a private knowledge base.\n\n**AI Query & Response:** A user asks a question via **Telegram**. The **RAG Agent** uses the question to perform a semantic search on the **MongoDB Vector Store**, retrieving the most relevant, source-specific passages. It then feeds this retrieved context to the **Google Gemini Chat Model** to generate a precise, factual answer, which is sent back to the user on Telegram.\n\nThis process ensures the agent never \"hallucinates\" or uses general internet knowledge, making the responses accurate and trustworthy.\n\n## Requirements\nTo use this template, you will need the following accounts and credentials:\n\n* **n8n Account**\n* **Google Gemini API Key:** For generating vector embeddings and powering the AI Agent.\n* **MongoDB Atlas Cluster:** A free-tier cluster is sufficient, configured with a Vector Search index.\n* **Telegram Bot:** A bot created via BotFather and a Chat ID where the bot will listen for and send messages.\n* **Google Drive Credentials** (if using the Google Drive ingestion path).\n\n## How to set up\n\n1.  **Set up MongoDB Atlas:** Create a free cluster and a database. Create a Vector Search Index on your collection to enable efficient searching.\n2.  **Configure Ingestion Path (Left Side):** Set up the **On File Upload** webhook or connect your **Google Drive** credentials. Configure the **Embeddings** and **MongoDB Insert** nodes with your credentials, collection name, and index name.\n3.  **Configure Chat Path (Right Side):** Set up the **Telegram Trigger** with your Bot Token/Webhook. Configure the **Google Gemini Chat Model** and the **MongoDB Retrieve** tool with your credentials/index details.\n4.  **Final Step:** Configure the **Send Answer via Telegram** node with your Bot Token and the Chat ID."
      },
      "typeVersion": 1,
      "id": "--14"
    },
    {
      "name": "스티키 노트1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -752,
        -160
      ],
      "parameters": {
        "color": 4,
        "width": 816,
        "height": 752,
        "content": "Workflow 1: Knowledge Ingestion Pipeline\n(Triggers on file upload to form or Google Drive)"
      },
      "typeVersion": 1,
      "id": "-1-15"
    },
    {
      "name": "스티키 노트2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        80,
        -160
      ],
      "parameters": {
        "color": 6,
        "width": 896,
        "height": 768,
        "content": "Workflow 2: RAG Chatbot Query Pipeline\n(Triggers on question received via Telegram)"
      },
      "typeVersion": 1,
      "id": "-2-16"
    }
  ],
  "active": true,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "connections": {
    "RAG--7": {
      "main": [
        [
          {
            "node": "Telegram--10",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "--6": {
      "main": [
        [
          {
            "node": "MongoDB-Atlas-Vector-Store----3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "--2": {
      "main": [
        [
          {
            "node": "--6",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "--13": {
      "ai_memory": [
        [
          {
            "node": "RAG--7",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "--8": {
      "main": [
        [
          {
            "node": "MongoDB-Atlas-Vector-Store----3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "--0": {
      "ai_document": [
        [
          {
            "node": "MongoDB-Atlas-Vector-Store----3",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "Google-Gemini--5": {
      "ai_languageModel": [
        [
          {
            "node": "RAG--7",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "--1": {
      "main": [
        [
          {
            "node": "RAG--7",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "MongoDB Atlas Vector Store1": {
      "ai_tool": [
        [
          {
            "node": "RAG--7",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "--9": {
      "main": [
        [
          {
            "node": "RAG--7",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "--11": {
      "ai_embedding": [
        [
          {
            "node": "MongoDB-Atlas-Vector-Store----3",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "--12": {
      "ai_embedding": [
        [
          {
            "node": "MongoDB Atlas Vector Store1",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    }
  }
}
자주 묻는 질문

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

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

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

고급

유료인가요?

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

워크플로우 정보
난이도
고급
노드 수17
카테고리-
노드 유형13
난이도 설명

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

저자

Automation consultant with expertise in n8n, AI models, and workflow optimization. I help educators, startups, and businesses design scalable automation for content creation, exam prep, and process efficiency. Skilled in integrating Google Sheets, Telegram, and AI agents for impactful results.

외부 링크
n8n.io에서 보기

이 워크플로우 공유

카테고리

카테고리: 34