Quick overview
This workflow receives inbound website or form leads via a webhook, normalizes the lead data, uses an OpenAI-compatible Chat Completions API to score ICP fit and generate messaging, then routes hot leads to Slack and forwards warm/cold leads to a CRM webhook.
How it works
- Receives a POST request with lead details (such as name, email, company, website, and message) via an n8n webhook.
- Normalizes the payload by cleaning fields, inferring a company website from the email domain, flagging corporate vs. free webmail, and truncating long messages.
- Sends the normalized lead to an OpenAI-compatible Chat Completions endpoint (configured via environment variables) to return strict JSON with an ICP score, tier, summary, next action, and personalized opening line.
- Parses the AI JSON response, applies safe fallbacks if parsing fails, and merges the enrichment back into the lead record.
- Routes leads with a score of 75 or higher to Slack using an incoming webhook with a formatted hot-lead alert.
- Sends warm/cold leads (score below 75) to your CRM or logging endpoint via a webhook POST.
Setup
- Copy the production URL from the inbound webhook trigger and configure your form or website to POST lead data to it.
- Set environment variables for the OpenAI-compatible endpoint, including OPENAI_API_KEY (required) and optionally OPENAI_BASE_URL and OPENAI_MODEL.
- Create a Slack incoming webhook, set SLACK_WEBHOOK_URL in your environment, and choose the target channel for hot lead alerts.
- Set CRM_WEBHOOK_URL to the endpoint in your CRM or middleware that should receive warm/cold lead payloads.
- Update the ICP criteria and expected JSON fields in the system prompt of the AI request to match your ideal customer profile and routing threshold.
Additional info
Built by Daniel Lopes (AI DevTools). Explore more open-source MCP servers, AI guardrails, and production automation workflows at https://danlopes18-ctrl.github.io/