by Tony Adijah
Who is this for This workflow is built for professionals, founders, freelancers, and anyone drowning in email who wants to automatically triage their inbox using AI — sorting emails into categories, applying Gmail labels, and generating reply drafts for important messages, all running locally with Ollama (zero paid API costs). What this workflow does It watches your Gmail inbox for new unread emails, uses a local AI model (Ollama) to classify each email into one of six categories (Urgent, Action Required, Follow-up, Newsletter, Automated, or Spam/Promotional), automatically applies the matching Gmail label, generates reply drafts for high-priority emails, and logs every processed email to Google Sheets for analytics. How it works Gmail Trigger watches your inbox for new unread emails at a configurable interval (default: every 30 minutes). Extract Email Data parses the sender, subject, body, attachments, and metadata into clean fields — handles all Gmail node output formats. AI Classifier (Ollama, running locally) analyzes the email content and returns a structured classification with category, priority, confidence score, summary, suggested action, sentiment, and a reply draft for important messages. Extract Classification robustly parses the AI response (handles markdown fences, nested objects, and edge cases) and merges it with email metadata. Smart Router sends each email down one of six dedicated paths based on its classification. Gmail Label nodes automatically apply the correct label to each email in your inbox. Reply Draft nodes create Gmail drafts for Urgent and Action Required emails — ready for you to review, edit, and send from your Drafts folder. Log Entry tracks every processed email in Google Sheets with category, priority, confidence, summary, and timestamp for analytics and review. Setup steps Gmail OAuth — Connect your Google account. Grant read, modify, and compose permissions. Create Gmail Labels — In Gmail, manually create these labels (the workflow applies them automatically): 🔴 Urgent 📋 Action Required 💬 Follow-up 📰 Newsletter 🤖 Automated 🚫 Spam-Promo Get Label IDs — Use the Gmail API or n8n's Gmail node (operation: "Get Many Labels") to find each label's ID. Update the labelIds in each Gmail Label node with your actual IDs. Ollama — Ensure Ollama is running locally (http://localhost:11434) with your preferred model pulled (e.g., ollama pull mistral). Change the model name in the Ollama Chat Model node if needed. Google Sheets (optional) — Connect your Google Sheets OAuth credential and set a spreadsheet ID in the logging node. Create a sheet with columns: Date, From, Subject, Category, Priority, Confidence, Reason, Summary, Key Action, Has Reply Draft, Sentiment, Auto Archive, Gmail ID, Processed At. Test — Send yourself a few test emails (urgent request, newsletter, promotional) and run the workflow manually to verify classification accuracy. Requirements Gmail account with OAuth credentials (read, modify, compose permissions) Ollama running locally with a pulled model (mistral, llama3, gemma2, etc.) Google Sheets account with OAuth credentials (optional, for logging) n8n instance (self-hosted recommended for Ollama connectivity) How to customize Swap mistral for llama3, gemma2, deepseek, or any Ollama-compatible model. Add more categories by editing the AI system prompt and adding outputs to the Switch node. Change the reply draft tone (formal, casual, friendly) in the AI system prompt. Add Slack or Telegram notifications for urgent emails by branching from the Label nodes. Add auto-archive for newsletters and spam by adding a Gmail "Remove Labels" node (remove INBOX label). Decrease the polling interval for near-real-time processing. Add sender whitelist/blacklist logic in a Code node before the AI classifier.
by Milan Vasarhelyi - SmoothWork
Video Introduction Want to automate your inbox or need a custom workflow? 📞 Book a Call | 💬 DM me on Linkedin What This Workflow Does This automation eliminates the tedious task of manually entering receipt data by automatically processing receipt images uploaded to Google Drive. When you drop a new receipt into a monitored folder, the workflow extracts vendor name, date, itemized purchases, and total amount using AI, logs everything to a Google Sheet, and sends you an email confirmation with a formatted summary. Key Benefits Save time:** No more manual data entry from receipts Reduce errors:** AI-powered extraction ensures accuracy Stay organized:** All expense data automatically tracked in one spreadsheet Get notified:** Instant email confirmation when receipts are processed Common Use Cases Personal expense tracking and budgeting Small business accounting and bookkeeping Reimbursement documentation Tax preparation record-keeping Setup Requirements Accounts needed: Google Drive account (for receipt storage) OpenAI account (for AI-powered data extraction) Google Sheets account (for data logging) Gmail account (for notifications) Configuration steps: Google Drive: Connect your account and select the folder where you'll upload receipts Google Sheets: Make a copy of the template spreadsheet (link in workflow notes) to your own account and update the Sheet ID in the workflow Email recipient: Change the notification email address to your own AI model: The workflow uses GPT-4-mini by default, but you can select a different OpenAI model based on your accuracy and cost preferences The AI Agent is configured to extract data in a strict JSON format with fields for vendor, date (converted to DD/MM/YYYY), itemized purchases, and total amount.
by Veena Pandian
Who is this for? E-commerce store owners, product managers, marketplace sellers, and pricing analysts who want to automatically track competitor pricing and get actionable alerts when their products are overpriced or underpriced relative to the market. What this workflow does This workflow runs daily to compare your product prices against live competitor prices from Google Shopping. It identifies pricing gaps, calculates suggested prices that protect your margins, sends instant Slack alerts for critical issues, logs everything to a historical price tracking sheet, and delivers a comprehensive daily summary via Slack and email. How it works Daily trigger fires on a configurable schedule (default: every 24 hours). Reads your product catalog from a Google Sheet — auto-detects column names regardless of naming convention. Searches Google Shopping for each product using SearchAPI to find real-time competitor prices. Analyzes the pricing gap — compares your price to the market average and classifies each product as UNDERPRICED, SLIGHTLY_UNDER, COMPETITIVE, SLIGHTLY_OVER, or OVERPRICED. Suggests optimal prices based on market averages while maintaining a minimum margin above your cost. Sends instant Slack alerts when a product hits critical or warning thresholds. Logs all results to a price_log tab in your Google Sheet for trend analysis. Sends a daily summary via Slack message and HTML email with a full breakdown of all products. Setup steps Create a Google Sheet with a products tab containing columns: product_name, my_price (required), and optionally sku, my_cost. Add a second tab called price_log with headers: date, product_name, sku, my_price, my_cost, margin_now, competitor_lowest, competitor_average, competitor_highest, competitor_count, gap_pct, signal, suggested_price, action. Get a SearchAPI key from searchapi.io and set it as the n8n environment variable SEARCHAPI_KEY. Connect Google Sheets OAuth2 credentials and update the sheet ID in both Sheets nodes. Connect Slack OAuth2 credentials and configure your alert channel. Connect Gmail OAuth2 credentials and update the recipient email address. Requirements n8n instance (self-hosted or cloud) SearchAPI.io account and API key Google Cloud project with Sheets API enabled Slack workspace with a bot configured Gmail account with OAuth2 credentials How to customize Pricing thresholds** — Adjust the 0.85, 0.95, 1.05, 1.15 multipliers in the "Analyze Pricing Gap" node to change sensitivity. Minimum margin** — Change the 1.15 cost multiplier to set your floor margin (default: 15%). Schedule** — Modify the trigger interval for more or less frequent checks. Notifications** — Replace or add Slack/email with Telegram, Discord, Microsoft Teams, or webhooks. Region** — Change the gl parameter in the search node from us to your target market country code.
by WeblineIndia
(Retail) Customer Cleanup API → Supabase and send Notification This workflow provides an API-first solution to validate, clean, deduplicate and store customer data in Supabase. It ensures consistent customer records, prevents duplicates and keeps both internal teams and customers informed through automated notifications. This workflow acts as a backend customer intake API. It validates and normalizes incoming customer data, checks for existing users in Supabase, stores new customers safely and returns clear API responses. Internal teams receive Slack and Telegram updates, while customers get an email confirmation on successful creation. You receive: Centralized customer data validation** Automatic duplicate prevention** Supabase-backed customer storage** Real-time API responses** Team notifications + user confirmation email** Ideal for retail, e-commerce and SaaS teams that want clean customer data without manual intervention. Quick Start – Implementation Steps Import the provided n8n workflow JSON. Configure Supabase credentials with read/write access. Connect Slack, Telegram and Gmail/SMTP credentials. Copy the Webhook URL and use it as your customer intake API. Activate the workflow — your customer API is live. What It Does This workflow automates customer data intake and processing: Receives customer data via a POST API call. Cleans and normalizes names, email and phone numbers. Validates required fields and formats using JavaScript. Aggregates clear, field-specific validation errors. Checks Supabase to prevent duplicate users. Stores valid, new customers in Supabase. Returns structured API responses (success, validation error or duplicate). Sends notifications to Slack and Telegram. Emails the customer after successful account creation. This ensures reliable, consistent customer records across systems. Who’s It For This workflow is ideal for: Retail and e-commerce platforms CRM and customer data teams SaaS product teams Backend automation teams Marketing teams needing clean contact lists Developers building API-driven systems Requirements to Use This Workflow To run this workflow, you need: n8n instance** (cloud or self-hosted) Supabase project** with a customers table Supabase service role key Slack workspace** with API access Telegram bot** + chat ID Gmail or SMTP account** for user notifications How It Works API Request – Client sends customer data to the webhook endpoint. Validation & Cleanup – JavaScript validates and formats data. Validation Fail – Returns 400 response with clear error messages. Duplicate Check – Supabase is queried using the email address. Duplicate Found – Returns 409 response without creating a record. Create Customer – New customer is saved in Supabase. Success Response – API confirms successful creation. Notifications – Slack, Telegram and customer email are triggered. Setup Steps Create a Supabase table with fields for customer data, validation status and errors. Add Supabase credentials to n8n. Import the workflow JSON into n8n. Configure the Webhook node and copy the API URL. Review the validation logic if custom rules are required. Configure Slack, Telegram and email credentials. Test using Postman for invalid, duplicate and valid requests. Activate the workflow. How To Customize Nodes Customize Validation Rules Update the JavaScript validation node to add country-specific phone rules or additional fields. Customize Duplicate Logic Extend duplicate checks to include phone numbers or other identifiers. Customize Notifications Modify Slack and Telegram messages, add emojis, mentions or execution metadata. Add-Ons (Optional Enhancements) You can extend this workflow to: Add API key authentication Enable rate limiting Log failed attempts separately Support multi-country phone validation Add CRM or email marketing sync Implement soft deletes or upserts Use Case Examples 1. Customer Registration API Centralize customer creation for web and mobile apps. 2. Data Hygiene Automation Prevent invalid or duplicate contacts in your database. 3. Retail & CRM Integration Keep customer records consistent across systems. 4. Marketing Readiness Ensure only clean, valid contacts enter campaigns. Troubleshooting Guide | Issue | Possible Cause | Solution | | ----------------------- | ----------------------------- | ----------------------------------- | | Validation always fails | Incorrect payload structure | Ensure data is sent in request body | | Duplicate user created | Duplicate check misconfigured | Verify Supabase filter conditions | | No Slack alert | Invalid credentials | Reconnect Slack API | | No email sent | Gmail/SMTP not configured | Verify sender account | | API not responding | Webhook not active | Activate the workflow | Need Help? If you need help customizing or extending this workflow, adding authentication, scaling for high traffic, integrating CRMs or enhancing validation, the n8n automation team at WeblineIndia can assist you with production-ready automation and integration support. Contact us today.
by Cheng Siong Chin
How It Works This workflow automates end-to-end recruitment operations for HR teams, talent acquisition specialists, and hiring managers facing high-volume candidate processing challenges. It solves the critical problem of manual interview coordination, inconsistent candidate evaluation, and scattered assessment data across multiple platforms.The system orchestrates a seamless pipeline: triggers initiate workflow execution, configuration nodes prepare analytics parameters, and Former Analytics Agent structures the evaluation framework. The Orchestration Agent intelligently routes candidates through specialized AI assessment modules—including sourcing verification, simulated interviews, and competency evaluation—each powered by different AI models (OpenAI GPT-4, Claude) optimized for specific assessment criteria. Consolidated insights automatically populate Google Sheets for centralized tracking, while Gmail notifications keep stakeholders informed. Critical alerts route to HR teams via Slack integration, ensuring immediate visibility into high-priority candidates and assessment bottlenecks, dramatically reducing time-to-hire while improving evaluation consistency. Setup Steps Configure OpenAI API key for GPT-4 powered candidate sourcing and interview agents Link Anthropic Claude API for competency assessment modules Authorize Google Sheets access and specify target spreadsheet/worksheet for candidate data Set up Gmail integration with sender email and recipient distribution lists Connect Slack workspace and configure target channel for priority notifications Customize assessment criteria in Former Analytics Agent node based on role requirements Prerequisites Developer account with API access, OpenAI API key (GPT-4 enabled) Use Cases High-volume technical recruitment campaigns requiring standardized assessment frameworks Customization Modify AI agent prompts to align with specific role competencies Benefits Reduces time-to-hire by 60% through parallel AI assessments
by Łukasz
Overdue Invoice Payment Reminder Workflow Documentation What Is This? This workflow is an automated invoice payment tracking and reminder system for the Polish accounting service iFirma.pl. It monitors unpaid and overdue invoices, then automatically sends escalating reminders to contractors based on configurable time thresholds. The system handles three escalation levels: payment reminders before/at due date, pre-trial summons, and formal legal action notices. Who Is It For? Designed for Polish businesses, accounting departments, and financial controllers using iFirma.pl for invoice management. This workflow is essential for companies struggling with late payments and cash flow management, particularly those needing to enforce payment terms professionally and systematically. B2B service providers, consultancies, software development agencies, and any business issuing invoices to other companies will benefit from automated payment enforcement. The workflow eliminates manual tracking of payment deadlines and ensures consistent, professional follow-up with delinquent clients. Whether managing a handful of high-value invoices or processing hundreds of transactions monthly, this automation delivers timely notifications without manual calendar monitoring or spreadsheet management. How Does It Work? This end-to-end invoice monitoring automation consists of four main stages: 1. Configuration & Authentication Sets up user credentials (email/login, API key), defines escalation timeframes (X days before due date, Y days after, Z days after), and prepares company details for legal correspondence. The workflow then constructs a cryptographic authentication signature using HMAC-SHA1 algorithm, which iFirma requires for API access. 2. Invoice Retrieval & Filtering Connects to iFirma API to fetch all unpaid, partially paid, and overdue invoices, then filters them based on payment deadline dates. Only invoices that are either overdue or approaching their due date (within X days) proceed to the next stage. 3. Contractor Data Enrichment For each qualifying invoice, the workflow fetches complete contractor information from iFirma (since invoice records contain only partial contractor data). This includes email addresses, company names, and addresses needed for sending reminders. The workflow deduplicates contractors to avoid redundant API calls. 4. Escalation Logic & Notification Dispatch Invoices are categorized into three groups based on how overdue they are: Payment Reminder**: Due today or X days before due date → Sends reminder via iFirma's built-in notification system Pre-Trial Summons**: Y days after due date → Sends formal legal warning via email and optionally physical mail (PostGrid) Legal Action Notice**: Z days after due date → Sends notice of commenced legal proceedings via email and optionally physical mail Each action triggers a Slack notification to keep your team informed. How To Set It Up? Prerequisites: An active N8N account or self-hosted instance An iFirma.pl account with API access enabled A Slack workspace with appropriate bot permissions (Optional) PostGrid account for physical mail delivery (Optional) Gmail account configured for sending emails Required Configuration: In the "Configuration" node, set the following parameters: Email/Login: Your iFirma.pl account email or login username API Key Invoice: API key from iFirma.pl (found at: Start > Data and Configuration > Extensions and Integrations > API) X days before due date: How many days before payment deadline to send the first reminder (default: 7) Y days after due date: When to send pre-trial summons (default: 7 days overdue) Z days after due date: When to send legal action notice (default: 14 days overdue) Your Company Details Configuration: In the "Your Company Details" node, provide: Company Name, Email, Phone Full address (Street, City, Postal Code, Country Code) Bank details (Bank Name, Account Number, SWIFT Code) Tax Identification Number (TIN/NIP) This information is used for professional letterheads in legal correspondence and PostGrid physical mail delivery. Credentials Setup: Configure Slack OAuth2 credentials for notifications Set up Gmail OAuth2 credentials for email sending (if using email route) Configure PostGrid API credentials for physical letter delivery (if using mail route) Scheduling: The workflow runs automatically every 24 hours via the Schedule Trigger node. For testing, execute manually using the "Execute workflow" button. What's More? Custom Authentication Implementation: iFirma.pl requires HMAC-SHA1 authentication, which N8N doesn't provide natively. The workflow includes a complete JavaScript implementation of the SHA-1 cryptographic hash function and HMAC (Hash-based Message Authentication Code) algorithm. This ensures secure API access without external dependencies. Endpoint Mapping Intelligence: The workflow automatically maps invoice types (Rodzaj) to the correct iFirma API endpoints. Different invoice types (domestic, foreign, construction, advance payments, etc.) require different API paths for sending reminders. Professional HTML Templates: Pre-trial summons and legal action notices use professionally formatted HTML templates with proper legal language, payment details, deadlines, and consequences clearly outlined. These templates maintain consistent branding and meet legal communication standards. Multi-Channel Notification: Reminders can be sent via multiple channels simultaneously: iFirma's e-invoice system, email, physical mail (PostGrid), and internal Slack notifications for team awareness. Understanding the HMAC-SHA1 Authentication The "Encode API Key" nodes implement a critical security function that N8N cannot perform natively. Here's what happens and why: What the iFirma API Requires: iFirma.pl uses HMAC-SHA1 for request authentication. Each API request must include an Authentication header formatted as: IAPIS user={userLogin}, hmac-sha1={hash} The hash is calculated from: URL + userLogin + keyName + requestBody Why Custom Implementation is Needed: N8N's crypto functions don't include SHA-1 (it's considered outdated for modern security, though still required by some legacy APIs). Therefore, the workflow implements the entire SHA-1 and HMAC algorithms in pure JavaScript. How the Algorithm Works: Message Construction: Combines the API endpoint URL, user login, key name ("faktura"), and request body (if any) into a single string Hex Key Conversion: The API key from iFirma is provided in hexadecimal format and must be converted to raw bytes HMAC Process: Creates inner and outer padding arrays using XOR operations with specific constants (0x36 and 0x5C) Hashes the inner padded message using SHA-1 Hashes the outer padding combined with the inner hash result SHA-1 Implementation: Uses bitwise operations, rotating functions, and four rounds of 20 operations each to produce a 160-bit hash Header Generation: Formats the final hash as a hex string and constructs the authentication header Why Each Step Matters: Deterministic Hashing**: The same input always produces the same hash, allowing iFirma to verify request authenticity Binary Key Conversion**: The hex-to-bytes conversion ensures the secret key is interpreted correctly HMAC Security**: Using both inner and outer hashing with different padding prevents length extension attacks Message Integrity**: Including the URL and request body in the hash ensures the request hasn't been tampered with Thank You, Perfect! Visit my profile for other free business automations. And if you're looking for dedicated software development or custom n8n workflow solutions, don't hesitate to reach out at developers@sailingbyte.com or on sailingbyte.com!
by Abdallah Hussein
Who this template is for This template is designed for n8n users running workflows in production who need reliable and structured error monitoring, not just basic alerts. It’s especially useful for: Automation engineers and developers Teams running business-critical workflows Anyone who wants smarter alerting with reduced noise What this workflow does This workflow acts as a global, severity-based error monitoring system for n8n. When a linked workflow fails, it automatically: Classifies the error by severity (Critical, High, Normal) Routes alerts based on severity level Sends notifications via Telegram and Email Logs critical errors for auditing and troubleshooting This ensures important issues are escalated properly, while avoiding unnecessary alert fatigue. How it works An Error Trigger captures execution failures from linked workflows. A Code node analyzes the error and assigns a severity level. Alerts are routed based on severity: 🔴 Critical → Email + Telegram + Logging 🟠 High → Telegram alert 🟡 Normal → Telegram alert All alerts include rich context such as workflow name, failed node, execution time, and execution URL. The workflow only runs when an error occurs. How to set up Configure the required credentials (Telegram, Email, optional Google Sheets). Replace placeholder values such as: YOUR_TELEGRAM_CHAT_ID YOUR_ALERT_EMAIL Activate this workflow. Open any workflow you want to monitor. In Workflow Settings, set Error Workflow to this workflow. Save and test by triggering an error. Requirements An active n8n instance (cloud or self-hosted) Telegram Bot credentials Email credentials (for critical alerts) Optional: Google Sheets credentials for logging How to customize the workflow You can extend this workflow by: Adding more alert channels (Slack, Discord, etc.) Adjusting severity classification logic Implementing rate-limiting or noise reduction Logging errors to databases or external monitoring tools Detailed instructions and explanations are included inside the workflow using sticky notes.
by V3 Code Studio
🚀 Never miss a new lead again — get instant email alerts and stay ahead of every opportunity! This workflow automatically notifies your team the moment a new lead is created in your CRM or form submission. It keeps your sales, marketing, and support teams aligned — so no lead goes unnoticed, and every customer feels heard right away. ✨ How it works ✅ Capture: A webhook receives new lead data from your CRM or online form. 🧩 Clean: The workflow filters and formats the data for clear presentation. 💌 Compose: Generates a beautiful HTML email with your branding and lead details. 📨 Send: Instantly emails your team or the lead using Gmail or SMTP. ⚡ React Fast: Your team gets notified in seconds — no manual checks needed! ⚙️ Set up steps 🔗 Add a POST webhook in your CRM or app that points to your n8n webhook URL. 🏢 Update your company info (logo, name, website) in the configuration node. 📧 Connect Gmail OAuth2 or your SMTP credentials to send branded emails instantly. Compatible with Odoo, HubSpot, Zoho CRM, Salesforce, Pipedrive, Typeform, and any system that supports outgoing webhooks.
by Hirokazu Kawamoto
How it works This workflow is triggered when the contact form is submitted. It automatically saves the inquiry details to Google Sheets and sends a notification to Slack. You can then review the inquiry and reply directly from Slack using the Contact button. How to use Open the Gmail node and set up the Credential. Open the Google Sheets node and set up the Credential. Open the Slack node and set up the Credential to allow sending messages. You can create a new Slack App here. Open the ContactWebhook node and configure Basic Auth. Open the Config node and update the contactWebhookUrl parameter to match the Production URL from the ContactWebhook node. Customizing this workflow You can customize the Slack notification message in the Config node. You can modify the reply email body in the Gmail node. We recommend including a scheduling link (e.g., to book a meeting).
by Yaron Been
Monitor customers for competitor tech adoption via PredictLeads and alert CSMs to prevent churn. This workflow uses PredictLeads to monitor existing customers for competitor tool adoption (HubSpot, Salesforce, Zoho CRM) and renewal timing risk, then alerts Customer Success Managers so they can take proactive action before customers churn. How it works Schedule trigger runs weekly and loads customer domains from Google Sheets Fetches each customer's full tech stack via PredictLeads Technology Detections API Looks up technology details by ID in PredictLeads to identify competitor tools Detects if customer adopted competitor tools (HubSpot, Salesforce, Zoho CRM) Calculates days until renewal and flags high-risk accounts (competitor detected + within 90 days) Sends churn risk alert email to the assigned CSM Setup Create Google Sheet with columns: company_domain, renewal_date, csm_email Connect Gmail OAuth2 for CSM alert emails Connect Slack OAuth2 for team notifications (optional) Add PredictLeads API credentials (X-Api-Key and X-Api-Token headers) Requirements PredictLeads API account (https://docs.predictleads.com) Google Sheets OAuth2 credentials Gmail OAuth2 credentials Slack OAuth2 credentials (optional) Customization Adjust competitor list in "Detect Competitor Usage" Code node Modify 90-day renewal window threshold in "Calculate Renewal Risk" node Change notification channel from Slack to another platform if needed
by Salman Mehboob
Never miss a lead from your Instagram ads again. This workflow automatically monitors every comment on your Instagram ad posts in real time, classifies the comment using AI, and takes the right action instantly — whether that is replying with accurate information from your knowledge base, thanking a happy customer, or alerting your team about a negative review that needs human attention. Built for agencies, service businesses, and ecommerce brands running Instagram ad campaigns who are losing potential clients because comments go unanswered for hours — or worse, never get a reply at all. The Problem This Solves When you run Instagram ads, your comment section becomes your most active sales channel. Potential customers ask about pricing, timelines, and services directly in the comments. Happy customers leave reviews. Unhappy ones post complaints. Competitors spam your section with their own links. Managing all of this manually is impossible at scale: Comments come in at 2am when your team is offline A single active ad can receive hundreds of comments per day Slow replies mean lost leads — potential clients move on to competitors who respond faster Inconsistent replies from different team members destroy brand voice Negative comments that go unanswered damage ad performance and brand reputation Spam comments clutter your section and reduce trust from real prospects This workflow solves every one of these problems automatically. How It Works Step 1 — Real-Time Instagram Webhook Trigger The workflow fires the instant someone comments on your Instagram ad post. No polling. No delays. The comment is received within seconds via the Meta Graph API webhook, giving you a response time advantage that manual management can never match. Step 2 — Smart Filter Before any processing happens, the workflow checks three things: The comment field is confirmed as a real comment (not a like or post update) The comment is not from your own account (prevents reply loops) The post is an ad post (media_product_type = AD) This ensures only relevant, genuine comments from real users trigger the workflow. Step 3 — Fetch Full Comment Details The workflow calls the Instagram Graph API to retrieve the full comment data including the commenter username, exact comment text, and comment ID needed for replying. Step 4 — Fetch Ad Post Content The workflow fetches the caption and details of the ad post the comment was left on. This is critical context for the AI — it needs to understand what is being advertised before it can classify or answer the comment accurately. Step 5 — Clean and Normalize Data All extracted data is normalized into clean variables: post text, post permalink, comment text, comment ID, and commenter username. This makes all downstream nodes simple and reliable. Step 6 — AI Comment Classifier An AI agent powered by OpenRouter (GPT-4o) reads both the post caption and the comment together and classifies the comment into one of four categories: QUERY** — The person is asking about the service, price, timeline, or process POSITIVE_REVIEW** — The person is expressing satisfaction or giving a compliment NEGATIVE_REVIEW** — The person is complaining, expressing frustration, or calling the service fake SPAM** — The comment is irrelevant, promotional, or from a bot The classifier also returns a confidence level: HIGH, MEDIUM, or LOW. This structured output is enforced via a JSON output parser ensuring 100% reliable downstream routing. Step 7 — Switch Node Routes to the Right Branch Based on the classification the workflow splits into four paths: QUERY Branch: The AI reply agent searches your Google Docs knowledge base for the answer. If found it writes a clear, helpful, human-sounding public reply that answers the question and ends with a soft call to action. If the answer is not in the knowledge base it redirects the user to your DM or WhatsApp without making up information. The reply is posted directly to Instagram via the Graph API. POSITIVE_REVIEW Branch: The AI reply agent writes a warm, genuine thank-you reply without consulting the knowledge base. It keeps it short, sounds human, and subtly encourages others to try the service. The reply is posted directly to Instagram via the Graph API. NEGATIVE_REVIEW Branch: No auto reply is posted. Instead a detailed Slack alert is sent immediately to your team with the commenter username, the full comment text, and a prompt to handle it manually. Negative comments require human judgment and empathy — this workflow keeps humans in control of the most sensitive interactions. SPAM Branch: No action taken. The comment is ignored completely. No reply, no alert, no wasted API calls. What Makes This Workflow Unique Most Instagram comment automation tools either reply to everything with the same canned message, or require expensive third-party subscriptions like ManyChat or Spur. This workflow does something none of them do: Two-context AI classification** — the classifier reads both the post content AND the comment together, not just the comment in isolation. This produces dramatically more accurate classifications, especially for short or ambiguous comments Knowledge base powered replies** — answers come from your actual business document, not hallucinated AI responses. When information is not available the AI redirects to your team rather than guessing Confidence-based routing** — the classifier flags low confidence cases so you can add human review for uncertain classifications Negative review human handoff** — negative comments are never auto-replied to. Your team gets instant Slack alerts with full context to handle reputation-sensitive situations personally Free to run** — uses your own OpenRouter API key and Meta Graph API. No third-party subscription required Requirements Instagram Business Account connected to a Facebook Page Meta Developer App with webhooks configured for Instagram comments System User token from Meta Business Portfolio with instagram_basic and pages_read_engagement permissions n8n instance (self-hosted or cloud) with the webhook URL registered in Meta Developer Dashboard OpenRouter API key (supports GPT-4o, Gemini, Claude, and 200+ other models) Google Docs OAuth2 credentials with a knowledge base document prepared Slack API credentials with a channel configured for negative review alerts ngrok or a public HTTPS URL if running n8n locally Setup Steps Create your Meta Developer App and configure Instagram webhooks pointing to your n8n webhook URL Subscribe your Instagram Business Account to the app using the Facebook Page subscribed_apps endpoint Generate a System User token in Meta Business Portfolio with the required permissions Create your knowledge base as a Google Doc with your services, prices, FAQs and contact information Add your OpenRouter API key to n8n credentials Connect your Google Docs OAuth2 account and update the document ID in the Knowledge Base tool node Connect your Slack account and update the channel or user ID in the Inform User node Update the filter condition with your Instagram username to prevent reply loops Activate the workflow and test by commenting on one of your Instagram ad posts Customization Options Change the AI model** — swap GPT-4o for any OpenRouter model including Claude, Gemini Flash, or Mistral to control cost Extend the knowledge base** — add product FAQs, testimonials, pricing tables, or process explanations to improve answer quality Add Instagram DM** — extend the QUERY branch to also send a private DM with your WhatsApp link or service proposal alongside the public reply Add Telegram alerts** — replace or complement Slack with Telegram notifications for negative reviews Extend to Facebook** — the classifier and reply logic works identically for Facebook page comments. Add a second webhook trigger for Facebook and merge both into the same classification flow Add confidence gating** — route LOW confidence classifications to a Slack approval queue before posting any reply Localization** — the system prompt handles Urdu, English, and mixed language automatically. Extend to any other language by adding examples to the classifier prompt Use Cases SEO and digital marketing agencies** managing multiple client Instagram accounts and ad campaigns Service businesses** running Instagram ads for consulting, coaching, legal, medical, or educational services Ecommerce brands** receiving high volumes of product questions on sponsored posts Real estate agencies** handling inquiries on property listing ads Any business** that spends money on Instagram ads and cannot afford to let leads go cold in the comment section Nodes Used Webhook — Instagram comment trigger Filter — comment validation and ad post check HTTP Request — Instagram Graph API for comment details and ad post content IF — comment text existence check Set — data normalization AI Agent (LangChain) — comment classifier with structured output AI Agent (LangChain) — comment reply generator Structured Output Parser — enforces JSON classification output OpenRouter Chat Model — powers both AI agents Google Docs Tool — knowledge base retrieval Switch — routes to correct branch based on classification HTTP Request — posts reply to Instagram via Graph API Slack — sends negative review alert to team Built with Meta Graph API v25.0 and OpenRouter. Tested on Instagram Business accounts connected via Facebook Business Portfolio System Users. 📩 Support & Contact 📧 Email: salmanmehboob1947@gmail.com 💼 LinkedIn: Salman Mehboob
by Cheng Siong Chin
How It Works This workflow automates competitive real estate pricing analysis by combining multiple MLS data sources with AI-powered market intelligence. Designed for real estate professionals, property managers, and investment analysts, it solves the critical challenge of identifying underpriced properties in competitive markets where manual analysis is time-consuming and prone to oversight. The system fetches listings from multiple MLS platforms, consolidates market data, and deploys specialized AI agents for dual-layer analysis. The Pricing Agent evaluates individual property valuations against market comparables, while the Market Research Agent provides broader market context and trend insights. When underpriced opportunities are detected, automated alerts are dispatched via email and Slack, enabling rapid response to market opportunities. Operating on a daily schedule, this workflow transforms hours of manual research into automated intelligence delivery. Setup Steps Configure MLS API credentials in "Fetch MLS Data" and "Fetch Recent Sales Data" nodes Add OpenAI API key in "OpenAI Model - Pricing Agent" Set Gmail SMTP credentials in "Send Underpriced Alert Email" node with recipient addresses Configure Slack webhook URL in "Send Slack Alert" node for channel notifications Adjust "Daily Pricing Update Schedule" cron expression for preferred execution time Prerequisites OpenAI API account with GPT-4 access, MLS data provider API credentials Use Cases Investment firms identifying acquisition targets, real estate brokerages monitoring competitive listings Customization Modify AI agent prompts for specific property types, adjust underpricing threshold percentages Benefits Reduces manual research time by 90%, eliminates human bias in valuation analysis