huggingface-webhooks
БесплатноЗапускает вложенные скриптыНе проверенReceive and verify Hugging Face webhooks. Use when setting up Hugging Face webhook handlers, debugging X-Webhook-Secret verification, or handling events on…
от hookdeck★ 104 звезды на GitHubОб этом скилле
Hugging Face Webhooks
When to Use This Skill
- Setting up Hugging Face webhook handlers
- Debugging
X-Webhook-Secretverification failures - Handling repo events on models, datasets, Spaces, and buckets
- Reacting to new commits, tags, or branches via
updatedRefs - Building discussion or Pull Request bots on the Hub
- Listening for comments on discussions
- Auto-retraining models when a dataset is updated
Essential Code (USE THIS)
Hugging Face does not use HMAC signatures. Instead, the secret you configure in the webhook settings is sent verbatim in the X-Webhook-Secret header (or as a ?secret= query parameter). Verify with a timing-safe string comparison.
Hugging Face Secret Verification (JavaScript)
const crypto = require('crypto');
function verifyHuggingFaceWebhook(secretHeader, secret) {
if (!secretHeader || !secret) return false;
// Hugging Face sends the secret verbatim — compare directly,
// but use timing-safe comparison to prevent timing attacks.
try {
return crypto.timingSafeEqual(
Buffer.from(secretHeader),
Buffer.from(secret)
);
} catch {
// Buffers must be same length for timingSafeEqual
return false;
}
}
Express Webhook Handler
const express = require('express');
const crypto = require('crypto');
const app = express();
// CRITICAL: Use express.json() — Hugging Face sends JSON payloads
app.post('/webhooks/huggingface',
express.json(),
(req, res) => {
// Header takes precedence; fall back to ?secret= query parameter
const secretHeader = req.headers['x-webhook-secret'] || req.query.secret;
if (!verifyHuggingFaceWebhook(secretHeader, process.env.HUGGINGFACE_WEBHOOK_SECRET)) {
console.error('Hugging Face webhook verification failed');
return res.status(401).send('Unauthorized');
}
const { event, repo, discussion, comment, updatedRefs, updatedConfig, webhook } = req.body;
// event.scope + event.action identifies the event type
const key = `${event.scope}.${event.action}`;
console.log(`Received ${key} on ${repo.type} ${repo.name}`);
switch (event.scope) {
case 'repo':
// create | update | delete | move
console.log(`Repo ${event.action}: ${repo.name}`);
break;
case 'repo.content':
// action is always "update"
console.log(`Repo content updated on ${repo.name}, refs:`, updatedRefs);
break;
case 'repo.config':
// action is always "update"
console.log(`Repo config updated:`, updatedConfig);
break;
case 'discussion':
// create | update | delete
console.log(`Discussion ${event.action} #${discussion?.num}: ${discussion?.title}`);
break;
case 'discussion.comment':
// create | update
console.log(`Comment ${event.action} by ${comment?.author?.id}`);
break;
default:
// Forward-compatibility: treat narrowed scopes (e.g. repo.config.dois)
// as an "update" on the broader scope.
console.log(`Unknown scope: ${event.scope} (${event.action})`);
}
res.json({ received: true });
}
);
Python Secret Verification (FastAPI)
import secrets
def verify_huggingface_webhook(secret_header: str | None, secret: str | None) -> bool:
if not secret_header or not secret:
return False
# Hugging Face sends the secret verbatim — timing-safe string comparison.
return secrets.compare_digest(secret_header, secret)
For complete working examples with tests, see:
- examples/express/ - Full Express implementation
- examples/nextjs/ - Next.js App Router implementation
- examples/fastapi/ - Python FastAPI implementation
Common Event Types
Hugging Face webhook events are identified by event.scope + event.action.
event.scope |
event.action values |
Description |
|---|---|---|
repo |
create, update, delete, move |
Global events on a repo (model, dataset, Space, bucket) |
repo.content |
update |
New commits, branches, or tags (updatedRefs), or bucket files added or deleted (updatedFiles) |
repo.config |
update |
Settings, secrets, DOI, privacy changes. updatedConfig is included |
discussion |
create, update, delete |
Discussion or Pull Request opened, retitled, merged, or closed |
discussion.comment |
create, update |
Comment created or edited (or hidden — content is undefined when hidden: true) |
A discussion is also a Pull Request when
discussion.isPullRequestistrue.
Forward-compatibility: New narrowed scopes may be added (e.g. repo.config.dois). Treat unknown narrowed scopes as an update on the broader scope.
Payload Shape
{
"event": { "action": "create", "scope": "discussion" },
"repo": {
"type": "model",
"name": "openai-
Установить huggingface-webhooks в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл huggingface-webhooks?
Receive and verify Hugging Face webhooks. Use when setting up Hugging Face webhook handlers, debugging X-Webhook-Secret verification, or handling events on models, datasets, Spaces, and buckets — repo updates, new commits, tags, and bucket file changes (repo.content), config changes (repo.config), discussions, Pull Requests, and discussion comments.
Как установить скилл huggingface-webhooks?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл huggingface-webhooks запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic