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.
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
Every 10 minutes, ClickRuntime looks in your Gmail for new emails that match your billing search.
For each new email, it finds the sender in Stripe and reads their plan, subscription status and latest invoice.
AI reads the email and sorts it into a topic such as refund, failed payment or plan change, with a one-line summary.
It remembers which emails it has handled, so none is posted twice.
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
Build your own
Need it to work differently?
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
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?
Does it reply to the customer?
What if the customer writes from a different address?
What permissions does it need?
Does it need AI?
How many runs does it use?
Can I change how it works?
Related
You might also like
Post Stripe revenue reports in Slack
Each morning Slack shows yesterday's sales, refunds and net revenue from Stripe, compared with the day before.
See how it worksGet a monthly Stripe tax summary in Slack
On the first of each month you see the tax collected on last month's Stripe invoices, broken down by tax rate and region.
See how it worksFind duplicate customers in Stripe
Each day Slack lists any new groups of Stripe customers that share an email address, so you can merge them.
See how it worksKeep exploring
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.