Skip to content

Every 10 minutes

Triage billing emails with the customer's Stripe status

New billing emails arrive in Slack already sorted by topic, with the sender's plan and payment status from Stripe beside them.

Runs
Every 10 minutes
Apps
Slack, Stripe
AI
Yes, uses the built-in AI allowance
Access
Stripe read; chat:write

Send this to your assistant

Create a ClickRuntime automation: every 10 minutes, check my inbox for new billing emails, look up the sender in Stripe, have AI sort the request, and post it to #billing with their plan and payment status.

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

A two-person support team at a software company answers dozens of billing emails a week: failed cards, refund requests, plan changes, invoice copies. For each one they open Stripe, search for the sender, check the subscription and the last invoice, then decide who should handle it. The lookup takes longer than the reply.

Posting each billing email to Slack with the customer's plan, status and last payment already attached removes that lookup. The team can see at a glance who is past due, who is on a large plan and which requests are simple, and pick them up in the right order.

What you get out of it

  • Context arrives with the email

    Plan, subscription status and the latest invoice are shown next to the message. Whoever picks it up can reply without opening Stripe first.

  • Urgent cases are easy to spot

    A past-due customer on a large plan asking about a failed payment looks different from a question about an invoice copy. The team handles revenue at risk first.

  • Requests are sorted by topic

    AI labels each email as a refund, a failed payment, a plan change or a general question. Channels and owners can follow those labels.

  • Unknown senders are flagged

    When the sender is not a Stripe customer, the message says so. That catches people writing from a different address, and the occasional phishing attempt.

How it works

What happens, step by step

  1. Every 10 minutes, ClickRuntime looks in your Gmail for new emails that match your billing search.

  2. For each new email, it finds the sender in Stripe and reads their plan, subscription status and latest invoice.

  3. AI reads the email and sorts it into a topic such as refund, failed payment or plan change, with a one-line summary.

  4. It remembers which emails it has handled, so none is posted twice.

  5. Each email is posted to your #billing Slack channel with the topic, summary and Stripe details.

Before it runs live

  • Connect Slack, then invite the app to the channel (type /invite @ClickRuntime there)
  • Connect Stripe

What you get

RunsEvery 10 minutes
Triage billing emails with the customer's Stripe statustoday, 9:00Succeeded
Slack · #billing[failed payment] Card declined on renewal from ops@northwind.example Card expired, asks how to update it. Stripe: Team plan, past_due

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

  • Act only on the items that match your own rules, and skip the rest
  • Change what the AI looks for, or how it writes the result
  • Add another app, for example also send it to Google Sheets
  • Combine it with other Slack and Stripe 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.
support_emails_triaged_with_the_customer_s_stripe_status.pyexample
import stripe
from clickruntime import on_trigger, credentials, notify, state, ai, report_fetched
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build

QUERY = "to:billing@acme.example newer_than:1d"
SCHEMA = {"type": "object", "properties": {"topic": {"type": "string", "enum": ["refund", "failed payment", "plan change", "invoice", "other"]}, "summary": {"type": "string"}}}

@on_trigger
def run(event):
    gmail = build("gmail", "v1", credentials=Credentials(credentials.connection("google", "work")), cache_discovery=False)
    seen = set(state.get("seen") or [])
    ids = [m["id"] for m in gmail.users().messages().list(userId="me", q=QUERY).execute().get("messages", []) if m["id"] not in seen]
    report_fetched(len(ids))
    if not ids:
        return {"posted": 0}
    stripe.api_key = credentials.secret("STRIPE_API_KEY")
    for mid in ids:
        msg = gmail.users().messages().get(userId="me", id=mid, format="metadata", metadataHeaders=["From", "Subject"]).execute()
        h = {x["name"]: x["value"] for x in msg["payload"]["headers"]}
        email = h["From"].split("<")[-1].strip(">").strip().lower()
        found = stripe.Customer.search(query=f"email:'{email}'", expand=["data.subscriptions"]).data
        sub = found[0].subscriptions.data[0] if found and found[0].subscriptions.data else None
        status = f"{sub.items.data[0].price.nickname or sub.items.data[0].price.id}, {sub.status}" if sub else ("customer, no subscription" if found else "not a Stripe customer")
        label = ai.generate(f"Subject: {h.get('Subject')}\n{msg['snippet']}", system="Classify this billing email.", json_schema=SCHEMA, max_output_tokens=80).json
        notify.slack(f"[{label['topic']}] {h.get('Subject')} from {email}\n{label['summary']}\nStripe: {status}", channel="#billing")
        seen.add(mid)
    state.set("seen", sorted(seen)[-500:])
    return {"posted": len(ids)}

FAQ

Common questions

Which emails count as billing emails?
Those that match a Gmail search you choose, such as messages sent to billing@ or with words like invoice, refund or payment. Everything else in your inbox is ignored.
Does it reply to the customer?
No. It posts the email and the Stripe details to Slack so a person can reply. It can also suggest a short reply in the Slack message if you ask for one.
What if the customer writes from a different address?
The message says no Stripe customer was found for that email, so the team knows to ask for the account address or search by name.
What permissions does it need?
Stripe read; chat:write. Nothing else in your accounts is used.
Does it need AI?
Yes. It uses ClickRuntime's built-in AI, so you don't need an OpenAI or Anthropic key. Every plan includes a monthly AI allowance.
How many runs does it use?
One run each time it checks. Checks that find nothing new 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 “Triage billing emails with the customer's Stripe status” from your assistant

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