> For the complete documentation index, see [llms.txt](https://docs.sedona.fun/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sedona.fun/webhooks.md).

# Receive webhooks

[← Back to dashboard](https://www.sedona.fun/dashboard/api-keys)

Webhook subscription creation and webhook receipt are separate processes with different privileges.

## Create one subscription

> Warning: subscription creation is an administrator mutation and has no idempotency key. An automatic retry can create a second subscription.

Run the dedicated example only with an administrator key and an owner-only output path outside the repository:

```sh
FLEET_BASE_URL=https://fleet-api-production-fleet-api.up.railway.app \
FLEET_ADMIN_API_KEY=<administrator-key> \
FLEET_LINE_ID=<authorized-line-id> \
FLEET_WEBHOOK_CALLBACK_URL=https://example.invalid/fleet/webhook \
FLEET_WEBHOOK_SECRET_OUTPUT_FILE=/private/owner-only/fleet-webhook-secret \
OPENBLUE_CONFIRM_WEBHOOK_CREATE=create-one-webhook \
npm run example:webhook-create
```

Fleet returns the signing secret only in the create response. Store it immediately in a secret manager. Read and update routes never return it, and Fleet currently has no signing-secret rotation endpoint. To replace a lost or compromised secret, create a replacement subscription, switch the receiver, then delete the old subscription.

## Verify exact bytes

Configure the receiving process with the show-once secret:

```sh
FLEET_BASE_URL=https://fleet-api-production-fleet-api.up.railway.app \
FLEET_API_KEY=fleet_sk_REDACTED \
FLEET_WEBHOOK_SECRET=<show-once-signing-secret> \
npm run example:webhook
```

Construct `WebhookRequest` from the exact raw body and Node `rawHeaders`, then verify before parsing:

```ts
const request = WebhookRequest.fromNode(incomingMessage, rawBody);
const verification = await client.webhooks.verify(request);
if (verification.state !== "verified") {
  return rejectDelivery();
}
const parsed = await client.webhooks.parse(request);
```

Never parse and re-serialize JSON before verification. Header case, duplicate order, and body bytes are part of the signed input.

## Replay and delivery policy

Fleet delivers at least once. Persist `X-Fleet-Event-Id` in durable application storage and make event processing atomic with deduplication before returning 2xx. `X-Fleet-Webhook-Id` identifies the delivery attempt.

The SDK verifies the Fleet signature but does not enforce timestamp age because Fleet publishes no receiver freshness window. Choose an application policy after signature verification, and account for legitimate delayed retries.

Subscription filters use Fleet wire event names. Parsed events use canonical SDK names; for example, Fleet delivery lifecycle events map to `message.status`. Always include the `_` arm in `Events.match` because the event set is open.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.sedona.fun/webhooks.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
