Automated Test Alerting for Slack

Learn how to build an automated workflow using n8n to monitor running tests for specific health metrics and receive instant alerts in Slack.

Overview:

This guide walks you through creating a daily automation that checks running tests for traffic or data issues (low visitors, SRM failures, large conversion drops, minimum orders per variant) and posts a Slack alert when a test fails health thresholds.

Softwares Used

To build this automated reporting pipeline, you will need the following tools:

  • n8narrow-up-right: The primary workflow automation platform used to connect APIs and schedule tasks.

  • Slackarrow-up-right: The final destination where the AI-generated health checks and reports will be posted.

How to Create Your Automated Test Alerts

Step 1: Get Your Intelligems API Keys

To request access and receive your API key, contact our support teamarrow-up-right.

Step 2: Create the Workflow in n8n

Node 1: Schedule Trigger

  1. Click the "+" button to add a node

  2. Search for "Schedule Trigger"

  3. Configure it:

    • Trigger Interval: "Hours"

    • Hours Between Triggers: 8 (runs 3x daily: morning, afternoon, evening)

    • Or set to 12 for 2x daily

Node 2: Create Organization List

  • Add "Code" node

  • Select "Code in JavaScript"

  • Select "Run Once for All Items"

  • Paste this code. Update it with a display name for your client & their API key:

Node 3: Get All Running Tests

  1. Click "+" after the Schedule node

  2. Search for "HTTP Request"

  3. Configure:

    • Method: GET

    • URL: https://api.intelligems.io/v25-10-beta/experiences-list

    • Authentication: None

    • Enable Send Headers

      • Name: intelligems-access-token

      • Value: {{ $json.apiKey }}

  4. Click "Execute step" to verify it works

Node 4: Filter Tests by Status = "started"

  • Add "Code" node

  • Select "Code in JavaScript"

  • Select "Run Once for All Items"

  • Update the below code so that InsertOrgId maps to match the Intelligems organization IDs of your clients (you can find these in Intelligems under Settings > General > Organization Settings), the name value is display name for your clients, and the apiKey value is the Intelligems API Key for those clients. Then paste this code into the Code section in n8n.

Node 5: Get Test Analytics Data (Loop)

  1. Add "HTTP Request" node

  2. Configure:

    • Method: GET

    • URL: https://api.intelligems.io/v25-10-beta/analytics/resource/{{ $json.experienceId }}

    • Authentication: None

    • Enable Send Headers

      • Name: intelligems-access-token

      • Value: {{ $json.apiKey }}

  3. Click "Execute step" to verify it works

Node 6: Check if below threshold

  • Add "Code" node

  • Select "Code in JavaScript"

  • Select "Run Once for All Items"

  • Update the below code so that the minTotalVisitors, minOrdersPerVariant, srmPValueThreshold, and conversionDropThreshold values match your threshold requirements. Then paste this code into the Code section in n8n.

Node 7: If hasIssues = True

  1. Add an "If" node

  2. Set the condition as {{ $json.hasIssues }} is euqal to true

Node 8: Send to Slack

  1. For the "true" response only, add a "Slack" node where the action is "Send a message"

  1. Authentication:

  • Click "Create New Credential"

  • Click "Connect my account" and follow the prompts

  1. Channel/Use:

  • Under "Send Message To" configure where you want this slack message to appear

  1. Message:

  • in "Message Text" input:

Step 3: Activate the Workflow

  1. Once everything works, click "publish" at the top to make this workflow go live!

  2. Your workflow will now run 3 times a day and notify you if an active test does not meet your threshold.

Last updated