Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

livekit-webhooks

БесплатноЗапускает вложенные скриптыНе проверен

Receive and verify LiveKit webhooks (LiveKit Cloud and self-hosted livekit-server). Use when setting up LiveKit webhook handlers, debugging the…

hookdeckот hookdeck★ 104 звезды на GitHub

Об этом скилле

LiveKit Webhooks

LiveKit (livekit.io) is the open-source WebRTC platform: an SFU for realtime audio, video and data, plus Agents, SIP telephony and Egress/Ingress. LiveKit Cloud and self-hosted livekit-server send the same webhook request, signed the same way.

When to Use This Skill

  • How do I receive LiveKit webhooks?
  • How do I verify a LiveKit webhook (Authorization JWT + sha256 claim)?
  • Why does every LiveKit webhook delivery fail with 401 / an empty body?
  • How do I handle participant_joined, room_finished or egress_ended?
  • How do I configure webhooks in LiveKit Cloud or in a self-hosted config.yaml?

Webhooks vs SDK events: webhook event names are snake_case (participant_joined). PascalCase names (ParticipantConnected, TrackSubscribed) are in-process client SDK callbacks (RoomEvent / ParticipantEvent), not webhooks. LiveKit's docs cover both on one page; only the snake_case list is delivered over HTTP.

Verification (core)

This is not an HMAC-in-a-custom-header scheme. LiveKit sends Authorization: <JWT> (bare token, no Bearer prefix) and Content-Type: application/webhook+json. Verify in two mandatory steps: the JWT signature only covers its claims, and the body is bound only through the sha256 claim.

  1. JWT: HS256 keyed with the project API secret, iss must equal the API key, exp must be present and unexpired (10 s clock tolerance). Pin the algorithm.
  2. Body: sha256 claim == base64(SHA-256(raw body)), standard base64 with padding.
import crypto from 'node:crypto';
import { jwtVerify } from 'jose';

async function verifyLiveKitWebhook(rawBody, authHeader, apiKey, apiSecret) {
  if (!authHeader) throw new Error('authorization header is empty');
  const token = authHeader.replace(/^Bearer\s+/i, '').trim(); // proxies may add it
  const { payload } = await jwtVerify(token, new TextEncoder().encode(apiSecret), {
    algorithms: ['HS256'], issuer: apiKey, requiredClaims: ['exp'], clockTolerance: 10,
  });
  if (typeof payload.sha256 !== 'string' || !payload.sha256) throw new Error('sha256 was not found in the token');
  const expected = Buffer.from(crypto.createHash('sha256').update(rawBody).digest('base64'));
  const received = Buffer.from(payload.sha256);
  if (expected.length !== received.length || !crypto.timingSafeEqual(expected, received)) {
    throw new Error('sha256 checksum of body does not match');
  }
  return payload;
}

Python is the same with PyJWT: jwt.decode(token, key=api_secret, algorithms=["HS256"], issuer=api_key, leeway=10, options={"require": ["exp", "iss"]}), then hmac.compare_digest(base64.b64encode(hashlib.sha256(raw_body).digest()), claim.encode()). Official one-liners: Node new WebhookReceiver(apiKey, apiSecret).receive(body, authHeader) (livekit-server-sdk); Python WebhookReceiver(TokenVerifier(api_key, api_secret)).receive(body, auth) (livekit-api). Fail closed (401) if LIVEKIT_API_KEY/LIVEKIT_API_SECRET are unset.

Raw body + content type: Express needs express.raw({ type: 'application/webhook+json' }); express.json()/default express.raw() match only application/json, leave the body empty, and every delivery 401s. Next.js: await request.text(). FastAPI: await request.body().

For complete handlers with tests, see examples/express/, examples/nextjs/, examples/fastapi/.

Common Event Types

The webhooks docs list 12 events, all in the top-level event field:

Event Triggered When
room_started First participant joins an empty room
room_finished Room closes (room.close(), or empty timeout expired after the last participant left)
participant_joined Media connection established, state becomes ACTIVE
participant_left Participant left and all cleanup completed
participant_connection_aborted Connection aborted unexpectedly (e.g. media connection failed)
track_published / track_unpublished Participant (un)published a track; room/participant carry only SID, name, identity
egress_started / egress_updated / egress_ended Recording/streaming started, updated (e.g. file size), ended
ingress_started / ingress_ended External stream ingest started / ended

agent_job_pending, agent_job_started and agent_job_ended exist in LiveKit's protocol definition (livekit_webhook.proto, webhook/consts.go) but not in the docs table or the Cloud test-event picker. Handle unknown names with a 200, never a throwing default.

Body is protojson: { event, id, createdAt, room?, participant?, track?, egressInfo?, ingressInfo?, numDropped? }. Zero/default fields are omitted, int64s (createdAt, joinedAt…) arrive as JSON strings, enums as names ("VIDEO"). Dedupe on id. A non-zero numDropped means events were lost. See [references/overview.md](refere

Полный SKILL.md на GitHub

Установить livekit-webhooks в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

examples/express/.env.exampleexamples/express/README.mdexamples/express/package.jsonexamples/express/src/index.jsexamples/fastapi/.env.exampleexamples/fastapi/README.mdexamples/fastapi/main.pyexamples/fastapi/requirements.txtexamples/fastapi/test_webhook.pyexamples/nextjs/.env.exampleexamples/nextjs/README.mdexamples/nextjs/app/webhooks/livekit/route.tsexamples/nextjs/package.jsonexamples/nextjs/vitest.config.tsreferences/overview.mdreferences/setup.mdreferences/verification.md

FAQ

Что делает скилл livekit-webhooks?

Receive and verify LiveKit webhooks (LiveKit Cloud and self-hosted livekit-server). Use when setting up LiveKit webhook handlers, debugging the Authorization-header JWT and sha256 body-hash verification, fixing the application/webhook+json content-type trap, or handling room_started, room_finished, participant_joined, participant_left, track_published, egress_ended and ingress_started events.

Как установить скилл livekit-webhooks?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл livekit-webhooks запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить livekit-webhooks с