File Gmail attachments into Box and ping Slack

Auto-sort inbound email attachments into the right Box folder by sender, share a link, and notify your team in Slack every 15 minutes.

Agentic Task
GmailBoxSlackOperationsPersonal ProductivityNotifications & AlertsDocument ProcessingEmail Automation

Build me an agent workflow that auto-files Gmail attachments into the right Box folder and posts a notification to Slack.

Trigger: cron, every 15 minutes.

Each run, the agent should:

1) Use Gmail's List Messages with a query like `has:attachment newer_than:1h -in:sent -from:me` to find recent inbound messages that have attachments. Use Get a Message (format=full) to load each one so it can read headers, the parts tree, and attachment IDs.

2) For every attachment on each qualifying message, pull the bytes with Gmail's Get Attachment (the response is base64url-encoded; decode before uploading).

3) For each attachment, find the destination Box folder using Box Search Content. Match on the sender's company name (from the From display name) and the sender's email domain. If a folder already exists, file the attachment inside it. If nothing matches, create a new folder with Box Create Folder named after the sender's domain (or the configured top-level parent's root).

4) Upload the file with Box Upload File into that folder. Then call Box Add Shared Link to File to generate a shareable URL for the uploaded file.

5) Post a single Slack message per email using Slack Send a Message to the configured channel. The message should include the sender (name plus email), the email subject, the file name(s), and the Box shared link(s). If multiple files came in on one message, group them in one Slack post rather than spamming the channel.

Filtering rules the agent must apply before uploading anything:

- Skip auto-replies (Auto-Submitted header is anything other than `no`, or subject starts with `Auto:` / `Out of Office`).

- Skip calendar invites (parts with content type `text/calendar` or `application/ics`, and `.ics` attachments).

- Skip inline signature images: anything under ~20KB whose Content-Disposition is `inline` or that has a `Content-ID` referenced from the HTML body.

- Skip any message whose Gmail message ID has already been processed (de-dupe by storing processed message IDs so the next 15-minute run never re-files the same email).

Configuration the user should be able to set when they connect the workflow:

- The Slack channel ID to notify.

- An optional top-level Box parent folder ID where all sender folders live (default: Box root, `0`).

- An optional allowlist of Gmail labels to scope to (e.g. only mail tagged `Clients`).

- An optional minimum attachment size and an optional allowed-extensions list.

Be resilient: if Box returns a name-conflict on upload, append a short timestamp to the filename and retry. If Box rate-limits (429), respect Retry-After. If a single message fails, log it and continue with the rest of the run rather than aborting the whole batch.

Operations to use: gmail.List Messages, gmail.Get a Message, gmail.Get Attachment, box.Search Content, box.Create Folder, box.Upload File, box.Add Shared Link to File, slack.Send a Message.

Additional information

What does this prompt do?
  • Watches Gmail every 15 minutes for new inbound messages with attachments and pulls the files out automatically.
  • Looks up an existing Box folder that matches the sender's company or domain, or creates a new one if none exists.
  • Uploads each attachment into the right folder, generates a shareable link, and posts a tidy notification to your Slack channel.
  • Skips noise like auto-replies, calendar invites, and tiny signature images, and remembers what it already filed so the same email is never processed twice.
What do I need to use this?
  • A Gmail account where the inbound mail lands.
  • A Box account with permission to read and write files and folders.
  • A Slack workspace and the channel you want the notifications posted to.
  • Optional: a top-level Box folder you want everything organized inside (otherwise it uses the root).
How can I customize it?
  • Change the cadence: run every 5 minutes for faster handoffs, or once an hour if your inbox is quieter.
  • Change the folder rule: match by sender domain, by the sender's company name, or by a custom label you apply in Gmail.
  • Change who hears about it: pick a different Slack channel, send a DM instead, or tag specific teammates when certain senders come in.
  • Tighten the filters: only file attachments over a certain size, only specific file types like PDFs and spreadsheets, or only mail tagged with a Gmail label.

Frequently asked questions

What kinds of attachments does it actually file?
By default it files real documents and ignores the noise: auto-replies, calendar invites, and tiny inline signature images are skipped. You can narrow it further to only PDFs, spreadsheets, or files over a certain size.
How does it decide which Box folder to use?
It searches Box for an existing folder that matches the sender's company or email domain. If it finds a match it files the attachment there. If nothing matches, it creates a new folder named after the sender and uses that going forward.
Will the same email get filed twice?
No. The workflow remembers which messages it has already processed, so even if it runs every 15 minutes it will never re-upload the same attachment.
Can I change the Slack channel it posts to?
Yes. The channel is a setting you pick when you connect Slack. You can swap it later, post to a private channel, or have it DM you instead.
Does this work if my team uses a shared inbox?
Yes. Connect the Gmail account that receives the mail you care about. You can also filter to a specific Gmail label if you only want certain conversations filed.

Stop dragging email attachments into Box by hand.

Connect Gmail, Box, and Slack once. Geni files every inbound attachment into the right folder and tells your team about it every 15 minutes.