by Mark Shcherbakov
Video Guide I prepared a comprehensive guide demonstrating how to build a multi-level retrieval AI agent in n8n that smartly narrows down search results first by file descriptions, then retrieves detailed vector data for improved relevance and answer quality. Youtube Link Who is this for? This workflow suits developers, AI enthusiasts, and data engineers working with vector stores and large document collections who want to enhance the precision of AI retrieval by leveraging metadata-based filtering before deep content search. It helps users managing many files or documents and aiming to reduce noise and input size limits in AI queries. What problem does this workflow solve? Performing vector searches directly on large numbers of document chunks can degrade AI input quality and introduce noise. This workflow implements a two-stage retrieval process that first searches file descriptions to filter relevant files, then runs vector searches only within those files to fetch precise results. This reduces irrelevant data, improves answer accuracy, and optimizes performance when dealing with dozens or hundreds of files split into multiple pieces. What this workflow does This n8n workflow connects to a Supabase vector store to perform: Multi-level Retrieval:** File Description Search: Calls a Supabase RPC function to find files whose descriptions (metadata) best match the user query. It filters and limits the number of relevant files based on similarity scores. Document Chunk Retrieval: Uses retrieved file IDs to perform a second RPC call fetching detailed vector pieces only within those files, again filtered by similarity thresholds. OpenAI Integration:** The filtered document chunks and associated metadata (like file names and URLs) are passed to an OpenAI message node that includes system instructions to guide the AI in leveraging the knowledge base and linked resources for comprehensive responses. Custom Code Functions:** Two code nodes interact with Supabase stored procedures match_files and match_documents to perform the semantic searches with multiline metadata filtering unavailable in default vector filters. Helper Flows and SQL Setup:** Templates and SQL scripts prepare database tables and functions, with additional flows to generate embeddings from file description summaries using OpenAI. N8N Workflow Preparation: Create or verify Supabase account with vector store capability. Set up necessary database tables and RPC functions (match_files and match_documents) using provided SQL scripts. Replace all credentials in n8n nodes to connect to your Supabase and OpenAI accounts. Optionally upload document files and generate their vector embeddings and description summaries in a separate helper workflow. Main Workflow Logic: Code Function Node #1: Receives user query and calls the match_files RPC to retrieve file IDs by searching file descriptions with vector similarity thresholds and file limits. Code Function Node #2: Takes filtered file IDs, invokes match_documents RPC to fetch vector document chunks only from those files with additional similarity filtering and count limits. OpenAI Message Node: Combines fetched document pieces, their metadata (file URLs, similarity scores), and system prompts to generate precise AI-powered answers referencing the documents. This multi-tiered retrieval process improves search relevance and AI contextual understanding by smartly limiting vector search scope first to relevant files, then to specific document chunks, refining user query results.
by Adam Janes
How it works The workflow loads a list of test cases from a Google Sheet (previous results stored from an LLM) For each test case, we execute a call to an LLM judge in parallel (using HTTP Request + Webhook nodes) The judge uses the Input, Output, and Reference Answer fields from the spreadsheet to mark each LLM response as Pass/Fail The results are logged into a separate sheet in the same Sheets file. Set up steps: Add your credentials for Google Sheets and OpenRouter (or replace the OpenRouter node with your favourite chat model). Make a copy of the example Sheet to populate it with you own test data. Run the workflow with the Execute Workflow button next to the Manual Trigger node.
by Aashiq
👤 Who’s it for This workflow is for content creators, marketers, educators, or anyone who wants to instantly summarize YouTube videos and repurpose them into different formats (LinkedIn post, tweet, etc.) via a simple Telegram chatbot. ⚙️ How it works This n8n automation listens for messages in Telegram. If the message contains a YouTube link, it: Extracts the video ID Fetches the video transcript using RapidAPI Cleans the transcript of any special characters Sends it to OpenAI to generate a summary If the message is not a link, it simply acts as an AI chatbot using OpenAI with memory support. ✅ Supports follow-up prompts like: “Make it shorter” “Turn this into a LinkedIn post” “Create a tweet thread” 🧑🤝🧑 Multi-User Support This Telegram bot supports multiple users simultaneously. It tracks memory and context separately for each user using Telegram's unique chat_id. ✅ Each user gets personalized AI replies ✅ Follow-up commands work per user ✅ No interference between users 🛠️ Requirements A Telegram bot token (get via @BotFather) An OpenAI API Key (from https://platform.openai.com/account/api-keys) A RapidAPI Key and Host (typically youtube-transcript3.p.rapidapi.com) > 🚨 API keys must be added manually — they are not included in the template. 🧩 How to Set It Up Configure the Telegram Trigger node with your bot token. In the HTTP Request node, set: X-RapidAPI-Key: your RapidAPI key X-RapidAPI-Host: your RapidAPI host URL Add your OpenAI API credentials to the AI Agent node. Use the provided sticky notes for guidance inside the workflow itself. 🎛️ How to Customize Modify AI prompt behavior in the AI Agent node Change the text formatting in the Code node Use a different transcript API if preferred Add commands like make it into a blog post, summarize in bullet points, etc. 📌 Notes All nodes are renamed to reflect their function API credentials are removed for security Includes colored boxes and sticky notes to guide the user Compatible with n8n cloud and self-hosted setups
by Sarfaraz Muhammad Sajib
AI-Powered Automated Outreach Scheduling with Gemini, Gmail & Google Sheets Automate your lead generation and outreach process seamlessly using AI, Gmail, and Google Sheets—all within n8n. No complicated setup—just import, activate, and start reaching prospects with personalized messages generated by Google Gemini’s AI model. Quick Setup Import the Workflow Download and import the provided workflow into your n8n instance. Connect Your Accounts Authenticate your Google Sheets account. Connect your Gmail account for sending emails. Prepare the Spreadsheet Use this template to set up your leads and tracking sheet. Configure the Gemini API Obtain your Gemini API key. Here Add it to the Gemini API credentials within n8n. Set Scheduling Preferences Customize the Schedule Trigger node to control when the workflow runs. Edit Email Prompts Update the initial and follow-up email prompts to match your outreach tone and goals. Set Rate Limits Configure the rate limiting settings to comply with Gmail sending limits and avoid spam filters. Activate the Workflow Enable the workflow to begin automated outreach to your leads. Track and Manage Leads Monitor responses and update lead statuses directly in your Google Sheet. How It Works Schedule Trigger:** Automatically starts outreach based on your defined schedule Google Sheets Integration:** Fetches leads and updates their status after outreach Email Validation:** Checks if lead emails are valid before sending Website Scraper:** Gathers info from lead websites to personalize messages Google Gemini AI:** Generates tailored cold outreach messages optimized for high response Gmail Node:** Sends personalized emails directly from your Gmail account Core Features Pull leads automatically from Google Sheets Validate emails to avoid bounces Scrape lead websites for custom messaging context Generate AI-crafted outreach emails with dynamic personalization Send emails on schedule without manual intervention Update lead status to track outreach progress AI Integration Uses Google Gemini AI to create professional, friendly, and engaging outreach emails Dynamic prompt templates tailored to each lead’s company and website content Structured JSON output to easily map subject, greeting, and body content 💡 Usage Examples B2B cold outreach campaigns with personalized emails Automated follow-ups based on lead engagement Lead nurturing with context-aware messaging Sales prospecting workflows integrated into your CRM ✨ Benefits Save hours by automating personalized outreach Increase response rates with AI-optimized messaging Keep lead data organized and updated in Google Sheets Fully scalable and customizable n8n workflow Minimal setup, ready to run out-of-the-box
by David Roberts
AI evaluation in n8n This is a template for n8n's evaluation feature. Evaluation is a technique for getting confidence that your AI workflow performs reliably, by running a test dataset containing different inputs through the workflow. By calculating a metric (score) for each input, you can see where the workflow is performing well and where it isn't. How it works This template shows how to calculate a workflow evaluation metric: whether an output matches an expected output (i.e. has the same meaning). The workflow takes questions about the causes of historical events and compares them with the reference answers in the dataset. We use an evaluation trigger to read in our dataset It is wired up in parallel with the regular chat trigger so that the workflow can be started from either one. More info If we're evaluating (i.e. the execution started from the evaluation trigger), we calculate the correctness metric using AI We pass this information back to n8n as a metric If we're not evaluating we avoid calculating the metric, to reduce cost
by HoangSP
Medical Q&A Chatbot for Urology using RAG with Pinecone and GPT-4o This template provides an AI-powered Q&A assistant for the Urology domain using Retrieval-Augmented Generation (RAG). It uses Pinecone for vector search and GPT-4o for conversational responses. 🧠 Use Case This chatbot is designed for clinics or medical pages that want to automate question answering for Urology-related conditions. It uses a vector store of domain knowledge to return verified responses. 🔧 Requirements ✅ OpenAI API key (GPT-4o or GPT-4o-mini) ✅ Pinecone account with an active index ✅ Verified Urology documents embedded into Pinecone ⚙️ Setup Instructions Create a Pinecone vector index and connect it using the Pinecone credentials node. Upload Urology-related documents to embed using the Create Embeddings for Urology Docs node. Customize the chatbot system message to reflect your medical specialty. Deploy this chatbot on your website or link it with Telegram via the chat trigger node. 🛠️ Components chatTrigger: Listens for user messages and starts the workflow. Medical AI Agent: GPT-based agent guided by domain-specific instructions. RAG Tool Vector Store: Fetches relevant documents from Pinecone using vector search. Memory Buffer: Maintains conversation context. Create Embeddings for Urology Docs: Encodes documents into vector format. 📝 Customization You can replace the knowledge base with any other medical domain by: Updating the documents stored in Pinecone. Modifying the system prompt in the AI Agent node. 📣 CTA This chatbot is ideal for clinics, medical consultants, or educational websites wanting a reliable AI assistant in Urology.
by Derek Cheung
How it works: This project creates a personal AI assistant named Angie that operates through Telegram. Angie can summarize daily emails, look up calendar entries, remind users of upcoming tasks, and retrieve contact information. The assistant can interact with users via both voice and text inputs. Step-by-step: Telegram Trigger: The workflow starts with a Telegram trigger that listens for incoming message events. The system determines if the incoming message is voice or text. If voice, the voice file is retrieved and transcribed to text using OpenAI's API Speech to Text AI Assistant: The telegram request is passed to the AI assistant (Angie). Tools Integration: The AI assistant is equipped with several tools: Get Email: Uses Gmail API to fetch recent emails, filtering by date. Get Calendar: Retrieves calendar entries for specified dates. Get Tasks: Connects to a Baserow (open-source Airtable alternative) database to fetch to-do list items. Get Contacts: Also uses Baserow to retrieve contact information. Response Generation: The AI formulates a response based on the gathered information and sends back to the user on Telegram
by Lucas Walter
Who's it for This workflow is perfect for directory site creators, content managers, and developers who need to automatically find and select the highest quality favicon or logo for websites they're showcasing. Instead of manually hunting down brand assets or settling for blurry default icons, this workflow does the heavy lifting by fetching multiple options and using AI to pick the best one. How it works The workflow takes a website URL and domain as input, then intelligently fetches favicon images from three different sources: Google's Favicon API - Gets the site's actual favicon Logo.dev - Provides high-quality brand logos Clearbit - Alternative logo source for business websites Once all images are collected, the workflow uses OpenAI's vision model to analyze each icon based on: Image quality and resolution (minimum 256x256) Brand authenticity (avoiding generic framework icons) Visual clarity without artifacts or blur Professional presentation suitable for directory listings The AI assigns quality scores from 0.0 to 1.0, and the workflow automatically returns the URL of the highest-scoring favicon. Requirements OpenAI API key (for image analysis) Logo.dev API key (free tier available) How to set up Configure API credentials: Add your OpenAI API key to n8n credentials Sign up for Logo.dev and add your API token The Clearbit and Google APIs require no authentication Test the workflow: Use the pinned test data (Fyxer AI example) or replace with your own Ensure all HTTP nodes can successfully fetch images Verify the AI analysis is working by checking the quality scores Customize input format: Modify the workflow trigger to accept your preferred input format Adjust the domain extraction logic if needed for your use case How to customize the workflow For different quality criteria: Edit the AI prompt in the "analyze_each_icon" node to emphasize different aspects (transparency, size, style preferences) For additional favicon sources: Add more HTTP Request nodes pointing to other favicon/logo APIs Update the merge node to handle additional inputs Modify the final URL construction logic to handle new sources For batch processing: Wrap this workflow in a loop to process multiple websites at once Add error handling for failed requests or AI analysis timeouts The workflow is designed to be reliable and handles errors gracefully - if one favicon source fails, it continues with the available options and still provides the best result possible.
by Oneclick AI Squad
This n8n workflow automates the process of scraping LinkedIn profiles using the Apify platform and organizing the extracted data into Google Sheets for easy analysis and follow-up. Use Cases Lead Generation**: Extract contact information and professional details from LinkedIn profiles Recruitment**: Gather candidate information for talent acquisition Market Research**: Analyze professional networks and industry connections Sales Prospecting**: Build targeted prospect lists with detailed professional information How It Works 1. Workflow Initialization & Input Webhook Start Scraper**: Triggers the entire scraping workflow Read LinkedIn URLs**: Retrieves LinkedIn profile URLs from Google Sheets Schedule Scraper Trigger**: Sets up automated scheduling for regular scraping 2. Data Processing & Extraction Data Formatting**: Prepares and structures the LinkedIn URLs for processing Fetch Profile Data**: Makes HTTP requests to Apify API with profile URLs Run Scraper Actor**: Executes the Apify LinkedIn scraper actor Get Scraped Results**: Retrieves the extracted profile data from Apify 3. Data Storage & Completion Save to Google Sheets**: Stores the scraped profile data in organized spreadsheet format Update Progress Tracker**: Updates workflow status and progress tracking Process Complete Wait**: Ensures all operations finish before final steps Send Success Notification**: Alerts users when scraping is successfully completed Requirements Apify Account Active Apify account with sufficient credits API token for authentication Access to LinkedIn Profile Scraper actor Google Sheets Google account with Sheets access Properly formatted input sheet with LinkedIn URLs Credentials configured in n8n n8n Setup HTTP Request node credentials for Apify Google Sheets node credentials Webhook endpoint configured How to Use Step 1: Prepare Your Data Create a Google Sheet with LinkedIn profile URLs Ensure the sheet has a column named 'linkedin_url' Add any additional columns for metadata (name, company, etc.) Step 2: Configure Credentials Set up Apify API credentials in n8n Configure Google Sheets authentication Update webhook endpoint URL Step 3: Customize Settings Adjust scraping parameters in the Apify node Modify data fields to extract based on your needs Set up notification preferences Step 4: Execute Workflow Trigger via webhook or manual execution Monitor progress through the workflow Check Google Sheets for scraped data Review completion notifications Good to Know Rate Limits**: LinkedIn scraping is subject to rate limits. The workflow includes delays to respect these limits. Data Quality**: Results depend on profile visibility and LinkedIn's anti-scraping measures. Costs**: Apify charges based on compute units used. Monitor your usage to control costs. Compliance**: Ensure your scraping activities comply with LinkedIn's Terms of Service and applicable laws. Customizing This Workflow Enhanced Data Processing Add data enrichment steps to append additional information Implement duplicate detection and merge logic Create data validation rules for quality control Advanced Notifications Set up Slack or email alerts for different scenarios Create detailed reports with scraping statistics Implement error recovery mechanisms Integration Options Connect to CRM systems for automatic lead creation Integrate with marketing automation platforms Export data to analytics tools for further analysis Troubleshooting Common Issues Apify Actor Failures**: Check API limits and actor status Google Sheets Errors**: Verify permissions and sheet structure Rate Limiting**: Implement longer delays between requests Data Quality Issues**: Review scraping parameters and target profiles Best Practices Test with small batches before scaling up Monitor Apify credit usage regularly Keep backup copies of your data Regular validation of scraped information accuracy
by Sebastian/OptiLever
Who's it for This workflow is designed for users who want to implement iterative AI-powered content improvement processes. It's ideal for content creators, marketers, product managers, and anyone who needs to refine ideas through multiple rounds of critique and enhancement until they meet quality standards. How it works The workflow creates a sophisticated feedback loop using three specialized AI agents that work together to continuously improve content. Starting with an initial input (like a product description), the system generates ideas and then enters a reasoning loop where: A Critic Agent analyzes the current output and identifies flaws or areas for improvement A Refiner Agent takes the original input plus the critic's feedback to create enhanced versions An Evaluator Agent assesses the refined output and determines if it meets the quality threshold The loop continues until either the evaluator determines the output is satisfactory or a maximum number of iterations is reached (configurable, default is 5 turns). How to set up Configure the initial AI agent to generate your starting content Set up the loop structure with "Reset Loop" enabled in the loop node options Configure three AI agents within the loop: Critic: Provide detailed analysis prompts for identifying improvements Refiner: Create prompts that incorporate feedback to enhance content Evaluator: Define quality criteria and decision-making logic Add Edit Fields nodes at the beginning and end of the loop to maintain data structure Include a Code node to track iteration count and loop control Set up the IF node to check exit conditions (max turns or completion status) Requirements n8n workflow environment Access to AI/LLM nodes (OpenAI, Anthropic, etc.) Basic understanding of JSON data structures Configured AI model credentials How to customize the workflow Customize the system prompts for each agent based on your specific use case. The critic should focus on your quality criteria, the refiner should understand your improvement goals, and the evaluator should have clear success metrics. Adjust the maximum iteration count in the code node and IF condition based on your complexity needs and token budget considerations.
by ARRE
Good to know: This workflow automatically processes incoming emails (you can filter them base on your needs) and creates concise AI-powered summaries, then logs them to a Google Sheets spreadsheet for easy tracking and analysis. Who is this for? ➖Business professionals who receive many emails and need quick summaries ➖Customer service teams tracking email communications ➖Project managers monitoring email correspondence ➖Anyone who wants to automatically organize and summarize their email communications What problem is this workflow solving? This workflow solves the problem of email overload by automatically reading incoming emails, generating concise summaries using AI, and organizing them in a structured format. It eliminates the need to manually read through every email to understand the key points and maintains a searchable record of communications. What this workflow does: ✅Monitors your Gmail inbox for new emails ✅Filters emails based on specific criteria (sender validation) ✅Extracts key information (sender, date, subject, content) ✅Uses AI to generate concise summaries of email content ✅Automatically logs all data including the AI summary to a Google Sheets spreadsheet How it works: 1️⃣Gmail trigger monitors for new emails at specified intervals 2️⃣Email data is processed and formatted using JavaScript 3️⃣A conditional check validates the sender 4️⃣AI agent (powered by Groq's language model) reads the email content and generates a summary 5️⃣All information is automatically appended to a Google Sheets document How to use: Set up Gmail OAuth2 credentials in n8n Configure Google Sheets OAuth2 credentials Set up Groq API credentials for AI processing Create a Google Sheets document and update the document ID Customize the sender validation criteria as needed Activate the workflow Requirements: ✅n8n instance (cloud or self-hosted) ✅Gmail account with OAuth2 access ✅Google Sheets account ✅AI API ✅Basic understanding of n8n workflow Customizing this workflow: 🟢Modify the Gmail trigger filters to target specific labels or criteria 🟢Adjust the sender validation logic in the conditional node 🟢Customize the AI prompt to change summary style or focus 🟢Add additional data fields to the Google Sheets output 🟢Change the polling frequency for checking new emails 🟢Switch to different AI models by replacing the Groq node
by Davide
This workflow automates the generation and delivery of personalized business documents (e.g., contracts, job offers, invoices, pay slips) in PDF format. The data source is a Google Sheet, and the documents are created using CraftMyPDF, then uploaded to Google Drive and optionally sent via email. This workflow is ideal for bulk document generation (contracts, invoices, etc.) with minimal manual intervention. Benefits Fully Automated**: Once triggered, it handles the whole pipeline end-to-end—no manual editing or document creation needed. Customizable**: Works with any type of business document as long as you provide a CraftMyPDF template. Scalable**: Processes multiple entries in batch, ideal for HR departments or finance teams. Integrated**: Seamlessly connects Google Sheets, CraftMyPDF, Google Drive, and Gmail. Trackable**: Updates the original spreadsheet to keep track of which documents have been processed. Requirements Self-hosted n8n instance (required for some advanced node usage). Google Sheet template with columns like: FIRST NAME, LAST NAME, ADDRESS, etc. A CraftMyPDF account with a ready-made template. Google OAuth2 credentials for Sheets, Drive, and Gmail integrations. How It Works Trigger & Data Fetch: The workflow starts with a manual trigger ("When clicking ‘Execute workflow’"). It retrieves employee data from a Google Sheet ("Get employees"), filtering rows where the "DONE" column is empty. PDF Generation & Processing: The "Loop Over Items" node processes each employee record individually. The "Create agreement" node uses CraftMyPDF to generate a PDF contract, populating it with employee details (name, address, email, etc.). A conditional node ("Success?") checks if PDF creation was successful. PDF Handling & Notifications: The PDF is fetched ("Get agreement") and uploaded to Google Drive ("Upload agreement") with a filename like [First-Name]-[Last-Name].pdf. An email with the PDF attachment is sent to the employee via Gmail ("Send email with PDF"). Tracking & Completion: The Google Sheet row is updated with "x" in the "DONE" column ("Update row") to mark completion. The workflow merges results and loops until all records are processed. Set Up Steps Prerequisites: Use the self-hosted version of n8n (required for this workflow). Clone the provided Google Sheet template. Configure CraftMyPDF: Create an account on CraftMyPDF. Design a PDF template and note its Template ID. Insert this ID in the "Create agreement" node. Credentials Setup: Connect nodes to: Google Sheets (to fetch/update data). Google Drive (to store PDFs). Gmail (to send emails). CraftMyPDF (for PDF generation). Customization: Adjust field mappings in the "Create agreement" node to match your PDF template placeholders. Modify the email template in "Send email with PDF" as needed. Execution: Run the workflow manually. It will process all rows lacking a "DONE" marker, generating PDFs, sending emails, and updating the sheet automatically. Need help customizing? Contact me for consulting and support or add me on Linkedin.