Quick overview
This workflow captures website form leads via a webhook, screens and scores them with OpenAI, logs every lead to Google Sheets, and creates Gmail reply and follow-up drafts (optionally alerting Slack for hot or risky leads) so you can review before sending.
How it works
- Receives a new lead from a POST webhook (or a manual test lead), or runs on a weekday 9 AM schedule to check for follow-ups.
- Normalizes the form payload, validates the email, and screens for spam, bots, prompt-injection patterns, risky content, and an optional shared secret.
- For valid new leads, looks up the email in Google Sheets to skip drafting if the same contact was handled recently.
- Uses OpenAI to return structured qualification data (fit score, category, intent, budget, timeline, urgency, missing info, and a short owner summary) and assigns a tier (hot, warm, poor fit, spam, or needs review).
- Drafts a personalized first reply in Gmail for hot/warm leads using OpenAI, or drafts a fixed polite decline for poor fits, and then scrubs the text for prices/discounts/guarantees by replacing them with confirmation tags.
- Appends the lead, qualification results, and any Gmail draft/thread IDs to Google Sheets, and optionally posts an alert to Slack for hot leads or leads marked as needing human review.
- On scheduled runs, reads “waiting” leads from Google Sheets, checks Gmail for replies and sent messages, drafts an OpenAI follow-up in the same thread when due, and updates the Google Sheet to mark leads as replied or follow-up drafted.
Setup
- Add credentials for OpenAI, Google Sheets, and Gmail, and add Slack credentials if you want alerts.
- Create a Google Sheet with a tab named “Leads” (or update the tab name), then paste the spreadsheet URL into the workflow settings.
- Update the configuration fields (business details, ideal client/not-a-fit criteria, booking link, thresholds, and optional Slack channel ID and webhook shared secret) before enabling the workflow.
- Copy the production webhook URL and configure your website form tool to send lead submissions to it (optionally including the x-webhook-secret header if you set a shared secret).