Skip to content

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.

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

  1. Every 15 minutes, ClickRuntime checks your Gmail for new unread emails.

  2. It remembers which emails it has handled, so each one is only sorted once.

  3. AI reads the subject and opening lines and picks the best matching label from your own Gmail labels.

  4. The label is added to the email in Gmail.

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

RunsEvery 15 minutes
Label your Gmail by type and post important emails to Discordtoday, 9:00Succeeded
Discord · #inboxSupport: orders@acme.example - Parcel arrived damaged, order #2291

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 Discord and Gmail 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_classify_gmail_and_notify_discord.pyexample
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?
It looks at unread emails in your inbox, and remembers which ones it has handled. Emails you have already opened are left as they are.
What if an email does not fit any label?
It is left without a label and stays in your inbox as normal. Nothing is archived or deleted.
Can I choose which labels go to Discord?
Yes. By default urgent and support emails are posted, and you can add others such as orders over a certain size or emails from a key customer.
What permissions does it need?
Gmail modify; Discord send. 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 “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.