Quick Overview
This workflow receives lead submissions via a webhook, normalizes the fields, uses OpenAI to score and categorize each lead with a structured JSON output, appends every lead to Google Sheets, and posts an alert to a Slack channel when the lead score meets a qualifying threshold.
How it works
- Receives a POST request on an n8n webhook endpoint with lead details (for example from a web form).
- Normalizes the incoming payload into consistent fields like name, email, company, message, and source.
- Sends the normalized lead to OpenAI (gpt-4o-mini) to return a JSON assessment containing score, category, reasoning, and a suggested reply.
- Prepares a log record with a timestamp and the AI results, then appends it as a new row in Google Sheets.
- Checks whether the lead score is 70 or higher and, if so, posts a formatted “hot lead” alert to Slack including the reasoning and suggested reply.
Setup
- Create or select a Google Sheets spreadsheet with a header row for timestamp, name, email, company, message, source, score, category, reasoning, and suggested_reply, then connect Google Sheets OAuth and set the document ID and sheet name.
- Add an OpenAI API credential and confirm the chat model selection (default gpt-4o-mini) in the OpenAI model configuration.
- Add a Slack OAuth credential, ensure the target channel exists (for example #leads), and set the correct Slack channel in the Slack message step.
- Copy the webhook URL from the Lead Intake webhook and configure your form or source system to send a POST request with lead fields (name, email, company, message, source).