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.

Last updated

March 16, 2026

Connectors used

Slack
Google Mail

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:

  1. Triggers nightly at 23:59 UTC to start the cleanup.
  2. Fetches up to 50 unread emails from your Gmail inbox received in the past day, retrieving only metadata.
  3. Slims down each email to essential details for the AI agent.
  4. Uses an AI model to categorize emails into Archive, Read Later, or Urgent buckets, and creates a Slack digest summarizing the results.
  5. Archives emails classified as spam, promotions, or no reply notifications.
  6. Adds a Read Later label to newsletters, blog updates, and non urgent subscriptions.
  7. Sends the Slack digest to a specified channel with a friendly morning briefing.

What You Need

  1. A Gmail account with API access configured.
  2. A Slack workspace with permissions to post messages to the target channel.
  3. The Needle platform account connected to your Gmail and Slack connectors.
  4. A Gmail label named Read Later already created in your account.

How The Flow Works

StepDescription
Scheduled TriggerRuns every night at 23:59 UTC to automate the workflow.
Triage GatekeeperChecks if the workflow is in test mode or production mode.
Gmail Find EmailRetrieves up to 50 unread emails from the inbox received in the last 24 hours, fetching metadata only to keep it lightweight.
Email TrimmerProcesses fetched emails, stripping unnecessary data and keeping only sender, subject, snippet, labels, and ID for efficient AI processing.
AI Inbox TriageAnalyzes trimmed emails using an AI model to categorize each email into exactly one bucket and generates a Slack digest.
Data ExtractionExtracts the list of Gmail message IDs to archive and the IDs that should be labeled Read Later.
Gmail Archive EmailArchives each email marked for archiving by message ID.
Gmail Add LabelAdds the Read Later label to emails marked to read later.
Digest CollectorExtracts the Slack digest message from the merged data or provides a default message if none is found.
Slack Send MessagePosts 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:

  1. The total number of emails processed.
  2. Counts of emails archived, marked to read later, and left urgent.
  3. A numbered list of urgent emails showing sender and subject.
  4. A friendly sign off to start your day.

Notes

  1. Make sure the Read Later Gmail label exists before running the workflow.
  2. The AI step relies on metadata only; emails with limited metadata may be misclassified.
  3. The workflow limits to 50 emails per night to manage API usage and speed.
  4. The time zone is fixed at UTC for scheduling; adjust as needed for your local time.
  5. 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.

Try Needle today

Streamline AI productivity at your company today

Join thousands of people who have transformed their workflows.

Agentic workflowsAutomations, meet AI agents
AI SearchAll your data, searchable
Chat widgetsDrop-in widget for your website
Developer APIMake your app talk to Needle
    Needle LogoNeedle
    Like many websites, we use cookies to enhance your experience, analyze site traffic and deliver personalized content while you are here. By clicking "Accept", you are giving us your consent to use cookies in this way. Read our more on our cookie policy .