Triage support emails with Gmail, OpenAI, Slack, and Google Sheets
Quick Overview This workflow monitors a labeled Gmail support inbox, uses OpenAI to classify and draft replies with thread context from Google Sheets, then posts each ticket to Slack with approval buttons and logs the Slack metadata and AI fields back to Google Sheets.
How it works Triggers when a new email arrives in Gmail with the specified Support label. Extracts key fields from the Gmail message (sender, subject, snippet/body, message ID, thread ID, and received timestamp). Looks up the Gmail thread ID in Google Sheets to detect whether the message is a follow-up and to pull the latest prior ticket context. Sends the current email plus any prior thread context to OpenAI to generate a JSON classification, risk signals, and a suggested reply draft. Parses and normalizes the OpenAI JSON output, applies safety overrides (for example low confidence, billing/refund, angry, or urgent), and assigns a ticket ID and review status. Builds and sends a Slack message (via a Slack API HTTP request) containing the summary and suggested reply with Approve/Needs Edit/Reject buttons. Merges the Slack response (channel and message timestamp) into the ticket data and appends or updates the ticket row in Google Sheets.
Setup Connect credentials for Gmail OAuth2, OpenAI API, Google Sheets OAuth2, and an HTTP Header Auth credential for your Slack API request. Create and apply a Gmail label for support emails and update the Gmail Trigger label ID to match your label. Create a Google Sheets ticket log with the required columns (such as ticket_id, gmail_thread_id, status, summary, suggested_reply, slack_channel, slack_message_ts) and set the spreadsheet ID and sheet/tab in both Google Sheets steps. Configure the Slack destination by setting the Slack channel ID in the Slack payload builder and replacing the HTTP Request URL with your Slack endpoint (for example chat.postMessage) and authorization header/token. Activate the separate “Support Approval Button Handler” workflow and set your Slack app’s Interactivity Request URL to that handler’s webhook URL.
Related Templates
AI Email Classifier & Auto-Delete for Gmail (SPAM/OFFER Cleaner)
This workflow is designed for freelancers, solopreneurs, and business owners who receive a high volume of irrelevant mes...
Generate Product Ad Copy & CTAs with GPT-4 for Slack and Airtable
⚡ AI Copywriter Pro: Instant Ad Copy & CTA Generator Transform product details into compelling marketing copy in second...
Auto-classify Gmail emails with AI and apply labels for inbox organization
Who is this for? Professionals and individuals who receive high volumes of emails, those who want to automatically organ...
🔒 Please log in to import templates to n8n and favorite templates
Workflow Visualization
Loading...
Preparing workflow renderer
Comments (0)
Login to post comments