Workflow
Nightly Inbox Triage
Automatically triages unread emails every night. It archives clutter, tags newsletters to read later, and sends a concise Slack digest of urgent messages.
Tags
Email AutomationInbox TriageSlack DigestTask Management
The Night Shift Inbox Janitor
This workflow automatically tidies up your Gmail inbox every night, sorting unread emails received in the last 24 hours into three categories and sending a summary to Slack. It helps you achieve Inbox Zero by archiving clutter, tagging emails to read later, and leaving urgent messages untouched.
It does seven things:
- Triggers nightly at 23:59 UTC to start the cleanup.
- Fetches up to 50 unread emails from your Gmail inbox received in the past day, retrieving only metadata.
- Slims down each email to essential details for the AI agent.
- Uses an AI model to categorize emails into Archive, Read Later, or Urgent buckets, and creates a Slack digest summarizing the results.
- Archives emails classified as spam, promotions, or no reply notifications.
- Adds a Read Later label to newsletters, blog updates, and non urgent subscriptions.
- Sends the Slack digest to a specified channel with a friendly morning briefing.
What You Need
- A Gmail account with API access configured.
- A Slack workspace with permissions to post messages to the target channel.
- The Needle platform account connected to your Gmail and Slack connectors.
- A Gmail label named Read Later already created in your account.
How The Flow Works
| Step | Description |
|---|---|
| Scheduled Trigger | Runs every night at 23:59 UTC to automate the workflow. |
| Triage Gatekeeper | Checks if the workflow is in test mode or production mode. |
| Gmail Find Email | Retrieves up to 50 unread emails from the inbox received in the last 24 hours, fetching metadata only to keep it lightweight. |
| Email Trimmer | Processes fetched emails, stripping unnecessary data and keeping only sender, subject, snippet, labels, and ID for efficient AI processing. |
| AI Inbox Triage | Analyzes trimmed emails using an AI model to categorize each email into exactly one bucket and generates a Slack digest. |
| Data Extraction | Extracts the list of Gmail message IDs to archive and the IDs that should be labeled Read Later. |
| Gmail Archive Email | Archives each email marked for archiving by message ID. |
| Gmail Add Label | Adds the Read Later label to emails marked to read later. |
| Digest Collector | Extracts the Slack digest message from the merged data or provides a default message if none is found. |
| Slack Send Message | Posts the nightly inbox cleanup digest message to the configured Slack channel. |
Output
At the end of each run, you receive a neat Slack message summarizing:
- The total number of emails processed.
- Counts of emails archived, marked to read later, and left urgent.
- A numbered list of urgent emails showing sender and subject.
- A friendly sign off to start your day.
Notes
- Make sure the Read Later Gmail label exists before running the workflow.
- The AI step relies on metadata only; emails with limited metadata may be misclassified.
- The workflow limits to 50 emails per night to manage API usage and speed.
- The time zone is fixed at UTC for scheduling; adjust as needed for your local time.
- Testing mode supports sending a mock digest without touching Gmail for safe trial runs.
Want to showcase your own workflows?
Become a Needle workflow partner and turn your expertise into recurring revenue.
