Flag Meta Audience Network wasted spend with Meta Marketing API and Claude
Go to WorkflowDescription
Quick overview
This workflow pulls Meta Ads placement insights, flags underperforming Audience Network slices based on spend and CPA thresholds, uses Anthropic Claude to rank recommended actions, and compiles a plain-text leak report that is sent via Gmail.
How it works
Runs manually to start the analysis.
Requests the last 30 days of Meta Marketing API account insights broken down by publisher platform and platform position.
Calculates a non–Audience Network cost-per-result benchmark from your other placements, then flags Audience Network placements with zero results or CPA far above the benchmark and estimates recoverable spend.
Sends the flagged placement list and benchmark context to Anthropic Claude to generate a prioritized JSON action plan (exclude, keep, or investigate).
Formats Claude’s response into a readable Audience Network leak report and sends it as an email via Gmail.
Setup
Set environment variables for Meta Marketing API access (META_ACCESS_TOKEN, META_AD_ACCOUNT_ID, and optionally META_API_VERSION).
Add an Anthropic API key in the ANTHROPIC_API_KEY environment variable.
Configure the Gmail credential and set the email recipients/subject in the Gmail Send node.
Review and adjust the thresholds and RESULT_ACTIONS list to match your conversion events and acceptable Audience Network performance.