Demo
REFERENCE

testzeus-notifications

AUTO-GENERATEDBUILD 2026.12.05

Configure notification channels for test results in TestZeus.

Category: integration · Version: 1.0.0 · Requires: testzeus-auth

Triggers: notification, email alert, webhook, slack, jira, alert, notify, channel, notification channel, pagerduty, opsgenie, teams

Overview

Notification channels in TestZeus allow you to receive alerts when tests complete, suites finish, or reports are generated. Channels can include email addresses, webhooks, and integrations with third-party services.

Quick Reference

bash
# Email channel
testzeus notification create \
  --name "QA Team" \
  --emails "qa@example.com,team@example.com"

# Webhook channel
testzeus notification create \
  --name "CI Pipeline" \
  --webhooks "https://ci.example.com/webhook"

# Combined channel
testzeus notification create \
  --name "All Alerts" \
  --emails "team@example.com" \
  --webhooks "https://hooks.example.com"

# List channels
testzeus notification list

# Update
testzeus notification update channel_id \
  --is-default true

# Delete
testzeus notification delete channel_id

Channel Types

Email Notifications

bash
# Single email
testzeus notification create \
  --name "Dev Team" \
  --emails "dev@example.com"

# Multiple emails
testzeus notification create \
  --name "QA Team" \
  --emails "qa1@example.com,qa2@example.com,lead@example.com"

# With default flag
testzeus notification create \
  --name "Default Alerts" \
  --emails "team@example.com" \
  --is-default true

Webhook Notifications

bash
# Single webhook
testzeus notification create \
  --name "CI Webhook" \
  --webhooks "https://ci.example.com/testzeus/webhook"

# Multiple webhooks
testzeus notification create \
  --name "Multi Pipeline" \
  --webhooks "https://hooks1.example.com,https://hooks2.example.com"

# Slack webhook format
testzeus notification create \
  --name "Slack Alerts" \
  --webhooks "https://hooks.slack.com/services/XXX/YYY/ZZZ"

Third-Party Integrations

Slack

bash
# Use Slack incoming webhook URL
testzeus notification create \
  --name "Slack #qa-alerts" \
  --webhooks "https://hooks.slack.com/services/XXX/YYY/ZZZ"

Microsoft Teams

bash
# Use Teams incoming webhook URL
testzeus notification create \
  --name "Teams QA" \
  --webhooks "https://outlook.office.com/webhook/..."

PagerDuty

bash
# Use PagerDuty events API endpoint
testzeus notification create \
  --name "PagerDuty" \
  --webhooks "https://events.pagerduty.com/v2/enqueue"

OpsGenie

bash
# Use OpsGenie webhook URL
testzeus notification create \
  --name "OpsGenie" \
  --webhooks "https://app.opsgenie.com/webhooks/..."

Create Notification Channel

Basic Email Channel

bash
testzeus notification create \
  --name "QA Team Alerts" \
  --emails "qa-team@example.com" \
  --is-active true

Webhook Channel

bash
testzeus notification create \
  --name "CI/CD Integration" \
  --webhooks "https://ci.example.com/webhooks/testzeus" \
  --is-active true

Combined Channel

bash
testzeus notification create \
  --name "Full Alert Stack" \
  --emails "team@example.com,lead@example.com" \
  --webhooks "https://hooks.example.com/slack,https://hooks.example.com/teams" \
  --is-active true \
  --is-default true

With Filtering

Some channels can be filtered to receive only specific alerts:

bash
# Critical alerts only
testzeus notification create \
  --name "Critical Only" \
  --emails "oncall@example.com" \
  --filters "priority=critical"

Manage Channels

List Channels

bash
# List all
testzeus notification list

# Get details
testzeus notification get channel_id

Update Channel

bash
# Update emails
testzeus notification update channel_id \
  --emails "new@example.com,another@example.com"

# Update webhooks
testzeus notification update channel_id \
  --webhooks "https://new-webhook.example.com"

# Enable/disable
testzeus notification update channel_id \
  --is-active false

# Set as default
testzeus notification update channel_id \
  --is-default true

# Remove from default
testzeus notification update channel_id \
  --is-default false

Delete Channel

bash
testzeus notification delete channel_id

Use with Schedules

Attach to Report Schedule

bash
testzeus schedule create \
  --name "Daily Report" \
  --cron-expression "0 9 * * *" \
  --notification-channels channel_id_1,channel_id_2

Attach to Suite Schedule

bash
testzeus test-suite-schedules create \
  --name "Daily Checkout" \
  --test-suite suite_id \
  --cron-expression "0 9 * * *" \
  --notification-channels channel_id

Webhook Payload

When a webhook is triggered, it receives a payload like:

json
{
  "event": "test_run_completed",
  "timestamp": "2024-03-24T10:30:00Z",
  "data": {
    "run_id": "run_123",
    "name": "Checkout Suite",
    "status": "completed",
    "passed": 24,
    "failed": 1,
    "duration": "4m 23s"
  },
  "links": {
    "dashboard": "https://app.testzeus.ai/runs/run_123",
    "report": "https://app.testzeus.ai/runs/run_123/report"
  }
}

Event Types

Event Description
test_run_started A test run began
test_run_completed A test run finished
test_run_failed A test run failed
suite_started A suite run began
suite_completed A suite run finished
report_generated A scheduled report was generated

SDK Usage

python
from testzeus_sdk import TestZeusClient

async def main():
    async with TestZeusClient() as client:
        # Create email channel
        email_channel = await client.notification_channels.create_notification_channel(
            name="QA Team",
            display_name="QA Team Alerts",
            emails=["qa1@example.com", "qa2@example.com"],
            is_active=True
        )

        # Create webhook channel
        webhook_channel = await client.notification_channels.create_notification_channel(
            name="CI Pipeline",
            emails=["ci@example.com"],
            webhooks=["https://ci.example.com/webhook"],
            is_active=True
        )

        # List channels
        channels = await client.notification_channels.get_list()

        # Update
        await client.notification_channels.update_notification_channel(
            channel_id,
            is_default=True
        )

        # Delete
        await client.notification_channels.delete(channel_id)

Best Practices

1. Separate Alert Levels

bash
# Critical failures only - page people
testzeus notification create \
  --name "PagerDuty Critical" \
  --webhooks "https://events.pagerduty.com/..."

# All results - email team
testzeus notification create \
  --name "Team Email" \
  --emails "team@example.com"

# Reports only - leadership
testzeus notification create \
  --name "Weekly Summary" \
  --emails "leadership@example.com"

2. Use Descriptive Names

bash
# Good
--name "Slack #qa-alerts"
--name "PagerDuty Production"
--name "Email QA Team"

# Avoid
--name "channel1"
--name "test"
--name "notify"

3. Set Default Channel

bash
# Only one should be default
testzeus notification update channel_id --is-default true

Common Workflows

CI/CD Pipeline Integration

bash
# 1. Create webhook channel
testzeus notification create \
  --name "GitHub Actions" \
  --webhooks "https://github.com/webhooks/testzeus"

# 2. Attach to suite schedule
testzeus test-suite-schedules create \
  --name "CI Checks" \
  --test-suite ci_suite_id \
  --cron-expression "0 * * * *" \
  --notification-channels github_actions_channel_id

On-Call Rotation

bash
# 1. Create PagerDuty channel
testzeus notification create \
  --name "On-Call" \
  --webhooks "https://events.pagerduty.com/..."

# 2. Attach to critical suites
testzeus test-suite-schedules create \
  --name "Critical Path" \
  --test-suite critical_suite_id \
  --cron-expression "0 9 * * *" \
  --notification-channels oncall_channel_id

Daily Summary

bash
# 1. Create email channel
testzeus notification create \
  --name "Daily Summary" \
  --emails "team@example.com"

# 2. Attach to report schedule
testzeus schedule create \
  --name "Evening Report" \
  --cron-expression "0 18 * * *" \
  --notification-channels daily_summary_channel_id

Error Handling

Common Errors

Error Cause Solution
Invalid webhook URL Malformed URL Check URL format
Webhook unreachable URL not accessible Test webhook endpoint
Email invalid Malformed email Check email addresses

Test Webhook

Always test your webhook before using in production:

bash
# Send test notification (if supported)
curl -X POST https://your-webhook-url \
  -H "Content-Type: application/json" \
  -d '{"event": "test", "message": "Test from TestZeus"}'

Component Schema

Use NotificationChannel component:

json
{
  "component": "NotificationChannel",
  "props": {
    "name": "QA Team",
    "type": "email",
    "emails": ["qa@example.com"],
    "webhooks": [],
    "isActive": true,
    "isDefault": false
  }
}
json
{
  "component": "NotificationChannel",
  "props": {
    "name": "CI Webhook",
    "type": "webhook",
    "emails": [],
    "webhooks": ["https://ci.example.com/webhook"],
    "isActive": true,
    "isDefault": true
  }
}