Quick overview
This workflow polls your Gmail inbox every 15 minutes, uses OpenAI to classify unread emails as URGENT, STANDARD, or SPAM, drafts reply emails for non-spam messages, posts a review notification to Slack, and logs spam messages to Google Sheets.
How it works
- Runs every 15 minutes on a schedule and fetches up to 20 unread messages from your Gmail Inbox.
- Marks each fetched Gmail message as read and extracts key fields (sender, subject, snippet, body text, thread ID) for processing.
- Sends the email content to OpenAI to return a strict JSON classification (category, action label, priority note, and suggested subject).
- Routes SPAM messages to Google Sheets to append a row in a “Spam Log” sheet and stops further processing for those emails.
- Sends URGENT and STANDARD messages to OpenAI to generate a concise, plain-text reply draft in your writing style.
- Saves the generated reply as a Gmail draft in the original thread and posts a Slack message with the triage details so you can review and send.
Setup
- Connect a Gmail OAuth2 credential and ensure the workflow has access to read Inbox messages, mark them as read, and create drafts.
- Add an OpenAI credential and customize the two system prompts to match your role, triage rules, writing voice, and signature.
- Connect a Slack credential and replace
REPLACE_ME_CHANNEL_ID with the channel ID where draft-ready alerts should be posted.
- Connect a Google Sheets credential, replace
REPLACE_ME_SHEET_ID, and create a sheet tab named “Spam Log” with columns matching the appended fields (From, Snippet, Subject, Timestamp, Message ID).
- Adjust the schedule interval and Gmail fetch limit/filters if needed, then activate the workflow.