Skip to main content
Webhooks let Zespan push alert notifications to your own infrastructure in real time. When an alert rule fires, Zespan immediately sends a signed HTTP POST to your configured endpoint. Use webhooks to integrate with Slack, PagerDuty, OpsGenie, custom dashboards, or any HTTP endpoint.
This page covers alert webhooks — notifications for error rate, latency, and cost threshold breaches. Looking for prompt webhooks (version.created, label.assigned, version.deleted)? See Prompts → Webhooks.
Webhooks are available on the Scale plan. On Pro and Team, email notifications are available but webhook delivery is not.

Configuring a webhook URL

Webhook URLs are set per alert rule. When creating or editing an alert rule in Dashboard → Alerts, enter your endpoint URL in the Webhook URL field. The URL must:
  • Use HTTPS
  • Accept POST requests
  • Respond with a 2xx status code within 10 seconds

Payload schema

When an alert fires, Zespan sends a POST request with Content-Type: application/json and the following body:
string
Always "alert.fired" for alert webhooks.
string
The ID of the alert rule that triggered.
string
The human-readable name of the alert rule, as set in the dashboard.
string
The metric that crossed the threshold: error_rate, cost_usd, latency_ms, request_count, or token_count.
string
The comparison that triggered: ">" or "<".
number
The configured threshold value.
number
The actual metric value at the time of firing.
number
The aggregation window in minutes.
string
ISO 8601 UTC timestamp when the alert fired.
string
Direct link to the traces page for this project — include this in your Slack message for one-click investigation.
string
HMAC-SHA256 signature for verifying the payload. See below.

Verifying the signature

Every webhook payload includes a signature field in the format sha256=<hex_digest>. You should verify this before processing the payload to protect against spoofed requests. The signature is computed as:
Where webhook_secret is the signing secret shown once when you configure the webhook URL in the dashboard. Store it as an environment variable.
Use the raw request body (Buffer) for signature verification, not the parsed JSON object. Parsing changes whitespace and field ordering, which invalidates the signature.

Delivery guarantees

If all 3 delivery attempts fail, the webhook is marked as failed and no further retries are made. You can see failed deliveries in Dashboard → Alerts → Webhook history.

Integration examples

Slack

Post a formatted message to a Slack channel using an incoming webhook:

PagerDuty

Create a PagerDuty incident from an alert:

Testing your webhook endpoint

Use the Test webhook button in the alert rule editor to send a sample payload to your endpoint. The test payload uses current_value equal to threshold + 1 so your handler can distinguish it from real alerts if needed (the fired_at timestamp will also be clearly recent). Alternatively, use a tool like webhook.site to inspect raw payloads during development before wiring up your real handler.