Quick overview
This workflow monitors Gmail for new emails, uses Groq (via the LangChain Agent node) to categorize and summarize each message and draft a reply, sends an alert email for high-priority items, and logs the analysis and draft details to Google Sheets.
How it works
- Checks Gmail every minute for new incoming emails.
- Skips processing if the email has no body content or snippet.
- Extracts the sender, subject, received date, message ID, and a truncated body (up to 3000 characters) for analysis.
- Sends the email content to Groq to return a JSON analysis with category, priority, summary, key asks, action items, suggested labels, and a draft reply.
- Parses and validates the AI JSON output, stopping if it cannot be parsed.
- Sends a Gmail alert to your chosen address when the email is marked HIGH priority, then continues.
- Appends the parsed analysis fields to a Google Sheets “Email Log” sheet and creates a Gmail draft reply only when the analysis indicates a response is required.
Setup
- Connect a Gmail OAuth2 credential with permission to read emails and create drafts, and select it in the Gmail Trigger, Alert email, and Create Draft nodes.
- Add a Groq API credential and select it in the Groq chat model node.
- Replace the alert recipient address ([email protected]) in the high-priority alert step.
- Create a Google Sheet with an “Email Log” tab, add a Google Sheets OAuth2 credential, and replace YOUR_GOOGLE_SHEET_ID with your document ID (optional if you disable logging).