API & SDKs
Webhooks
Subscribe to deployment and health events with signature verification.
Relay delivers signed webhook events when deployments finish, quotas change, or origin health flips. Verify signatures before acting on payloads.
Event types
| Event | When | Action |
|---|---|---|
| function.deployed | Deploy reaches ready | Invalidate caches |
| function.failed | Deploy rejected | Alert on-call |
| origin.unhealthy | Health check fails | Fail over |
| quota.warning | 80% of limit used | Plan capacity |
Verification sketch
tsverify.ts
const expected = hmacSha256(secret, rawBody);
if (!timingSafeEqual(expected, headerSignature)) {
return new Response('invalid signature', { status: 401 });
}Tip
Return 2xx quickly and process asynchronously. Slow webhook handlers are disconnected after 5 seconds.
- Store the signing secret outside source control.
- Reject timestamps older than five minutes.
- Idempotently handle duplicate deliveries.
