Quick overview
This workflow receives website lead form submissions via webhook, validates and scores them with an OpenAI-compatible chat completion API, logs every lead to Google Sheets, drafts a reply in Gmail for non-spam leads, and alerts a Slack channel when a lead meets the hot-score threshold.
How it works
- Receives a POST request from a website form via a webhook endpoint.
- Normalizes the submitted fields and rejects obvious bots or invalid submissions (for example, bad email, empty message, honeypot filled, or too many links) with a 422 response.
- Sends the lead details and your business rules to an OpenAI-compatible Chat Completions endpoint to generate a score, category, urgency, summary, budget, and a reply draft.
- Parses the AI response and, if the AI fails or returns invalid JSON, falls back to simple rule-based scoring and a default reply so the lead still gets processed.
- Appends the enriched lead record (including score, tier, summary, and any AI error note) to a Google Sheets tab.
- Creates a Gmail draft reply for non-spam leads and posts a Slack message for hot leads, then responds to the webhook with a thank-you message (or debug details if enabled).
Setup
- Create an OpenAI-compatible API credential using HTTP Header Auth (header name
Authorization, value Bearer <your_key>) and set the base URL/model in the Settings values.
- Connect Google Sheets credentials and set the target spreadsheet ID and tab name in the Settings values, ensuring the sheet has headers matching the columns written (for example
received_at, name, email, phone, company, source, category, urgency, budget, score, tier, summary, message, ai_note).
- Connect Gmail OAuth credentials for creating email drafts.
- Connect Slack credentials and set the target channel name in the Settings values.
- Copy the webhook Production URL and configure your website form to send submissions as a POST request to that endpoint (including fields like name, email, phone, company, and message).