Skip to content

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.

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

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

  1. Every 10 minutes the automation reads the list of changes in the shared drive since its last check.

  2. It keeps the files that were moved to trash or removed.

  3. For each one it notes the file name and the last person who changed it.

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

RunsEvery 10 minutes
Alert Slack when a Google shared drive file is deletedtoday, 9:00Succeeded
#it-alerts · Slack🗑 3 files removed from shared drive "Finance" • FY26 forecast.xlsx · trashed by Leo Martin • Invoices/2026-10 (folder) · trashed by Leo Martin • Vendor list (Google Sheets) · trashed by Priya Shah Restore from the shared drive's trash within 30 days.

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

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.
alert_slack_when_a_google_shared_drive_file_is_deleted.pyexample
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?
It reports the trash event when it happens. A restore shows up as a normal change and is not posted, so a quick undo still leaves the alert in the channel.
What does the connected Google account need?
It has to be a member of the shared drive. Content manager or higher is enough to see trash events for every file in it.
Can I track a normal My Drive folder this way?
Yes. Drop the driveId and the change list covers the connected account's My Drive. Changes made by other people in shared folders are included when the account can see the file.
What permissions does it need?
drive.readonly; chat:write. Nothing else in your accounts is used.
Does it need AI?
No. It runs without AI, so it doesn't use your plan's 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 “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.