Skip to content

Alerts-V2-Testing Workflow

This workflow provides automated SMS alerting for system errors, sending immediate notifications to a predefined list of team members whenever any n8n workflow execution fails. It serves as a critical monitoring and incident response system to ensure rapid awareness of system issues.

Purpose

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

This workflow appears to be part of a system monitoring infrastructure that ensures key personnel are immediately notified when workflows fail. The recipient list includes various team members with phone numbers, suggesting this is used for operational alerting in a production environment.

How It Works

  1. Error Detection: The workflow automatically triggers whenever any other workflow in the n8n instance encounters an error
  2. Recipient Processing: A JavaScript function takes the error data and creates individual notifications for each person in a predefined contact list
  3. SMS Delivery: Each notification is sent as an SMS message via Africa's Talking API, containing error details, execution ID, timestamp, and a link to the execution logs

The workflow ensures that multiple team members are simultaneously alerted to system failures, enabling rapid incident response.

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 whenever 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 Node Name Purpose
Error Trigger Error Trigger Detects workflow execution failures across the entire n8n instance
Code (JavaScript) Code in JavaScript Processes error data and creates individual notifications for each recipient
HTTP Request Send SMS via Africa's Talking Sends SMS notifications via Africa's Talking API

External Services & Credentials Required

Africa's Talking SMS API

  • Service: Africa's Talking messaging service
  • 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

⚠️ Security Note: The API key is currently hardcoded in the workflow and should be moved to a secure credential store.

Environment Variables

Currently, no environment variables are used. The following should be configured:

  • AFRICAS_TALKING_API_KEY: API key for Africa's Talking service
  • AFRICAS_TALKING_USERNAME: Username for the SMS service
  • SMS_SENDER_ID: Sender identifier for SMS messages

Data Flow

Input

  • Error Data: Automatic input from n8n's error trigger containing:
    • Execution ID
    • Error message
    • Execution URL
    • Timestamp
    • Workflow details

Processing

  • Recipient List: Hardcoded list of 7 team members with names and phone numbers
  • Message Template: Formatted alert message including error details and execution link

Output

  • SMS Messages: Individual SMS notifications sent to each recipient
  • API Responses: Status responses from Africa's Talking API for each message sent

Error Handling

This workflow itself does not include explicit error handling mechanisms. If the SMS sending fails, there's no fallback notification method. Consider adding:

  • Retry logic for failed SMS sends
  • Alternative notification channels (email, Slack)
  • Logging of notification delivery status

Known Limitations

  • Hardcoded Recipients: Contact list is embedded in the code rather than stored in a configurable location
  • Security Risk: API credentials are hardcoded in the workflow
  • No Delivery Confirmation: No verification that SMS messages were successfully delivered
  • Single Channel: Only SMS notifications - no backup communication methods
  • Rate Limiting: No protection against SMS spam if multiple workflows fail simultaneously

No related workflows identified from the current context.

Setup Instructions

  1. Import Workflow:

    • Copy the workflow JSON
    • Import into your n8n instance
    • Activate the workflow
  2. Configure Africa's Talking:

    • Sign up for Africa's Talking account
    • Obtain API key and username
    • Replace hardcoded credentials with secure credential store
  3. Update Recipients:

    • Modify the recipient list in the JavaScript node
    • Update phone numbers to match your team
    • Ensure phone numbers include country codes
  4. Security Hardening:

    • Move API key to n8n credentials
    • Update HTTP Request node to use credential reference
    • Consider encrypting sensitive data
  5. Testing:

    • Create a test workflow that intentionally fails
    • Verify SMS notifications are received
    • Check message formatting and links
  6. Monitoring:

    • Monitor SMS delivery rates
    • Set up logging for notification attempts
    • Consider implementing delivery confirmations