Create an AI Telegram bot using Google Drive, Qdrant, and OpenAI GPT-4.1
How it works
This workflow creates an intelligent Telegram bot with a knowledge base powered by Qdrant vector database. The bot automatically processes documents uploaded to Google Drive, stores them as embeddings, and uses this knowledge to answer questions in Telegram. It consists of two independent flows: document processing (Google Drive β Qdrant) and chat interaction (Telegram β AI Agent β Telegram).
Step-by-step
Document Processing Flow:
- New File Trigger: The workflow starts when the New File Trigger node detects a new file created in the specified Google Drive folder (polling every 15 minutes).
- Download File: The Download File (Google Drive) node downloads the detected file from Google Drive.
- Text Splitting: The Split Text into Chunks node splits the document text into chunks of 3000 characters with 300 character overlap for optimal embedding.
- Load Document Data: The Load Document Data node processes the binary file data and prepares it for vectorization.
- OpenAI Embeddings: The OpenAI Embeddings node generates vector embeddings for each text chunk.
- Insert into Qdrant: The Insert into Qdrant node stores the embeddings in the Qdrant vector database collection.
- Move to Processed Folder: After successful processing, the Move to Processed Folder (Google Drive) node moves the file to a "Qdrant Ready" folder to keep files organized.
Telegram Chat Flow:
- Telegram Message Trigger: The Telegram Message Trigger node receives new messages from the Telegram bot.
- Filter Authorized User: The Filter Authorized User node checks if the message is from an authorized chat ID (26899549) to restrict bot access.
- AI Agent Processing: The AI Agent receives the user's message text and processes it using the fine-tuned GPT-4.1 model with access to the Qdrant knowledge base tool.
- Qdrant Knowledge Base: The Qdrant Knowledge Base node retrieves relevant information from the vector database to provide context for the AI agent's responses.
- Conversation Memory: The Conversation Memory node maintains conversation history per chat ID, allowing the bot to remember context.
- Send Response to Telegram: The Send Response to Telegram node sends the AI-generated response back to the user in Telegram.
Set up steps
Estimated set up time: 15 minutes
-
Google Drive Setup:
- Add your Google Drive OAuth2 credentials to the New File Trigger, Download File, and Move to Processed Folder nodes.
- Create two folders in your Google Drive: one for incoming files and one for processed files.
- Copy the folder IDs from the URLs and update them in the New File Trigger (folderToWatch) and Move to Processed Folder (folderId) nodes.
-
Qdrant Setup:
- Add your Qdrant API credentials to the Insert into Qdrant and Qdrant Knowledge Base nodes.
- Create a collection in your Qdrant instance (e.g., "Test-youtube-adept-ecom").
- Update the collection name in both Qdrant nodes.
-
OpenAI Setup:
- Add your OpenAI API credentials to the OpenAI Chat Model and OpenAI Embeddings nodes.
- (Optional) Replace the fine-tuned model ID in OpenAI Chat Model with your own model or use a standard model like
gpt-4-turbo.
-
Telegram Setup:
- Create a Telegram bot via @BotFather and obtain the bot token.
- Add your Telegram bot credentials to the Telegram Message Trigger and Send Response to Telegram nodes.
- Update the authorized chat ID in the Filter Authorized User node (replace
26899549with your Telegram user ID).
-
Customize System Prompt (Optional):
- Modify the system message in the AI Agent node to customize your bot's personality and behavior.
- The current prompt is configured for an n8n automation expert creating social media content.
-
Activate the Workflow:
- Toggle "Active" in the top-right to enable both the Google Drive trigger and Telegram trigger.
- Upload a document to your Google Drive folder to test the document processing flow.
- Send a message to your Telegram bot to test the chat interaction flow.
AI Telegram Bot with Google Drive, Qdrant, and OpenAI GPT-4
This n8n workflow automates the creation of an AI-powered Telegram chatbot that can answer questions based on documents stored in Google Drive, utilizing Qdrant for vector storage and OpenAI's GPT-4 for conversational AI.
It simplifies the process of building a knowledge-base chatbot by handling document ingestion, embedding generation, vector storage, and AI interaction.
What it does
- Monitors Google Drive: It triggers when new files are added to a specified Google Drive folder.
- Loads Documents: When a new file is detected, it loads the document content.
- Splits Text: The document content is then split into smaller, manageable chunks (recursive character splitting) suitable for embedding.
- Generates Embeddings: OpenAI's embedding model generates vector representations of these text chunks.
- Stores in Qdrant: These embeddings are then stored in a Qdrant vector database, creating a searchable knowledge base.
- Listens for Telegram Messages: The workflow continuously listens for incoming messages from a Telegram bot.
- Filters Messages: It filters out messages that are not text or are empty.
- Processes User Queries: When a valid text message is received, an AI Agent (powered by OpenAI's Chat Model and Qdrant Vector Store) processes the query.
- Retrieves Information: The AI Agent queries the Qdrant vector store to find relevant document chunks based on the user's question.
- Generates Response: Using the retrieved information and its conversational capabilities, the OpenAI Chat Model generates a comprehensive answer.
- Sends Telegram Response: The AI's response is sent back to the user via Telegram.
Prerequisites/Requirements
To use this workflow, you will need:
- n8n Instance: A running n8n instance.
- Telegram Bot: A Telegram bot token (obtained from BotFather).
- Google Drive Account: Access to a Google Drive account and a specific folder for documents.
- OpenAI API Key: An API key for OpenAI (for embeddings and the chat model, ideally GPT-4).
- Qdrant Instance: A running Qdrant instance (local or cloud-based) and its API key/URL.
Setup/Usage
- Import the workflow: Download the JSON provided and import it into your n8n instance.
- Configure Credentials:
- Telegram Trigger: Set up a Telegram API credential with your bot token.
- Google Drive Trigger: Configure a Google Drive OAuth2 credential with access to the folder where your documents will be stored.
- OpenAI Chat Model: Set up an OpenAI API credential with your API key.
- Embeddings OpenAI: Use the same OpenAI API credential.
- Qdrant Vector Store: Configure a Qdrant API credential with your Qdrant instance URL and API key.
- Specify Google Drive Folder: In the "Google Drive Trigger" node, specify the ID of the Google Drive folder you want to monitor for new documents.
- Activate the workflow: Once all credentials and configurations are set, activate the workflow.
- Start interacting:
- Add documents (e.g., PDFs, text files) to your designated Google Drive folder. The workflow will automatically process them and add them to your Qdrant knowledge base.
- Send messages to your Telegram bot. The bot will use the AI Agent to answer your questions based on the documents you've uploaded.
Related Templates
Generate verified job offer letters with OpenAI, Gmail and Slack
π AI-Powered Verified Job Offer Letter Generator Description Creating job offer letters manually is time-consuming, error-prone, and difficult to scale. This AI-powered workflow automates the entire job offer letter process β from validating candidate emails to generating and delivering professional PDF offer letters. This intelligent workflow eliminates repetitive drafting, reduces human errors, and ensures offer letters are sent only to verified email addresses, helping HR teams move faster while maintaining professionalism and accuracy. --- What This Workflow Does Transforms manual offer letter creation into a seamless, automated HR process: π Capture Candidate & Job Details β Receives candidate name, email, job role, salary, joining date, and company details via webhook or form. π§ Email Verification β Validates the candidateβs email address before sending any communication to prevent delivery errors. π§ AI-Powered Offer Letter Generation β Uses AI to generate a clear, professional, and structured job offer letter. π HTML Offer Letter Formatting β Converts the AI-generated content into a clean and readable HTML layout. π PDF Generation β Automatically converts the offer letter into a professional PDF document. π§ Offer Letter Delivery β Sends the PDF offer letter directly to the verified candidate email. ποΈ Document Storage β Saves a copy of the offer letter for internal records and future reference. π Confirmation Response β Returns a success response confirming completion. --- Key Features π€ AI Offer Letter Writing β Generates professional, ready-to-send offer letters automatically. π§ Email Verification Built-In β Ensures offer letters are only sent to valid email addresses. π PDF Generation β Creates clean, official-looking offer letters. βοΈ End-to-End Automation β No manual drafting, formatting, or sending required. π Centralized Record Keeping β Keeps copies of all generated offer letters. π Flexible Triggering β Can be triggered from HR systems, forms, or internal tools. --- Perfect For π’ HR & Recruitment Teams β Automate offer letter creation and delivery. π Startups & Growing Companies β Send professional offer letters without extra admin work. π« Staffing & Hiring Agencies β Generate offer letters quickly for multiple candidates. π» Remote & Distributed Teams β Ensure consistent communication across locations. π§ Operations Teams β Maintain accurate records and reduce manual errors. --- What Youβll Need Required Integrations π Webhook Trigger β Receives candidate and job details. π€ OpenAI β Generates offer letter content. π§ VerifyEmail β Validates candidate email addresses. π HTMLCSS to PDF β Converts HTML into PDF offer letters. π§ Gmail β Sends the offer letter email. βοΈ Google Drive (optional) β Stores generated offer letters. --- Optional Enhancements π¨ Brand Customization β Add company logo, colors, and formatting to offer letters. π§Ύ HR System Integration β Connect with ATS or HR tools for automatic triggering. π Multilingual Offer Letters β Generate offer letters in different languages. π Approval Step β Add internal approval before sending offer letters. π Audit Logging β Store offer letter data in Google Sheets or databases. π Additional Attachments β Include policies or onboarding documents with the offer letter. --- Quick Start 1οΈβ£ Import the workflow template into your n8n workspace 2οΈβ£ Connect credentials for OpenAI, VerifyEmail, Gmail, and HTMLCSS to PDF 3οΈβ£ Send test candidate data to the webhook 4οΈβ£ Review the generated PDF offer letter 5οΈβ£ Activate the workflow and start sending offer letters automatically --- Customization Options 1οΈβ£ Offer Letter Tone β Adjust AI prompt for formal or friendly tone. 2οΈβ£ Company Branding β Customize HTML layout and styling. 3οΈβ£ Email Content β Modify subject line and email message. 4οΈβ£ PDF Layout β Adjust spacing, fonts, and structure. 5οΈβ£ Storage Location β Change where offer letters are saved. 6οΈβ£ Validation Rules β Extend email or input checks. --- Expected Results β‘ Faster Hiring Process β Generate offer letters in minutes. π€ Consistent Quality β Every offer letter follows a professional format. π§ Error-Free Delivery β Verified emails reduce failed communication. ποΈ Organized Records β All offer letters stored automatically. π’ Professional Candidate Experience β Clean, official documents every time. --- Workflow Structure Visualization π Candidate & Job Details β π§ Email Verification β π§ AI Offer Letter Generation β π HTML Formatting β π PDF Conversion β π§ Email Delivery β π Confirmation Response --- π Ready to Automate Job Offer Letters? Import this template today and let AI handle offer letter creation, verification, and delivery β so your team can focus on hiring the right talent faster. β¨ ---
Generate AI website legal and accessibility compliance reports with OpenAI, Gmail and Google Drive
Automated Legal & Accessibility Website Compliance Checker Description Automate website compliance checks in minutes using AI-powered analysis. This workflow scans any website for essential legal and accessibility requirements, generates a professional compliance report, delivers it as a PDF, and stores it securely β helping teams identify risks early and stay audit-ready with zero manual effort. --- What This Workflow Does Transforms manual website compliance reviews into a single automated flow: π Capture Website Details β Accepts website URL, company name, and email via webhook. π₯ Fetch Website Content β Securely downloads and cleans website HTML for analysis. π§ AI Compliance Analysis β Uses AI to audit the site against key compliance standards. π Scoring & Insights β Calculates an overall compliance score and highlights gaps. π Generate Visual Report β Builds a detailed, easy-to-read HTML compliance report. π¨οΈ Convert to PDF β Converts the report into a downloadable, shareable PDF. π§ Email Delivery β Sends the compliance report directly to the provided email. βοΈ Secure Storage β Saves the PDF report to Google Drive for records and audits. --- Key Features π€ AI-Powered Compliance Audits β Automatically checks privacy, cookies, accessibility, SSL, and more. π Compliance Scoring β Clear numerical scores and status indicators for each section. π Professional PDF Reports β Branded, structured reports suitable for clients or audits. βοΈ End-to-End Automation β From URL submission to email delivery without manual steps. π§ Instant Email Notifications β Reports delivered automatically to stakeholders. βοΈ Google Drive Backup β Centralized storage for compliance history and documentation. --- Compliance Checks Included βοΈ Privacy Policy presence & indicators βοΈ Cookie consent mechanisms βοΈ Terms of Service availability βοΈ Accessibility (WCAG-related indicators) βοΈ Contact information visibility βοΈ SSL / HTTPS verification βοΈ Critical issues & improvement recommendations --- Perfect For π’ Startups & SaaS Companies β Quickly assess website compliance before launch. π§Ύ Agencies & Consultants β Deliver automated compliance audits to clients. βοΈ Legal & Compliance Teams β Speed up preliminary compliance checks. π» Freelancers & Web Developers β Validate client websites post-deployment. π Operations Teams β Maintain ongoing compliance documentation effortlessly. --- What Youβll Need Required Integrations π Webhook β Receive website URL and user details. π€ OpenAI β Analyze website HTML for compliance indicators. π HTMLCSS to PDF β Convert compliance report into a PDF. π§ Gmail β Send compliance report via email. βοΈ Google Drive β Store generated compliance reports. π HTTP Request β Fetch website HTML content (no authentication required). --- Optional Enhancements π Compliance Dashboard β Connect Google Drive or logs to Looker Studio. π Multi-Website Scans β Extend webhook to accept bulk URLs. π Scheduled Scans β Run periodic compliance checks automatically. π¨ Slack Alerts β Send compliance summaries to internal channels. π Custom Branding β Adjust HTML styling, logos, and colors. --- Quick Start 1οΈβ£ Import the workflow JSON into your n8n workspace. 2οΈβ£ Activate the webhook and copy the endpoint URL. 3οΈβ£ Connect OpenAI, Gmail, Google Drive, and HTMLCSS to PDF credentials. 4οΈβ£ Send a POST request with website URL, company name, and email. 5οΈβ£ Review the emailed PDF compliance report. 6οΈβ£ Check Google Drive for stored audit copies. 7οΈβ£ Activate the workflow for production use. --- Expected Results β‘ Minutes Instead of Hours β Instant compliance assessments. π€ AI Accuracy β Consistent, structured compliance analysis. π Risk Visibility β Early detection of legal and accessibility gaps. π Audit-Ready Reports β Clean, shareable documentation. βοΈ Centralized Storage β Every scan archived automatically. --- Workflow Structure π Webhook Trigger β π₯ Fetch Website HTML β π§Ή Clean & Prepare Content β π§ AI Compliance Analysis β π Parse Results β π Generate HTML Report β π¨οΈ Convert to PDF β π§ Email Report β βοΈ Save to Google Drive --- Ready to Automate Website Compliance? Import this template and turn any website URL into a complete compliance report β automatically, consistently, and professionally. Perfect for audits, clients, and peace of mind. β ---
WhatsApp group chat with your vector database β no Facebook Business required
Enable smart, real-time answers in your WhatsApp groups using a custom webhook, Pinecone vector database, and no Facebook Business setup. > π‘ Note: This template uses a custom WhatsApp webhook. It does not use the official WhatsApp Business API. --- π₯ Who is this for? This workflow is designed for individuals and teams who want to enable smart WhatsApp group automation β without going through Metaβs official WhatsApp Business API. Ideal for small businesses, internal teams, communities, and personal power users. --- β What problem is this solving? Setting up WhatsApp bots with intelligent responses often requires approval from Meta and a verified business account. This workflow removes those barriers by using a self-hosted webhook to handle incoming messages and respond using a document-trained AI via Pinecone. --- βοΈ What this workflow does Connects a regular WhatsApp number to a custom webhook Adds the bot to any group chat (it stays silent unless mentioned) Indexes documents from Google Drive into Pinecone Responds with intelligent, context-aware answers from your custom knowledge base Auto-updates its knowledge every minute as the document changes --- π οΈ Setup Step 1: Connect Google Drive Set up your Google Drive credentials in n8n Step 2: Configure Pinecone Create an index in Pinecone Dimension: 1536 Select this index in both Pinecone nodes Click Test Workflow to ingest your document into Pinecone Step 3: Get Access to the WhatsApp Webhook Fill out this form to request access Youβll receive a WhatsApp confirmation for linking Step 4: Test WhatsApp Integration β One-on-one test: Send a message from another number π₯ Group test: Add the bot to a group; it will only respond when tagged --- π§© How to customize this workflow Modify the system prompt inside the AI agent node to control tone and behavior Update the connected Google Doc to match your specific domain (e.g. FAQs, SOPs, product manuals) Adjust the Pinecone sync frequency if you want updates more or less often --- π Use cases Customer Support: Instant, intelligent replies in WhatsApp without live agents Team Knowledge Bot: Tag the bot for quick access to SOPs and internal docs Community Groups: Automate common questions while keeping noise low Personal AI Assistant: A WhatsApp chatbot trained on your notes and files --- π Sticky Note Suggestion π¬ What this template does: > Enables an AI bot in your WhatsApp group that answers questions based on a Google Doc you provide. It uses a custom webhook, Google Drive, and Pinecone. π§ Requirements: > Google Drive account > Pinecone account with an index (dimension 1536) > Access to the custom WhatsApp webhook (see setup steps)