Quick Overview
This workflow receives lead form submissions via a webhook, scores each lead with Groq’s Llama model using BANT criteria, and routes the lead to Slack or an SMTP email path based on the HOT/MID/COLD tier.
How it works
- Receives a POST request from a lead form via an n8n webhook.
- Normalizes the incoming fields (name, email, company, budget, authority, need, timing) into a consistent lead object.
- Sends the lead details to the Groq Chat Completions API (Llama 3.3 70B) to return a BANT-based tier (HOT/MID/COLD) with a short reason and confidence score.
- Parses the AI response into structured fields and attaches the score metadata to the lead.
- If the lead is HOT, posts a formatted alert message to Slack in the configured channel.
- If the lead is MID or COLD, sends an email to the lead via SMTP using the corresponding subject line.
- Returns a JSON response to the webhook caller with the lead’s score and a success message.
Setup
- Configure the incoming lead source to POST to this workflow’s webhook URL and include the expected fields (name, email, company, budget, authority, need, timing).
- Add an HTTP Header Auth credential for Groq and set the Authorization header to your Groq API key for the chat completions request.
- Add an HTTP Header Auth credential for Slack and set it to a Slack bot token with permission to call
chat.postMessage, then update the target channel (default #sales) if needed.
- Add SMTP credentials for sending email and replace the
fromEmail addresses (e.g. [email protected], [email protected]) with valid sender addresses for your mail server.