Skip to content

On a schedule

Post a daily Chargebee revenue summary to Slack

Every morning at 8am Slack gets yesterday's Chargebee figures: money collected, failed payments, refunds, new subscriptions and cancellations.

Runs
On a schedule
Apps
Chargebee
AI
Not needed
Access
read-only key; chat:write

Send this to your assistant

Create a ClickRuntime automation: every day at 8am, post to #revenue in Slack yesterday's Chargebee totals: successful payments, failed payments, refunds, new subscriptions and cancellations.

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

Chargebee has detailed reports, but most people want five numbers each morning: what came in, what failed, what was refunded, and how many customers joined or left.

This reads yesterday's transactions and subscriptions from the Chargebee API and posts a short summary to Slack before the day starts. Founders, finance and the revenue team all see the same figures.

It suits subscription businesses that want a daily pulse without building a dashboard, and teams who discuss numbers in Slack rather than in a BI tool.

What you get out of it

  • Failed payments in plain sight

    A day with unusually many failed payments often means a card processor issue or an expired gateway setting. Seeing it the next morning lets you act quickly.

  • Same numbers for everyone

    Posting to a shared channel means sales, finance and the founder discuss the same figures, not their own exports.

  • Refunds are counted too

    A spike in refunds can point to a billing mistake or an unhappy cohort. The summary shows it alongside collections.

  • Growth and churn side by side

    New subscriptions next to cancellations shows whether the day moved you forward.

  • Read-only key

    The automation only reads transactions and subscriptions. It cannot issue refunds or change any billing.

How it works

What happens, step by step

  1. Every morning ClickRuntime reads yesterday's transactions from Chargebee.

  2. It totals successful payments, failed payments and refunds separately.

  3. It counts subscriptions created and cancelled during the same day.

  4. A short summary is posted to your Slack channel.

Before it runs live

  • Connect Chargebee

What you get

RunsOn a schedule
Post a daily Chargebee revenue summary to Slacktoday, 9:00Succeeded
Slack · #revenue📊 Chargebee, Mon 10 Nov Collected: USD 14,820.00 (96 payments) Failed: USD 1,190.00 (7 payments) Refunded: USD 240.00 (2) New subscriptions: 11 · Cancellations: 3

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 Chargebee 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.
post_a_daily_chargebee_revenue_summary_to_slack.pyexample
from datetime import datetime, time as dtime, timedelta
from clickruntime import on_trigger, credentials, http, notify

SITE = "yourcompany"  # yourcompany.chargebee.com

def fetch_all(api, auth, path, key, params):
    out, offset = [], None
    while True:
        body = http.get(f"{api}/{path}", auth=auth, params={**params, "limit": 100, **({"offset": offset} if offset else {})}).json()
        out += [r[key] for r in body["list"]]
        offset = body.get("next_offset")
        if not offset:
            return out

@on_trigger
def run(event):
    api, auth = f"https://{SITE}.chargebee.com/api/v2", (credentials.secret("CHARGEBEE_API_KEY"), "")
    day = datetime.now().date() - timedelta(days=1)
    start = int(datetime.combine(day, dtime.min).timestamp())
    end = start + 86400
    tx = fetch_all(api, auth, "transactions", "transaction", {"date[between]": f"[{start},{end - 1}]"})
    def total(kind, status):
        rows = [t for t in tx if t["type"] == kind and t["status"] == status]
        return sum(t["amount"] for t in rows) / 100, len(rows)
    paid, failed, refunded = total("payment", "success"), total("payment", "failure"), total("refund", "success")
    created = fetch_all(api, auth, "subscriptions", "subscription", {"created_at[between]": f"[{start},{end - 1}]"})
    cancelled = fetch_all(api, auth, "subscriptions", "subscription", {"cancelled_at[between]": f"[{start},{end - 1}]"})
    cur = tx[0]["currency_code"] if tx else "USD"
    notify.slack(f"📊 Chargebee, {day:%a %d %b}\n"
                 f"Collected: {cur} {paid[0]:,.2f} ({paid[1]} payments)\n"
                 f"Failed: {cur} {failed[0]:,.2f} ({failed[1]} payments)\n"
                 f"Refunded: {cur} {refunded[0]:,.2f} ({refunded[1]})\n"
                 f"New subscriptions: {len(created)} · Cancellations: {len(cancelled)}", channel="#revenue")
    return {"collected": paid[0], "new": len(created), "cancelled": len(cancelled)}

FAQ

Common questions

What if I bill in more than one currency?
This version assumes one currency. If you bill in several, ask your assistant to total each currency on its own line, since Chargebee stores amounts in the currency charged.
Which time zone defines 'yesterday'?
The schedule's time zone. Set the automation to your business time zone and yesterday means midnight to midnight there.
Is this the same as MRR?
No. It reports cash collected and subscription counts for one day. MRR changes come from upgrades, downgrades and cancellations, which are covered by separate alerts.
What permissions does it need?
read-only key; chat:write. 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 a daily Chargebee revenue summary to Slack” from your assistant

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