Skip to content

Alerts-V2-Testing Workflow

This workflow provides automated SMS notifications to a predefined team when any n8n workflow execution fails. When an error occurs in any workflow, it captures the error details and sends formatted SMS alerts to multiple recipients via Africa's Talking SMS service.

Purpose

No business context provided yet — add a context.md to enrich this documentation.

This workflow serves as a critical monitoring and alerting system for n8n workflow failures. It ensures that key team members are immediately notified when workflows encounter errors, enabling rapid response to system issues and minimizing downtime impact on operations.

How It Works

  1. Error Detection: The workflow is triggered automatically whenever any workflow in the n8n instance encounters an error
  2. Recipient Preparation: Error data is processed and combined with a hardcoded list of 7 team members who should receive notifications
  3. SMS Delivery: Individual SMS messages are sent to each recipient containing error details, execution ID, timestamp, and a link to the execution logs

Workflow Diagram

graph TD
    A[Error Trigger] --> B[Code in JavaScript]
    B --> C[Send SMS via Africa's Talking]

    style A fill:#ff6b6b
    style B fill:#4ecdc4
    style C fill:#45b7d1

Trigger

Error Trigger: Automatically activates when any workflow execution in the n8n instance fails or encounters an error. This is a system-level trigger that monitors all workflow executions.

Nodes Used

Node Type Purpose
Error Trigger Captures error events from any failed workflow execution
Code (JavaScript) Processes error data and creates individual records for each SMS recipient
HTTP Request Sends SMS messages through Africa's Talking API

External Services & Credentials Required

Africa's Talking SMS API

  • Service: SMS delivery platform
  • Required Credentials:
    • API Key (currently hardcoded in workflow)
    • Username: toll_free_sms_ke
    • Sender ID: Educate
  • Endpoint: https://api.africastalking.com/version1/messaging

Environment Variables

This workflow currently uses hardcoded values. Consider moving these to environment variables: - AFRICASTALKING_API_KEY - AFRICASTALKING_USERNAME - SMS_SENDER_ID - ALERT_RECIPIENTS (JSON array of phone numbers and names)

Data Flow

Input

  • Error execution data from failed workflows containing:
    • Error message
    • Execution ID
    • Execution URL
    • Timestamp

Processing

  • Combines error data with recipient list (7 team members)
  • Creates individual SMS payload for each recipient

Output

  • SMS messages sent to all recipients containing:
    • System alert header
    • Error message
    • Execution ID
    • Formatted timestamp
    • Direct link to execution logs

Error Handling

This workflow does not include explicit error handling. If the SMS sending fails, there is no fallback notification mechanism. Consider adding: - Retry logic for failed SMS sends - Alternative notification channels (email, Slack) - Error logging for the alerting system itself

Known Limitations

  • Recipient list is hardcoded in the JavaScript node
  • API credentials are embedded in the workflow (security risk)
  • No retry mechanism for failed SMS deliveries
  • No rate limiting or cost controls for SMS sending
  • Single notification channel (SMS only)

No related workflows specified in the provided context.

Setup Instructions

  1. Import Workflow: Import the JSON into your n8n instance
  2. Configure Africa's Talking:
    • Sign up for Africa's Talking account
    • Obtain API key and username
    • Replace the hardcoded API key in the HTTP Request node
  3. Update Recipients:
    • Modify the recipients array in the JavaScript node
    • Add/remove team members as needed
    • Ensure phone numbers are in international format (+254...)
  4. Test the Workflow:
    • Create a test workflow that intentionally fails
    • Verify SMS notifications are received
  5. Activate: Set the workflow to active status
  6. Security Hardening:
    • Move API credentials to environment variables
    • Consider using n8n credentials store instead of hardcoded values

Note: This is a backup version of the workflow (as indicated by the name prefix). Ensure you're working with the correct production version before making changes.