Skip to main content

Webhook Notifications

Get notified about important events via webhooks.

Overview

GoZen can send HTTP POST notifications to external services like Slack, Discord, or custom endpoints.

Configuration

{
"webhooks": [
{
"name": "slack-alerts",
"url": "https://hooks.slack.com/services/xxx",
"events": ["budget_warning", "provider_down"],
"enabled": true
},
{
"name": "discord-notifications",
"url": "https://discord.com/api/webhooks/xxx",
"events": ["daily_summary"],
"enabled": true
}
]
}

Supported Events

EventDescription
budget_warningBudget threshold reached (e.g., 80%)
budget_exceededBudget limit exceeded
provider_downProvider became unhealthy
provider_upProvider recovered
failoverRequest failed over to backup provider
daily_summaryDaily usage summary

Payload Format

Generic Format

{
"event": "budget_warning",
"timestamp": "2025-02-19T10:30:00Z",
"data": {
"budget_type": "daily",
"limit": 10.0,
"current": 8.5,
"percentage": 85
}
}

Slack Format

GoZen automatically formats messages for Slack webhooks with rich formatting.

Discord Format

GoZen automatically formats messages for Discord webhooks with embeds.

Custom Headers

Add custom headers for authentication:

{
"webhooks": [
{
"name": "custom-endpoint",
"url": "https://api.example.com/webhook",
"events": ["budget_exceeded"],
"headers": {
"Authorization": "Bearer xxx",
"X-Custom-Header": "value"
},
"enabled": true
}
]
}

API Endpoints

EndpointMethodDescription
/api/v1/webhooksGETList all webhooks
/api/v1/webhooksPOSTCreate webhook
/api/v1/webhooks/{name}PUTUpdate webhook
/api/v1/webhooks/{name}DELETEDelete webhook
/api/v1/webhooks/testPOSTTest a webhook