Score and route inbound web leads with OpenAI, Gmail and Google Sheets
Quick overview This workflow receives web form submissions via webhook, uses OpenAI to score and classify each lead, then emails hot leads through Gmail and logs them to separate Google Sheets tabs for hot versus cold review.
How it works Receives a POST webhook request containing lead details (name, email, company, role, message). Normalizes the incoming fields and adds a timestamp. Sends the lead details to OpenAI Chat Completions to return a JSON score (1–10), intent label, and one-sentence rationale. Parses and validates the AI JSON output and merges it back into the lead record. If the score is 7 or higher, sends a Gmail alert and appends the lead to the “Hot Leads” tab in Google Sheets. If the score is below 7, appends the lead to the “Cold Review” tab in Google Sheets. Responds to the webhook caller with a JSON payload including ok, score, and intent.
Setup Add an OpenAI API key (used via HTTP Header Auth) and ensure the Authorization header is set for requests to https://api.openai.com/v1/chat/completions. Connect a Gmail OAuth2 credential and set the recipient email (update the workflow variable alertInbox or replace the default you@example.com). Create a Google Sheet with two tabs named exactly “Hot Leads” and “Cold Review”, add the expected header columns, and replace REPLACE_WITH_YOUR_SHEET_ID in both Google Sheets nodes. Activate the workflow, copy the production webhook URL for the lead-qualifier endpoint, and configure your form tool to POST submissions to it as JSON.
Related Templates
AI Email Classifier & Auto-Delete for Gmail (SPAM/OFFER Cleaner)
This workflow is designed for freelancers, solopreneurs, and business owners who receive a high volume of irrelevant mes...
Automatic News Summarization & Email Digest with GPT-4, NewsAPI and Gmail
📰 AI News Digest Agent: Auto News Summarizer & Email Newsletter Create an intelligent news curation system that automat...
Generate Food Recipes from Gmail & Form Requests with Ollama & Llama 3.2
This n8n template demonstrates how to create an intelligent food recipe assistant that accepts requests via Gmail and we...
🔒 Please log in to import templates to n8n and favorite templates
Workflow Visualization
Loading...
Preparing workflow renderer
Comments (0)
Login to post comments