Command Palette

Search for a command to run...

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

langfuse-webhooks

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

Receive and verify Langfuse webhooks. Use when setting up a Langfuse prompt-management webhook endpoint, verifying the x-langfuse-signature header (t=,v1=…

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

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

Langfuse Webhooks

Langfuse (the open-source LLM engineering platform) can run an Automation on prompt management: when a prompt version is created, updated (labels or tags) or deleted, a "Webhook Call" action sends a JSON notification to your URL. Each request is signed with the x-langfuse-signature header, so your endpoint can verify the sender and the exact body.

When to Use This Skill

  • How do I receive Langfuse webhooks?
  • How do I verify the x-langfuse-signature header (t=<timestamp>,v1=<signature>)?
  • How do I handle Langfuse prompt version created, updated and deleted events?
  • Why does my Langfuse webhook signature verification fail (raw body, timestamp prefix)?
  • Why does an updated Langfuse webhook arrive twice?

Verification (core)

The header is x-langfuse-signature: t=<timestamp>,v1=<hex>. The signature is the lowercase hex HMAC-SHA256 of <t>.<raw body>, keyed with the webhook's signing secret as UTF-8 bytes.

const crypto = require('crypto');

function verifyLangfuseSignature(rawBody /* Buffer */, header, secret) {
  let t;
  const sigs = [];
  for (const part of String(header || '').split(',')) {
    const i = part.indexOf('=');
    if (i === -1) continue;
    const k = part.slice(0, i).trim(), v = part.slice(i + 1).trim();
    if (k === 't' && t === undefined) t = v;          // keep t as the exact string sent
    else if (k === 'v1') sigs.push(v);                // may repeat (rotation); ignore v0 etc.
  }
  if (!secret || !t || sigs.length === 0) return false;
  const expected = crypto.createHmac('sha256', Buffer.from(secret, 'utf8'))
    .update(Buffer.concat([Buffer.from(`${t}.`), rawBody])).digest();
  return sigs.some((s) =>                             // validate before decoding, then constant-time
    /^[0-9a-fA-F]{64}$/.test(s) &&
    crypto.timingSafeEqual(Buffer.from(s.toLowerCase(), 'hex'), expected));
}
  • Sign bytes: the raw body exactly as received (express.raw({ type: '*/*' }), Next.js await request.arrayBuffer(), FastAPI await request.body()). Never JSON.parse/stringify first.
  • Use t exactly as it appears in the header; never parse it to a number and re-format it.
  • The secret is used as-is (UTF-8), not hex- or base64-decoded. Env var: LANGFUSE_WEBHOOK_SECRET.
  • Accept the delivery if any v1= entry matches. A header with no t= or no v1= fails.
  • Hex is case-insensitive: require exactly 64 hex characters, then compare bytes in constant time.
  • Python: hmac.compare_digest on bytes (bytes.fromhex after a [0-9a-fA-F]{64} check).
  • Missing header, malformed value or mismatch: 401.
  • No timestamp window by default. Hookdeck retries and replays resend the original headers and timestamp, so a fixed window would reject legitimate retries. To opt in, set LANGFUSE_WEBHOOK_TOLERANCE_SECONDS (unset or 0 = off); t is Unix seconds.

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

Event Types

Route on the body's type first, then on action for prompt versions.

type Sent When
prompt-version A prompt automation fires; action says what happened (below)
monitor-alert An alert automation fires because an alert's severity changed; no action, the alert is in payload
action (prompt-version) Sent When
created A prompt version is created
updated A prompt version's labels or tags change (two deliveries: the version gaining and the version losing the label/tag)
deleted A prompt version is deleted

Langfuse's docs print a created prompt body and a monitor-alert body; the lowercase updated and deleted values match the enum in Langfuse's open-source code. Project notification channels (failed exports, deactivated evaluators) can post type: "project-notification" with an event object, which the docs don't print. Log and acknowledge any type or action you don't handle. The prompt payload carries id, timestamp, type, apiVersion, action and a prompt object (name, version, labels, tags, prompt, config, commitMessage, ...). See references/overview.md.

Delivery

POST with a JSON body. A 2xx confirms receipt; otherwise Langfuse retries with exponential back-off, and after 5 consecutive failed deliveries it disables the automation's trigger (re-enable it on the Automations page). Langfuse's open-source worker waits 10 seconds per attempt and makes 4 attempts a few hundred milliseconds apart (self-hosting defaults). Respond quickly and make the handler idempotent: key on the payload id, which stays the same when a delivery is retried.

Environment Variables

LANGFUSE_WEBHOOK_SECRET=your_langfuse_webhook_secret   # shown when the webhook is created; regenerable
# LANGFUSE_WEBHOOK_TOLERANCE_SECON
Полный SKILL.md на GitHub

Установить langfuse-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/langfuse/route.tsexamples/nextjs/lib/verify-langfuse.tsexamples/nextjs/package.jsonexamples/nextjs/vitest.config.tsreferences/overview.mdreferences/setup.mdreferences/verification.md

FAQ

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

Receive and verify Langfuse webhooks. Use when setting up a Langfuse prompt-management webhook endpoint, verifying the x-langfuse-signature header (t=,v1= HMAC-SHA256), debugging signature failures, or handling prompt version created, updated and deleted events and alert notifications.

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

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

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

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

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

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