Skip to content
  • There are no suggestions because the search field is empty.

Cap Notifications Agent

How the Daily Cap Email Works

Contents

  1. What the agent does
  2. Reading the email
  3. Thresholds
  4. How lifetime caps are measured
  5. What gets left out
  6. How the workflow runs
  7. Making changes
  8. Constraints that shape the build
  9. Troubleshooting

1. What the agent does

The Cap Notifications Agent sends one email every weekday morning listing partner and offer pairs that are at or over a custom cap in Everflow. It replaces the cap alert email that previously ran in Hitpath.

It runs at 12:00pm Pacific, every day, as n8n workflow CzaKa5h6VBaGRZKG on madrivo.app.n8n.cloud. Nobody triggers it.

It goes to pubteam@madrivo.com, copying angela@madrivo.com as the workflow owner.

The email is grouped by publisher manager, worst line first, so each manager can find their own section and act on it. Every partner name links straight to that pair's Pacing report in Everflow.

A companion diagram, shows the same process visually with click-through technical detail on each step.

2. Reading the email

The header strip carries five counts:

Tile What it means
Caps flagged Total lines in the email
Publishers over Distinct partners appearing
Offers affected Distinct offers appearing
Highest overage The single worst percentage in the list
Hard-cap flags Lines on a hard cap sitting above 100%

Each line shows the partner, the offer, the bizdev rep, the cap and its period, what has come through, and the percentage.

Cap mode is the field people miss. A soft cap warns but lets traffic keep flowing — that is a live situation worth acting on. A hard cap stops traffic at the limit, so a hard cap at 101% usually means the cap already did its job, and there is nothing left to do. Hard caps sitting well above 100% point at a configuration problem rather than partner overdelivery.

Colour follows severity: muted slate under 100% (approaching, not breached), then orange at 100–149%, red at 150–199%, dark red at 200% and above.

The list is capped at 35 lines so Gmail does not clip the message. When lines are held back, a banner says how many and points to the Pacing report for the full set.

A quiet day still sends an email saying nothing is over threshold. Silence would be ambiguous — you could not tell a clean day from a broken workflow.

3. Thresholds

Each cap period is listed from a different point:

Cap period Listed from Measured over
Daily 120% Today so far
Weekly 85% Week to date (Mon–Sun)
Monthly 85% Month to date
Lifetime 100% Since the cap was created

Weekly and monthly sit at 85% deliberately: they are an early warning, so there is time to request a cap increase before the cap is actually hit. Daily sits at 120% because a daily cap slightly over is normal noise.

A line stays in the email day after day until the cap is raised or the partner is brought back under it. It does not show once and disappear.

4. How lifetime caps are measured

A lifetime cap counts only what has come through since the cap was created — not all history.

This matters more than it sounds. Most lifetime caps were added to partner/offer pairs that had already been running for months. Counting everything back to the beginning resurfaces old volume as a permanent breach that can never be cleared. One real pair showed 157 conversions against a 125-lead cap that was created two months after that partner had already stopped sending traffic.

So the email reports "since you set this cap, they have delivered X," which is a number someone can act on.

This deliberately differs from Everflow's own Pacing report, whose "Global Cap Used" summary appears to count all time. The two will not match on lifetime caps, and that is intended.

5. What gets left out

Four filters run before anything reaches the email:

Filter What it removes Why
Publisher manager Sections belonging to Internal, Internal Jenny, and Ian The Internal names are old PDMs rather than partners anyone works today. Ian is on a different team.
Live this month Any pair with no conversions in the current month Removes dormant publishers and retired offers
Paused offers Offers whose name begins PAUSED ON Nothing to action on a paused offer
Zero caps Cap records with no limit actually set Most records in the cap table have no cap

The footer of every email reports how many lines each of the first two filters removed, so nothing disappears silently.

Manager exclusions live in one list at the top of the Build Cap Email node:

const EXCLUDE_MGR = /^(Internal|Ian)\b/i;

The match is anchored to the start of the name on a word boundary, so Ian catches "Ian Ho" but not a name like "Ianthe". Adding or removing someone is a one-word edit here.

6. How the workflow runs

Seventeen nodes, one path, about 70 seconds end to end.

# Node What happens
1 Daily 12pm PT Schedule trigger, cron 0 12 * * *, workflow timezone America/Los_Angeles
2 Build Config Computes the today / week / month / lifetime date windows in Everflow's ET timezone
3 Fetch Custom Caps Pages POST /v1/networks/custom/capstable until empty
4 Collect Caps Keeps settings with a real cap; emits per-period offer and partner ID scopes
5 Period Report Today's figures, scoped to daily-cap pairs
6 Week To Date Week's figures, scoped to weekly-cap pairs
7 Month To Date Month's figures, scoped to all capped pairs — also the live-this-month gate
8 Lifetime Windows Cuts the span into ~5 chunks of 360 days
9 Lifetime Entity report grouped by month, so each cap can be scored from its creation date
10 Lifetime Clicks Same windows, click-cap pairs only, on unique_click
11 Build Cap Email Scores every cap, applies floors and exclusions, renders the HTML
12 Send Cap Alert Gmail
7. Making changes
To change Edit
A threshold FLOOR_BY in Build Cap Email
Who is excluded EXCLUDE_MGR in Build Cap Email
Who receives it SEND_TO and CC_TO in Build Cap Email
Who gets failure alerts sendTo at the end of Build Alert
The send time The cron in Daily 12pm PT
Max lines before truncation MAX_LINES in Build Cap Email

Reload the n8n tab before running a workflow manually. A manual run uploads whatever is on your browser canvas, not the saved server copy. A stale tab will run an older version, and the editor can autosave that stale canvas over newer work.

8. Constraints that shape the build

Two platform limits explain most of how this workflow is put together. Both are easy to reintroduce by accident.

n8n keeps every node's output in memory for the whole run. Peak memory is the sum of everything the run has touched, not the largest single item. So every Everflow query is scoped by offer and partner ID to the pairs that actually carry a cap of that period — never network-wide.

A period with no caps still has to filter to something. An empty filter array means no filter, which silently becomes a network-wide query. Empty scopes fall back to offer ID 0, which matches nothing.

Do not add ?relationship=all to the capstable request. It attaches full offer and partner objects to every one of tens of thousands of records. Names come from the report rows instead, which already carry them.

Everflow rate-limits bursts of API calls, and n8n passes the failures through quietly. The lifetime query groups by month so a single request covers a whole year, keeping the run to about five lifetime calls. Both lifetime nodes retry three times, three seconds apart, and anything still missing is counted and surfaced as a banner in the email rather than reported as zero.

Click caps are measured on unique billable clicks, not gross. Everflow enforces them that way — confirmed on a live offer where two partners stopped at exactly their 1,500-click cap while gross traffic ran to roughly double, the excess landing in Invalid Clicks. Because the lifetime query filters on conversions, click caps need the separate Lifetime Clicks pass or a partner burning clicks without converting would be invisible.

9. Troubleshooting
Symptom What is actually happening
The workflow spins forever and never finishes The run already died. n8n marks a killed run crashed but leaves it finished: false, so the canvas spinner never stops. Reload the tab; check the executions list for the real status.
"N lifetime-cap queries did not return" banner in the email Everflow rejected some lifetime calls, usually rate-limiting. The lifetime numbers in that email are incomplete and should not be quoted.
Two runs minutes apart give different numbers Same cause as above — a different subset of queries failed each time.
"Workflow did not finish, possible out-of-memory issue" A query is pulling more than its scope, or the cap table has grown. Check that every report node still filters on its period's ID list.
"Task request timed out after 60 seconds" on a Code node A Code node is being handed too much data. n8n runs Code nodes in a separate process and everything they reference has to be serialised across to it.
A run fails and nobody hears about it Check Settings → Error Workflow still points at this workflow.
A cap you expect is missing from the email Check the footer counts first — it was probably filtered as internal-managed or as having no traffic this month.
An offer that is paused still appears The paused check reads the offer name from the report rows, not the cap record. A pair with no report rows has no name to test.

Article Owner: Angela Jimenez

Written By: Angela Jimenez

Date Last Modified: September 17, 2026

Tags: Everflow, n8n, Operations, PDM Caps, Automation, Reporting, Agent, AI