Skip to content

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.

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

  1. Every few minutes ClickRuntime checks your Gmail for new emails from the senders on your list.

  2. AI writes a reply based on the email and the guidance you gave it.

  3. The reply is sent in the same email thread, and the email is labelled so it is never answered twice.

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

RunsEvery 5 minutes
Reply to chosen senders with AI and log every exchangetoday, 9:00Succeeded
Gmail · Reply sentRe: March invoice. Hi Northwind team, the March invoice was sent on 2 April to accounts@northwind.example. I'll resend it today if it hasn't arrived.

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 Google Sheets 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.
ai_replies_to_chosen_senders_logged_to_a_sheet.pyexample
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?
You give a list of email addresses or domains. Only emails from those senders are answered; all other mail is ignored.
Can it save drafts instead of sending?
Yes. It can create a draft reply in Gmail for you to check and send, which many people prefer while they get comfortable with the replies.
Will someone get more than one reply to the same email?
No. Each email is answered once and marked, so later checks skip it even if it stays unread.
What permissions does it need?
Gmail gmail.modify; Sheets read+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 “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.