{"product_id":"n8n-ai-lead-qualification-openai-postgresql-email-approval","title":"n8n AI Lead Qualification: OpenAI + PostgreSQL + Email Approval","description":"\u003ch3\u003eAutomatically qualify B2B leads with n8n AI—then require human email approval before outreach\u003c\/h3\u003e\n\u003cp\u003eThis n8n workflow receives B2B lead submissions via webhook, stores them in \u003cstrong\u003ePostgreSQL\u003c\/strong\u003e, and uses an \u003cstrong\u003eOpenAI-powered AI Agent\u003c\/strong\u003e to score and draft next steps. Low-confidence results are sent for manual review, and any approval-required actions wait for \u003cstrong\u003ehuman email approval\u003c\/strong\u003e before outreach or conversion.\u003c\/p\u003e\n\n\u003ch3\u003eWhat this workflow does\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003eWebhook intake:\u003c\/strong\u003e Accepts a POST request with required lead details (email and message). Invalid payloads are rejected with \u003cstrong\u003eHTTP 400\u003c\/strong\u003e.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eNormalize, validate, and persist:\u003c\/strong\u003e Upserts the lead into \u003cstrong\u003ePostgreSQL\u003c\/strong\u003e and prepares lead history for the AI assessment.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eOpenAI AI Agent qualification:\u003c\/strong\u003e Runs an OpenAI AI Agent that looks up prior lead history, applies a deterministic \u003cem\u003epolicy calculator\u003c\/em\u003e, and saves the assessment + activity log back to PostgreSQL.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eReliability check \u0026amp; manual review:\u003c\/strong\u003e If the structured decision is unreliable, the workflow marks the lead for manual review, emails the reviewer, and returns \u003cstrong\u003eHTTP 202\u003c\/strong\u003e.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eNo action vs action:\u003c\/strong\u003e If the policy result is \u003cem\u003eno_action\u003c\/em\u003e, it logs the outcome and returns \u003cstrong\u003eHTTP 200\u003c\/strong\u003e. If approval is required, it creates an approval record in PostgreSQL and returns \u003cstrong\u003eHTTP 202\u003c\/strong\u003e with an approval ID.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eHuman email approval gate:\u003c\/strong\u003e The reviewer receives a draft to \u003cstrong\u003eapprove or reject\u003c\/strong\u003e. Approved leads proceed to follow-up email via SMTP (and are logged), or are converted into a client record in PostgreSQL (and are logged).\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eSafe handling on rejection\/timeout:\u003c\/strong\u003e Rejected or timed-out cases record the rejection and take no sensitive action.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eUse cases\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003eSaaS lead intake from your website\/contact form with automated qualification and audit trails in PostgreSQL.\u003c\/li\u003e\n  \u003cli\u003eSales ops workflows that require human approval before any outreach or conversion.\u003c\/li\u003e\n  \u003cli\u003eTeams managing high-volume B2B submissions where AI drafts next steps but reviewers control final action.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eTechnical details\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003eNodes\/logic:\u003c\/strong\u003e if, set, code, no op, webhook, postgres\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eAI:\u003c\/strong\u003e OpenAI AI Agent with Postgres-backed memory for prior lead history\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eApproval workflow:\u003c\/strong\u003e Approval records in PostgreSQL + reviewer email for approve\/reject\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eOutreach:\u003c\/strong\u003e Follow-up email via SMTP (logged) and\/or conversion to client record in PostgreSQL\u003c\/li\u003e\n\u003c\/ul\u003e","brand":"N8N Commerce","offers":[{"title":"Default Title","offer_id":46010440876211,"sku":"N8N-19520","price":44.99,"currency_code":"GBP","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0749\/6279\/6723\/files\/4x00SgZ_xwo-fl5SEA8Jk_qB5razrH.png?v=1789290312","url":"https:\/\/buyflowscripts.com\/products\/n8n-ai-lead-qualification-openai-postgresql-email-approval","provider":"N8N Commerce","version":"1.0","type":"link"}