Every 15 minutes
Label your Gmail by type and post important emails to Discord
New emails are sorted into your Gmail labels such as Invoice, Order and Support, and urgent or support emails are posted to your Discord #inbox channel.
- Runs
- Every 15 minutes
- Apps
- Discord, Gmail
- AI
- Yes, uses the built-in AI allowance
- Access
- Gmail modify; Discord send
Send this to your assistant
Create a ClickRuntime automation: every 15 minutes, sort my new Gmail messages into my labels, apply the label, and post urgent or support emails to #inbox on Discord.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
A two-person online business runs everything from one Gmail inbox: supplier invoices, order confirmations, customer questions and a lot of newsletters. The team talks on Discord all day but only opens the inbox a couple of times. Customer emails wait for hours between newsletters, and invoices are hard to find at the end of the month.
This automation sorts every new email into the right label and posts the urgent and support ones to Discord, so the team answers customers quickly and the inbox stays organised without anyone filing by hand.
What you get out of it
Customer emails reach the team quickly
Support and urgent emails appear in Discord, where the team already spends the day. Someone can reply within minutes. Customers notice the difference.
An inbox that sorts itself
Each email gets the label it belongs under, so invoices, orders and support are already separated. Finding last month's invoices takes one click. The inbox stays usable as volume grows.
Uses your own labels
Emails are sorted into the labels you already have in Gmail. Nothing changes in how you browse or search your mail. You can add a label and it is used from the next check.
Less noise in chat
Only urgent and support emails are posted to Discord, not every newsletter. The channel stays useful instead of becoming a second inbox. Alerts are worth reading.
Bookkeeping gets easier
With invoices consistently labelled, handing them to your accountant is quick. Missing invoices are easier to spot. Month-end takes less time.
How it works
What happens, step by step
Every 15 minutes, ClickRuntime checks your Gmail for new unread emails.
It remembers which emails it has handled, so each one is only sorted once.
AI reads the subject and opening lines and picks the best matching label from your own Gmail labels.
The label is added to the email in Gmail.
Urgent and support emails are also posted to your #inbox Discord channel with the sender and subject.
Before it runs live
- Connect Discord
- 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 Discord and Gmail steps into one automation
Under the hood
The code that runs this automation
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
from clickruntime import on_trigger, credentials, http, state, ai, report_fetched
CHANNEL_ID = "your-discord-inbox-channel-id"
ALERT = {"Support", "Urgent"}
@on_trigger
def run(event):
gmail = build("gmail", "v1", credentials=Credentials(credentials.connection("google", "work")), cache_discovery=False)
seen = state.get("seen") or []
found = gmail.users().messages().list(userId="me", q="is:unread in:inbox newer_than:2d").execute().get("messages", [])
ids = [m["id"] for m in found if m["id"] not in seen]
report_fetched(len(ids))
if not ids:
return {"summary": "Nothing new"}
labels = {l["name"]: l["id"] for l in gmail.users().labels().list(userId="me").execute()["labels"] if l["type"] == "user"}
for mid in ids:
m = gmail.users().messages().get(userId="me", id=mid, format="metadata", metadataHeaders=["From", "Subject"]).execute()
h = {x["name"]: x["value"] for x in m["payload"]["headers"]}
label = ai.generate(f"Labels: {', '.join(labels)}\nEmail: {h.get('Subject')} - {m['snippet']}\nReply with the one best label or NONE.", max_output_tokens=10).text.strip()
if label in labels:
gmail.users().messages().modify(userId="me", id=mid, body={"addLabelIds": [labels[label]]}).execute()
if label in ALERT:
http.post(f"https://discord.com/api/v10/channels/{CHANNEL_ID}/messages", headers={"Authorization": f"Bot {credentials.secret('DISCORD_BOT_TOKEN')}"},
json={"content": f"{label}: {h.get('From')} - {h.get('Subject')}"})
seen.append(mid)
state.set("seen", seen[-1000:])
return {"summary": f"{len(ids)} emails sorted"}FAQ
Common questions
Does it read emails I have already read?
What if an email does not fit any label?
Can I choose which labels go to Discord?
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
Post failure and alert emails to a Discord channel
Alert emails from your services show up in your team's Discord channel within minutes, with the subject and a short preview.
See how it worksGet a daily summary of your inbox in Discord
Each morning, a short Discord message tells you what arrived in your Gmail in the last day and what needs a reply.
See how it worksWelcome new form leads by email and alert Discord
Each new lead from your form gets a welcome email from your Gmail, and your team gets a Discord message with the details.
See how it worksKeep exploring
Set up “Label your Gmail by type and post important emails to Discord” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.