Skip to main content
An open chat receives the reply as it is written. Your server can learn that the same job finished after the person closed the tab by subscribing to run.completed. Use the webhook to update your product, for instance by marking the customer’s brief ready.

Receive an event

Add a handler for the event type to the webhooks map in your kit route. The kit verifies the signature before dispatching the event. Locally, npx openlegion dev forwards deliveries to the running application’s webhook route. For a deployed integration, register your public HTTPS endpoint and configure its signing secret on your server. Send a test ping and confirm that the endpoint returns a successful response.

Handle retries and missing updates

Persist the event ID with the work it triggers. A delivery can arrive again with the same ID, including after a manual resend. If the payload has data.truncated: true, retrieve the referenced object before acting on its current state. A handler should acknowledge the event after durably recording it or completing its work. If a notification is missing, check the endpoint’s deliveries and response codes. Use GET /events to reconcile activity after downtime. The delivery API can resend a settled delivery. A browser losing its chat connection is a separate case. The kit can reattach to an existing run and load its history. Webhook delivery and verification · Chat streaming and recovery