POST that Sevalla sends to a webhook’s endpoint each time one of the events it subscribes to happens in your company, such as a deployment of an application finishing. This page describes the request your endpoint receives. To create webhooks, roll their secret and check deliveries in the dashboard, see Webhooks in the platform docs.
Request
The event type, such as
APP_DEPLOY.The event’s details. Its fields depend on
type: see Event data.Event types
Set the events a webhook receives inallowed_events when you create or update it.
allowed_events accepts the three database events, but Sevalla doesn’t send them yet. A webhook subscribed only to database events receives no deliveries.is_preview set to true.
Event data
APP_CREATE
APP_UPDATE and APP_DELETE
APP_DEPLOY
Deployment ID. Pass it to Get deployment for the details.
The pipeline stage’s name, or an empty string when the application isn’t in a pipeline.
STATIC_SITE_CREATE, STATIC_SITE_UPDATE and STATIC_SITE_DELETE
STATIC_SITE_DEPLOY
Deployment ID. Pass it to Get static site deployment for the details.
Verify requests
Thesvl-signature header contains the webhook’s signing secret itself, not a hash of the body. To check that a request comes from Sevalla, compare the header with the secret you stored, in constant time, and reject the request with 401 when it doesn’t match. Get webhook returns the secret in secret.
While a secret rollover is under way, deliveries carry the old secret until the period you chose ends, then the new one, so accept both. Roll webhook secret takes expire_in_hours from 0 (the default, which switches at once) to 24.
server.ts
Retries
When a delivery fails, Sevalla retries the event after 1 minute, 5 minutes, 10 minutes, 30 minutes, 1 hour, 2 hours, 4 hours, 8 hours, 16 hours and 1 day, each counted from the previous attempt. It retries only during the 4 days after the event, so the 10th retry, about 2 days and 8 hours after the event, is the last. If it fails too, the event isn’t sent again. See Retries in the platform docs.- Each retry is a new delivery with a new
event_delivery_idand the sameevent_id. Retries stop as soon as one delivery succeeds. - Retries go to the endpoint the webhook had when the event happened, and carry the current signing secret.
- Respond with a
2xxas soon as you’ve checked the signature, and do slow work afterwards, so a slow handler isn’t counted as a failure.
Manage webhooks with the API
A delivery’s
status is PENDING while Sevalla sends it, SUCCESS when your endpoint answered with a 2xx, and FAILED otherwise.