Quick overview
This workflow triages incoming Gmail messages with OpenAI, applies category labels, logs outcomes to Google Sheets, and posts high-priority alerts to Slack, while also drafting replies and follow-up nudges and learning sender/domain filing rules from repeated label corrections approved in Slack.
How it works
- When an inbox message arrives, the workflow reads labels from Gmail and filing rules from Google Sheets. It skips messages you sent, messages already logged, and messages carrying the ignore label.
- OpenAI classifies the email using its text and recent thread context. An approved sender rule takes priority over a domain rule. In live mode, the workflow applies the selected Gmail label.
- When a reply meets your drafting criteria and the thread has no existing draft, the workflow prepares a reply using writing samples from your sent mail. Meeting replies can include available Google Calendar times. Google Sheets records the outcome, and high-priority messages trigger a Slack alert.
- Each weekday morning, the workflow checks up to 20 recent sent threads by default. It can draft a follow-up when a reply is still expected and posts a Slack digest covering the last 24 hours of the log.
- To teach a rule, remove the original AI label and apply the intended category. By default, correcting two distinct messages from the same sender to the same category within seven days qualifies that rule for weekly Slack review. Choose a category to activate the rule, skip this review, or decline future proposals for that sender.
Setup
- Create a Google spreadsheet with two tabs named Triage log and Rules. Copy the exact column headers from the yellow setup note into the first row of each tab.
- Connect Gmail, Google Sheets, Google Calendar, OpenAI, and Slack. Select the same Google Sheets OAuth2 credential on all three Google Sheets HTTP Request nodes.
- In Set Workflow Settings, enter the spreadsheet ID, Slack channel, and calendar ID. Invite the Slack app to that channel and confirm the time zone used by the workflow.
- Run Manual Setup Trigger once to create the Gmail labels. Leave dry_run set to true and process a test email. Check its row in Triage log. When you’re ready to apply labels and create drafts, set dry_run to false, activate the workflow, and test with a new email. The first test message is already logged.
Requirements
- A Gmail mailbox with permission to read threads, manage labels, and create drafts.
- Edit access to the Google spreadsheet and access to Google Calendar availability for meeting suggestions.
- An OpenAI API credential with access to gpt-5-mini or a compatible model selected in the workflow.
- A Slack app that can post in the chosen channel and an n8n review form that approvers can open.
Customization
- Adjust categories, draft confidence, priority thresholds, meeting slots, and follow-up timing in Set Workflow Settings.
- Choose sender-based or domain-based rule learning. For listed public email domains such as gmail.com, learned rules apply to individual senders.
- Change the default weekday 08:00 digest and Monday 09:00 rule review in their respective Schedule Trigger nodes.
Additional info
You review and send email drafts yourself. During dry run, the workflow can still call OpenAI, write to Google Sheets, and post to Slack. Manual setup creates Gmail labels, and weekly reviews can save approvals or explicit declines. Skipped and expired reviews save nothing. OpenAI can receive email text, thread excerpts, sent-mail writing samples, and proposed meeting times. Slack alerts can include the sender, subject, and summary.