Prioritize exception queues with Gemini, Google Sheets, Slack and Gmail

Go to Workflow
0 views
Built by WeblineIndia WeblineIndia
Created on June 19, 2026

Description

Quick Overview
This workflow receives a webhook trigger, reads exception records from Google Sheets, uses Google Gemini (Generative Language API) to rank and summarize them, posts a prioritized report to Slack, writes summary metrics back to Google Sheets, and emails a critical alert via Gmail when needed.

How it works
Receives a webhook request to start an exception-queue analysis run.
Reads the current exception list from a Google Sheets worksheet and stops with a “No open exceptions found” webhook response if there are no rows.
Formats the sheet rows into a structured text list and sends it to the Google Gemini API to generate a ranked, scored priority list plus summary counts.
Parses the Gemini response and builds Slack Block Kit content, an HTML email body for critical items, and fields for saving analysis metadata.
Appends or updates a summary row in a second Google Sheets worksheet with the AI summary and severity counts.
Posts the ranked exception report to a Slack channel.
If any critical exceptions are detected, sends an alert email via Gmail, then returns a JSON “Done” response to the original webhook caller with processing statistics.

Setup
Add credentials for Google Sheets OAuth2, Slack OAuth2, and Gmail OAuth2 in n8n.
Provide a Google Gemini API key and update the HTTP request to use it (preferably via an n8n credential or environment variable rather than hard-coding).
Update the Google Sheets document ID and ensure Sheet1 contains columns like ExceptionID, Title, Severity, System, and ReportedAt, and Sheet2 has columns for summary and count fields used by the workflow.
Select the target Slack channel in the Slack node and confirm it matches where you want the priority report posted.
Configure the Gmail node with the recipient(s) and ensure your webhook URL (path: /exception-trigger) is used by the system that should trigger the analysis.

Nodes Used (5)

Code
n8n-nodes-base.code
Gmail
n8n-nodes-base.gmail
Google Sheets
n8n-nodes-base.googleSheets
HTTP Request
n8n-nodes-base.httpRequest
Slack
n8n-nodes-base.slack