See llms.txt for all machine-readable content.

Back to Templates

Qualify inbound leads with OpenAI or Anthropic, Google Sheets, Slack and Gmail

Quick overview

Takes a website form webhook enquiry, checks required fields, scores the lead with AI (mock AI in dry-run mode, or your own OpenAI or Anthropic key), logs a row to Google Sheets, and can alert you in Slack and Gmail for hot leads. Dry-run and mock AI on.

How it works

  1. Receives a POST request on a webhook endpoint containing a lead form payload.
  2. Validates required fields, normalizes values (including parsing budget), silently accepts honeypot spam, and returns a 422 response for invalid submissions.
  3. Builds a prompt and sends the lead details to the selected AI provider (mock mode, OpenAI Chat Completions, or Anthropic Messages) to produce a JSON score, tier, summary, red flags, and suggested reply.
  4. Parses the AI response (or falls back to a rule-based score if the AI output is unusable) and flags leads that meet the hot threshold.
  5. Prepares a Google Sheets row with the lead details, AI results, and metadata, then either returns a dry-run plan or appends the row to the configured Google Sheets tab.
  6. If the lead is hot, posts an alert to the configured Slack channel and sends an email alert via Gmail, then responds to the original webhook request with a success JSON response.

Setup

  1. Configure your lead source to POST to the workflow webhook URL (test or production) and include fields like name, email, message, and an optional honeypot field named hp_field.
  2. Create a Google Sheet with a tab (for example, “Leads”) whose header row matches the columns expected by the workflow, then paste the Sheet ID and tab name into the Config node.
  3. Add Google Sheets credentials in n8n, and (optional) add Slack and Gmail credentials if you want hot-lead alerts.
  4. Choose your AI mode in Config (mock, openai, or anthropic) and add the corresponding OpenAI or Anthropic credentials if not using mock.
  5. Update alert destinations in Config (Slack channel name and alert email), then set dry_run to false when you are ready to write to Google Sheets and send alerts.