Free n8n template · Intermediate
AI Lead Qualification
Turn a website enquiry into a scored lead, a spreadsheet row and a Slack notification. Keep the final decision with your team.
- 01Website enquiry
- 02Validate + classify
- 03Google Sheets
- 04Slack notification
What it does
- Who it is for
- Sales and operations teams testing a consistent first pass on inbound enquiries.
- Input
- An authenticated JSON webhook containing lead_id, name, email, company and message.
- Process
- Validate the enquiry, ask AI for a priority suggestion, validate its response, append a row, then notify Slack.
- Output
- A suggested score from 0 to 100, priority, reason and needs_review flag, stored with the original lead ID.
Validation status: Export structure and Code node logic are checked with local fixtures. Live n8n import and authenticated provider runs have not been verified. Follow the setup guide with synthetic data before using it with real records.
Set up the workflow
Tools and prerequisites
- An n8n instance with Code, HTTP Request and Webhook nodes. The downloads use built-in nodes only; import compatibility still needs checking on your installed version.
- Your own OpenAI API account with billing enabled. Store the key in an n8n Header Auth credential named OpenAI: header Authorization, value Bearer followed by your key.
- A Google Sheets OAuth2 credential in n8n and a dedicated test spreadsheet. Enable the Sheets API and grant the connected account access to that spreadsheet.
- A Slack app with chat:write permission, invited to your test channel. Store its bot token in a separate Header Auth credential: Authorization: Bearer <token>.
- An n8n Webhook Header Auth credential with header X-AutomateHQ-Key and a long random value. Call this from your server, never from public browser code.
Installation steps
- Import the JSON using n8n’s Import from File command. Leave it inactive while configuring it.
- Create a sheet tab named Leads and add the column headers below in exactly this order.
- Fill in Configure workflow and attach the credentials listed below. Invite the Slack app to the channel.
- Select Listen for test event in Receive lead. From a trusted server or terminal, POST the example JSON to the node’s Test URL with Content-Type: application/json and your X-AutomateHQ-Key header.
- Confirm one row appears and one Slack message arrives. Verify that the webhook response includes the same lead_id. Try an invalid email and confirm no row is written.
- Tune the prompt on representative enquiries. Activate only after testing, then replace the Test URL with the Production URL in your server-side form handler.
Spreadsheet column order
Create these headers in row 1. The workflow appends values in this order using RAW input, which keeps text from becoming a spreadsheet formula.
lead_id, name, email, company, score, priority, reason, needs_reviewConfiguration points
- Configure workflow
- Set spreadsheetId, sheetName and slackChannel. Set model to a structured-output-capable model available in your account (default: gpt-4o-mini).
- Receive lead
- Select your Webhook Header Auth credential. Do not disable authentication.
- Classify with OpenAI
- Select the OpenAI Header Auth credential. Edit the system prompt to describe your qualification rules.
- Append review row
- Select your Google Sheets OAuth2 credential.
- Notify Slack
- Select the separate Slack Header Auth credential.
Example input & output
Synthetic examples, not customer data. AI output may differ on each run. A well-formed response still needs review.
Input
{
"lead_id": "demo-001",
"name": "Alex Tan",
"email": "[email protected]",
"company": "Example Logistics",
"message": "We manually route 200 enquiries each week. Can you connect our form to a CRM and Slack?"
}Illustrative output
{
"lead_id": "demo-001",
"score": 85,
"priority": "high",
"reason": "A specific recurring workflow and clear integration needs.",
"needs_review": true
}What can go wrong
401/403 at the webhook
Check the X-AutomateHQ-Key header and selected credential. Keep the secret on the sending server.
OpenAI failure or invalid classification
The run stops before writing. Read the failed node; check quota, credentials, model access or output validation. API calls make up to three attempts.
Sheet row exists but Slack failed
Do not rerun the entire workflow blindly. Check the row by lead_id and retry the notification only. Slack can return ok:false with HTTP 200; the workflow checks this.
Failed nodes stop execution and remain visible in n8n’s Executions view. No write node retries automatically. A caller timeout does not prove that no write happened: inspect downstream systems before replaying. Add an error workflow if you need alerts.
Limitations
- The score is a model suggestion, not a probability of conversion. Every lead remains marked for human review.
- This starter appends records. It does not merge CRM contacts, prevent repeated webhook submissions or send lead follow-ups.
- Google Forms is not connected automatically. Connect a trusted form handler that sends the documented JSON payload.
Before your team depends on it
From demo to production
A successful test run proves one path works. Production engineering also accounts for repeated requests, unavailable services and people correcting the result.
- Store lead_id in a durable database with a unique constraint before writing to external systems. A retry after a timeout may otherwise create another row.
- Separate intake from delivery with a queue. Track sheet and Slack delivery independently so a Slack outage cannot duplicate a lead.
- Define qualification rules, consent, record ownership and review responsibility. Test multilingual Singapore and Thailand enquiries against a labelled sample.
- Add per-sender rate limits, monitoring and cost budgets. Alert an owner on failures without including full enquiry text.
Security & privacy
The submitted name, email, company and message go to OpenAI; lead details go to your spreadsheet. Slack receives only the lead ID, priority and score. Use synthetic leads first, restrict sheet access and set an execution-data retention policy in n8n.
Secrets belong in n8n’s credential store. Successful production payloads are not saved by this export; manual and failed executions are saved for debugging. Configure pruning and binary-data retention, restrict execution access and delete test runs when finished. Webhook headers can appear in execution inputs, so rotate test keys.
Estimated running costs
One model request, one Sheets append and one Slack message per valid lead; a transient model failure can make up to three model attempts. Add n8n hosting or execution charges and any workspace plan costs.
For 1,000 runs, estimate the model cost as (average input tokens × input price per million + average output tokens × output price per million) ÷ 1,000. For example, at hypothetical rates of $1 input and $4 output per million tokens, 1,500 input and 250 output tokens per run would cost $2.50 per 1,000 runs, before retries and hosting. These are illustrative rates, not a provider quote.
Use your execution usage and the current OpenAI pricing and n8n plan to budget. The template download is free; connected services may charge.
Make it your own
- Replace the sheet with your CRM after adding contact matching.
- Route high-priority leads to an owner using explicit territory rules.
- Add a review queue before creating follow-up drafts.