Skip to content

On a schedule

Post yesterday's Klaviyo revenue to Slack

Each morning Slack shows the revenue Klaviyo attributed to campaigns and flows yesterday, compared with the day before.

Runs
On a schedule
Apps
Klaviyo
AI
Not needed
Access
read (metrics, campaigns, flows)

Send this to your assistant

Create a ClickRuntime automation: every morning at 9am, post yesterday's Klaviyo-attributed revenue from campaigns and flows to #ecommerce in Slack, with the change from the day before.

Paste it into your assistant. It tells you what it will send or change before it runs live.

First time? Adding ClickRuntime to your assistant takes about two minutes.

Why use it

Why teams use this automation

Ecommerce owners and lifecycle marketers like to know whether yesterday's email and SMS efforts paid off, but the figure is buried inside Klaviyo's reporting. Logging in, picking the Placed Order metric and the right date range, then remembering what the number was the day before, adds up to a daily task that feels too small to bother with until a slump has been going on for a week.

Every morning, ClickRuntime looks up the Placed Order metric in your Klaviyo account, runs an aggregate that sums the order value for the previous day, and compares it with the day before that. It then posts the result to Slack, so the team starts the day with yesterday's revenue and whether it went up or down.

It is meant for teams who share one revenue number rather than each pulling their own.

What you get out of it

  • A bad day is noticed on the next morning

    A broken flow, a paused campaign or a deliverability problem shows up as a drop in revenue. Seeing that drop at 8 a.m. gives you the chance to fix it before it costs another full day.

  • Everyone works from the same figure

    When marketing, the founder and the operations lead each pull numbers on their own, they disagree on date ranges and filters. One automated post ends that, since every number is computed the same way.

  • Campaign effects are easy to connect

    After a send, the next morning's post shows the revenue bump or the lack of one. That quick feedback helps you judge a subject line, an offer or a send time while the details are still in mind.

  • The day-over-day comparison adds context

    A figure alone is hard to judge, since a $4,200 day might be great or poor. Including the previous day beside it tells people at a glance whether to celebrate or investigate.

  • Reporting costs nobody any time

    Analysts and marketers spend minutes each day opening dashboards to answer the same question. Replacing that with a Slack post removes a small but constant interruption from the people who should be planning campaigns.

How it works

What happens, step by step

  1. Every morning at 9 ClickRuntime asks Klaviyo for the order revenue it attributed to your campaigns and flows over the last two days.

  2. It adds up yesterday's total and the day before's.

  3. It works out the percentage change between the two days.

  4. A message goes to your #ecommerce Slack channel with yesterday's revenue and the change, such as "+12% vs the day before".

Before it runs live

  • Connect Klaviyo

What you get

RunsOn a schedule
Post yesterday's Klaviyo revenue to Slacktoday, 9:00Succeeded
Slack · #ecommerceKlaviyo-attributed revenue yesterday: $4,812.40 (+12% vs the day before)

Build your own

Need it to work differently?

This template is a starting point. Copy the prompt and change it, or describe a different automation from scratch, with your own conditions, more apps or an AI step. Your assistant writes it, tests it and runs it on ClickRuntime.
  • Your own rules

    Conditions, thresholds, filters and exceptions, written the way you'd explain them to a colleague.

  • Any number of apps

    One automation can read from one app and update several others. Over 248 apps are ready, and anything with an API works too.

  • AI where it helps

    Summaries, classification, extraction and drafts use ClickRuntime's built-in AI, with no extra key.

  • On a schedule or on each event

    Runs as often as every 5 minutes, or the moment an app sends an event, and keeps track of what it already handled.

Changes you can ask for

  • Run it at a different time, more or less often, or only on weekdays
  • Add an AI step, for example to summarize, sort or draft a reply
  • Add another app, for example also send it to Slack
  • Combine it with other Klaviyo steps into one automation

Under the hood

The code that runs this automation

This is the Python script that runs each time the automation starts. Your AI assistant writes it for you when you send the prompt, and you allow each step in your assistant. To change how the automation works, describe the change to your assistant and it updates the script for you. For every function it can use, see the script reference.
daily_attributed_revenue_to_slack.pyexample
from datetime import date, timedelta
from clickruntime import on_trigger, credentials, http, notify

API = "https://a.klaviyo.com/api"

def klaviyo():
    return {"Authorization": f"Klaviyo-API-Key {credentials.secret('KLAVIYO_API_KEY')}",
            "revision": "2024-10-15", "accept": "application/vnd.api+json", "content-type": "application/vnd.api+json"}

@on_trigger
def run(event):
    h = klaviyo()
    metric_id = next(m["id"] for m in http.get(f"{API}/metrics", headers=h).json()["data"]
                     if m["attributes"]["name"] == "Placed Order")
    start, end = date.today() - timedelta(days=2), date.today()
    body = {"data": {"type": "metric-aggregate", "attributes": {
        "metric_id": metric_id, "measurements": ["sum_value"], "interval": "day", "timezone": "UTC",
        "by": ["$attributed_channel"],
        "filter": [f"greater-or-equal(datetime,{start}T00:00:00)", f"less-than(datetime,{end}T00:00:00)"]}}}
    rows = http.post(f"{API}/metric-aggregates", json=body, headers=h).json()["data"]["attributes"]["data"]
    before, yday = (sum(r["measurements"]["sum_value"][i] for r in rows) for i in (0, 1))
    change = (yday - before) / before * 100 if before else 0
    notify.slack(f"Klaviyo-attributed revenue yesterday: ${yday:,.2f} ({change:+.0f}% vs the day before)",
                 channel="#ecommerce")
    return {"revenue": yday, "change_pct": round(change, 1)}

FAQ

Common questions

What does Klaviyo-attributed revenue include?
It is the order value Klaviyo attributes to your emails and SMS messages according to its attribution window. It does not equal total store revenue, which also includes orders that were not influenced by a message. The post is labeled so nobody mistakes it for sales totals.
Which time zone defines yesterday?
The schedule and the day boundaries follow the time zone chosen for the automation, which should match your Klaviyo account's time zone so figures line up with the dashboard. If they differ, small differences can appear around midnight.
Could it post a weekly or monthly total as well?
Yes. The same aggregate can run over a week or a month, and a weekly total on Monday is a common addition to the daily post. You can ask for a second schedule, or for the post to include a running month-to-date figure.
What permissions does it need?
read (metrics, campaigns, flows). Nothing else in your accounts is used.
Does it need AI?
No. It runs without AI, so it doesn't use your plan's AI allowance.
How many runs does it use?
One run each time it runs (on a schedule). Checks that find nothing to do and stop right away aren't counted.
Can I change how it works?
Yes. Describe the change to your AI assistant, for example a different schedule, channel or filter. It updates the automation, tests it and tells you what changed.

Set up “Post yesterday's Klaviyo revenue to Slack” from your assistant

Copy the prompt above, or connect your assistant first. Free plan, no credit card.