Skip to content

voice AI demos: set up with the Hookdeck REST API, verify Hookdeck's signature, and use the LIVEKIT source type - #55

Merged
leggetter merged 5 commits into
mainfrom
feat/voice-ai-setup-rest-api
Nov 19, 2026
Merged

leggetter merged 5 commits into
mainfrom
feat/voice-ai-setup-rest-api

Conversation

@leggetter

@leggetter leggetter commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

Three changes to the four voice AI demos (Vapi, ElevenLabs, Retell, LiveKit), so the tutorials can show the code the demos run:

  1. Setup is TypeScript only. npm run setup calls the Hookdeck REST API with fetch instead of running the Hookdeck CLI. The CLI is only used by npm run listen.
  2. Every app verifies Hookdeck's signature. Each webhook handler checks x-hookdeck-signature with HOOKDECK_SIGNING_SECRET before doing anything, and answers 401 when it's missing or wrong.
  3. LiveKit uses the LIVEKIT source type. Event Gateway verifies LiveKit's token, so the app no longer checks it.

Setup through the Hookdeck API

  • New shared helper: _shared/hookdeck/hookdeck-api.ts (API version 2026-09-01), synced into the four demos through _shared/manifest.json.
  • Setup calls:
    • PUT /connections creates or updates the source, the CLI destination and the rules in one call, matched by name.
    • PUT /sources sets the signing secret on the ElevenLabs, Vapi and Retell sources (config.auth).
    • LiveKit puts its config.auth inline in PUT /connections, because the API won't create a LIVEKIT source without it.
  • Probes: the Vapi, ElevenLabs and Retell probe scripts read request records through the same helper.
  • Unchanged: hookdeck-cli.ts and hookdeck-listen.ts (used by npm run listen), and deepgram/stt-tts, which keeps its CLI-based setup.

Hookdeck signature check

  • New shared helper: _shared/hookdeck/hookdeck-signature.ts computes the base64 HMAC-SHA256 of the raw body and compares it in constant time. It also accepts x-hookdeck-signature-2, which Hookdeck sends while a rolled secret is still active.
  • No timestamp: the signature has no timestamp, on purpose. Event Gateway verified the provider's signature when it accepted the request, so a retry or replay hours later still passes.
  • Signing secret: the reader copies it from the dashboard (Project settings → Secrets) into .env next to HOOKDECK_API_KEY. The API key can't read it, so setup can't fetch it. Each app exits with a hint at startup when it's missing.
  • Rejected deliveries: each app records them, so its UI shows the 401.
  • ElevenLabs: the display-only constructEvent check is removed. It rejects timestamps older than 30 minutes, so it failed on late retries and replays.

LiveKit on the LIVEKIT source type

  • Setup: creates a LIVEKIT source with LIVEKIT_API_KEY and LIVEKIT_API_SECRET. The WEBHOOK option is removed.
  • App: the WebhookReceiver token check, src/verify.ts and the clock tolerance for retries are removed. The app checks Hookdeck's signature only.
  • Simulator, README and scenes: a bad LiveKit signature is shown as rejected by Event Gateway (VERIFICATION_FAILED, no event, 200 to the sender).

Dashboard location for the API key

  • The voice AI demos and deepgram/stt-tts, hookdeck/cli-fleet-fanout, hookdeck/mcp-events-forward-proxy, hookdeck/transformations and hookdeck/binary-payloads point to Project settings -> Secrets for the project API key, the page that shows it with the signing secret.

Tested

  • Setup: ran in all four demos. Rerunning it against existing resources left every .env unchanged. LiveKit setup ran in a new Hookdeck project, created the LIVEKIT source and the LiveKit Cloud webhook, and needed the inline config.auth fix in 1cb35f1.
  • Signature, valid: events sent through Event Gateway reached each app with 200.
  • Signature, wrong or missing: sent straight to each app, they got 401 on all five webhook routes.
  • Retry: after a forced 500, the same event was retried and passed the signature check.
  • Real provider traffic: an ElevenLabs text call stored the transcript, audio and collected data. A LiveKit room delivered 9 verified events and room_finished closed the call.
  • LiveKit rejection: a bad LiveKit token was rejected by Event Gateway with VERIFICATION_FAILED.
  • Deduplication: repeats were dropped in all four demos.
  • Checks: npm test passes in all four demos, browser tests included (23, 46, 31 and 65 tests). npm run sync-shared -- --check passes.

Posted by an AI agent with human oversight.

🤖 Generated with Claude Code

leggetter and others added 3 commits November 19, 2026 00:12
…CLI is only for listen

npm run setup in the Vapi, ElevenLabs, Retell and LiveKit demos now calls the
Hookdeck API with fetch instead of running the Hookdeck CLI. Each setup is
TypeScript from start to finish, so the tutorials can show the code it runs:

- PUT /connections creates or updates the source, the CLI destination and the
  rules in one call, matched by name
- PUT /sources sets the source's verification settings (config.auth)

The new shared helper _shared/hookdeck/hookdeck-api.ts (API version 2026-09-01)
is synced into the four demos. The probe scripts use it too. The Hookdeck CLI is
still used by npm run listen, through the unchanged hookdeck-cli.ts and
hookdeck-listen.ts. deepgram/stt-tts keeps its CLI-based setup.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each demo app now verifies x-hookdeck-signature (base64 HMAC-SHA256 of the raw body, keyed with HOOKDECK_SIGNING_SECRET from .env) before it does anything else, and answers 401 when it is missing or wrong. A rejected delivery is recorded in the app's deliveries list. The signature has no timestamp, so retries and replays hours later still pass.

- Shared helper _shared/hookdeck/hookdeck-signature.ts, synced to src/ in the four demos, with unit tests
- Vapi: both client routes; Retell: /webhooks/retell and /webhooks/retell-function; ElevenLabs and LiveKit: their one webhook route
- ElevenLabs: the display-only SDK constructEvent check is gone; the page shows the Hookdeck signature result instead
- LiveKit: the source is now the LIVEKIT type, so Event Gateway verifies LiveKit's token and rejects forgeries; the app's WebhookReceiver check and its retry clock tolerance are removed, and the bad-signature scene shows Event Gateway rejecting it
- .env.example and READMEs: set HOOKDECK_SIGNING_SECRET next to HOOKDECK_API_KEY (the API key cannot read it)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ls in the connection call

The API won't create a LIVEKIT source without config.auth, so setup failed in a
new project. The source's API key and secret now go inline in PUT /connections,
which sets them on create and updates them on a rerun, and the separate
PUT /sources call is gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@leggetter leggetter changed the title voice AI demos: set up Event Gateway with the Hookdeck REST API; the CLI is only for listen voice AI demos: set up with the Hookdeck REST API, verify Hookdeck's signature, and use the LIVEKIT source type Nov 19, 2026
leggetter and others added 2 commits November 19, 2026 15:04
…e signing secret

The Hookdeck dashboard shows the project API key and the signing secret on the
same page, Project settings -> Secrets.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…r demos

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@leggetter
leggetter marked this pull request as ready for review November 19, 2026 16:23
@leggetter
leggetter merged commit b8937c1 into main Nov 19, 2026
10 checks passed
@leggetter
leggetter deleted the feat/voice-ai-setup-rest-api branch November 19, 2026 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant