Diagnose failed workflows with OpenAI and send throttled Telegram alerts
Quick overview
Description
Quick overview This workflow triggers on n8n workflow failures, fingerprints and throttles duplicate errors, uses an OpenAI chat model to generate a structured diagnosis, and sends formatted Telegram alerts that notify loudly for high/critical issues and silently for lower-severity ones. How it works Triggers whenever a connected n8n workflow execution fails via the Error Trigger. Builds an error fingerprint from the workflow, failing node, and normalized error message, then throttles repeats during a configurable cooldown window using workflow static data. If the error is not throttled, sends the failure context (message, description, truncated stack trace, and metadata) to an OpenAI chat model to return a structured diagnosis. Formats an HTML-safe Telegram message including severity, likely cause, suggested fix, fix steps, and the number of suppressed repeats (or falls back to raw error details if the AI step fails). Routes the alert by severity and sends it to Telegram as a normal notification for critical/high issues or as a silent message for medium/low issues. If the error is throttled, records that a duplicate was suppressed and skips sending a Telegram message. Setup Add an OpenAI credential to the OpenAI Chat Model node and confirm the selected model is available for your account. Create a Telegram bot with @BotFather, add a Telegram credential in n8n, and ensure both Telegram send nodes use it. In the Configuration step, set your target telegramChatId, adjust cooldownMinutes, maxStackLines, and instanceLabel as needed. Activate this workflow, then in each workflow you want monitored set Settings → Error Workflow to this workflow so failures are forwarded here. Requirements An OpenAI API key (or swap in any other chat model sub-node) A Telegram bot token from @BotFather and your chat ID Customization Change cooldownMinutes in Configuration to mute repeats for longer or shorter Replace the Telegram nodes with Slack, Discord or email; the alert text is in $json.message Edit the AI system prompt to describe your own stack for sharper diagnoses Additional info Throttling uses workflow static data, which only persists in active (production) runs, so manual test runs always send an alert. An n8n automation workflow template by Israel.
Community Metrics
Author
Israel
Platform
web
Pricing model
free
Categories
- Automation
- AI
Tags
- n8n
- workflow
- telegram
- code
- basic-llm-chain
- openai-chat-model
- structured-output-parser
Capabilities
- 5 nodes