Command Palette

Search for a command to run...

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

supabase-webhooks

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

Receive and verify Supabase webhooks. Use when setting up Supabase Database Webhooks (INSERT, UPDATE, DELETE table events sent via pg_net triggers) or…

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

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

Supabase Webhooks

When to Use This Skill

  • How do I receive Supabase Database Webhooks (INSERT / UPDATE / DELETE)?
  • How do I verify a Supabase Auth Hook signature?
  • Why is my Supabase webhook-signature verification failing?
  • How do I secure a Supabase Database Webhook when there is no signature?
  • How do I implement a send_email / send_sms / custom_access_token Auth Hook?
  • What does the v1,whsec_ secret prefix mean?

Two Surfaces, Two Security Models

Supabase sends outbound HTTP from two different systems. They do not share a security model — do not apply one's verification to the other.

Database Webhooks Auth Hooks (HTTP Hook)
Source Postgres trigger → pg_net Supabase Auth (GoTrue)
Docs Database Webhooks Auth Hooks
Events INSERT, UPDATE, DELETE 6 auth lifecycle hooks
Signature None — no HMAC, no signing secret, no Supabase header Standard Webhooks HMAC-SHA256
Auth Whatever headers you configure (e.g. Authorization: Bearer …) webhook-id / webhook-timestamp / webhook-signature
Semantics Fire-and-forget, async Request/response — your JSON body changes auth behaviour
Retries None documented Up to 3 retries (2s backoff, 5s total budget) — requires a non-empty retry-after header

Supabase documents no source-IP allowlist and no user-agent value for either surface. Do not build either into your receiver.

Verification (core)

Auth Hooks — Standard Webhooks HMAC-SHA256

const { Webhook } = require('standardwebhooks');

// Secret is issued as "v1,whsec_<base64>". Strip the "v1,whsec_" prefix; the
// remainder is STANDARD base64 that the library base64-DECODES to the raw HMAC
// key. Using the base64 string itself as the key rejects every real delivery.
const wh = new Webhook(process.env.SUPABASE_AUTH_HOOK_SECRET.replace('v1,whsec_', ''));

// Signs `{webhook-id}.{webhook-timestamp}.{raw_body}` and base64-compares in
// constant time against every space-delimited `v1,<sig>` entry, with a
// ±5-minute timestamp tolerance. Pass the RAW body — re-serialised JSON fails.
const payload = wh.verify(rawBody, {
  'webhook-id': headers['webhook-id'],
  'webhook-timestamp': headers['webhook-timestamp'],
  'webhook-signature': headers['webhook-signature'],
}); // throws WebhookVerificationError on failure

Database Webhooks — developer-configured shared secret

There is no signature to verify. Authenticate with a header you set yourself when creating the webhook, compared in constant time:

const crypto = require('crypto');

function timingSafeEqualStr(a, b) {
  const x = Buffer.from(a || '', 'utf8');
  const y = Buffer.from(b || '', 'utf8');
  if (x.length !== y.length) return false; // length is not secret here
  return crypto.timingSafeEqual(x, y);
}

// Header value comes from the headers JSON you pass to supabase_functions.http_request
function authenticateDatabaseWebhook(headers, secret) {
  if (!secret) return false;
  const authorization = headers['authorization'] || '';
  const presented = authorization.toLowerCase().startsWith('bearer ')
    ? authorization.slice(7).trim()
    : headers['x-webhook-secret'] || '';
  return timingSafeEqualStr(presented, secret);
}

if (!authenticateDatabaseWebhook(req.headers, process.env.SUPABASE_WEBHOOK_SECRET)) {
  return res.status(401).json({ error: 'Unauthorized' });
}

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

Database Webhook Events

Only three, all fired after the row change:

type Fires when record old_record
INSERT A row is inserted new row null
UPDATE A row is updated new row previous row
DELETE A row is deleted null deleted row

type is UPPERCASE and is the discriminator. The full payload has exactly four other top-level fields — there are no others:

{ "type": "INSERT", "table": "<table name>", "schema": "<schema name>", "record": { }, "old_record": null }

record / old_record mirror the table's own columns, so their inner shape is whatever your table defines.

Create one in the Dashboard (Integrations → Webhooks) or in SQL:

create trigger "my_webhook" after insert on "public"."my_table"
for each row execute function "supabase_functions"."http_request"(
  'https://example.com/webhooks/supabase',  -- url
  'POST',                                   -- method (POST or GET)
  '{"Content-Type":"application/json","Authorization":"Bearer YOUR_SHARED_SECRET"}',
  '{}',                                     -- params
  '1000'                                    -- timeout in ms
);

There is **no delivery id header and no d

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

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

FAQ

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

Receive and verify Supabase webhooks. Use when setting up Supabase Database Webhooks (INSERT, UPDATE, DELETE table events sent via pg_net triggers) or Supabase Auth Hooks (send_email, send_sms, custom_access_token, before_user_created, mfa_verification_attempt, password_verification_attempt), debugging Standard Webhooks signature verification with the webhook-id, webhook-timestamp and webhook-signature headers, or handling the `v1,whsec_` secret format.

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

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

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

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

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

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