Skip to content

Webhook secure intake

The accept-or-reject gate for an incoming webhook in one call: signature check, body schema check, a raw-bytes fingerprint for redelivery dedup, event time in UTC and epoch, and PII redaction. Pure CPU.

$0.005 per call · one payment for the whole workflow
POST /api/skill/webhook-intake
Sample output + API docs →

5 tools run server-side in one request: one payment, one response, and a partial-success envelope if a step fails. Free with proof-of-work (no wallet), or $0.005 in USDC over x402 or MPP.

When to use this pack

Run it on every incoming webhook: reject an invalid signature first, then validate the body, fingerprint it for dedup, normalize its time and redact PII before logging.

Tools in this pack

Each is also callable on its own.

ToolRoute
Webhook signature verifyPOST /api/webhook-verify
JSON Schema validatePOST /api/json-validate
HashPOST /api/hash
Time convertPOST /api/time-convert
Redact PIIPOST /api/redact

Bought one at a time, these 5 tools cost $0.005 together; the pack is that sum less a 10% bundle discount, rounded up to the $0.001 settlement floor, which is $0.005.

Workflow

  1. Verify the provider signature over the raw body with webhook-verify; reject when invalid.
  2. Check the trusted body against a provider envelope schema with json-validate.
  3. Fingerprint the raw bytes with hash (sha256) as the redelivery dedup key.
  4. Normalize the event timestamp to UTC ISO and epoch with time-convert.
  5. Redact emails, IPs, phone numbers and card fragments with redact before logging.

Arguments

NameRequiredDescriptionExample
rawBodyyesthe raw webhook body exactly as received on the wire (signatures are over the raw bytes){"ref":"refs/heads/main","before":"6113728f27ae82c7b1a177c8d03f9e96e0adf246","after":"d6fde92930d4715a2b49857d24b940956b26d2d3","repository":{"full_name":"acme/checkout-service"},"pusher":{"name":"alice","email":"alice@example.com"},"head_commit":{"id":"d6fde92930d4715a2b49857d24b940956b26d2d3","message":"fix: retry payment capture on 5xx","timestamp":"2026-07-01T15:04:05Z"}}
provideryeswhich provider signed the webhook: github | stripe | shopify | slackgithub
secretyesthe webhook signing secret from the provider dashboard (never echoed back)gh_hook_secret_demo_only
signatureyesthe signature header value, with or without its scheme prefix (sha256= / v0= / t=...,v1=...)sha256=45f74caa8f537323fd4fa022357ebc620cbcfb28a6dcd65b0f1da3646edf5c4a
timestampnothe provider timestamp header - required for stripe/slack replay protection (stripe's may ride in the signature's t= element)

What one call returns

A JSON object with pack, args, steps, summary; steps holds each tool's own result or error. Full example on the API page.

Call it directly

Any x402 client pays the 402 and gets the whole workflow back. With the agent402-client SDK (npm i agent402-client):

import { Agent402 } from "agent402-client";
// payFetch: an x402-wrapped fetch your wallet signs (@x402/fetch).
// Tools on the free tier need no options: new Agent402() pays them by proof-of-work.
// an existing prepaid credits key also works: new Agent402({ creditsKey })
const client = new Agent402({ fetch: payFetch });
const result = await client.call("skill-webhook-intake", {"rawBody":"{\"ref\":\"refs/heads/main\",\"before\":\"6113728f27ae82c7b1a177c8d03f9e96e0adf246\",\"after\":\"d6fde92930d4715a2b49857d24b940956b26d2d3\",\"repository\":{\"full_name\":\"acme/checkout-service\"},\"pusher\":{\"name\":\"alice\",\"email\":\"alice@example.com\"},\"head_commit\":{\"id\":\"d6fde92930d4715a2b49857d24b940956b26d2d3\",\"message\":\"fix: retry payment capture on 5xx\",\"timestamp\":\"2026-07-01T15:04:05Z\"}}","provider":"github","secret":"gh_hook_secret_demo_only","signature":"sha256=45f74caa8f537323fd4fa022357ebc620cbcfb28a6dcd65b0f1da3646edf5c4a","timestamp":"..."});

Run it in Claude

claude mcp add agent402 -s user -- npx -y agent402-mcp@0.17.2

Then paste this prompt:

Securely ingest this incoming webhook using Agent402's webhook-intake skill pack.

Provider: github
Raw body (byte-for-byte as received on the wire - never re-serialize before verifying):
{"ref":"refs/heads/main","before":"6113728f27ae82c7b1a177c8d03f9e96e0adf246","after":"d6fde92930d4715a2b49857d24b940956b26d2d3","repository":{"full_name":"acme/checkout-service"},"pusher":{"name":"alice","email":"alice@example.com"},"head_commit":{"id":"d6fde92930d4715a2b49857d24b940956b26d2d3","message":"fix: retry payment capture on 5xx","timestamp":"2026-07-01T15:04:05Z"}}

Signature header value: sha256=45f74caa8f537323fd4fa022357ebc620cbcfb28a6dcd65b0f1da3646edf5c4a
Signing secret: gh_hook_secret_demo_only

(1) webhook-verify with provider, payload=the RAW body string, secret, signature (scheme prefix ok). This is the accept/reject gate: if valid=false, STOP - return 401 to the sender and log only the step-3 fingerprint, never the body. For stripe/slack also pass the provider timestamp so the ±300s replay window is enforced (stripe's t= element inside the signature works too). (2) json-validate the parsed body against the provider envelope schema - for GitHub push events {type:'object', required:['repository']}; for Stripe require id/type/created. A schema failure on a VALID signature = provider API-version drift: alert loudly, quarantine, don't silently drop fields. (3) hash the raw body with algo='sha256' - the content fingerprint. Dedup redeliveries on it (at-least-once delivery means the same event arrives more than once) or reuse it as the Idempotency-Key for downstream calls. (4) time-convert the event timestamp (GitHub head_commit.timestamp ISO; Stripe created / Slack event_time epoch seconds; Shopify created_at RFC 3339) → UTC ISO + epochSeconds. Store the epoch, render the ISO. (5) redact the body before it touches any log. Persist ONLY the redacted string; report per-kind counts as metrics. Final return: {accepted: <signature valid AND schema valid>, verify: {valid, scheme, reason}, schemaValid: bool, schemaErrors: [], fingerprint: <sha256 hex>, eventTimeUtc, eventEpochSeconds, redactedBody, redactionCounts, oneLineSummary: 'webhook accepted: signature ok, envelope ok, deduped by fingerprint, 1 email redacted, safe to process'}. All five tools are pure-CPU and PoW-eligible - the whole gate runs on the free tier. Budget: $0.005 for the one pack call (the price /api/pricing lists).

← All skill packs