Every 15 minutes
Sort new emails, draft replies and create tasks
New emails are labelled, simple questions get a draft reply, and anything you need to do becomes a Google Task.
- Runs
- Every 15 minutes
- Apps
- Gmail, Google Tasks
- AI
- Yes, uses the built-in AI allowance
- Access
- gmail.modify, gmail.compose; tasks
Send this to your assistant
Create a ClickRuntime automation: every 15 minutes, label my new emails as action, reply or FYI, save a draft reply for the ones I should answer, and create a Google Task for anything I need to do.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
A full inbox mixes three kinds of email: ones to answer, ones that need work, and ones to read later. Sorting them by eye takes the first hour of many working days, and the replies that only need two lines wait the longest.
Consultants, founders and anyone who handles customer or client email alone use it to start the day with replies already drafted and real work already on a list.
What you get out of it
Short replies are already written
A draft sits in Gmail for each email that only needs an answer. You read, adjust and send.
Work goes on a list
Emails that need more than a reply become Google Tasks, so they are tracked instead of re-read.
Nothing is sent without you
Drafts stay drafts. You decide what goes out and when.
Labels show what was handled
Each email gets a label for its category, so you can see at a glance what has been sorted.
How it works
What happens, step by step
Every 15 minutes, ClickRuntime looks for new emails in your Gmail inbox that it has not sorted yet.
AI decides whether each one needs a reply, needs work, or is just for your information.
Emails that need a reply get a draft saved in Gmail; emails that need work become a Google Task.
Each email gets a label for its category, so it is never sorted twice.
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 Google Tasks
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 Tasks steps into one automation
Under the hood
The code that runs this automation
import base64
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
from clickruntime import on_trigger, report_fetched, credentials, ai
LABELS = {"reply": "Label_reply", "action": "Label_action", "fyi": "Label_fyi"}
SCHEMA = {"type": "object", "properties": {"category": {"enum": list(LABELS)}, "task": {"type": "string"}, "reply": {"type": "string"}}}
@on_trigger
def run(event):
creds = Credentials(credentials.connection("google", "work"))
gmail = build("gmail", "v1", credentials=creds, cache_discovery=False).users()
new = gmail.messages().list(userId="me", q="in:inbox has:nouserlabels newer_than:2d").execute().get("messages", [])
report_fetched(len(new))
if not new:
return {"new": 0}
for m in new:
msg = gmail.messages().get(userId="me", id=m["id"], format="metadata", metadataHeaders=["From", "Subject"]).execute()
h = {x["name"]: x["value"] for x in msg["payload"]["headers"]}
out = ai.generate(f"Classify this email as reply, action or fyi. For reply, write a short polite answer. For action, "
f"write a task title.\nFrom: {h.get('From')}\nSubject: {h.get('Subject')}\n{msg['snippet']}",
json_schema=SCHEMA, max_output_tokens=300).json
if out["category"] == "reply":
raw = f"To: {h.get('From')}\r\nSubject: Re: {h.get('Subject', '')}\r\n\r\n{out['reply']}"
gmail.drafts().create(userId="me", body={"message": {"threadId": msg["threadId"],
"raw": base64.urlsafe_b64encode(raw.encode()).decode()}}).execute()
if out["category"] == "action":
build("tasks", "v1", credentials=creds, cache_discovery=False).tasks().insert(tasklist="@default", body={"title": out["task"]}).execute()
gmail.messages().modify(userId="me", id=m["id"], body={"addLabelIds": [LABELS[out["category"]]]}).execute()
return {"sorted": len(new)}FAQ
Common questions
Will it send replies on its own?
Can drafts sound like me?
What does it skip?
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
Turn emailed meeting notes into tasks and a recap
When meeting notes reach your inbox, each action item becomes a Google Task and attendees get a short recap email.
See how it worksGet a payment task for every invoice in your inbox
Each invoice email becomes a Google Task due on its payment date, with the supplier and amount in the title.
See how it worksGet your Google Tasks ranked by priority each morning
Each morning an email lists your open Google Tasks in the order to tackle them, with a line on why the top ones matter.
See how it worksKeep exploring
Set up “Sort new emails, draft replies and create tasks” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.