6 templates found
Category:
Author:
Sort:

Handling appointment leads and follow-up with Twilio, Cal.com and AI

This n8n workflow builds an appointment scheduling AI agent which can Take enquiries from prospective customers and help them book an appointment by checking appointment availability Where no appointment is booked, the Agent is able to send follow-up messages to re-engage leads. After an appointment is booked, the agent is able reschedule or even cancel the booking for the user without human intervention. For small outfits, this workflow could contribute the necessary "man-power" required to increase business sales. The sample Airtable can be found here: https://airtable.com/appO2nHiT9XPuGrjN/shroSFT2yjf87XAox 2024-10-22 Updated to Cal.com API v2. How it works The customer sends an enquiry via SMS to trigger our workflow. For this trigger, we'll use a Twilio webhook. The prospective or existing customer's number is logged in an Airtable Base which we'll be using to track all our enquries. Next, the message is sent to our AI Agent who can reply to the user and decide if an appointment booking can be made. The reply is made via SMS using Twilio. A scheduled trigger which runs every day, checks our chat logs for a list of prospective customers who have yet to book an appointment but still show interest. This list is sent to our AI Agent to formulate a personalised follow-up message to each lead and ask them if they want to continue with the booking. The follow-up interaction is logged so as to not to send too many messages to the customer. Requirements A Twilio account to receive customer messages. An Airtable account and Base to use as our datastore for enquiries. Cal.com account to use as our scheduling service. OpenAI account for our AI model. Customising this workflow Not using Airtable? Swap this out for your CRM of choice such as hubspot or your own service. Not using Cal.com? Swap this out for API-enabled services such as Acuity Scheduling or your own service.

JimleukBy Jimleuk
27828

Message buffer system with Redis for efficient processing

🚀 Message-Batching Buffer Workflow (n8n) This workflow implements a lightweight message-batching buffer using Redis for temporary storage and a JavaScript consolidation function to merge messages. It collects incoming user messages per session, waits for a configurable inactivity window or batch size threshold, consolidates buffered messages via custom code, then clears the buffer and returns the combined response—all without external LLM calls. --- 🔑 Key Features Redis-backed buffer queues incoming messages per context_id. Centralized Config Parameters node to adjust thresholds and timeouts in one place. Dynamic wait time based on message length (configurable minWords, waitLong, waitShort). Batch trigger fires on inactivity timeout or when buffer_count ≥ batchThreshold. Zero-cost consolidation via built-in JavaScript Function (consolidate buffer)—no GPT-4 or external API required. --- ⚙️ Setup Instructions Extract Session & Message Trigger: When chat message received (webhook) or When clicking ‘Test workflow’ (manual). Map inputs: set variables context_id and message into a Set node named Mock input data (for testing) or a proper mapping node in production. Config Parameters Add a Set node Config Parameters with: minWords: 3 Word threshold waitLong: 10 Timeout (s) for long messages waitShort: 20 Timeout (s) for short messages batchThreshold: 3 Messages to trigger batch early All downstream nodes reference these JSON values dynamically. Determine Wait Time Node: get wait seconds (Code) JS code: js const msg = $json.message || ''; const wordCount = msg.split(/\s+/).filter(w => w).length; const { minWords, waitLong, waitShort } = items[0].json; const waitSeconds = wordCount < minWords ? waitShort : waitLong; return [{ json: { contextid: $json.contextid, message: msg, waitSeconds } }]; Buffer Message in Redis Buffer messages: LPUSH bufferin:{{$json.contextid}} with payload {text, timestamp}. Set buffer\count increment: INCR buffercount:{{$json.context_id}} with TTL {{$json.waitSeconds + 60}}. Set last\seen: record lastseen:{{$json.context_id}} timestamp with same TTL. Check & Set Waiting Flag Get waiting\reply: if null, Set waiting\reply to true with TTL {{$json.waitSeconds}}; else exit. Wait for Inactivity WaitSeconds (webhook): pauses for {{$json.waitSeconds}} seconds before batch evaluation. Check Batch Trigger Get last\seen and Get buffer\count. IF (now - last_seen) ≥ waitSeconds 1000 OR buffer_count ≥ batchThreshold, proceed; else use Wait node to retry. Consolidate Buffer consolidate buffer (Code): js const j = items[0].json; const raw = Array.isArray(j.buffer) ? j.buffer : []; const buffer = raw.map(x => { try { return typeof x === 'string' ? JSON.parse(x) : x; } catch { return null; } }).filter(Boolean); buffer.sort((a, b) => new Date(a.timestamp) - new Date(b.timestamp)); const texts = buffer.map(e => e.text?.trim()).filter(Boolean); const unique = [...new Set(texts)]; const message = unique.join(' '); return [{ json: { contextid: j.contextid, message } }]; Cleanup & Respond Delete Redis keys: bufferin, buffercount, waitingreply, lastseen (for the context_id). Return consolidated message to the user via your chat integration. --- 🛠 Customization Guidance Adjust thresholds by editing the Config Parameters node. Change concatenation (e.g., line breaks) by modifying the join separator in the consolidation code. Add filters (e.g., ignore empty or system messages) inside the consolidation Function. Monitor performance: for very high volume, consider sharding Redis keys by date or user segments. --- © 2025 Innovatex • Automation & AI Solutions • innovatexiot.carrd.co • LinkedIn

Edisson GarciaBy Edisson Garcia
2050

Automate solar lead qualification & follow-ups with Google Sheets and Gmail

Automate Solar Lead Qualification & Follow-ups with Google Sheets and Gmail Note: This template is designed for both self-hosted and cloud-based n8n instances. The workflow image above shows the complete automation flow. This n8n workflow automates the entire solar lead qualification process - from capturing lead information through a webhook, storing data in Google Sheets, evaluating qualification criteria, and sending personalized email follow-ups based on qualification status. Who is this for? This workflow is designed for: Solar installation companies Solar sales teams Renewable energy consultants Lead generation specialists in the solar industry What problem does this workflow solve? Managing solar leads efficiently can be challenging. This workflow solves several key pain points: Time-consuming manual lead qualification: Automatically evaluates leads against predefined criteria Inconsistent follow-up: Ensures every lead receives a timely, personalized response Document management: Securely stores and shares utility bill documents Lead tracking inefficiency: Centralizes lead data in Google Sheets with qualification status What this workflow does This workflow creates a complete solar lead management system that: Captures lead information through a webhook endpoint Securely stores utility bill uploads in Google Drive Records all lead data in Google Sheets Automatically evaluates leads based on three qualification criteria: Homeownership status Credit score (must be 650+) Absence of trees on roof Updates qualification status in the Google Sheet Sends personalized email follow-ups based on qualification status: Qualified leads receive a congratulatory email with next steps Disqualified leads receive helpful information about why they didn't qualify and suggestions for remediation Setup Prerequisites Before setting up this workflow, you'll need: A self-hosted n8n instance Google account with access to: Google Sheets Google Drive Gmail A form on your website that can make POST requests to a webhook Step 1: Google Sheets Setup Create a new Google Sheet for storing leads Add the following columns in the first row (exact naming is important): Name Address Has Trees on Roof credit score phone Zip code Email Homeowner utility bill Qualification status Disqualification reason Step 2: Google Drive Setup Sign in to your Google Drive account Create a folder named "Solar Lead Utility Bills" (or your preferred name) Right-click on the folder and select "Share" Set permissions to "Anyone with the link can view" Note the folder ID from the URL for configuration (the long string after /folders/ in the URL) Step 3: Configure Google Credentials in n8n In your n8n instance, go to Settings → Credentials Add credentials for: Google Sheets: Create new credentials, follow OAuth2 authentication Google Drive: Create new credentials, follow OAuth2 authentication Gmail: Create new credentials, follow OAuth2 authentication Ensure all credentials have the necessary scopes: Google Sheets: .../auth/spreadsheets Google Drive: .../auth/drive Gmail: .../auth/gmail.send Step 4: Import and Configure the Workflow In n8n, go to Workflows → Import from File Upload the workflow JSON file Update all Google Sheets nodes with your Google Sheet document ID: Open your Google Sheet Copy the ID from the URL (long string between /d/ and /edit) Update the document ID field in the Google Sheets nodes In the "[STEP 2] Upload Utility Bill" node, set the folder destination to your created folder Step 5: Configure the Webhook Activate the "[STEP 1] Receive Form Submission" webhook node Copy the generated webhook URL Configure your website form to send data to this URL Ensure your form submits the following fields with exact naming: firstName lastName address hasTreesOnRoof creditScore phone zipCode email homeOwnership utilityBill (file upload) Step 6: Customize Email Templates Open the "[STEP 10A] Send Acceptance Email" node Customize the email subject and message to match your company's branding Open the "[STEP 10B] Send Rejection Email" node Customize the rejection email to reflect your company's voice Step 7: Activate and Test Click "Save" on the workflow Toggle the "Active" switch to activate the workflow Submit a test lead through your form Check that: The data appears in your Google Sheet The qualification status is updated correctly The appropriate email is sent How to customize this workflow to your needs Adjusting Qualification Criteria You can modify the qualification logic in the "[STEP 7] Check Qualification Criteria" node: Open the node and click the "Edit Code" button Locate the criteria sections (homeowner, credit score, trees on roof) Modify the conditions as needed: javascript // Example: Change credit score threshold if (creditScoreRaw.includes("600 - 649") || creditScoreRaw.includes("650 - 689") || creditScoreRaw.includes("690 - 719") || creditScoreRaw.includes("720+")) { creditQualified = true; } Add additional criteria if needed Customizing Email Templates Personalize your emails further: Open the email nodes Use variable references to include more customer data: Dear {{ $json.Name }}, We noticed your utility bill shows an average of {{ $json.monthlyBill }} per month. With solar, you could save approximately {{ $json.monthlySavings }}. Adding Integration with CRM Systems Extend this workflow by connecting it to your CRM: Add a Hubspot/Salesforce/etc. node after the "[STEP 8] Update Qualification Status" node Configure the node to create or update contacts in your CRM Map the lead data fields to your CRM fields Troubleshooting Common Issues Webhook not receiving data Verify your form is correctly configured to send POST requests Check CORS settings on your website Ensure all required fields are being sent Google Drive upload failing Check Google Drive permissions Verify your OAuth scopes include drive.file Ensure your Drive has sufficient storage space Email not sending Verify Gmail credentials Check if Gmail API is enabled in your Google Cloud Console Look for Send Rate Exceeded errors in execution logs Google Sheets Column Format If you're having issues with data not appearing correctly: Make sure the column names exactly match those in the code Check that the Google Sheet permissions allow editing Verify the sheet name is correctly referenced in the nodes Getting Help If you encounter issues with this template, you can: Check the n8n documentation on webhooks Review Google Sheets integration documentation Post in the n8n community forum This template was created by David Olusola. If you find it helpful, please consider giving it a star in the n8n template library!

David OlusolaBy David Olusola
868

Sales lead routing with Gemini Sentiment Analysis & Model Evaluation Framework

This n8n template demonstrates how to deploy an AI workflow in production while simultaneously running a robust, data-driven Evaluation Framework to ensure quality and optimize costs. Use Cases Model Comparison: Quickly A/B test different LLM models (e.g., Gemini 3 Pro vs. Flash Lite) for speed and cost efficiency against your specific task. Prompt Regression: Ensure that tweaks to your system prompt do not introduce new errors or lower the accuracy of your lead categorization. Production Safety: Guarantee that test runs never trigger real-world actions like sending emails to a client or sales team. Requirements A configured Gmail Trigger (or equivalent email trigger). A Google Gemini account for the LLM models. An n8n Data Table containing your "Golden Dataset" of test cases and ground truths. How it Works The workflow contains two distinct, parallel execution paths: Production Path: The Gmail Trigger monitors for new emails. The email text is routed through the Sentiment Analysis node, which categorizes the lead as Positive, Neutral, or Negative. Check if Evaluating nodes verify the current execution mode. If it is not an evaluation run (the Fail branch), the lead is routed to the corresponding Send Email node for action. Evaluation Path: The When fetching a dataset row trigger pulls test cases (input text and expected sentiment/ground truth) from an n8n Data Table. Each test case loops through the same Sentiment Analysis node. The Check if Evaluating nodes route this path to the Success branch, skipping the real email actions. The Save Output node writes the model's prediction to the Data Table. The Set Metrics node uses the Categorization metric to compare the prediction against the ground truth, returning a score (0 or 1) to measure accuracy. Key Technical Details Model Switching: Multiple Google Gemini Chat Model nodes are connected via the Model input on the Sentiment Analysis node, allowing you to easily swap and compare models without changing the core logic. Edge Case Handling: The System Prompt Template in the Sentiment Analysis node is customized to handle tricky inputs, such as negative feedback about a competitor that should be classified as a Positive lead. Metrics: The workflow uses the built-in Categorization metric, which is ideal for classification tasks like sentiment analysis, to provide objective evidence of performance.

Mihai FarcasBy Mihai Farcas
264

Generate sales reports from Google Sheets with Azure OpenAI and Telegram

Description: Transform your spreadsheet data into actionable intelligence with this smart n8n workflow template! This automation extracts sales, lead, and customer data from spreadsheets, analyzes it with Azure OpenAI, and delivers concise, prioritized summaries straight to your team’s Telegram—keeping everyone aligned without manual reporting. Perfect for sales teams, managers, and business owners, this workflow ensures that critical insights, performance trends, and lead recommendations are instantly available where your team communicates most. What This Template Does (Step-by-Step): 📂 Extract Spreadsheet Data Fetches customer, lead, and sales information from Google Sheets, Excel, or CSV files. 🧹 Prepare & Structure Data Cleans and formats entries for accurate AI analysis. 🤖 AI-Powered Insights with Azure OpenAI Analyzes sales and lead data to surface key metrics, trends, and per-lead recommendations. 📊 Generate Clear Summary Reports Compiles insights into a concise, easy-to-read digest for decision-making. 📲 Send Summaries to Telegram Instantly delivers formatted reports to your group or channel for real-time visibility. Perfect For: Sales teams tracking pipeline performance Managers monitoring KPIs and trends Business owners seeking actionable insights without manual reporting Teams needing instant updates on opportunities and next steps Built With: Spreadsheet integrations (Google Sheets, Excel, CSV) Azure OpenAI (AI-driven insights & recommendations) Telegram API (team-wide report delivery) n8n workflow logic (data preparation & formatting) Key Benefits: ✅ AI-driven sales insights without manual effort 🔍 Clear prioritization of leads and opportunities 🧠 Smarter, faster decision-making with real-time reports 📒 Centralized updates for full team visibility 🛠 100% no-code and fully customizable in n8n

Rahul JoshiBy Rahul Joshi
39

Identify competitor content gaps across ChatGPT, Perplexity & Gemini with SE Ranking

Who is this for Marketing teams tracking AI SEO performance Content strategists planning editorial calendars SEO teams doing competitive intelligence What this workflow does Identify content opportunities by analyzing where competitors outrank you in AI search and traditional SEO. What you'll get AI visibility gaps across ChatGPT, Perplexity, and Gemini Keyword gaps with search volume and difficulty Competitor backlink authority metrics Prioritized opportunities with HIGH/MEDIUM/LOW scoring Actionable recommendations for each gap How it works Fetches AI search visibility for your domain and competitor Compares metrics across ChatGPT, Perplexity, and Gemini Extracts competitor's top-performing prompts and keywords Analyzes competitor backlink authority Calculates opportunity scores and prioritizes gaps Exports ranked opportunities to Google Sheets Requirements Self-hosted n8n instance SE Ranking community node installed SE Ranking API token (Get one here) Google Sheets account (optional) Setup Install the SE Ranking community node Add your SE Ranking API credentials Update the Configuration node with your domain and competitor Connect Google Sheets for export (optional) Customization Change source for different regions (us, uk, de, fr, etc.) Adjust volume/difficulty thresholds in Code nodes Modify priority scoring weights

EugeneBy Eugene
38
All templates loaded