Quick Overview
This workflow monitors Gmail for new unread emails, uses Google Gemini to classify each email’s intent, then creates Gmail draft replies and Slack alerts for questions/requests, escalates complaints with Slack and Google Tasks, and logs FYI and spam activity to Google Sheets.
How it works
- Triggers when a new unread email arrives in Gmail.
- Extracts the sender, subject, body text, and message ID, then bundles incoming emails for batch processing.
- Sends the bundled emails to Google Gemini to classify each message as Question, Request, Complaint, FYI, or Spam and to generate the required action payloads.
- Parses Gemini’s JSON response, splits it back into one item per email, and routes each email by its classified intent.
- For Question or Request emails, creates a Gmail draft reply, posts a Slack notification with a preview, and logs the action to Google Sheets.
- For Complaint emails, posts an urgent Slack alert, creates a high-priority follow-up in Google Tasks, and logs the action to Google Sheets.
- For FYI and Spam emails, skips external actions and logs the outcome to Google Sheets.
Setup
- Connect credentials for Gmail OAuth2, Google Gemini (PaLM) API, Slack OAuth2, Google Sheets OAuth2, and Google Tasks OAuth2.
- Update the Gmail trigger settings and mailbox access to match the account and unread-email behavior you want to monitor.
- Set the target Google Sheets document and ensure it has columns for Timestamp, Email ID, Sender, Subject, Intent, and Action.
- Select the Slack channels for general notifications and urgent complaint alerts.
- Choose the Google Tasks list and update the task list ID used for complaint follow-ups.