Every 5 minutes
Reply to chosen senders with AI and log every exchange
When someone on your list emails you, they get a prompt reply written by AI, and each email and reply is logged in a Google Sheet.
- Runs
- Every 5 minutes
- Apps
- Gmail, Google Sheets
- AI
- Yes, uses the built-in AI allowance
- Access
- Gmail gmail.modify; Sheets read+write
Send this to your assistant
Create a ClickRuntime automation: when an email arrives from anyone in my list, write a reply with AI, send it, and log the email and my reply in a sheet.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
A consultant gets routine questions from a handful of long-standing clients: where an invoice is, when the next report is due, how to log in to a shared portal. The answers rarely change, but each one interrupts focused work, and slow replies make clients feel ignored.
This automation watches for emails from the people you choose, replies using AI and the guidance you give it, and keeps a log of every email and reply in a sheet so you can check what was said.
What you get out of it
Clients hear back quickly
A prompt answer to a simple question keeps relationships warm, even when you are in meetings or working on something else.
Only the people you pick
Replies go only to senders on your list. Everyone else's email is left alone for you to handle.
A full record of what was sent
Every incoming email and reply is logged with the date, so you can review the answers and correct anything that needs a personal follow-up.
Fewer interruptions in the day
Routine questions stop pulling you out of deep work, and your attention goes to the emails that need you.
How it works
What happens, step by step
Every few minutes ClickRuntime checks your Gmail for new emails from the senders on your list.
AI writes a reply based on the email and the guidance you gave it.
The reply is sent in the same email thread, and the email is labelled so it is never answered twice.
The sender, subject, original text and reply are added as a row in your Google Sheet.
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 your Google Sheets account and pick the spreadsheets it may use
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 Google Sheets steps into one automation
Under the hood
The code that runs this automation
import base64
from email.mime.text import MIMEText
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
from clickruntime import on_trigger, credentials, ai, report_fetched
SENDERS = ["ops@northwind.example", "accounts@acme.example"]
SHEET_ID, LABEL_ID = "your-spreadsheet-id", "Label_AutoReplied"
GUIDE = "You are my assistant. Answer briefly and politely. If unsure, say I will follow up personally."
@on_trigger
def run(event):
creds = Credentials(credentials.connection("google", "work"))
gmail = build("gmail", "v1", credentials=creds, cache_discovery=False)
q = "newer_than:1d -label:AutoReplied (" + " OR ".join(f"from:{s}" for s in SENDERS) + ")"
msgs = gmail.users().messages().list(userId="me", q=q).execute().get("messages", [])
report_fetched(len(msgs))
if not msgs:
return {"replied": 0}
rows = []
for m in msgs:
msg = gmail.users().messages().get(userId="me", id=m["id"], format="full").execute()
hdr = {h["name"]: h["value"] for h in msg["payload"]["headers"]}
reply = ai.generate(f"Email from {hdr['From']}:\n{msg['snippet']}", system=GUIDE, max_output_tokens=400).text
mime = MIMEText(reply); mime["To"] = hdr["From"]; mime["Subject"] = "Re: " + hdr.get("Subject", "")
mime["In-Reply-To"] = hdr.get("Message-ID", "")
gmail.users().messages().send(userId="me", body={"raw": base64.urlsafe_b64encode(mime.as_bytes()).decode(),
"threadId": msg["threadId"]}).execute()
gmail.users().messages().modify(userId="me", id=m["id"], body={"addLabelIds": [LABEL_ID]}).execute()
rows.append([hdr.get("Date"), hdr["From"], hdr.get("Subject"), msg["snippet"], reply])
build("sheets", "v4", credentials=creds, cache_discovery=False).spreadsheets().values().append(
spreadsheetId=SHEET_ID, range="Log!A:E", valueInputOption="RAW", body={"values": rows}).execute()
return {"replied": len(rows)}FAQ
Common questions
How do I choose who gets replies?
Can it save drafts instead of sending?
Will someone get more than one reply to the same email?
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
Log PDF invoices from Gmail in a spreadsheet
Every invoice that arrives by email is added as a row in your Invoices sheet with supplier, date, number and total.
See how it worksScore new leads in a sheet and email the best ones
Each new lead in your sheet gets a score and a reason, and you get an email with a suggested first message for any strong one.
See how it worksLog TradingView alert emails to a Google Sheet
Every TradingView alert email becomes a row in your Signals sheet with the ticker, buy or sell signal and price.
See how it worksKeep exploring
Set up “Reply to chosen senders with AI and log every exchange” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.