AgentRecipes
Recipes › Sales & lead generation

How to let Claude Code run a Meta Ads lead campaign on a daily read-decide-log loop

Sales & lead generationClaude Code✓ Confirmed by source

Confirmed by source: Write-up of a 31-day live campaign on a real Meta Ads account with real spend, run by the agent with no human intervention apart from a daily start command, including full results and the target it missed. (checked 2026-10-18)

The problem

Running a small paid lead-generation campaign means checking numbers, making new ad creatives, pausing losers and adjusting budget every day, which eats one to two hours of a person's time and leaves no record of why each change was made.

Tools needed

Step-by-step recipe

  1. Give the agent API access to the ad account, the landing pages and the analytics tool, plus a rules file with the goal (for example a target cost per lead), a hard total budget, a kill threshold for underperforming ads and how much the daily budget may grow in one step.
  2. Start each day with a fresh session triggered by one command; first have a subagent read every earlier daily log and summarise the strategy so far, so the agent picks up where it left off without relying on model memory.
  3. Pull fresh performance data over several windows (whole campaign, last 7 days, yesterday, today) and judge ads on rolling averages rather than single days.
  4. Have the agent write each decision in a fixed format (what, hypothesis, confidence, revisit trigger) and then act: create new ad or landing page variants, pause ads over the threshold, scale winners within the allowed step, or explicitly do nothing.
  5. Check lead quality in analytics from day one, not just cost per lead, so cheap but wrong-audience signups are caught early.
  6. Write the updated logs, learnings and campaign history to files and commit them to git, then end the session; repeat the next morning.

Copyable prompt

Prompt template
You manage the [AD PLATFORM] campaign for [PRODUCT]. Goal: [QUALIFIED LEADS FROM AUDIENCE] at or below [TARGET COST PER LEAD]. Total budget: [AMOUNT], never exceed it.
1. Ask a subagent to read logs/*.md and summarise strategy, open hypotheses and revisit triggers.
2. Fetch metrics for: full campaign, last 7 days, yesterday, today. Use 7-day averages for decisions.
3. Check who actually signed up in [ANALYTICS TOOL]; flag leads outside [AUDIENCE].
4. Rules: pause any ad above [KILL THRESHOLD] after [MIN SPEND]; raise daily budget by at most [PERCENT] when a winner holds below target for [N] days; doing nothing is allowed.
5. Log every decision as: Decision / What / Hypothesis / Confidence / Revisit trigger.
6. Save logs/[DATE].md and commit to git.

Original template written by our AI agent for AgentRecipes, not copied from the source. Replace the [BRACKETS] and {{variables}} with your own values and test before relying on it.

What the builder reported

Over 31 days the agent spent $1,493 of a $1,500 budget for 243 leads at $6.14 each, missing the $2.50 target the author set; it tested about 50 ad variants across 8 formats, its best ad reached $1.29 per lead on day 12, and the owner's daily input was about 2 minutes. The author calls the results directional, not definitive.

These are the source author's own claims. AgentRecipes has not run this recipe itself.

Watch out for

Source

Original write-up: Technically (2026-08-25) ↗

Found via Agent Use Cases: “Run Meta ad campaigns autonomously for a newsletter”. This recipe summarises the source in words written by our AI agent; read the original for the full details. Link last checked 2026-10-18.

More sales & lead generation recipes

Research discovery-call contacts and email a brief before the meeting with LindyBefore a discovery call you need a short, reliable brief on the person and their company, but looking them up by hand every time eats…Lindy✓ Confirmed by sourceTurn every sales-call transcript into notes, a follow-up draft and approvable CRM updates (Make)After every customer call, an account executive has the same clean-up to do: write notes, update the CRM, draft the follow-up and pull…Make✓ Confirmed by sourceTurn every inbound sales call and voicemail into a scored, filled-in CRM lead with Whisper, ChatGPT and ZapierA business that lives on inbound phone calls gets thousands of calls and voicemails a month, but the CRM only ever receives a phone…Zapier✓ Confirmed by source

New agent recipes in your inbox

A short email with the newest automation recipes, each linked to its real-world source. No spam. Every email has a one-click unsubscribe link.