Command Palette

Search for a command to run...

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

box-webhooks

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

Receive and verify Box V2 webhooks. Use when setting up Box webhook handlers, debugging BOX-SIGNATURE-PRIMARY verification, or handling events like…

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

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

Box Webhooks

When to Use This Skill

  • How do I receive Box webhooks?
  • How do I verify the BOX-SIGNATURE-PRIMARY header?
  • How do I handle FILE.UPLOADED, FOLDER.CREATED, or SIGN_REQUEST.COMPLETED events?
  • Why is my Box webhook signature verification failing?
  • How do I dedupe Box webhook retries?

This skill covers V2 webhooks (created through the API per file or folder). V1 webhooks are unsigned and not covered. Box Sign events (SIGN_REQUEST.*) are V2 triggers, signed the same way.

Essential Code (USE THIS)

Box sends two signatures, BOX-SIGNATURE-PRIMARY and BOX-SIGNATURE-SECONDARY. The example below checks the primary signature. A receiver with both keys can accept either signature after checking it with its matching key.

  • Signature: standard base64 (padded, 44 characters) HMAC-SHA256, no prefix
  • Signed message: the raw request body bytes, then the BOX-DELIVERY-TIMESTAMP header value, with no separator
  • Key: the app's primary signature key, used as a UTF-8 string (not decoded)
const crypto = require('crypto');

// rawBody: Buffer of the exact request bytes (express.raw({ type: '*/*' }), not express.json)
function verifyBox(rawBody, signature, timestamp, secret) {
  if (!secret || !signature || !timestamp) return false;
  if (!/^[A-Za-z0-9+/]{43}=$/.test(signature)) return false; // validate before comparing
  const signed = Buffer.concat([rawBody, Buffer.from(timestamp, 'latin1')]); // body first, no separator
  const expected = crypto.createHmac('sha256', secret).update(signed).digest('base64');
  const a = Buffer.from(signature, 'latin1'), b = Buffer.from(expected, 'latin1');
  return a.length === b.length && crypto.timingSafeEqual(a, b);
}
// verifyBox(rawBody, req.headers['box-signature-primary'], req.headers['box-delivery-timestamp'], secret)
import base64, hashlib, hmac, re

def verify_box(raw_body: bytes, signature, timestamp, secret: str) -> bool:
    if not secret or not signature or not timestamp or not re.fullmatch(r"[A-Za-z0-9+/]{43}=", signature):
        return False
    signed = b"".join([raw_body, timestamp.encode("latin-1")])  # body first, no separator
    digest = hmac.new(secret.encode(), signed, hashlib.sha256).digest()
    return hmac.compare_digest(signature.encode("ascii"), base64.b64encode(digest))

A missing or empty header, a malformed value, or a mismatch gets 401.

Setup note (same text Hookdeck shows for its Box source): Paste the primary signature key from the Box Developer Console. Add the secondary key to keep V2 deliveries verified while rotating either key.

Timestamp window: Box suggests rejecting a BOX-DELIVERY-TIMESTAMP (RFC 3339) older than 10 minutes. The examples leave that off by default, because Hookdeck retries and replays resend the original headers and timestamp. Set BOX_WEBHOOK_TOLERANCE_SECONDS to a positive number (for example 600) to opt in; unset or 0 is off. Box's own SDK helper (WebhookValidator) always enforces the 10 minutes and checks both keys, which is why the examples verify by hand. See references/verification.md.

HTTP method: Box's Box Sign webhooks page says Box sends an HTTP POST; the V2 webhooks page says only that "Box makes an HTTP call to the address". The examples accept GET, POST, PUT, PATCH and DELETE and verify the signature first for every method, treating a missing body as empty bytes.

Dedupe on id: the body's id is the same across Box's retries; BOX-DELIVERY-ID changes on every retry, so don't use it.

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

Common Event Types

The body is {type: "webhook_event", id, created_at, trigger, webhook, created_by, source, additional_info}. Dispatch on trigger:

Trigger Description
FILE.UPLOADED A file is uploaded or moved to the folder
FILE.DOWNLOADED A file is downloaded
FILE.TRASHED A file is moved to trash
FILE.DELETED A file is permanently deleted
FOLDER.CREATED A folder is created
COMMENT.CREATED A comment is created
COLLABORATION.CREATED A collaboration is created
SHARED_LINK.CREATED A shared link is created
METADATA_INSTANCE.UPDATED A metadata template instance is updated
SIGN_REQUEST.COMPLETED A Box Sign request is completed

Box documents 46 triggers in all, including file, folder, comment, collaboration, metadata, shared-link, task, Box Sign and Doc Gen events. See references/overview.md.

For the full event reference, see Box webhook triggers.

Important Headers

Header Description
BOX-SIGNATURE-PRIMARY Base64 HMAC-SHA256 made with the primary signature key
`BOX-SIGNATURE-SECO
Полный SKILL.md на GitHub

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

FAQ

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

Receive and verify Box V2 webhooks. Use when setting up Box webhook handlers, debugging BOX-SIGNATURE-PRIMARY verification, or handling events like FILE.UPLOADED, FILE.DOWNLOADED, FILE.TRASHED, FOLDER.CREATED, COMMENT.CREATED, COLLABORATION.CREATED, and SIGN_REQUEST.COMPLETED.

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

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

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

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

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

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