How it works
What this system does
Turn inbound inquiries into validated, owned HubSpot leads with explainable scoring and controlled first responses. Four connected n8n workflows use ZeroBounce for email validation, OpenAI for scoring and drafting, Slack for optional Hot lead alerts, Resend for sending, and PostgreSQL for durable queue and duplicate-send controls.
This is the executable counterpart to the Intelligent Lead Routing & Response blueprint. It also supplies the intake and routing layer within the Revenue Operations Intelligence architecture.
The four-workflow lifecycle
- Intake: workflow 01 normalizes an authenticated backend payload, stores it before returning 202, and starts the worker asynchronously.
- Process: workflow 02 validates email, resolves or creates the contact, preserves existing ownership, assigns unowned contacts through atomic rotation, scores the inquiry, and saves a draft.
- Prepare properties: workflow 03 is a one-time manual setup for custom HubSpot fields.
- Operate: workflow 04 records failures and detects stalled jobs, review holds, alert failures, and logging holds.
Classification and send permission
The model supplies bounded fit, intent, and urgency scores with evidence. Code determines Hot/Warm/Cold and applies separate sending gates. Cold, low-confidence, unsupported, opted-out, stale, and excluded customer inquiries do not auto-send. A Warm classification alone is not permission to send.
Existing owners and nonempty contact fields are preserved. New unowned contacts rotate across configured available reps; availability is a configuration flag, not live calendar presence. Immediately before sending, the worker rechecks the email, owner, suppression, validation, lifecycle, and response state.
Resend acceptance is recorded separately from confirmed delivery. The sent subject/body is logged in HubSpot afterward. Stored provider requests, send guards, bounded retries, and a per-email cooldown reduce duplicate sends; uncertain provider outcomes require operator reconciliation rather than a full workflow replay.
Important test behavior
Dry run still updates HubSpot and makes paid validation and AI API calls. It blocks email sending. Defaults are dry_run: true, auto_send_enabled: false, and Slack disabled. Use a sandbox CRM and test inboxes before activating the workflows.
The supplied validation report records 64 local checks. Live n8n execution, PostgreSQL functions and concurrent load, vendor credentials and responses, actual delivery, and model quality against your services and labeled leads were not verified by that report.
Connect attribution separately
Add the GA4 & HubSpot Lead Attribution System when you also need source preservation and aggregate traffic reporting. Lead routing creates or updates contacts; attribution looks up existing contacts and retries while creation is pending. They are separate workflow packages with separate event contracts.
How to use
Before you start
- A current compatible n8n instance and dedicated PostgreSQL 14+ application database with an encrypted connection.
- A HubSpot sandbox or controlled test contacts and the required contact, schema, and email-activity permissions.
- ZeroBounce and OpenAI API credentials. Test runs can incur API charges.
- Resend with a verified sender domain when enabling email; Slack credentials only if alerts are enabled.
- Your approved service catalog, company details, HubSpot portal ID, real owner IDs, rep profiles, and a trusted form backend.
Import and configure
- Download the complete package, extract it, and read the full setup manual. Import the four .n8n.json files individually into n8n and save each workflow. Supporting SQL and JSON files are not workflow imports.
- Run database-setup.sql in the dedicated application database, not against n8n internal tables. Apply the documented role grants where needed. Run database-smoke-test.sql in a sandbox; it rolls back.
- Rebind every placeholder credential: Form Header Auth, Postgres, HubSpot Header Auth, ZeroBounce Query Auth, OpenAI Header Auth, Resend Header Auth, and optional Slack Header Auth. Store secrets in n8n credentials.
- Run workflow 03 manually to create missing custom properties. Resolve incompatible existing definitions before proceeding and keep this workflow manual.
- Edit Configuration in workflow 02. Replace company information, approved services, verified sender, HubSpot portal ID, and rep profiles using actual HubSpot owner IDs. Leave dry_run: true, auto_send_enabled: false, and Slack off for initial sandbox checks. Required placeholders deliberately block processing.
- In workflow 01, Start Lead Worker, select imported workflow 02. Keep Wait for Sub-Workflow Completion off and permit intake calls in the worker settings.
- Select workflow 04 as the error workflow for workflow 02, and optionally for 01. These references are specific to your n8n instance and must be set after import.
- If needed, configure Hot lead Slack alerts in workflow 02 and independently configure operations Slack in workflow 04. Set real channel and member IDs.
- Save, publish, or activate 01, 02, and 04 as your n8n version requires in the test environment. Workflow 03 stays manual. Activation enables the production webhook and recovery schedules.
- Send the sample payload from your trusted backend using an inbox you control. Inspect the queue, contact, owner, scores, saved draft, and execution. Dry run still writes CRM records and uses paid APIs.
- After acceptance checks, set both dry_run: false and auto_send_enabled: true for live first responses. Existing dry-run drafts are not automatically sent when these switches change.
Form contract
Your backend sends POST https://YOUR_N8N_HOST/webhook/revops-l1-001-inbound using the configured header secret, such as X-Lead-Webhook-Secret. Keep that secret out of browser code.
Required fields are submission_id (a stable UUID) and email. Optional context includes name, company, phone, role, message, service interest, budget, timeline, form ID, and page URL. response_requested must be the actual JSON boolean true, recorded by your trusted backend, before the sending gates can permit a reply. Missing, false, or the string "true" prevents auto-send.
Retry the same inquiry with the same UUID and payload. Accepted and identical duplicate submissions return 202; conflicting reuse returns 409; malformed input returns 400. Native HubSpot form or webhook events need an adapter to this contract.
Validate before rollout
Test valid Hot and Warm leads, invalid or risky mailboxes, Cold and low-confidence leads, absent or unavailable owners, existing customers, opted-out contacts, unsupported services, and duplicate payloads. Confirm that dry run saves drafts without email, that a changed owner or suppression state blocks a pending send, and that database rotation behaves correctly under concurrency.
Inspect provider acceptance separately from delivery. Confirm that CRM logging failure does not resend an accepted email, and reconcile uncertain provider results using the saved request and idempotency key. The complete manual explains recovery. Delivery, bounce, complaint, reply tracking, and subscription integrations remain separate work.
Changing global configuration does not reliably cancel running or waiting executions. Use the documented CRM suppression controls and cancel pending executions when an immediate stop is needed.
Pair with GA4 and HubSpot attribution
Use the attribution system for source evidence and GA4 reporting. Have your trusted backend adapt a successful form submission to both contracts and share the same submission_id; attribution also requires its own stable event_id per producer. Configure the packages separately and test matching after contact creation. Importing them does not automatically connect their webhooks.
Read the Intelligent Lead Routing & Response blueprint for the architecture, and the Revenue Operations Intelligence blueprint for the broader process.
Reviewed duplicate cleanup
Use the HubSpot Duplicate Detection & Approved Merge System for separately configured duplicate review and cleanup. It imports inactive with merge execution disabled. Before combining the packages, test how CRM references reconcile the resulting record ID after an approved merge.
Proposal follow-up
The HubSpot Ghosted Proposal Follow-Up & Recovery System adds separately configured five-to-seven-day check-ins, high-value approvals, and reply tasks. It imports inactive with SMTP delivery disabled.