Every 10 minutes
Prioritise support emails from paying customers
New support emails are labelled paying, trial or unknown from Stripe, with a reply draft waiting in Gmail.
- Runs
- Every 10 minutes
- Apps
- Gmail, Stripe
- AI
- Yes, uses the built-in AI allowance
- Access
- gmail.modify; Stripe read customers/subscriptions
Send this to your assistant
Create a ClickRuntime automation: every 10 minutes, look up each new email sender in Stripe, label the email paying, trial or unknown in Gmail and draft a reply.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
A two-person SaaS team handles support from a shared Gmail inbox. Questions from customers paying hundreds a month sit between free-trial users and cold sales pitches, and the team answers in the order things arrived. A paying customer waiting a day for a reply is the kind of thing that shows up later as a cancellation.
This automation looks up each new sender in Stripe and labels the email by their status: paying, trial or unknown. Paying customers' emails can be filtered to the top, and every message gets a suggested reply saved as a Gmail draft, so the team starts from a draft instead of a blank page and always knows who they are talking to.
What you get out of it
Paying customers come first
A paying label makes it easy to answer the people who fund the business before anyone else.
Context without switching tabs
The label tells you the sender's status, so there is no need to search Stripe for each email.
Replies start from a draft
A suggested reply is waiting in Gmail, ready to edit and send.
You stay in control
Drafts are never sent automatically; a person reviews every reply.
Each email is handled once
Messages already labelled are skipped on the next check.
How it works
What happens, step by step
Every 10 minutes, ClickRuntime checks your Gmail inbox for new emails and stops straight away if there are none.
It looks each sender up in Stripe and works out whether they are paying, on a trial or unknown.
The email gets a matching label in Gmail, so you can sort and filter by it.
AI writes a suggested reply, saved as a draft in the same thread for you to review.
Before it runs live
- Connect Google through your own Google app (a one-time, 10-minute setup), so it works with your own Gmail
- 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 Slack
- Combine it with other Gmail and Stripe steps into one automation
Under the hood
The code that runs this automation
import base64
from email.message import EmailMessage
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
import stripe
from clickruntime import on_trigger, credentials, state, ai, report_fetched
@on_trigger
def run(event):
g = build("gmail", "v1", credentials=Credentials(credentials.connection("google", "work")), cache_discovery=False)
seen = set(state.get("seen") or [])
new = [m for m in g.users().messages().list(userId="me", q="in:inbox newer_than:1d").execute().get("messages", []) if m["id"] not in seen]
report_fetched(len(new))
if not new:
return {"new": 0}
stripe.api_key = credentials.secret("STRIPE_API_KEY")
for m in new:
msg = g.users().messages().get(userId="me", id=m["id"], format="metadata", metadataHeaders=["From", "Subject"]).execute()
h = {x["name"]: x["value"] for x in msg["payload"]["headers"]}
sender = h["From"].split("<")[-1].strip("> ")
subs = [s.status for c in stripe.Customer.search(query=f"email:'{sender}'", expand=["data.subscriptions"]).data for s in c.subscriptions.data]
status = "paying" if "active" in subs else "trial" if "trialing" in subs else "unknown"
g.users().messages().modify(userId="me", id=m["id"], body={"addLabelIds": [f"Label_{status.title()}"]}).execute()
reply = EmailMessage(); reply["To"], reply["Subject"] = sender, "Re: " + h.get("Subject", "")
reply.set_content(ai.generate(f"Draft a helpful support reply to a {status} customer.\nSubject: {h.get('Subject')}\n{msg['snippet']}", max_output_tokens=400).text)
g.users().drafts().create(userId="me", body={"message": {"threadId": msg["threadId"], "raw": base64.urlsafe_b64encode(reply.as_bytes()).decode()}}).execute()
state.set("seen", (list(seen) + [m["id"] for m in new])[-500:])
return {"new": len(new)}FAQ
Common questions
How does it decide paying or trial?
Will it send replies by itself?
Can I give the drafts some background on my product?
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
Ask cancelling customers why, and get a weekly churn summary
Customers who cancel get one personal question by email, their replies are sorted by reason, and you get a weekly summary.
See how it worksEmail buyers their product and receipt after a Stripe payment
As soon as someone pays, they get their download link and a receipt from your own Gmail address.
See how it worksGet yesterday's Stripe revenue in your inbox each morning
Every morning you get one email with yesterday's sales, refunds and new subscriptions, plus a two-line summary.
See how it worksKeep exploring
Set up “Prioritise support emails from paying customers” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.