Quick overview
This workflow receives new leads via a webhook, uses Google Gemini (or optionally OpenAI or Anthropic Claude) to score and summarize the request and draft a reply, logs the lead in Google Sheets, emails you hot-lead alerts, and can automatically email the lead and follow up if needed.
How it works
- Receives a new lead as a POST request via an n8n webhook.
- Validates and normalizes the lead data (including optional header-based shared secret checking) and prepares business settings such as tone, thresholds, and follow-up timing.
- Routes the lead to the selected AI provider (Google Gemini by default, or OpenAI / Anthropic Claude if enabled) to generate a lead score, summary, and email draft.
- Combines the AI output with the lead data, categorizes the lead (hot/warm/cold), sets an initial status, and writes the record to a Google Sheets “Leads” tab.
- If the score meets the hot-lead threshold, sends an email alert to the owner with the lead details and the AI-drafted reply.
- If auto-reply is enabled, emails the drafted reply to the lead, updates the Google Sheets status to “replied,” waits the configured number of days, and sends a follow-up email if the sheet still shows the lead as “replied,” then updates the status to “followed_up.”
Setup
- Create and select credentials for your chosen AI provider: Google Gemini (PaLM/AI Studio API key) or, if you enable them, OpenAI API or Anthropic API credentials.
- Create a Google Sheet with a tab named “Leads” and the required header columns, then replace the placeholder spreadsheet ID in all Google Sheets steps.
- Configure an SMTP email credential and select it in the email steps for owner alerts, lead replies, and follow-ups.
- Update the business configuration values (company details, owner/sender emails, hot threshold, follow-up delay, and follow-up template) and keep auto-reply set to “no” until you are satisfied with the draft quality.
- Copy the webhook URL (test and production) into your form or lead source, and optionally set a webhook shared secret and send it in the x-webhook-secret header.
Requirements
- An n8n instance (cloud or self-hosted)
- A Google account with Google Sheets access
- An API key for one AI provider: Google Gemini (free tier available), OpenAI or Anthropic
- An SMTP email account for sending emails
- A form, website or CRM able to send a POST request
Customization
- Change the AI provider, model or temperature, or edit the system prompt to adapt the scoring rules and the reply style
- Adjust the hot-lead threshold, the follow-up delay in days and the follow-up email template
- Add columns to the Google Sheet or send the alerts to Slack or Telegram instead of email
- Set a webhook secret in the config and send it in the x-webhook-secret header to protect the endpoint
Additional info
The workflow starts in review mode: nothing is sent to leads until you set auto_reply to "yes". To stop a follow-up, change the lead's status in the sheet to "won" or "lost". Status values used are draft_pending, to_reply, replied and followed_up.