Every 10 minutes
Alert Slack when a Google shared drive file is deleted
Files moved to trash or removed from a Google shared drive are posted to a Slack channel every 10 minutes with who removed them and the file name.
- Runs
- Every 10 minutes
- Apps
- Google Drive, Slack
- AI
- Not needed
- Access
- drive.readonly; chat:write
Send this to your assistant
Create a ClickRuntime automation: every 10 minutes, check the "Finance" shared drive for files that were trashed or removed and post the file name, who did it and when to #it-alerts.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
Shared drives are where teams keep files that matter, and deletions there are quiet. Someone tidies up a folder, the wrong spreadsheet goes to trash, and nobody notices until a report breaks or the 30-day restore window has closed.
This automation reads the shared drive's change list every 10 minutes and posts any files that were moved to trash or removed to a Slack channel, with the name of the person who last changed each file. One message covers everything removed in that window.
IT admins, finance leads and operations teams use it as an early warning so mistakes can be undone from the trash while it is still easy.
What you get out of it
Catch mistakes within minutes
A wrong deletion shows up in Slack the same hour, long before the 30-day trash limit.
Who did it
The person who last changed the file is named, which is usually the person to ask.
Folders count
A trashed folder shows as one line, marked as a folder, so a mass deletion is obvious.
Grouped alerts
Several deletions in one window arrive as a single message.
Change list, not a scan
Using Drive's change list means even large shared drives are cheap to check.
How it works
What happens, step by step
Every 10 minutes the automation reads the list of changes in the shared drive since its last check.
It keeps the files that were moved to trash or removed.
For each one it notes the file name and the last person who changed it.
A single Slack message lists everything removed in that window.
Before it runs live
- Connect Google Drive
- Connect Slack, then invite the app to the channel (type /invite @ClickRuntime there)
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 Google Sheets
- Combine it with other Google Drive and Slack steps into one automation
Under the hood
The code that runs this automation
from clickruntime import on_trigger, credentials, http, state, notify
DRIVE_ID = "0AbCdEfFinanceDriveId"
DRIVE_NAME = "Finance"
CHANNEL = "#it-alerts"
def g(path, **params):
resp = http.get(f"https://www.googleapis.com/drive/v3{path}", params={**params, "supportsAllDrives": True},
headers={"Authorization": f"Bearer {credentials.connection('google', 'work')}"})
resp.raise_for_status()
return resp.json()
@on_trigger
def run(event):
token = state.get("page_token")
if token is None:
state.set("page_token", g("/changes/startPageToken", driveId=DRIVE_ID)["startPageToken"])
return {"baseline": True}
removed = []
while token:
page = g("/changes", pageToken=token, driveId=DRIVE_ID, includeItemsFromAllDrives=True, includeRemoved=True,
fields="nextPageToken,newStartPageToken,changes(fileId,removed,file(name,mimeType,trashed,lastModifyingUser(displayName)))")
for c in page["changes"]:
f = c.get("file") or {}
if c.get("removed") or f.get("trashed"):
kind = " (folder)" if f.get("mimeType", "").endswith("folder") else ""
who = (f.get("lastModifyingUser") or {}).get("displayName", "unknown")
removed.append(f"• {f.get('name', c['fileId'])}{kind} · trashed by {who}")
token = page.get("nextPageToken")
if not token:
state.set("page_token", page["newStartPageToken"])
if removed:
notify.slack(f"🗑 {len(removed)} file{'s' if len(removed) > 1 else ''} removed from shared drive \"{DRIVE_NAME}\"\n"
+ "\n".join(removed[:40]) + "\nRestore from the shared drive's trash within 30 days.", channel=CHANNEL)
return {"removed": len(removed)}FAQ
Common questions
Will it tell me about files that were trashed and then restored?
What does the connected Google account need?
Can I track a normal My Drive folder this way?
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 new comments on Google Drive files to Slack
New comments and replies on Google Docs, Sheets and Slides in a Drive folder are posted to a Slack channel every 5 minutes with the quoted text and a link.
See how it worksScreen CVs in Drive and post the shortlist to Slack
Every CV saved to your Candidates folder gets a score against the job and a short summary in your hiring channel.
See how it worksSummarise new Drive videos in Slack
Every video added to your Recordings folder gets a short written summary and link posted to your team's Slack channel.
See how it worksKeep exploring
Set up “Alert Slack when a Google shared drive file is deleted” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.