Most people think AI ads means Claude/Codex writes the copy. For B2B lead gen it can run the whole system.
Not another "AI is replacing media buyers" post. Just what I actually run for B2B clients now.
Most Meta lead gen setups I see stop at "leads are flowing in". The half that pays off is what happens after the form submission. CRM, qualification, offline conversions back to Meta. Nobody builds it because it's annoying.
What I built sits between the Meta Marketing API, the CRM, and Claude Code. End-to-end:
- Claude Code/Codex drafts the campaign for the client based on their actual offer, ICP, and what's worked historically. Audience, ad copy, 3 creative variant briefs, the lead form questions, the qualification logic.
- Lead forms get built via the Meta API directly. Same with the campaign upload. Everything goes up paused, I review, then publish.
- Form submissions land in the CRM (GoHighLevel in most of my cases) with the full lead context attached, not just name + email.
- Once a lead is qualified or closed, that status fires back to Meta via the Conversions API as an offline conversion with a value. Meta's bidding optimizes against qualified leads, not raw submissions.
For B2B specifically this matters because Meta's default signal is the form submission. Optimize against that and you get a flood of tire kickers, because that's what Meta knows how to find. The moment you feed back qualified-or-closed as the signal, the cost per submitted lead goes up but the cost per actually-useful lead goes down.
The Claude Code/Codex piece is just the surface. The actual leverage is having the offer, ICP, past campaign data, CRM schema, and qualification rules all in one folder the model can read. Without that context every recommendation is generic. The folder is what makes the model useful inside an actual business.
Setup is a one-time thing. Meta Developer App, API credentials, CRM API access, Conversions API event mapping. After that everything runs from prompts and scheduled jobs.
Another thing is that Meta will absolutely ban API developer apps and ad accounts they think are abusing the Marketing API, and after security that's the biggest practical constraint of running this kind of setup. In practice it means respecting rate limits, keeping all writes paused until I manually publish, not scraping, and not doing anything the docs explicitly say not to do. Treat it like you're being audited. AI can move fast, but that doesn't mean it should.
Happy to go into any specific piece. Form schema, qualification logic, the offline conversion mapping, whatever's most useful.
Posted May 12, 2026, 6:14 AM UTC