Skip to main content
@hookieai/node is Hookie’s server SDK. It has no dependencies and uses only fetch and WebCrypto, so the same code runs on Node 18+, Cloudflare Workers, Deno and Bun. It is MIT licensed.
Browser forms have their own client, @hookieai/forms. See Forms.

Verify a webhook Hookie sent you

Hookie signs every delivery with Hookie-Signature and with the Standard Webhooks headers, over one timestamp. verifyWebhook checks either. Pass the destination’s whsec_... signing secret, and the raw body exactly as it arrived: a body you parsed and serialised again will not verify.
  • A timestamp more than 300 seconds from now is refused. Change it with toleranceSeconds.
  • After you rotate a secret, Hookie signs with the new and the previous one for a day. Pass both as [current, previous].
  • A replayStore refuses a delivery that already verified. The memory store lives in one process; behind several instances, back the same interface (has, add) with KV, a Durable Object, Redis or your database.
  • A failure is a HookieSignatureError whose reason says why, such as timestamp_too_old or no_valid_signature.
More on the headers in Signatures.

Send events

Every call carries an Idempotency-Key, and the SDK’s retries reuse it, so a flaky network stores one event. Pass your own idempotencyKey to make your own retries safe too. To post to an endpoint URL instead of using an ingest key, call hookie.ingest.sendToEndpoint(url, payload).

Manage your workspace

Helpers cover projects, endpoints, destinations, deliveries and search. hookie.admin.request(method, path, { body, query }) reaches any other route in the API reference. Create an API key under Settings, API keys (API keys).

Errors

Everything the SDK throws is a HookieError with status, reason, retryAfter and idempotencyKey. Branch on its class: HookieNetworkError, HookieAuthError, HookieValidationError, HookieNotFoundError, HookieConflictError, HookieRateLimitError (its isQuota is true when the monthly plan quota is used up) and HookieServerError.