Alert Channels API

Alert channels define how and where you receive notifications when monitors go down or recover. PixoMonitor supports multiple notification methods.

All alert channel endpoints require authentication. Include the Authorization: Bearer {token} header with all requests.

Supported Channel Types

TypeDescriptionRequired Config
EMAILEmail notificationsemail address
WEBHOOKCustom HTTP webhookurl
SLACKSlack workspace integrationwebhookUrl
DISCORDDiscord server integrationwebhook_url
TELEGRAMTelegram bot notificationsbot_token, chat_id
TEAMSMicrosoft Teams integrationwebhook_url
SMSSMS text messagesphone_number (E.164 format)
VOICEVoice call alertsphone_number (E.164 format)

List Alert Channels

GET/api/alert-channels

Retrieve all alert channels for the authenticated user

Headers:

HeaderValue
AuthorizationBearer {access_token}

Success Response (200 OK):

{
  "alertChannels": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "user_id": "user-uuid",
      "type": "SLACK",
      "config": {
        "webhookUrl": "https://hooks.slack.com/services/T00/B00/XXX"
      },
      "created_at": "2024-01-15T10:00:00Z",
      "updated_at": "2024-01-15T10:00:00Z"
    },
    {
      "id": "660e8400-e29b-41d4-a716-446655440001",
      "user_id": "user-uuid",
      "type": "EMAIL",
      "config": {
        "email": "ops@example.com"
      },
      "created_at": "2024-01-10T08:00:00Z",
      "updated_at": "2024-01-10T08:00:00Z"
    }
  ]
}

Create Alert Channel

POST/api/alert-channels

Create a new alert channel

Headers:

HeaderValue
AuthorizationBearer {access_token}
Content-Typeapplication/json

Request Body:

FieldTypeRequiredDescription
typestringYesChannel type (see supported types)
configobjectYesType-specific configuration

Configuration by Type

EMAIL

{
  "type": "EMAIL",
  "config": {
    "email": "alerts@example.com"
  }
}

WEBHOOK

{
  "type": "WEBHOOK",
  "config": {
    "url": "https://your-server.com/webhook/alerts"
  }
}

Webhook URLs must be publicly accessible. Private/internal IP addresses (localhost, 10.x.x.x, 192.168.x.x, etc.) are blocked for security reasons.

Webhook Payload:

{
  "monitor": {
    "id": "monitor-uuid",
    "name": "Production API",
    "url": "https://api.example.com/health",
    "type": "HTTPS"
  },
  "status": "DOWN",
  "error": "Connection timeout after 10000ms",
  "checkedAt": "2024-01-15T10:30:00Z"
}

SLACK

{
  "type": "SLACK",
  "config": {
    "webhookUrl": "https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX"
  }
}

Create a Slack Incoming Webhook at: https://api.slack.com/messaging/webhooks

DISCORD

{
  "type": "DISCORD",
  "config": {
    "webhook_url": "https://discord.com/api/webhooks/000000000000000000/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
  }
}

TELEGRAM

{
  "type": "TELEGRAM",
  "config": {
    "bot_token": "123456789:ABCdefGHIjklMNOpqrsTUVwxyz",
    "chat_id": "-1001234567890"
  }
}

Create a Telegram bot via @BotFather. The chat_id can be a user ID, group ID, or channel ID (prefix group/channel with -100).

TEAMS (Microsoft Teams)

{
  "type": "TEAMS",
  "config": {
    "webhook_url": "https://outlook.office.com/webhook/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX@XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/IncomingWebhook/..."
  }
}

SMS

{
  "type": "SMS",
  "config": {
    "phone_number": "+14155551234"
  }
}

VOICE

{
  "type": "VOICE",
  "config": {
    "phone_number": "+14155551234"
  }
}

Phone numbers must be in E.164 format: + followed by country code and number (e.g., +14155551234 for US numbers). No spaces, dashes, or parentheses.

Success Response (201 Created):

{
  "alertChannel": {
    "id": "770e8400-e29b-41d4-a716-446655440002",
    "user_id": "user-uuid",
    "type": "SLACK",
    "config": {
      "webhookUrl": "https://hooks.slack.com/services/T00/B00/XXX"
    },
    "created_at": "2024-01-15T12:00:00Z",
    "updated_at": "2024-01-15T12:00:00Z"
  }
}

Error Responses:

StatusErrorDescription
400Email address is requiredMissing email for EMAIL type
400Webhook URL is requiredMissing URL for WEBHOOK type
400Slack webhook URL is requiredMissing webhookUrl for SLACK
400Discord webhook URL is requiredMissing webhook_url for DISCORD
400Telegram bot token is requiredMissing bot_token for TELEGRAM
400Telegram chat ID is requiredMissing chat_id for TELEGRAM
400Microsoft Teams webhook URL is requiredMissing webhook_url for TEAMS
400Phone number is requiredMissing phone_number for SMS/VOICE
400Phone number must be in E.164 formatInvalid phone format
400Invalid webhook URL: Hostname 'localhost' is not allowedSSRF protection
400Invalid webhook URL: IP address is in a private/internal rangeSSRF protection

Update Alert Channel

PUT/api/alert-channels/:id

Update an existing alert channel's configuration

Path Parameters:

ParameterTypeDescription
idUUIDAlert channel ID

Headers:

HeaderValue
AuthorizationBearer {access_token}
Content-Typeapplication/json

Request Body:

FieldTypeRequiredDescription
configobjectNoUpdated configuration

Request Example:

{
  "config": {
    "webhookUrl": "https://hooks.slack.com/services/T00/B00/NEW-HOOK"
  }
}

Success Response (200 OK):

{
  "alertChannel": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "user_id": "user-uuid",
    "type": "SLACK",
    "config": {
      "webhookUrl": "https://hooks.slack.com/services/T00/B00/NEW-HOOK"
    },
    "created_at": "2024-01-15T10:00:00Z",
    "updated_at": "2024-01-16T14:00:00Z"
  }
}

Delete Alert Channel

DELETE/api/alert-channels/:id

Delete an alert channel

Path Parameters:

ParameterTypeDescription
idUUIDAlert channel ID

Headers:

HeaderValue
AuthorizationBearer {access_token}

Success Response (200 OK):

{
  "message": "Alert channel deleted"
}

Test Alert Channel

POST/api/alert-channels/:id/test

Send a test notification to verify the channel works

Path Parameters:

ParameterTypeDescription
idUUIDAlert channel ID

Headers:

HeaderValue
AuthorizationBearer {access_token}

Success Response (200 OK):

{
  "success": true,
  "message": "Test alert sent to SLACK channel"
}

For email channels:

{
  "success": true,
  "message": "Test email sent to alerts@example.com"
}

Error Responses:

StatusErrorDescription
404Alert channel not foundInvalid ID or not owned by user
500Error messageFailed to send test (details in message)

Always test your alert channels after creating them to ensure notifications are delivered correctly.


Test Email Directly

POST/api/alert-channels/test-email

Send a test email without creating an alert channel

Headers:

HeaderValue
AuthorizationBearer {access_token}
Content-Typeapplication/json

Request Body:

{
  "email": "test@example.com"
}

Success Response (200 OK):

{
  "success": true,
  "message": "Test email sent to test@example.com"
}

Security: SSRF Protection

To prevent Server-Side Request Forgery (SSRF) attacks, webhook URLs are validated against private/internal IP ranges.

Blocked Hostnames:

  • localhost
  • 0.0.0.0
  • *.local
  • *.localhost
  • *.internal

Blocked IP Ranges:

  • 127.0.0.0/8 (Loopback)
  • 10.0.0.0/8 (Private)
  • 172.16.0.0/12 (Private)
  • 192.168.0.0/16 (Private)
  • 169.254.0.0/16 (Link-local, includes AWS metadata)
  • ::1 (IPv6 Loopback)
  • fe80::/10 (IPv6 Link-local)
  • fc00::/7 (IPv6 Private)

Alert Message Format

Down Alert

When a monitor goes down, alerts include:

FieldDescription
Monitor NameName of the failing monitor
Monitor URLThe URL being monitored
Monitor TypeHTTP, HTTPS, TCP, etc.
StatusDOWN
ErrorSpecific error message
Checked AtTimestamp of the failing check

Recovery Alert

When a monitor recovers:

FieldDescription
Monitor NameName of the recovered monitor
Monitor URLThe URL being monitored
StatusUP
Downtime DurationHow long the monitor was down
Checked AtTimestamp of the recovery check

Error Responses Summary

StatusErrorDescription
400Validation errorsMissing or invalid configuration
400Invalid webhook URL: *SSRF protection triggered
404Alert channel not foundInvalid ID or not owned by user
500Failed to fetch/create/update/delete alert channelServer error
500Failed to send test alertTest notification failed