Skip to content
NEWError doctor and Watchtower: failed n8n runs explained in plain words, and emailed to you. See what is new

Library / Data Sync & ETL

Data Sync & ETL

Triage website form enquiries with OpenAI and Google Sheets

When an API call/webhook arrives, it moves and syncs data with OpenAI / ChatGPT using Google Sheets.

What it does

## Triage website form enquiries with OpenAI, spam filtering and a Google Sheets review queue ### Quick overview For small teams whose website form fills up with a mix of sales leads, support requests, job applications and spam. Each enquiry is checked, scored by an OpenAI model against a category list you control, and written to one of three Google Sheet tabs: Enquiries, Review or Spam. Nothing is sent to the person who filled in the form. ### How it works 1. A webhook receives the form as a POST (JSON or form-encoded) with name, email, company and message. No valid email means HTTP 400. A filled honeypot field means a bot, which gets a quiet 200 and is not logged. 2. The same email and message within 24 hours is answered as a duplicate and not logged twice, so double clicks and replays don't cost an AI call. 3. The model returns JSON with a category id, a confidence score, an urgency and a one-line summary. 4. A Code node checks that reply. An unknown category, broken JSON, an API error or a score under your threshold sends the enquiry to the Review tab, with the reason in check_notes. Spam needs a higher score, so a real lead is not buried in the Spam tab. 5. A Switch writes the row to Enquiries, Review or Spam. If Google Sheets fails, the form gets HTTP 500 so it can show a retry message instead of a false "thanks". ### Setup 1. Create a Google Sheet with three tabs: Enquiries, Review and Spam. Header rows are written on the first run. 2. Add a Google Sheets credential and an OpenAI credential in n8n. 3. In *Settings (edit me)*, replace YOUR_GOOGLE_SHEET_URL and adjust the categories, priorities and thresholds. 4. Add a hidden website field to your form for the honeypot, activate the workflow and point the form at the production webhook URL (path lead-triage). ### Requirements - A Google account with Google Sheets - An OpenAI API key, or any OpenAI-compatible API via the credential's Base URL ### How to customize - Categories, priorities, the two confidence thresholds, the duplicate window and the honeypot field name are all in *Settings (edit me)*. The prompt and the check read the same list. - Map your form's field names in *Normalize and Route Request*. - To protect the webhook, turn on Header Auth on the Webhook node. Need WhatsApp handling, human handoff and opt-out? A production version is available at https://zhangautomation.gumroad.com/l/ecvlr

The steps

  1. Receive Enquiry (POST)
  2. Settings (edit me)
  3. Normalize and Route Request
  4. Valid, Bot or Invalid?
  5. Reject Invalid Email (400)
  6. Quietly Accept Bot (200)
  7. Check for Duplicate
  8. Already Received?
  9. Answer Duplicate (200)
  10. Classify Enquiry with AI
  11. OpenAI Chat Model
  12. Validate AI Result
  13. Route by Outcome
  14. Add to Review Tab

18 steps in total.

Similar automations