Fetching Customer.io Data into an Operator Dashboard: Fan-Out, Pacing and Caching
TL;DR: Customer.io has no “give me everything” call, so our operator dashboard fetches delivery data with a fan-out of paced metric reads, caches the finished result in Redis for six hours, and shows only numbers we can explain in one sentence. Support, product and ops now get one place to answer “did that notification reach anyone?”
“Did that notification actually reach anyone?” is the simplest question support, product and ops ask us. The answer lives in Customer.io. The people asking live in our operator console. So the job was to fetch the data from the Customer.io API into the dashboard quickly, safely, and in a form nobody has to argue with.
The broader lesson: the charts were the easy part. The real work was the fetching, the limits, the cache and the definitions behind each number.
The short version
- One call is not enough. Customer.io reports per message, so one dashboard view needs dozens of reads.
- Pace the reads. At most six at a time, about 0.12 seconds apart, under a limit of about 10 requests per second.
- Cache the finished answer. Redis, six hours, keyed by range, dates and channel.
- Respect the vendor’s window. 45 days of daily data, with days that start at midnight Eastern.
- Show counts and plain definitions. No percentage-change arrows.
Why is fetching from Customer.io not one API call?
Customer.io’s metrics API is organised per message. Ask about one transactional message, or one campaign, and you get a series of counts: created, sent, delivered, opened. There is no endpoint that returns everything at once.
So one dashboard view means:
- List the transactional messages.
- Read the metrics of each one.
- List the campaigns.
- Read the metrics of each campaign, per channel (push and email).
- Add it all up, filter by channel and group by type.
A dozen messages and a few campaigns turn one click into dozens of requests. Three facts about the vendor decide how we may make them:
- Rate limit. About 10 requests per second.
- Window. Daily data reaches back only 45 days.
- Time zone. A “day” starts at midnight Eastern, not in the viewer’s time zone.

How do we keep Customer.io behind one seam?
Our backend is a modular monolith, and every outside service gets one home. Customer.io lives in a single provider package. The notifications module sees only a small interface: list messages, read a message’s metrics, list campaigns, read a campaign’s metrics.
The dashboard logic never learns which vendor sits behind it. If the vendor changes, one package changes. We also test without mocks: a small real HTTP server runs locally and answers in the vendor’s shape, and the real code fetches from it over the network. When campaigns arrived later, that server gained two endpoints and the dashboard logic did not move.
It is the same instinct as adding a Slack alert without touching checkout: what changes most sits behind a boundary, so nothing else has to change with it.
How do we fetch without hitting the Customer.io rate limit?
Ten requests a second is plenty, until the dashboard needs forty of them and two people open it at once.
So we pace the fetching on purpose. At most six reads are in flight at a time, and each starts about 0.12 seconds after the last. A simplified sketch of the idea:
async with pacer: # at most 6 in flight, about 0.12 s between starts
series = await stats.metrics(message_id, period=plan.period, steps=plan.steps)One load stays well under the ceiling, with room for a colleague.
One choice mattered more than the numbers: campaigns are optional. If the campaign endpoints fail, the dashboard still loads with the transactional figures. A page that falls over because one optional feed is down is worse than one that is slightly incomplete. It is the thinking in designing mobile-friendly APIs: idempotency, pagination and resilience: assume the other side will be slow or fail, and decide up front what happens then.
The same applies to databases. DynamoDB pagination: why a Query stops at 1 MB without an error is a good reminder that “one call” rarely returns everything.
Why do we cache the finished answer for six hours?
Paced fetching is polite, and polite is slow. The first load of a range took long enough that people asked us about it. But delivery figures are not a live ticker, so we cache the finished dashboard data in Redis:
- Key. The range (or the custom dates) plus the channel.
- Lifetime. Six hours.
- On a miss. Fetch once, store, return.
A simplified sketch:
key = f"notif:delivery-log:{which}:{channel}" # custom ranges use custom-<start>-<end>
page = await cache.get_or_load(key, ttl=6 * 60 * 60, loader=build_page)The first person to open a range pays for the fetch. Everyone after gets it instantly. We cache the finished result rather than each vendor call because the result is what is expensive to build, and its key can name every input that changes the answer.
We also learned to write the lifetime down in one place. For a while a code comment said “five minutes” while the code said six hours, and anyone reading the comment, including a manager reading a document built from it, was told something false. Building better platforms through better documentation makes the wider case: a wrong sentence in the docs is a bug.
A cache is also a place to hide things. Your cache is hiding a slow endpoint tells the story of a cache so good nobody noticed what was underneath. The cache key that forgot the photo was the same photo shows what happens when a key does not describe its inputs. Repeated work is also a cost problem: DynamoDB read capacity: three background jobs that wasted it shows how fast work nobody is waiting for adds up.
How does the custom date range stay honest?
Presets were easy: Today (24 hours), 7 days and 30 days. Then came the request for a calendar. A custom range looks like a date picker, but it is really a promise about what the vendor can answer:
- The range must fit inside the last 45 days.
- It cannot end after today, counted in Eastern time.
- A range that does not fit is refused with a clear message, never answered with quietly wrong numbers.
When you choose “Custom range,” it opens on the dates you were just looking at, and nothing is fetched until you press Apply. Until then the page says, “Pick a start and an end date, then press Apply,” and Export stays off. Every custom range gets its own cache key, so repeating one is instant.
How do we turn raw counts into numbers you can explain?
Fetching the data was the easy half. The harder half was deciding what to show.
Our first version put an arrow on every card showing change against the previous period. One card showed +639.7% because the previous period was tiny. A pie’s legend added up to more than 100%. One email figure said 100% while the channel card beside it said 94.3%. Each number was defensible alone. Together they looked broken.
We deleted the arrows and went back to definitions we can say in one sentence:
- Triggered. How many we asked Customer.io to send.
- Sent. How many it handed to the channel.
- Delivered. How many reached the device or inbox.
- Delivery rate. Delivered divided by triggered.
- Open rate. Opened divided by delivered.
If you cannot explain a figure in one sentence, do not show it. The pie shows counts, not shares, and zero shows as 0, not a dash. A number that needs a paragraph before a non-engineer believes it fails the test in explaining a design decision to non-engineers. It is also why we compute numbers in code, where they can be checked, as in how our AI computes dog feeding amounts in code.
What did we get wrong while fetching?
- Test traffic reached the chart. Our own end-to-end test messages and an uninstall-tracking message showed up as pie slices. They were real messages, but not real notifications. We now hide internal prefixes and that message, and say so in the docs.
- Campaigns were missing. Growth runs campaigns in Customer.io, separate from transactional messages, and the first version fetched only the transactional ones. Our totals came out lower than the vendor’s own dashboard, and nobody trusts a page that disagrees with its source. We added campaigns into the same totals and the same pie, labelled “<name> (campaign)”. A campaign that reports no “created” count falls back to “attempted”, then to “sent”, so it is still counted. Campaign numbers are easy to get wrong when two systems count them their own way. Why AppsFlyer shows organic installs when paid campaigns run is a good example, and the reason we pin one definition per word.
- Two figures on one page disagreed. A 78 sat next to a 68, because one used sent and the other used triggered. One definition per word, used everywhere, fixed it.
What this means for our delivery path
The dashboard shows triggered, sent, delivered and opened for any range and channel. It splits triggered counts by notification type, with a fixed six-colour palette plus a grey “Other”. It lets support or ops pick any window inside the last 45 days.
The biggest change is not on the page. When someone asks “did it reach people?”, we answer with a count and a definition, and they can check it against Customer.io and get the same number.
It is the other half of the delivery path in the notification delivery layer and designing for absence. Those cover getting messages out. This covers seeing what happened afterwards, closing the observability gap between sent and delivered.
The screen is a declared page of the console, built as in a console that cannot drift and building a modular admin console that scales independently. It reaches the backend through one door, and only staff can open it, in line with beyond tenant isolation: designing privacy-first admin consoles.
Practical limits and takeaways
- Fetching from a per-item API means fan-out. Plan for it from the start, and pace it by design: cap concurrency and space the starts before the first 429, not after.
- Cache the finished answer. Key it by every input, and write the lifetime down in one place.
- Respect the vendor’s windows. Validate dates up front, or time zones and limits will bite quietly.
- Prefer counts and plain definitions to derived percentages. If a figure needs a paragraph, remove it.
- Make optional feeds fail soft, and keep test traffic out. A missing campaign feed should shrink the page, not break it.
- Test against a real local server, not a mock, so the real request shapes get exercised.
A dashboard is only useful if the people reading it believe it. Most of the work was never drawing the charts. It was fetching the right data, and making every number small enough to explain.
FAQs
Can a dashboard fetch all Customer.io data in one API call?
No. Customer.io reports metrics per message and per campaign, so a dashboard view takes a list call plus one metrics read for each item. That is why we pace the reads and cache the result.
What is the Customer.io API rate limit?
About 10 requests per second for the App API we read from. We stay under it by keeping at most six reads in flight and spacing each start about 0.12 seconds apart.
How far back can the dashboard look?
45 days for daily data, which is the limit of the vendor’s API window. Day boundaries follow midnight Eastern, not the viewer’s time zone.
Why cache the data for six hours instead of showing it live?
Delivery figures change slowly, and a live recompute would multiply API calls and risk the rate limit. The first load of a range is slower. After that it is instant until the cache expires.
What is the difference between delivery rate and open rate?
Delivery rate is delivered divided by triggered: how many of the notifications we asked for actually reached a device or inbox. Open rate is opened divided by delivered: how many of those that arrived were opened.
Why does the chart not show some notifications?
Internal and test messages, such as end-to-end test traffic and an uninstall-tracking message, are hidden on purpose so staging noise never reaches the numbers.
References
- Customer.io, App API documentation
- Redis, Documentation