Automating Lead Generation with Claude Code and Clay

Nate Herk | AI Automationgo watch the original →

Use Claude Code as an orchestration agent to query Clay for lead sourcing, enrichment, and personalized email generation, then export the resulting CSV to Clay for automated cold outreach campaigns.

Orchestrating Lead Generation

Claude Code acts as an intelligent orchestrator that manages the lead generation workflow by interacting with the Clay API. By installing the Clay plugin via the Claude Code terminal (/marketplace), the agent gains the ability to execute specific actions such as finding business leads, enriching contact data, and validating email addresses. This approach replaces manual UI navigation with natural language prompts, allowing the agent to handle complex tasks like multi-region searches and data deduplication autonomously.

Executing the Workflow

To ensure high-quality output, the author uses a "goal prompt" strategy, defining specific end conditions for the agent. The process involves several key steps:

  • Context Injection: The author provides Claude Code with a local directory of context files, including business profiles, case studies, FAQs, and website copy, which the agent uses to draft personalized email content.
  • Dynamic Workflow: Using the /goal command, the agent is instructed to iterate until it secures 50 fully enriched leads, each containing a verified email, a personalized subject line, and a body copy tailored to the lead's specific pain points.
  • Verification: The agent performs internal validation passes, including agent-led debates on the quality of the generated copy, to ensure the output meets the specified criteria before exporting to a CSV file.
  • Campaign Launch: The final CSV is imported into Clay, where the user can manage sender accounts, purchase warmed-up domains, and initiate email sequences directly within the platform.

Cost and Performance

For a batch of 50 enriched leads, the process incurred a cost of 172 Clay credits, approximately $12 USD. While simple requests can complete in roughly 5 minutes, more complex workflows involving verification and multi-agent debate can take up to an hour. The author emphasizes that the quality of the output is heavily dependent on the depth of the context provided to Claude Code rather than the lead sourcing tool itself.

  • #ai
  • #automation
  • #lead-gen
  • #dev-tooling

summary by google/gemini-3.1-flash-lite. probably wrong about something. check the source.