Error Workflow¶
This workflow provides automated error monitoring and alerting for n8n workflow failures. When any workflow in the system encounters an error, it immediately notifies both a Slack channel and a predefined list of team members via SMS, ensuring critical issues are addressed promptly.
Purpose¶
No business context provided yet — add a context.md to enrich this documentation.
This workflow serves as a centralized error monitoring system for all n8n workflows. It ensures that when any workflow fails, the development and operations team is immediately notified through multiple channels (Slack and SMS) to minimize downtime and enable rapid response to system issues.
How It Works¶
- Error Detection: The workflow is triggered automatically whenever any other workflow in the n8n instance encounters an error
- Parallel Notification: Upon error detection, the workflow simultaneously sends a notification to Slack and prepares SMS notifications
- Contact Mapping: The error data is mapped to a predefined list of 7 team members who need to be notified
- Multi-Channel Alerts: Each team member receives an SMS alert while the team Slack channel gets a formatted notification
- Detailed Information: Both notifications include the error message, execution ID, timestamp, and a direct link to the execution logs
Workflow Diagram¶
graph TD
A[Error Trigger] --> B[Notify Slack]
A --> C[Map Error Message To Contacts]
C --> D[Send SMS To Contacts]
Trigger¶
Error Trigger: This workflow uses n8n's built-in Error Trigger node, which automatically activates whenever any other workflow in the same n8n instance fails or encounters an error during execution.
Nodes Used¶
| Node Type | Node Name | Purpose |
|---|---|---|
| Error Trigger | Error Trigger | Detects when any workflow fails and captures error details |
| HTTP Request | Notify Slack | Sends formatted error alert to Slack webhook |
| Code | Map Error Message To Contacts | Duplicates error data for each team member contact |
| HTTP Request | Send SMS To Contacts | Sends SMS alerts via Africa's Talking API |
External Services & Credentials Required¶
Slack Integration¶
- Slack Webhook URL:
https://hooks.slack.com/services/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 - Required: Valid Slack webhook URL for the target channel
Africa's Talking SMS Service¶
- API Endpoint:
https://api.africastalking.com/version1/messaging - Required Credentials:
- API Key (currently hardcoded - should be moved to environment variables)
- Username:
toll_free_sms_ke - Sender ID:
Educate
Environment Variables¶
Currently, sensitive data is hardcoded in the workflow. The following should be moved to environment variables:
AFRICASTALKING_API_KEY: Africa's Talking API keySLACK_WEBHOOK_URL: Slack webhook URL for notificationsAFRICASTALKING_USERNAME: Africa's Talking usernameSMS_SENDER_ID: SMS sender identifier
Data Flow¶
Input¶
The Error Trigger automatically receives: - Execution ID of the failed workflow - Error message and stack trace - Workflow information (ID, name) - Execution context and timestamp - Direct URL to execution logs
Output¶
- Slack Notification: Formatted alert message with error details
- SMS Notifications: Individual SMS messages sent to 7 predefined contacts
- Contact List: Currently includes Vivian Mosomi, Morris Ndungu, Sam, Edith Warenga, Kago Kagichiri, Francis, and Elijah
Error Handling¶
This workflow itself has minimal error handling. If the Slack or SMS notifications fail, there's no fallback mechanism. Consider adding: - Retry logic for failed API calls - Alternative notification channels if primary ones fail - Logging of notification delivery status
Known Limitations¶
- API keys are hardcoded in the workflow (security risk)
- Contact list is hardcoded in the JavaScript code
- No retry mechanism for failed notifications
- No delivery confirmation for SMS messages
- Single Slack channel notification (no escalation)
Related Workflows¶
This workflow monitors all other workflows in the n8n instance. Any workflow that fails will trigger this error notification system.
Setup Instructions¶
- Import Workflow: Import this JSON into your n8n instance
- Configure Slack Webhook:
- Create a Slack webhook in your workspace
- Replace the webhook URL in the "Notify Slack" node
- Set Up Africa's Talking:
- Sign up for Africa's Talking SMS service
- Replace the API key in the "Send SMS To Contacts" node
- Update the username if different from
toll_free_sms_ke
- Update Contact List:
- Modify the recipients array in the "Map Error Message To Contacts" node
- Add or remove team members as needed
- Ensure phone numbers are in international format (+254...)
- Activate Workflow: Enable the workflow to start monitoring for errors
- Test: Trigger a test error in another workflow to verify notifications work
Security Note: After setup, move all API keys and sensitive URLs to environment variables or n8n credentials for better security.