Skip to main content
Webhooks let your backend react to what happens inside your programmable worlds without polling. When a world finishes generating or fails, Alakazam POSTs a signed JSON event to an HTTPS endpoint you register, so you can update your own database, notify a player, or kick off the next step in your product’s logic. Each delivery is signed with an Alakazam-Signature header you verify against the raw request body, so you can trust that the event came from Alakazam and was not tampered with in flight.

Register an endpoint

Webhook endpoints belong to an app and are managed with your Alakazam user session (the same token you use for app and key management), not an API key. POST the HTTPS url you want events delivered to, and optionally the list of events to subscribe to. Omit events to register the default set of three: world.generation.succeeded, world.generation.failed, and session.ended (reserved: registered by default, but not yet delivered).
The response includes the endpoint’s secret, prefixed whsec_. Use it to verify every delivery from this endpoint.
The signing secret is returned once, at creation. Store it now, because it is never shown again. If you lose it, delete the endpoint and register a new one.

List your endpoints

List the webhook endpoints registered for an app. The response is metadata-only: the signing secret is never returned again after creation.

Delete an endpoint

Remove an endpoint to stop deliveries. Either verb works: DELETE, or POST to the /delete sub-path for environments that can’t send DELETE.

Event types

Subscribe to any subset of these. Omitting events registers the default set of three: world.generation.succeeded, world.generation.failed, and session.ended (reserved: registered by default, but not delivered yet). Subscribe to * to also auto-enroll in new event types as they ship.
Generation events fire for async jobs: those you create with async: true on POST /v1/worlds and poll at GET /v1/jobs/{jobId}. A webhook lets you skip the polling entirely.

Event payload

Every delivery is a POST with a JSON body in this envelope:
Respond with any 2xx status to acknowledge receipt. Any non-2xx, or a network failure, is treated as a failed delivery and retried.

Verify the signature

Every request carries an Alakazam-Signature header:
  • t is the Unix timestamp (seconds) of the delivery.
  • v1 is the hex HMAC-SHA256, keyed by the endpoint’s whsec_ signing secret, over the string `${t}.${rawBody}`: the timestamp, a literal ., then the exact raw request body.
To verify, recompute the HMAC over the raw body you received and compare it to v1 with a constant-time comparison. Also check that t is recent (within, say, five minutes) to reject replays.
Verify against the raw request bytes, before any JSON parsing or re-serialization. Frameworks that parse and re-stringify the body will change the bytes and break the signature. Capture the raw body first.

Retries and ordering

Each event is attempted up to 3 times with exponential backoff per endpoint. A delivery succeeds on any 2xx; anything else is retried until the attempts are exhausted.
  • No ordering guarantee. Events may arrive out of order, and an occasional duplicate is possible. Make your handler idempotent: key off the event’s data ids (for example jobId or worldId) rather than assuming arrival order.
  • Acknowledge fast. Return 2xx as soon as you’ve verified and stored the event, then do slower work asynchronously, so a slow handler doesn’t trigger retries.
  • Per-endpoint signing. Each endpoint has its own whsec_ secret, so verify with the secret for the endpoint that received the request.

Where to get keys

Manage your apps and API keys from the developer dashboard. Webhook endpoints are registered through the API itself (POST /v1/apps/{id}/webhooks, as above): the signing secret is returned once at registration.