An agency I worked with ran several AI campaigns per client: speed-to-lead for new and existing customers, database reactivation, smart follow-up and customer success. Each campaign logged leads in Airtable. Every week someone filtered each view, counted rows and pasted numbers into a report. It took hours and was always slightly out of date.
The fix was a single scheduled n8n workflow that does the counting and posts the result to a live dashboard. Here's the pattern.
The shape: fan out, normalise, merge, post
- Schedule trigger runs the workflow on a fixed interval.
- Fan out to one Airtable "search records" node per campaign and stage: leads, responded, booked, interested and not interested. In the build above that came to about 26 searches.
- Edit Fields after each search stamps every record with its
campaignandstage, so the data carries its own label. - Merge nodes in append mode collect everything into one stream.
- A Code node turns rows into totals and rates.
- An HTTP Request posts the summary to the dashboard's API.
Why label every record?
It's tempting to count inside each branch. Don't. If every branch outputs the same shape, { campaign, stage, ...record }, then one piece of code downstream handles all of them, and adding a campaign means copying one search node instead of rewriting logic.
The aggregation step
This is the heart of it, simplified from production:
// n8n Code node: one input item per lead record, labelled with campaign + stage
const totals = {};
for (const { json } of $input.all()) {
const key = json.campaign; // e.g. "s2l_a1"
totals[key] ??= { campaign: key, leads: 0, responded: 0,
booked: 0, interested: 0, not_interested: 0 };
totals[key][json.stage] += 1;
}
const pct = (a, b) => (b ? +((a / b) * 100).toFixed(1) : 0);
return Object.values(totals).map(t => ({
json: { ...t,
response_rate: pct(t.responded, t.leads),
conversion_rate: pct(t.booked, t.leads) },
}));
The dashboard receives one object per campaign with raw counts and rates, so it never has to do maths itself.
Things that bite in production
- Rate limits. Airtable's API allows about five requests per second per base. Twenty-plus parallel searches can hit that, so keep batching modest or add a short wait between groups.
- Empty results. A search with no matches returns nothing, which can silently drop a campaign from the merge. Turn on "always output data" or default missing campaigns to zero in code.
- Pagination. Make sure each search returns all records, not just the first page.
- Failures. Attach an error workflow that alerts you. A dashboard showing stale numbers is worse than one showing an error.
- Secrets. Keep the Airtable token and dashboard key in n8n credentials, never in node parameters.
The result
Nobody builds the weekly report anymore. Business owners open the dashboard and see what each AI agent produced. When a new campaign launches, adding it to reporting takes minutes. If you're still copying numbers into a spreadsheet every Monday, this pattern pays for itself quickly.