Agent skill
Bunny Stream Webhooks Skill
Receive and verify Bunny Stream webhooks. Use when setting up Bunny Stream webhook handlers, debugging X-BunnyStream-Signature verification, or handling video encoding events like Status 3 (Finished / encoding done), Status 5 (Failed), or captions and title/description generation.
Install this skill
npx skills add hookdeck/webhook-skills --skill bunny-stream-webhooks
When to Use This Skill
- Setting up Bunny Stream webhook handlers
- How do I verify Bunny Stream webhook signatures?
- Debugging
X-BunnyStream-Signatureverification failures - Handling video state changes (encoding finished, encoding failed)
- Reacting to
Status 3(Finished),Status 5(Failed), captions, or title/description events
Verification (core)
Bunny Stream signs the exact raw request body with HMAC-SHA256, keyed on your video library's Read-Only API key, and sends the digest as lowercase hex in the X-BunnyStream-Signature header. Verify against the unparsed raw body (do NOT re-serialize the JSON — whitespace or key-order changes break the digest) and compare timing-safe.
This is a custom scheme, not Standard Webhooks (no
webhook-id/webhook-timestamp/webhook-signature). Bunny's own steps also check thatX-BunnyStream-Signature-Versionisv1andX-BunnyStream-Signature-Algorithmishmac-sha256before computing the digest. There is no official SDK, so verify manually.
Node:
const crypto = require('crypto');
function verifyBunnyStream(rawBody, signatureHeader, secret) {
if (!signatureHeader) return false;
const expected = crypto.createHmac('sha256', secret).update(rawBody).digest('hex');
try {
return crypto.timingSafeEqual(
Buffer.from(signatureHeader, 'hex'),
Buffer.from(expected, 'hex')
);
} catch {
return false; // malformed hex / length mismatch
}
}
Python:
import hmac, hashlib
def verify_bunny_stream(raw_body: bytes, signature_header: str, secret: str) -> bool:
if not signature_header:
return False
expected = hmac.new(secret.encode(), raw_body, hashlib.sha256).hexdigest()
return hmac.compare_digest(signature_header, expected)
For complete handlers with route wiring, event dispatch, and tests, see:
The Payload Is Thin — Fetch Back
The callback body identifies the video and the event, and nothing more (Bunny's documented example):
{
"IsLiveStreamWebhook": false,
"VideoLibraryId": 133,
"VideoGuid": "657bb740-a71b-4529-a012-528021c31a92",
"Status": 3,
"EventId": "0f8e2c52-6a3e-4c1f-9d55-2b8c4f6c2a10",
"Timestamp": "2026-10-01T12:30:15.1234567Z"
}
EventId is unique per event and stays the same on retries, so deduplicate on it. Timestamp is when the event happened (UTC); deliveries can arrive out of order, so compare it before updating state. Reason is added for SmartGenerationFailed and left out otherwise. Ignore fields you don't know: Bunny added the last four to an existing payload.
There is no title, duration, or resolution in the payload. When you need full metadata, call the Stream API GET /library/{libraryId}/videos/{videoGuid} with the library's read-write API key, using VideoGuid from the webhook. Verify the signature before making any fetch-back call.
Status Codes (the event type lives in Status)
| Status | Meaning | Common Use |
|---|---|---|
0 | Queued | Upload accepted, awaiting processing |
1 | Processing | Ingest started |
2 | Encoding | Transcoding in progress |
3 | Finished | Encoding done — video ready to play |
4 | Resolution finished | One resolution finished; sent once per resolution, the first means playable |
5 | Failed | Encoding failed — alert / retry |
6 | PresignedUploadStarted | TUS/presigned upload began |
7 | PresignedUploadFinished | Presigned upload completed |
8 | PresignedUploadFailed | Presigned upload failed |
9 | CaptionsGenerated | Auto-captions ready |
10 | TitleOrDescriptionGenerated | AI title/description ready |
11 | CaptionGenerationFailed | Auto-captions failed |
12 | ChaptersGenerated | AI chapters ready |
13 | MomentsGenerated | AI moments ready |
32 | VideoDeleted | Video deleted (once per video, including collection deletes) |
33 | SmartGenerationFailed | A smart feature failed; Reason is Title, Description, Chapters or Moments |
Switch on the numeric Status, not the name, as Bunny advises.
For the full event reference, see Bunny Stream Webhooks.
Important Headers
| Header | Description |
|---|---|
X-BunnyStream-Signature | HMAC-SHA256 of the raw body, lowercase hex — verify this |
X-BunnyStream-Signature-Version | Signature scheme version, v1 |
X-BunnyStream-Signature-Algorithm | Algorithm identifier, hmac-sha256 |
Retries
Any 2xx acknowledges a delivery. A network error, timeout, 408, 429 or 5xx is retried after 30 seconds, 2 minutes, 10 minutes, 30 minutes, 1 hour and 2 hours, then dropped (about four hours after the event). Other 4xx responses are not retried. Retries resend the same body and are signed with the library's current Read-Only API key.
Environment Variables
# The signing secret IS your video library's Read-Only API key
BUNNY_STREAM_WEBHOOK_SECRET=your_library_read_only_api_key
Local Development
# Start tunnel (no account needed)
npx hookdeck-cli listen 3000 bunny-stream --path /webhooks/bunny-stream
Reference Materials
- references/overview.md - Bunny Stream webhook concepts, Status enum, payload
- references/setup.md - Configure the webhook URL per video library
- references/verification.md - Signature verification details and gotchas