Skip to content

Notification Channels API

Notification channels define where alerts are sent when route failures, recoveries, or other events occur.

Endpoints

MethodPathDescription
GET/api/notification-channelsList channels
POST/api/notification-channelsCreate channel
GET/api/notification-channels/{id}Get channel
PATCH/api/notification-channels/{id}Update channel
DELETE/api/notification-channels/{id}Delete channel
POST/api/notification-channels/{id}/testSend test notification

Notification Channel Object

json
{
  "id": "nch_abc123",
  "name": "Slack #alerts",
  "type": "slack",
  "config": {
    "webhookUrl": "https://hooks.slack.com/services/T.../B.../xxx"
  },
  "enabled": true,
  "lastNotifiedAt": "2024-01-15T10:30:00Z",
  "createdAt": "2024-01-01T00:00:00Z",
  "updatedAt": "2024-01-15T10:30:00Z"
}

Channel Types

Slack

json
{
  "type": "slack",
  "config": {
    "webhookUrl": "https://hooks.slack.com/services/T.../B.../xxx"
  }
}

Microsoft Teams

json
{
  "type": "teams",
  "config": {
    "webhookUrl": "https://outlook.office.com/webhook/..."
  }
}

Discord

json
{
  "type": "discord",
  "config": {
    "webhookUrl": "https://discord.com/api/webhooks/..."
  }
}

PagerDuty

json
{
  "type": "pagerduty",
  "config": {
    "routingKey": "your-pagerduty-routing-key",
    "severity": "critical"
  }
}

PagerDuty severity options: critical, error, warning, info

Email

json
{
  "type": "email",
  "config": {
    "addresses": ["[email protected]", "[email protected]"]
  }
}

Webhook

json
{
  "type": "webhook",
  "config": {
    "url": "https://yourapp.com/hookbase-alerts",
    "headers": {
      "Authorization": "Bearer your-secret"
    }
  }
}

List Channels

http
GET /api/notification-channels

Example

bash
curl https://api.hookbase.app/api/notification-channels \
  -H "Authorization: Bearer whr_your_api_key"

Response

json
{
  "data": [
    {
      "id": "nch_abc123",
      "name": "Slack #alerts",
      "type": "slack",
      "enabled": true,
      "lastNotifiedAt": "2024-01-15T10:30:00Z"
    }
  ]
}

Create Channel

http
POST /api/notification-channels

Request Body

FieldTypeRequiredDescription
namestringYesDisplay name
typestringYesChannel type: slack, teams, discord, pagerduty, email, webhook
configobjectYesType-specific configuration
enabledbooleanNoActive status (default: true)

Example

bash
curl -X POST https://api.hookbase.app/api/notification-channels \
  -H "Authorization: Bearer whr_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Slack #alerts",
    "type": "slack",
    "config": {
      "webhookUrl": "https://hooks.slack.com/services/T.../B.../xxx"
    }
  }'

Response

json
{
  "id": "nch_new123",
  "name": "Slack #alerts",
  "type": "slack",
  "config": {
    "webhookUrl": "https://hooks.slack.com/services/T.../B.../xxx"
  },
  "enabled": true,
  "createdAt": "2024-01-15T10:30:00Z"
}

Get Channel

http
GET /api/notification-channels/{id}

Returns the full channel object.

Update Channel

http
PATCH /api/notification-channels/{id}

Request Body

FieldTypeDescription
namestringDisplay name
configobjectType-specific configuration
enabledbooleanActive status

Delete Channel

http
DELETE /api/notification-channels/{id}

Response

204 No Content

Test Channel

Send a test notification to verify the channel is configured correctly.

http
POST /api/notification-channels/{id}/test

Example

bash
curl -X POST https://api.hookbase.app/api/notification-channels/nch_abc123/test \
  -H "Authorization: Bearer whr_your_api_key"

Response

json
{
  "success": true,
  "message": "Test notification sent to Slack #alerts"
}

Error Response

json
{
  "success": false,
  "error": "Failed to send notification: 403 Forbidden",
  "message": "Check that the webhook URL is correct and the integration is still active"
}

Error Responses

400 Bad Request

Invalid channel config:

json
{
  "error": "Bad Request",
  "message": "Slack webhook URL must start with https://hooks.slack.com/",
  "code": "INVALID_CONFIG"
}

Released under the MIT License.