Every 5 minutes
Classify incoming email by urgency and log it in Airtable
Every new email is tagged with a category and urgency and logged in Airtable, and urgent ones are posted to you in Slack.
- Runs
- Every 5 minutes
- Apps
- Airtable, Gmail
- AI
- Yes, uses the built-in AI allowance
- Access
- Gmail gmail.readonly; Airtable write
Send this to your assistant
Create a ClickRuntime automation: classify every new email by urgency and category, log it to my Airtable Inbox table, and message me in Slack if it's urgent.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
An operations lead at a logistics firm shares an inbox with two colleagues. Customer complaints, carrier updates and invoices all mix together, and when a manager asks how many complaints came in last month, nobody can say.
Classifying every email as it arrives and keeping a log in Airtable gives you both a quick alert for urgent messages and a record you can count, filter and report on.
What you get out of it
Urgent email is never buried
Messages marked urgent are posted to Slack within minutes, wherever you are working.
A searchable log of every email
Each email becomes an Airtable record with sender, subject, category and urgency, ready to filter and report on.
Answers to 'how many' questions
Counting complaints, supplier emails or refund requests per week is a simple Airtable view.
Shared inboxes get clearer ownership
Categories make it easy to assign types of email to the right person.
How it works
What happens, step by step
Every 5 minutes ClickRuntime checks your Gmail for new emails.
It skips emails it has already logged.
AI reads each email and assigns a category, an urgency level and a one-line summary.
Each email is added to your Airtable table, and urgent ones are also posted in your Slack channel.
Before it runs live
- Connect Airtable
- Connect Google through your own Google app (a one-time, 10-minute setup), so it works with your own Gmail
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 Airtable and Gmail steps into one automation
Under the hood
The code that runs this automation
from clickruntime import on_trigger, credentials, http, state, ai, notify, report_fetched
G, AT = "https://gmail.googleapis.com/gmail/v1/users/me", "https://api.airtable.com/v0/appXXXXXXXXXXXXXX/Inbox"
SCHEMA = {"type": "object", "properties": {"category": {"type": "string", "enum": ["complaint", "carrier", "invoice", "other"]},
"urgency": {"type": "string", "enum": ["low", "normal", "urgent"]}, "summary": {"type": "string"}}, "required": ["category", "urgency", "summary"]}
@on_trigger
def run(event):
h = {"Authorization": f"Bearer {credentials.connection('google', 'work')}"}
seen = set(state.get("seen") or [])
msgs = [m for m in http.get(f"{G}/messages", headers=h, params={"q": "in:inbox newer_than:1d"}).json().get("messages", []) if m["id"] not in seen]
report_fetched(len(msgs))
if not msgs:
return {"new": 0}
at = {"Authorization": f"Bearer {credentials.secret('AIRTABLE_API_KEY')}"}
for m in msgs:
msg = http.get(f"{G}/messages/{m['id']}", headers=h, params={"format": "metadata", "metadataHeaders": ["From", "Subject"]}).json()
hdr = {x["name"]: x["value"] for x in msg["payload"]["headers"]}
r = ai.generate(f"From: {hdr.get('From')}\nSubject: {hdr.get('Subject')}\n{msg['snippet']}", json_schema=SCHEMA, max_output_tokens=80).json
http.post(AT, headers=at, json={"fields": {"From": hdr.get("From"), "Subject": hdr.get("Subject"), "Category": r["category"],
"Urgency": r["urgency"], "Summary": r["summary"], "Link": f"https://mail.google.com/mail/#all/{m['id']}"}})
if r["urgency"] == "urgent":
notify.slack(f"Urgent email from {hdr.get('From')}: {r['summary']}", channel="#ops")
seen.add(m["id"])
state.set("seen", list(seen)[-2000:])
return {"logged": len(msgs)}FAQ
Common questions
Does it store the whole email in Airtable?
Can I choose the categories?
Where do urgent alerts go?
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 emails that ask for something into Airtable tasks
Emails that ask you to do something become tasks in Airtable, with a clear title, a due date and a priority.
See how it worksScreen CVs from email into an Airtable candidate list
Application emails become Airtable records with the candidate's details and a score for the role.
See how it worksLog invoice emails as payables in Airtable
Invoices that arrive by email are read and added to your Airtable payables table with vendor, amount, due date and invoice number.
See how it worksKeep exploring
Set up “Classify incoming email by urgency and log it in Airtable” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.