Command Palette

Search for a command to run...

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

planetscale-webhooks

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

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

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

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

PlanetScale Webhooks

When to Use This Skill

  • How do I receive PlanetScale webhooks?
  • How do I verify the X-PlanetScale-Signature header?
  • How do I handle branch.ready, deploy_request.opened, backup.failed or cluster.storage events (notify Slack, update a ticket, run CI on schema changes)?
  • Why is my PlanetScale webhook signature verification failing (the docs' JavaScript sample uses JSON.stringify(req.body))?

Verification (core)

PlanetScale signs the raw request body with HMAC-SHA256, keyed with the webhook's secret, and sends the bare hex digest in X-PlanetScale-Signature. There is no sha256= prefix, no timestamp and no list of signatures: compare the whole header value as one digest.

  • The HMAC key is the secret's UTF-8 bytes, used as-is (not hex- or base64-decoded).
  • Sign bytes: the body exactly as received. Never JSON.parse / JSON.stringify before verifying (the docs' JavaScript sample does JSON.stringify(req.body), which does not match byte-for-byte; the Python sample uses the raw body, and so should you).
  • Require exactly 64 hex characters before decoding (Buffer.from(x, 'hex') silently drops bad characters), then compare in constant time. Hex is case-insensitive.

Node:

const crypto = require('crypto');

function verify(rawBody, signatureHeader, secret) {
  if (typeof signatureHeader !== 'string' || !secret) return false;
  if (!/^[0-9a-f]{64}$/i.test(signatureHeader)) return false;
  const expected = crypto.createHmac('sha256', secret).update(rawBody).digest();
  return crypto.timingSafeEqual(Buffer.from(signatureHeader, 'hex'), expected);
}

Python (compare bytes so a non-ASCII header returns 401, not a 500):

import hmac, hashlib, re

def verify(raw_body: bytes, signature_header: str, secret: str) -> bool:
    if not signature_header or not secret:
        return False
    if not re.fullmatch(r"[0-9a-fA-F]{64}", signature_header):
        return False
    expected = hmac.new(secret.encode("utf-8"), raw_body, hashlib.sha256).hexdigest()
    return hmac.compare_digest(signature_header.lower().encode("utf-8"), expected.encode("utf-8"))

Missing, empty or malformed header, or a mismatch: respond 401. In Express use express.raw({ type: '*/*' }) so the body stays a Buffer whatever the content type.

For complete handlers with route wiring, event dispatch, and tests, see:

Common Event Types

The event name is the body's top-level event field (there is no event-name header). timestamp (Unix seconds), organization, database and resource (the resource's API representation) sit beside it.

Event Fires when
webhook.test You click Test webhook (one test every 20 seconds)
branch.ready A branch is created and ready to connect
branch.anomaly A branch has a new anomaly in Insights
deploy_request.opened A deploy request is opened
deploy_request.queued A deploy request is added to the deploy queue
deploy_request.in_progress A deploy request has started running
backup.failed A backup failed
backup.succeeded A backup completed
cluster.storage A Postgres database reached a storage threshold (60/75/85/90/95%)
database.access_request PlanetScale staff opens an access request

PlanetScale documents 26 events in total, including branch.primary_promoted, branch.out_of_memory, branch.schema_recommendation, branch.sleeping, branch.start_maintenance, deploy_request.pending_cutover, deploy_request.schema_applied, deploy_request.errored, deploy_request.reverted, deploy_request.closed, keyspace.storage and five Postgres maintenance events (maintenance.scheduled, maintenance.started, maintenance.completed, maintenance.failed, maintenance.canceled). See references/overview.md.

For the full event reference, see PlanetScale webhook events.

Important Headers

Header Description
X-PlanetScale-Signature Hex HMAC-SHA256 of the raw body, keyed with the webhook secret
Authorization Only if you configured one on the webhook; sent unchanged. Authenticates PlanetScale to you and does not replace the signature

Delivery Behaviour

Respond 2xx within 2 seconds or the delivery is marked failed; redirects are not followed; webhooks that repeatedly fail are disabled. No retry policy is documented, so do the work asynchronously and make side effects idempotent. There is no event or delivery ID, and storage events carry no resource.id, so compare the resource's state (resource.state, updated_at) with what you've stored rather than relying on a composite key. Each database can have up to 5 webhooks. Deliveries come from `3.2

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

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

FAQ

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

Receive and verify PlanetScale webhooks. Use when setting up PlanetScale webhook handlers, debugging X-PlanetScale-Signature verification, or handling branch.ready, deploy_request.opened, backup.failed and cluster.storage events from PlanetScale (managed Vitess and Postgres).

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

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

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

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

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

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