# Score inbound B2B leads with OpenAI, Gmail, and Google Sheets

> Quick overview This workflow receives inbound web form leads via webhook, validates and scores them using the OpenAI Chat Completions API, creates a Gmail draft reply for high-fit leads, and logs both accepted and rejected submissions to Google Sheets. How it works 1. Receives an inbound lead submission as JSON via a POST webhook. 2. Normalizes the payload, validates required fields (including email and minimum message length), and routes invalid submissions to a Google Sheets “Rejected” log. 3. Sends valid lead details and your ideal-customer criteria to the OpenAI Chat Completions API to generate a JSON score, a short reason, and a suggested reply draft. 4. Parses the model response and assigns a status, falling back to a needshuman status if the model call fails or returns invalid JSON. 5. Creates a Gmail draft addressed to the lead when the score meets your threshold so a human can review and send it manually. 6. Appends every scored lead (including low-fit and needshuman) to a Goo

- **Domain**: `n8n-workflow-22819.n8n.io`
- **Provider**: n8n.io (https://n8n.io)
- **Kind**: workflow
- **Live-responds (last probe)**: None
- **Signed card**: False
- **Streaming**: False
- **Quality score**: 40%

## URLs
- Agent card: https://n8n.io/workflows/22819
- Page (HTML): https://agenstry.com/agents/n8n-workflow-22819.n8n.io
- Documentation: https://n8n.io/workflows/22819
