Command Palette

Search for a command to run...

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

learnhouse-webhooks

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

Receive and verify LearnHouse webhooks. Use when setting up LearnHouse webhook handlers, debugging X-Webhook-Signature verification, or handling events such…

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

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

LearnHouse Webhooks

When to Use This Skill

  • How do I receive LearnHouse webhooks?
  • How do I verify the LearnHouse X-Webhook-Signature header?
  • How do I handle course_completed, course_enrolled or assignment_graded events?
  • Why is my LearnHouse webhook signature verification failing?
  • How do I deduplicate LearnHouse deliveries on delivery_id?

How LearnHouse Signs Webhooks

LearnHouse (open-source learning platform, cloud or self-hosted) POSTs a JSON envelope to your endpoint. Webhooks are a Pro feature.

  • Header: X-Webhook-Signature: sha256=<hex>
  • Algorithm: HMAC-SHA256, lowercase hex
  • Signed content: the raw request body bytes only. No header is signed. The body's own timestamp (when LearnHouse first tried the delivery) is covered by the signature, and LearnHouse's SDK docs suggest rejecting deliveries older than a few minutes on it. LearnHouse enforces no window itself.
  • Key: the endpoint secret (whsec_...), used whole, prefix included, as plain UTF-8 bytes. This is not Standard Webhooks: do not strip whsec_, do not base64-decode it, and do not use the standardwebhooks or svix libraries.
  • Missing, malformed or mismatched signature: respond 401.
  • Official SDK: @learnhouse/sdk exports parseWebhook (verifies and returns the typed event) and verifyWebhookSignature. The hand-written check below does the same thing.

Verification (core)

const crypto = require('crypto');

function verifyLearnhouseSignature(rawBody, header, secret) {
  if (!header || !secret) return false;
  const value = header.startsWith('sha256=') ? header.slice(7) : header; // bare digest also accepted
  if (!/^[0-9a-fA-F]{64}$/.test(value)) return false; // validate before decoding
  const expected = crypto.createHmac('sha256', Buffer.from(secret, 'utf8')).update(rawBody).digest();
  return crypto.timingSafeEqual(Buffer.from(value, 'hex'), expected);
}
import hmac, hashlib, re

def verify_learnhouse_signature(raw_body: bytes, header: str | None, secret: str | None) -> bool:
    if not header or not secret:
        return False
    value = header[len("sha256="):] if header.startswith("sha256=") else header
    if not re.fullmatch(r"[0-9a-fA-F]{64}", value):
        return False
    expected = hmac.new(secret.encode("utf-8"), raw_body, hashlib.sha256).digest()
    return hmac.compare_digest(bytes.fromhex(value), expected)

raw_body / rawBody must be the exact bytes received: never decode and re-encode, and never JSON.parse/JSON.stringify before verifying. Hex is compared case-insensitively.

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

Handling Events

Dispatch on the body's event field (the same name is also sent in the X-Webhook-Event header). Treat every field of the parsed body as untrusted and check its type before reading into it. Deliveries are at-least-once: dedupe on delivery_id (also sent as X-Webhook-Delivery).

{
  "event": "course_completed",
  "delivery_id": "dlv_9f1e3c7b22a44f0d",
  "timestamp": "2026-04-19T14:31:02Z",
  "org_id": 1,
  "data": {
    "user": {
      "user_uuid": "user_abc",
      "email": "[email protected]",
      "username": "alice"
    },
    "course": {
      "course_uuid": "course_xyz",
      "name": "Intro to Python"
    }
  }
}

Common Event Types

LearnHouse documents 46 event types in its Event Catalogue; the full list is in references/overview.md.

Event Triggered When
ping You send a test from the dashboard or POST .../test
course_enrolled A learner enrolls in a course
course_completed A learner completes a course
activity_completed A learner completes an activity
assignment_submitted A learner submits an assignment
assignment_graded An assignment is graded
certificate_claimed A learner receives a certificate
user_signed_up A user signs up to the organization

Environment Variables

LEARNHOUSE_WEBHOOK_SECRET=whsec_your_endpoint_secret

Paste the whole secret, including the whsec_ prefix. LearnHouse uses it as a plain HMAC key.

Local Development

LearnHouse rejects localhost and private IPs, so a local receiver needs a public tunnel. Run the Hookdeck CLI via npx (no install, no account required):

npx hookdeck-cli listen 3000 learnhouse --path /webhooks/learnhouse

Use the tunnel URL as the endpoint URL in LearnHouse. If you route deliveries through Hookdeck, its LearnHouse source verifies the signature (set the source secret to the full whsec_... value).

Reference Materials

  • references/overview.md - What LearnHouse webhooks are, all 46 events, payload and headers
  • [references/setup.md](references/setup.m
Полный SKILL.md на GitHub

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

FAQ

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

Receive and verify LearnHouse webhooks. Use when setting up LearnHouse webhook handlers, debugging X-Webhook-Signature verification, or handling events such as course_completed, course_enrolled, assignment_submitted and user_signed_up.

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

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

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

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

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

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