Every 5 minutes
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.
- Runs
- Every 5 minutes
- Apps
- Discord, Gmail
- AI
- Not needed
- Access
- Gmail readonly; Discord send
Send this to your assistant
Create a ClickRuntime automation: every 5 minutes, check my Gmail for new emails matching 'failed OR error OR alert' from my services and post a summary of each to #alerts on Discord.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
A small development team relies on emails from its hosting provider, payment processor, backup tool and build server to learn when something breaks. Those emails go to one shared inbox that only one person checks regularly. When a nightly backup fails or a payment webhook starts erroring, the rest of the team does not know until the person who reads the inbox is back online.
This automation watches the inbox for alert and failure emails and posts each one in a Discord channel the whole team already has open. Problems are seen by everyone, quickly, without sharing an inbox login.
What you get out of it
The whole team sees alerts
Failures are posted where the team already talks, not in one person's inbox. Whoever is free can pick the problem up.
Faster reaction to real problems
Alerts appear within minutes of arriving. A failed backup or payment error is handled the same day rather than discovered later.
No inbox sharing
Teammates see the subject and a preview without needing access to the mailbox. Other mail in that inbox stays private.
Each alert is posted once
Emails already posted are remembered, so a busy inbox does not cause repeat messages. The channel stays a clear list of what went wrong.
How it works
What happens, step by step
Every 5 minutes, ClickRuntime searches your Gmail for new emails that match your alert search.
Emails it has already posted are skipped; if there are no new ones, it stops there.
For each new alert, the sender, subject and a short preview are taken from the email.
A message is posted to your #alerts channel in Discord.
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
- Add an AI step, for example to summarize, sort or draft a reply
- 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, report_fetched
QUERY = "(failed OR error OR alert) newer_than:1d"
CHANNEL_ID = "your-discord-channel-id"
@on_trigger
def run(event):
gmail = build("gmail", "v1", credentials=Credentials(credentials.connection("google", "work")), cache_discovery=False)
seen = state.get("seen") or []
ids = [m["id"] for m in gmail.users().messages().list(userId="me", q=QUERY, maxResults=50).execute().get("messages", [])]
new = [i for i in ids if i not in seen]
report_fetched(len(new))
if not new:
return {"new": 0}
for mid in reversed(new):
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"]}
http.post(f"https://discord.com/api/v10/channels/{CHANNEL_ID}/messages",
headers={"Authorization": f"Bot {credentials.secret('DISCORD_BOT_TOKEN')}"},
json={"content": f"**{h.get('Subject', '')}**\nFrom: {h.get('From', '')}\n{m.get('snippet', '')[:300]}"})
state.set("seen", (seen + new)[-500:])
return {"new": len(new)}FAQ
Common questions
Which emails are forwarded?
Is the full email posted to Discord?
Can I send different alerts to different channels?
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
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.
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 worksGet email and Discord alerts when a site goes down or a domain frees up
Your sites and wished-for domains are checked every 30 minutes, and you get an email and a Discord message the moment one changes.
See how it worksKeep exploring
Set up “Post failure and alert emails to a Discord channel” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.