by Shiv Gupta
๐ต TikTok Post Scraper via Keywords | Bright Data + Sheets Integration ๐ Workflow Description Automatically scrapes TikTok posts based on keyword search using Bright Data API and stores comprehensive data in Google Sheets for analysis and monitoring. ๐ How It Works This workflow operates through a simple, automated process: Keyword Input:** User submits search keywords through a web form Data Scraping:** Bright Data API searches TikTok for posts matching the keywords Processing Loop:** Monitors scraping progress and waits for completion Data Storage:** Automatically saves all extracted data to Google Sheets Result Delivery:** Provides comprehensive post data including metrics, user info, and media URLs โฑ๏ธ Setup Information Estimated Setup Time: 10-15 minutes This includes importing the workflow, configuring credentials, and testing the integration. Most of the process is automated once properly configured. โจ Key Features ๐ Keyword-Based Search Search TikTok posts using specific keywords ๐ Comprehensive Data Extraction Captures post metrics, user profiles, and media URLs ๐ Google Sheets Integration Automatically organizes data in spreadsheets ๐ Automated Processing Handles scraping progress monitoring ๐ก๏ธ Reliable Scraping Uses Bright Data's professional infrastructure โก Real-time Updates Live status monitoring and data processing ๐ Data Extracted | Field | Description | Example | |-------|-------------|---------| | url | TikTok post URL | https://www.tiktok.com/@user/video/123456 | | post_id | Unique post identifier | 7234567890123456789 | | description | Post caption/description | Check out this amazing content! #viral | | digg_count | Number of likes | 15400 | | share_count | Number of shares | 892 | | comment_count | Number of comments | 1250 | | play_count | Number of views | 125000 | | profile_username | Creator's username | @creativity_master | | profile_followers | Creator's follower count | 50000 | | hashtags | Post hashtags | #viral #trending #fyp | | create_time | Post creation timestamp | 2025-01-15T10:30:00Z | | video_url | Direct video URL | https://video.tiktok.com/tos/... | ๐ Setup Instructions Step 1: Prerequisites n8n instance (self-hosted or cloud) Bright Data account with TikTok scraping dataset access Google account with Sheets access Basic understanding of n8n workflows Step 2: Import Workflow Copy the provided JSON workflow code In n8n: Go to Workflows โ + Add workflow โ Import from JSON Paste the JSON code and click Import The workflow will appear in your n8n interface Step 3: Configure Bright Data In n8n: Navigate to Credentials โ + Add credential โ Bright Data API Enter your Bright Data API credentials Test the connection to ensure it's working Update the workflow nodes with your dataset ID: gd_lu702nij2f790tmv9h Replace BRIGHT_DATA_API_KEY with your actual API key Step 4: Configure Google Sheets Create a new Google Sheet or use an existing one Copy the Sheet ID from the URL In n8n: Credentials โ + Add credential โ Google Sheets OAuth2 API Complete OAuth setup and test connection Update the Google Sheets node with your Sheet ID Ensure the sheet has a tab named "Tiktok by keyword" Step 5: Test the Workflow Activate the workflow using the toggle switch Access the form trigger URL to submit a test keyword Monitor the workflow execution in n8n Verify data appears in your Google Sheet Check that all fields are populated correctly โ๏ธ Configuration Details Bright Data API Settings Dataset ID:** gd_lu702nij2f790tmv9h Discovery Type:** discover_new Search Method:** keyword Results per Input:** 2 posts per keyword Include Errors:** true Workflow Parameters Wait Time:** 1 minute between status checks Status Check:** Monitors until scraping is complete Data Format:** JSON response from Bright Data Error Handling:** Automatic retry on incomplete scraping ๐ Usage Guide Running the Workflow Access the form trigger URL provided by n8n Enter your desired keyword (e.g., "viral dance", "cooking tips") Submit the form to start the scraping process Wait for the workflow to complete (typically 2-5 minutes) Check your Google Sheet for the extracted data Best Practices Use specific, relevant keywords for better results Monitor your Bright Data usage to stay within limits Regularly backup your Google Sheets data Test with simple keywords before complex searches Review extracted data for accuracy and completeness ๐ง Troubleshooting Common Issues ๐จ Scraping Not Starting Verify Bright Data API credentials are correct Check dataset ID matches your account Ensure sufficient credits in Bright Data account ๐จ No Data in Google Sheets Confirm Google Sheets credentials are authenticated Verify sheet ID is correct Check that the "Tiktok by keyword" tab exists ๐จ Workflow Timeout Increase wait time if scraping takes longer Check Bright Data dashboard for scraping status Verify keyword produces available results ๐ Use Cases Content Research Research trending content and hashtags in your niche to inform your content strategy. Competitor Analysis Monitor competitor posts and engagement metrics to understand market trends. Influencer Discovery Find influencers and creators in specific topics or industries. Market Intelligence Gather data on trending topics, hashtags, and user engagement patterns. ๐ Security Notes Keep your Bright Data API credentials secure Use appropriate Google Sheets sharing permissions Monitor API usage to prevent unexpected charges Regularly rotate API keys for better security Comply with TikTok's terms of service and data usage policies ๐ Ready to Use! Your TikTok scraper is now configured and ready to extract valuable data. Start with simple keywords and gradually expand your research as you become familiar with the workflow. Need Help? Visit the n8n community forum or check the Bright Data documentation for additional support and advanced configuration options. For any questions or support, please contact: Email or fill out this form
by Automate With Marc
This workflow contains community nodes that are only compatible with the self-hosted version of n8n. ๐ง Perplexity-Powered Daily AI News Digest (via Telegram) This ready-to-deploy n8n workflow automates the entire process of collecting, filtering, formatting, and distributing daily AI industry news summaries directly to your Telegram group or channel. Powered by Perplexity and OpenAI, it fetches only high-signal AI updates from trusted sources (e.g. OpenAI, DeepMind, HuggingFace, MIT Tech Review), filters out duplicates based on a Google Sheet archive, and delivers beautifully formatted news directly to your team โ every morning at 10AM. For more such build and step-by-step tutorials, check out: https://www.youtube.com/@Automatewithmarc ๐ Key Features: Perplexity AI Integration: Automatically fetches the most relevant AI developments from the last 24 hours. AI Formatter Agent: Cleans the raw feed, removes duplicates, adds summaries, and ensures human-friendly formatting. Google Sheets Log: Tracks previously reported news items to avoid repetition. Telegram Delivery: Sends a polished daily digest straight to your chat, ready for immediate team consumption. Customizable Scheduling: Preconfigured for daily use, but can be modified to fit your team's preferred cadence. ๐ผ Ideal For: Anyone who wants to stay ahead of fast-moving AI trends with zero manual effort ๐ ๏ธ Tech Stack: Perplexity AI OpenAI (GPT-4 or equivalent) Google Sheets Telegram API โ Setup Notes: Youโll need to connect your own OpenAI, Perplexity, Google Sheets, and Telegram credentials. Replace the Google Sheet ID and Telegram channel settings with your own.
by Boriwat Chanruang
Who is this for? This workflow is for small business owners, personal assistants, or project managers who rely on multiple platforms for communication and scheduling. Ideal for users managing customer support, personal scheduling, or group event coordination via LINE, Google Calendar, and Gmail. What problem is this workflow solving? Reduces the manual effort needed to manage conversations, schedule events, and handle email communications. Provides an intelligent system for replying to user messages and fetching relevant calendar or email information in real time. Bridges the gap between messaging platforms and productivity tools, improving efficiency. What this workflow does LINE Chatbot Automation**: Automatically processes and responds to messages received via LINE. Google Calendar Management**: Retrieves upcoming events or schedules new events dynamically based on user queries. Email Retrieval**: Fetches recent emails using Gmail and filters them based on user instructions. AI-Powered Replies**: Uses OpenAI GPT to interpret user queries and provide tailored responses. Setup Prerequisites: LINE Developer account and API access. Google Calendar and Gmail accounts with OAuth credentials. An n8n instance with access to environment variables. Steps: Set up environment variables (LINE_API_TOKEN and DYNAMIC_EMAIL). Configure API credentials for Google Calendar and Gmail in n8n. Test the workflow by sending a sample message via LINE. Enhancements: Use sticky notes to provide inline instructions for each node. Include a video walkthrough or a step-by-step document for first-time users. How to customize this workflow to your needs Localization**: Modify responses in the AI Agent node to match the language and tone of your audience. Integration**: Add more integrations like Slack or Microsoft Teams for additional notifications. Advanced Filters**: Add specific conditions to Gmail or Google Calendar nodes to fetch only relevant data, such as events with specific keywords or emails from certain senders. Advanced Use Cases Customer Support**: Automatically schedule meetings with clients based on their messages in LINE. Event Management**: Handle RSVP confirmations, event reminders, and email follow-ups for planned events. Personalized Assistant**: Use the workflow to act as a personal virtual assistant that syncs your schedule, replies to messages, and summarizes emails. Tips for Optimization Edit Fields Node**: Add a centralized node to configure dynamic inputs (e.g., tokens, emails, or thresholds) for easy updates. Fallback Responses**: Use a switch node to handle unrecognized input gracefully and provide clear feedback to users. Logs and Monitoring**: Add nodes to log interactions and track message flows for debugging or analytics. Let me know if you'd like me to expand on any specific section or add more customization ideas!
by Roninimous
This workflow integrates iOS Shortcuts with n8n to create a simple, automatic location-based reminder system. When the user arrives at a specified location, an automation in the Shortcuts app sends a webhook trigger to n8n. If the trigger matches predefined date and time conditions, n8n sends a Telegram message reminder to the user. This is perfect for repetitive weekly tasks like taking out the bins, customized with conditions for day and time. Key Features Location-Based Trigger: Uses iOS Shortcuts automation to start the workflow upon arrival at a specific location. Time and Day Validation: Logic in n8n checks current weekday and time to ensure reminders are sent only when appropriate. Telegram Integration: Sends reminders directly to your Telegram account using your bot. Minimal Setup: Uses native iOS and simple webhook setup in n8n. How It Works iOS Shortcut Trigger: When the user arrives at a designated location, the iOS shortcut sends a GET request to the n8n webhook. n8n Webhook Node: Receives the request and triggers the workflow. Conditional Check: An IF node checks if the current time is after 4:00 PM and it's a Wednesday (or any other configured condition). Telegram Node: If the condition passes, n8n sends a message like "Don't forget to take the bins out." to your Telegram bot. Setup Instructions Create a Telegram Bot: Use @BotFather to create a bot and obtain your bot token. Add Telegram API credentials in n8n with your bot token. Setup iOS Shortcut: Open the Shortcuts app on your iPhone. Go to the Automation tab โ Tap + โ Create Personal Automation. Choose Arrive โ Select a location. Add action: Get Contents of URL. Method: GET, URL: your n8n Webhook URL (e.g. https://n8n.yourdomain.com/webhook/your-path). Save the automation. (You can also test the automation by pressing the Play button) Import Workflow into n8n: Load the provided workflow JSON. Set your webhook path and Telegram credentials. Adjust the logic in the IF node to your usecase. In my case, I check if today is Wednesday and after 4 PM until Midnight. Expose n8n Publicly: Ensure your n8n instance is publicly accessible via HTTPS so the shortcut can reach it. Customization Guidance Change Reminder Message: Modify the text inside the Telegram node to suit different reminders. Add More Conditions: Extend the logic to support more days, hours, or different trigger messages. Add Multi-Channel Output: Send reminders via email, SMS, or Slack in addition to Telegram. Use More Triggers: Expand to other types of shortcut triggers (e.g. NFC tag, leaving location, time of day). Security and Implementation Webhook Protection: Avoid using easily guessable webhook URLs. Secure Telegram Token: Store your bot token securely in n8n credentials, not in plain workflow text. Limit Shortcut Scope: Only trigger the shortcut at trusted locations or with secure iCloud sync. Automation Permissions: Ensure your iPhone allows shortcut automations to run without confirmation. Benefits Automates repetitive location-based reminders without user interaction. Provides a lightweight, native solution using iOS and n8n with no extra apps. Keeps you on track for routine tasks like garbage days, medicine reminders, or arrival-based tasks. Easily extendable for multiple locations or trigger conditions.
by Jaruphat J.
Who is this for? This workflow is perfect for digital content creators, marketers, and social media managers who regularly create engaging short-form videos featuring inspirational or motivational quotes. While the workflow is universally applicable, it specifically highlights Thai as an example to demonstrate effective language and font integration. What problem is this workflow solving? Creating consistent and engaging multilingual video content manually, including attractive fonts and proper video formatting, is time-consuming and repetitive. Additionally, managing files, background music, and updating statuses manually can be tedious and prone to errors. What this workflow does Automatically fetches background video and music files stored on Google Drive. Randomly selects a quote (demonstrated with Thai language) and author information from Google Sheets. Dynamically combines the selected quote and author text using appealing fonts, such as the Thai font "Kanit," directly onto the video using FFmpeg on your n8n local environment. Creates visually engaging videos with a 9:16 aspect ratio, optimized for YouTube Shorts and other vertical video platforms. Automatically uploads the finalized video to YouTube. Updates the status and YouTube URL back into your Google Sheet, ensuring you have up-to-date records. Setup Requirements: This workflow requires a self-hosted n8n instance, as the execution of FFmpeg commands is not supported on n8n Cloud. Ensure FFmpeg is installed on your self-hosted environment. Google Sheets Setup: Your Google Sheet must include at least these columns: Index: (Unique identifier for each quote) Quote: (Text of the quote) Author: (Author of the quote) CreateStatus: (Track video creation status; values like 'DONE' or blank for pending) YoutubeURL: (Automatically updated after upload) To help you get started quickly, you can use this template spreadsheet. Next steps: Organize your video and music files in separate folders in Google Drive. Authenticate your Google Sheets, Google Drive, and YouTube accounts in n8n. Ensure fonts compatible with your target languages (such as Kanit for Thai) are available in your FFmpeg installation. How to customize this workflow to your needs Fonts:** Adjust font styles and sizes within the workflow's code node. Ensure the fonts you choose fully support the language you wish to use. Quote Management:** Easily add or remove quotes and authors in your Google Sheets document. Media Files:** Change or update background videos and music by modifying the files in your Google Drive folders. Video Specifications:** Customize video dimensions, text positioning, opacity, and music volume directly in the provided FFmpeg commands. Benefits of Using Localized Fonts and Quotes Utilizing fonts specific to your target language, as demonstrated with Thai, significantly increases audience engagement by making your content more relatable, shareable, and visually appealing. Ensure you select fonts that properly support the language you're targeting.
by Automate With Marc
๐งโโ๏ธ AI Legal Assistant Agent โ AI-Powered Legal Q&A with Document Retrieval Category: LegalTech / AI Agent / RAG / Chatbot Description: This no-code AI agent acts as a legal assistant chatbot that can answer user queries by retrieving information from a pre-indexed legal document library. Itโs powered by OpenAI + Pinecone + Telegram and designed for law firms, compliance teams, or anyone who needs instant answers from contracts, policies, or regulatory documents. For more of such builds and step-by-step video tutorial, check out: https://www.youtube.com/@Automatewithmarc ๐ How it Works: Telegram Trigger โ Starts when a user sends a message via Telegram. AI Agent (Open AI Model) โ Uses a retrieval-augmented generation (RAG) setup to understand the question and pull relevant context. Pinecone Vector Store โ Searches across a vectorized legal contract library for relevant clauses or documents. OpenAI Embeddings โ Converts uploaded documents into vector embeddings for efficient search. Memory Buffer โ Maintains conversation flow and context for follow-up questions. Telegram Response โ Sends the final AI-generated answer directly to the user. ๐ฏ Use Cases: In-house legal teams automating internal policy Q&A Law firms building client-facing legal bots Startups offering legal tech services with document-based queries Compliance teams monitoring contract terms and obligations โ Key Features: Real-time legal Q&A via Telegram Pinecone + OpenAI-powered vector search Retrieval-Augmented Generation (RAG) setup Factual, memory-aware assistant with fallback if info is unavailable Fully customizable and extendable โ๏ธ Setup Instructions: Connect OpenAI, Pinecone, and Telegram credentials Upload your contracts or policy docs into Pinecone Customize the system prompt or expand document sources as needed Activate and test via Telegram This workflow is a solid foundation for any AI-powered legal assistant or chatbot solutionโhighly relevant for modern LegalOps and knowledge management teams.
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 Nasser
For Who? Content Creators Youtube Automation Marketing Team How it works? 1 - Retrieve Base Image, Image Description and Situation from Airtable 2 - Generate Image Prompt 3 - Generate Image via Fal AI 4 - Verify if Image is generated 5 - Upload Image on Airtable ๐บย YouTube Video Tutorial: SETUP Setup Input : The first part of the workflow can be replaced with anything else. You need as input a Prompt and the Base Image URL (publicly available). Setup Output : In this Workflow, the output is storing the image on Airtable but you can replace that with anything else but basically you have two options : Store the Generated Image somewhere : Keep everything like this and replace the last Airtable node with the Third Party you want to use. Use the Image directly in n8n : In HTTP Request "Generate Image" switch sync_mode to "true", remove all the following nodes and add "Extract form File" node (convert to Base64 String) APIs : For the following third-party integrations, replace ==[YOUR_API_TOKEN]== with your API Token or connect your account via Client ID / Secret to your n8n instance: Fal AI (FLUX KONTEXT MAX) : https://fal.ai/models/fal-ai/flux-pro/kontext/max/api#schema-input Airtable : https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.airtable/?utm_source=n8n_app&utm_medium=node_settings_modal-credential_link&utm_campaign=n8n-nodes-base.airtable
by Nick Saraev
Deep Multiline Icebreaker System (AI-Powered Cold Email Personalization) Categories: Lead Generation, AI Marketing, Sales Automation This workflow creates an advanced AI-powered cold email personalization system that achieves 5-10% reply rates by generating deeply personalized multi-line icebreakers. The system scrapes comprehensive website data, analyzes multiple pages per prospect, and uses advanced AI prompting to create custom email openers that make recipients believe you've personally researched their entire business. Benefits Superior Response Rates** - Achieves 5-10% reply rates vs. 1-2% for standard cold email campaigns Deep Website Intelligence** - Scrapes and analyzes multiple pages per prospect, not just homepages Advanced AI Personalization** - Uses sophisticated prompting techniques with examples and formatting rules Complete Lead Pipeline** - From Apollo search to personalized icebreakers in Google Sheets Scalable Processing** - Handle hundreds of prospects with intelligent batching and error handling Revenue-Focused Approach** - System designed around proven $72K/month agency methodologies How It Works Apollo Lead Acquisition: Integrates directly with Apollo.io search URLs through Apify scraper Processes 500+ leads per search with comprehensive contact data Filters for prospects with both email addresses and accessible websites Multi-Page Website Scraping: Scrapes homepage to extract all internal website links Processes relative URLs and filters out external/irrelevant links Performs intelligent batching to prevent IP blocking during scraping Comprehensive Content Analysis: Converts HTML to markdown for efficient AI processing Uses GPT-4 to generate detailed abstracts of each webpage Aggregates insights from multiple pages into comprehensive prospect profiles Advanced AI Icebreaker Generation: Employs sophisticated prompting with system messages, examples, and formatting rules Uses proven icebreaker templates that reference non-obvious website details Generates personalized openers that imply deep manual research Smart Data Processing: Removes duplicate URLs and handles scraping errors gracefully Implements token limits to control AI processing costs Organizes final output in structured Google Sheets format Required Google Sheets Setup Create a Google Sheet with these exact tab and column structures: Search URLs Tab: URL - Contains Apollo.io search URLs for your target audiences Leads Tab (Output): first_name - Contact's first name last_name - Contact's last name email - Contact's email address website_url - Company website URL headline - Job title/position location - Geographic location phone_number - Contact phone (if available) multiline_icebreaker - AI-generated personalized opener Setup Instructions: Create Google Sheet with "Search URLs" and "Leads" tabs Add your Apollo search URLs to the first tab (one per row) Connect Google Sheets OAuth credentials in n8n Update the Google Sheets document ID in all sheet nodes The workflow reads from Search URLs and outputs to Leads automatically Apollo Search URL Format: Your search URLs should look like: https://app.apollo.io/#/people?personLocations[]=United%20States&personTitles[]=ceo&qKeywords=marketing%20agency&page=1 Business Use Cases AI Automation Agencies** - Generate high-converting prospect outreach for service-based businesses B2B Sales Teams** - Create personalized cold email campaigns that actually get responses Marketing Agencies** - Offer premium personalization services to clients Consultants** - Build authority through deeply researched prospect outreach SaaS Companies** - Improve demo booking rates through personalized messaging Professional Services** - Stand out from generic sales emails with custom insights Revenue Potential This system transforms cold email economics: 5-10x Higher Response Rates** than standard cold email approaches $72K/month proven methodology** - exact system used to scale successful AI agency Premium Positioning** - prospects assume you've done extensive manual research Scalable Personalization** - process hundreds of prospects daily vs. manual research Difficulty Level: Advanced Estimated Build Time: 3-4 hours Monthly Operating Cost: ~$150 (Apollo + Apify + OpenAI + Email platform APIs) Watch My Complete Live Build Want to see me build this entire deep personalization system from scratch? I walk through every component live - including the AI prompting strategies, website scraping logic, error handling, and the exact techniques that generate 5-10% reply rates. ๐ฅ See My Live Build Process: "I Deep-Personalized 1000+ Cold Emails Using THIS AI System (FREE TEMPLATE)" This comprehensive tutorial shows the real development process - including advanced AI prompting, multi-page scraping architecture, and the proven icebreaker templates that have generated over $72K/month in agency revenue. Set Up Steps Apollo & Apify Integration: Configure Apify account with Apollo scraper access Set up API credentials and test lead extraction Define target audience parameters and lead qualification criteria Google Sheets Database Setup: Create multi-sheet structure (Search URLs, Leads) Configure proper column mappings for lead data Set up Google Sheets API credentials and permissions Website Scraping Infrastructure: Configure HTTP request nodes with proper redirect handling Set up error handling for websites that can't be scraped Implement intelligent batching with split-in-batches nodes AI Content Processing: Set up OpenAI API credentials with appropriate rate limits Configure dual-AI approach (page summarization + icebreaker generation) Implement token limiting to control processing costs Advanced Icebreaker Generation: Configure sophisticated AI prompting with system messages Set up example-based learning with input/output pairs Implement formatting rules for natural-sounding personalization Quality Control & Testing: Test complete workflow with small prospect batches Validate AI output quality and personalization accuracy Monitor response rates and optimize messaging templates Advanced Optimizations Scale the system with: Industry-Specific Templates:** Customize icebreaker formats for different verticals A/B Testing Framework:** Test different AI prompt variations and templates CRM Integration:** Automatically add qualified responders to sales pipelines Response Tracking:** Monitor which personalization elements drive highest engagement Multi-Touch Sequences:** Create follow-up campaigns based on initial response data Important Considerations AI Token Management:** System includes intelligent token limiting to control OpenAI costs Scraping Ethics:** Built-in delays and error handling prevent website overload Data Quality:** Filtering logic ensures only high-quality prospects with accessible websites Scalability:** Batch processing prevents IP blocking during high-volume scraping Why This System Works The key to 5-10% reply rates lies in making prospects believe you've done extensive manual research: Non-obvious details from deep website analysis Natural language patterns that avoid template detection Company name abbreviation (e.g., "Love AMS" vs "Love AMS Professional Services") Multiple page insights aggregated into compelling narratives Check Out My Channel For more advanced automation systems and proven business-building strategies that generate real revenue, explore my YouTube channel where I share the exact methodologies used to build successful automation agencies.
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 Ajith joseph
๐ค Create a Telegram Bot with Mistral AI and Conversation Memory A sophisticated Telegram bot that provides AI-powered responses with conversation memory. This template demonstrates how to integrate any AI API service with Telegram, making it easy to swap between different AI providers like OpenAI, Anthropic, Google AI, or any other API-based AI model. ๐ง How it works The workflow creates an intelligent Telegram bot that: ๐ฌ Maintains conversation history for each user ๐ง Provides contextual AI responses using any AI API service ๐ฑ Handles different message types and commands ๐ Manages chat sessions with clear functionality ๐ Easily adaptable to any AI provider (OpenAI, Anthropic, Google AI, etc.) โ๏ธ Set up steps ๐ Prerequisites ๐ค Telegram Bot Token (from @BotFather) ๐ AI API Key (from any AI service provider) ๐ n8n instance with webhook capability ๐ ๏ธ Configuration Steps ๐ค Create Telegram Bot Message @BotFather on Telegram Create new bot with /newbot command Save the bot token for credentials setup ๐ง Choose Your AI Provider OpenAI: Get API key from OpenAI platform Anthropic: Sign up for Claude API access Google AI: Get Gemini API key NVIDIA: Access LLaMA models Hugging Face: Use inference API Any other AI API service ๐ Set up Credentials in n8n Add Telegram API credentials with your bot token Add Bearer Auth/API Key credentials for your chosen AI service Test both connections ๐ Deploy Workflow Import the workflow JSON Customize the AI API call (see customization section) Activate the workflow Set webhook URL in Telegram bot settings โจ Features ๐ Core Functionality ๐จ Smart Message Routing**: Automatically categorizes incoming messages (commands, text, non-text) ๐ง Conversation Memory**: Maintains chat history for each user (last 10 messages) ๐ค AI-Powered Responses**: Integrates with any AI API service for intelligent replies โก Command Support**: Built-in /start and /clear commands ๐ฑ Message Types Handled ๐ฌ Text Messages**: Processed through AI model with context ๐ง Commands**: Special handling for bot commands โ Non-text Messages**: Polite error message for unsupported content ๐พ Memory Management ๐ค User-specific chat history storage ๐ Automatic history trimming (keeps last 10 messages) ๐ Global state management across workflow executions ๐ค Bot Commands /start ๐ฏ - Welcome message with bot introduction /clear ๐๏ธ - Clears conversation history for fresh start Regular text ๐ฌ - Processed by AI with conversation context ๐ง Technical Details ๐๏ธ Workflow Structure ๐ก Telegram Trigger - Receives all incoming messages ๐ Message Filtering - Routes messages based on type/content ๐พ History Management - Maintains conversation context ๐ง AI Processing - Generates intelligent responses ๐ค Response Delivery - Sends formatted replies back to user ๐ค AI API Integration (Customizable) Current Example (NVIDIA): Model: mistralai/mistral-nemotron Temperature: 0.6 (balanced creativity) Max tokens: 4096 Response limit: Under 200 words ๐ Easy to Replace with Any AI Service: OpenAI Example: { "model": "gpt-4", "messages": [...], "temperature": 0.7, "max_tokens": 1000 } Anthropic Claude Example: { "model": "claude-3-sonnet-20240229", "messages": [...], "max_tokens": 1000 } Google Gemini Example: { "contents": [...], "generationConfig": { "temperature": 0.7, "maxOutputTokens": 1000 } } ๐ก๏ธ Error Handling โ Non-text message detection and appropriate responses ๐ง API failure handling โ ๏ธ Invalid command processing ๐จ Customization Options ๐ค AI Provider Switching To use a different AI service, modify the "NVIDIA LLaMA Chat Model" node: ๐ Change the URL in HTTP Request node ๐ง Update the request body format in "Prepare API Request" node ๐ Update authentication method if needed ๐ Adjust response parsing in "Save AI Response to History" node ๐ง AI Behavior ๐ Modify system prompt in "Prepare API Request" node ๐ก๏ธ Adjust temperature and response parameters ๐ Change response length limits ๐ฏ Customize model-specific parameters ๐พ Memory Settings ๐ Adjust history length (currently 10 messages) ๐ค Modify user identification logic ๐๏ธ Customize data persistence approach ๐ญ Bot Personality ๐ Update welcome message content โ ๏ธ Customize error messages and responses โ Add new command handlers ๐ก Use Cases ๐ง Customer Support**: Automated first-line support with context awareness ๐ Educational Assistant**: Homework help and learning support ๐ฅ Personal AI Companion**: General conversation and assistance ๐ผ Business Assistant**: FAQ handling and information retrieval ๐ฌ AI API Testing**: Perfect template for testing different AI services ๐ Prototype Development**: Quick AI chatbot prototyping ๐ Notes ๐ Requires active n8n instance for webhook handling ๐ฐ AI API usage may have rate limits and costs (varies by provider) ๐พ Bot memory persists across workflow restarts ๐ฅ Supports multiple concurrent users with separate histories ๐ Template is provider-agnostic - easily switch between AI services ๐ ๏ธ Perfect starting point for any AI-powered Telegram bot project ๐ง Popular AI Services You Can Use | Provider | Model Examples | API Endpoint Style | |----------|---------------|-------------------| | ๐ข OpenAI | GPT-4, GPT-3.5 | https://api.openai.com/v1/chat/completions | | ๐ต Anthropic | Claude 3 Opus, Sonnet | https://api.anthropic.com/v1/messages | | ๐ด Google | Gemini Pro, Gemini Flash | https://generativelanguage.googleapis.com/v1beta/models/ | | ๐ก NVIDIA | LLaMA, Mistral | https://integrate.api.nvidia.com/v1/chat/completions | | ๐ Hugging Face | Various OSS models | https://api-inference.huggingface.co/models/ | | ๐ฃ Cohere | Command, Generate | https://api.cohere.ai/v1/generate | Simply replace the HTTP Request node configuration to switch providers!
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.