Skip to content

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.

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 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

  1. Every 10 minutes, ClickRuntime checks your Gmail inbox for new emails and stops straight away if there are none.

  2. It looks each sender up in Stripe and works out whether they are paying, on a trial or unknown.

  3. The email gets a matching label in Gmail, so you can sort and filter by it.

  4. 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

RunsEvery 10 minutes
Prioritise support emails from paying customerstoday, 9:00Succeeded
Gmail · PayingExport to CSV not working (Acme Retail, paying). Draft ready: 'Hi Jamie, thanks for flagging this. Could you tell me which report you were exporting?'

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 Slack
  • Combine it with other Gmail 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.
triage_support_emails_by_stripe_customer_status.pyexample
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?
It finds the sender's email in Stripe and looks at their subscriptions. An active subscription means paying, a trialing one means trial, and no customer record means unknown.
Will it send replies by itself?
No. Replies are saved as drafts in the email thread for you to review and send.
Can I give the drafts some background on my product?
Yes. Give your AI assistant a short description of your product, your tone and common answers, and the drafts will use it.
What permissions does it need?
gmail.modify; Stripe read customers/subscriptions. 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 “Prioritise support emails from paying customers” from your assistant

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