Monitor n8n workflow health and OpenAI cost with Slack, Gmail and Sheets
Needs changesWhat this workflow does
This AI workflow has 51 nodes and runs on a schedule (every hour) (plus 2 other triggers). Along the way it connects Google Sheets, OpenAI Chat Model, OpenAI and Gmail and 1 more.
How it runs
Trigger: On a schedule (every hour) (plus 2 other triggers).
- Set Guard Mode (1h Window) (Edit Fields (Set)): sets 2 fields: mode, window_hours
- Set Digest Mode (7-Day Window) (Edit Fields (Set)): sets 2 fields: mode, window_hours
- Look Up Incident in Guard Log (Google Sheets): uses Google Sheets
- Set Monitor Config (Edit Fields (Set)): sets 15 fields: n8n_base_url, max_exec_per_hour, min_failures_for_runaway…
- Set Action Lane Config (Code): runs custom JavaScript code
- Fetch Active Workflows (HTTP Request): calls an HTTP API
- Validate Action Token (Code): runs custom JavaScript code
- Build Workflow Index (Code): runs custom JavaScript code
- Token Valid? (If): checks a condition and branches into true / false
- Fetch Executions per Workflow (HTTP Request): calls an HTTP API
…plus 34 more steps. See the full node list below.
Services it uses
Before you upgrade to n8n 3.0
1 thing in this workflow is removed in n8n 3.0. Fix it before you upgrade:
- AI Agent v1 (old agent modes) in AI Incident Triage Agent (v1.7): replace with Latest AI Agent node (Tools Agent). For SQL Agent, use a Postgres or MySQL tool with a recent AI Agent.
Rather not rewrite it? Many of these flows can be rebuilt in Make (free plan).
| Removed in 3.0 | Replace with |
|---|---|
| AI Agent v1 (old agent modes) AI Incident Triage Agent (v1.7) | Latest AI Agent node (Tools Agent). For SQL Agent, use a Postgres or MySQL tool with a recent AI Agent. |
Nodes used (16)
- Schedule Trigger
n8n-nodes-base.scheduleTrigger - Edit Fields (Set)
n8n-nodes-base.set - HTTP Request
n8n-nodes-base.httpRequest - Code
n8n-nodes-base.code - Switch
n8n-nodes-base.switch - Google Sheets
n8n-nodes-base.googleSheets - OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenAi - OpenAI
@n8n/n8n-nodes-langchain.openAi - AI Agent
@n8n/n8n-nodes-langchain.agent - Google Sheets Tool
n8n-nodes-base.googleSheetsTool - Gmail
n8n-nodes-base.gmail - Slack
n8n-nodes-base.slack - Structured Output Parser
@n8n/n8n-nodes-langchain.outputParserStructured - If
n8n-nodes-base.if - Webhook
n8n-nodes-base.webhook - Respond to Webhook
n8n-nodes-base.respondToWebhook
From the author
Quick overview This workflow monitors an n8n instance hourly and weekly by calling the n8n API to calculate execution health metrics and estimated LLM spend, then posts incident alerts to Slack, logs incidents and history to Google Sheets, and sends an…