Every 5 minutes
Sort your inbox with AI and get urgent emails on Telegram
New emails are labelled and newsletters archived for you, and only the urgent ones reach your phone as a Telegram message.
- Runs
- Every 5 minutes
- Apps
- Gmail, Telegram
- AI
- Yes, uses the built-in AI allowance
- Access
- Gmail gmail.modify; Telegram bot token
Send this to your assistant
Create a ClickRuntime automation: every 5 minutes, classify my new emails, apply labels, archive newsletters and promotions, and send me a Telegram message with a one-line summary of anything urgent.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
A restaurant owner gets supplier orders, booking questions, staff messages and a steady stream of promotions in one Gmail inbox. During service he cannot scroll through it, so the email from the fish supplier saying tomorrow's delivery is cancelled waits until midnight.
Letting the inbox sort itself and sending only the important messages to a phone app you already check means urgent email gets seen in minutes, without living in your inbox.
What you get out of it
Urgent email reaches you anywhere
A short Telegram message with who it is from and what they need is easier to notice on a busy day than an inbox badge.
Promotions stop crowding the inbox
Newsletters and offers are labelled and archived, so the inbox holds only messages that need a person.
Labels make the backlog quicker
When you do sit down with email, it is already grouped by type, such as orders, customers and admin.
Fewer alerts, each one meaningful
Only messages judged urgent trigger a notification, so you do not learn to ignore them.
How it works
What happens, step by step
Every 5 minutes ClickRuntime checks your Gmail for new emails.
It skips emails it has already sorted.
AI reads the sender, subject and opening of each email and picks a category and how urgent it is.
Each email gets a label, newsletters and promotions are archived, and urgent ones are sent to you on Telegram with a one-line summary.
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 Telegram
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 Telegram steps into one automation
Under the hood
The code that runs this automation
import time
from clickruntime import on_trigger, credentials, http, state, ai, report_fetched
G = "https://gmail.googleapis.com/gmail/v1/users/me"
LABELS = {"customer": "Label_1", "supplier": "Label_2", "admin": "Label_3", "newsletter": "Label_4", "promo": "Label_5"}
SCHEMA = {"type": "object", "properties": {"category": {"type": "string", "enum": list(LABELS)},
"urgent": {"type": "boolean"}, "summary": {"type": "string"}}, "required": ["category", "urgent", "summary"]}
@on_trigger
def run(event):
h = {"Authorization": f"Bearer {credentials.connection('google', 'work')}"}
since = state.get("since") or 0
msgs = http.get(f"{G}/messages", headers=h, params={"q": f"in:inbox after:{since}"}).json().get("messages", [])
report_fetched(len(msgs))
if not msgs:
return {"new": 0}
bot, chat = credentials.secret("TELEGRAM_BOT_TOKEN"), credentials.secret("TELEGRAM_CHAT_ID")
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']}\nUrgent means a cancelled delivery, complaint or deadline today.",
json_schema=SCHEMA, max_output_tokens=80).json
remove = ["INBOX"] if r["category"] in ("newsletter", "promo") else []
http.post(f"{G}/messages/{m['id']}/modify", headers=h, json={"addLabelIds": [LABELS[r["category"]]], "removeLabelIds": remove})
if r["urgent"]:
http.post(f"https://api.telegram.org/bot{bot}/sendMessage", json={"chat_id": chat, "text": f"{hdr.get('From')}: {r['summary']}"})
state.set("since", int(time.time()))
return {"sorted": len(msgs)}FAQ
Common questions
What counts as urgent?
Will it delete anything?
Can I see why an email was marked urgent?
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
Answer support emails from your FAQ and escalate the rest to Telegram
Routine support questions get a reply from your FAQ within minutes, and anything the AI is unsure about is sent to you on Telegram instead.
See how it worksReply to new lead emails fast and get a Telegram ping
Each new lead email gets a personal first reply within minutes, and you get a Telegram message with the lead and how promising it looks.
See how it worksApprove supplier invoices from Telegram
Each supplier invoice email is sent to your Telegram with supplier, amount and due date, and replying 'ok' marks it Approved in Gmail.
See how it worksKeep exploring
Set up “Sort your inbox with AI and get urgent emails on Telegram” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.