Command Palette

Search for a command to run...

UnylyUnyly
Back to skills

spotdraft-webhooks

FreeRuns bundled scriptsNot checked

Receive and verify SpotDraft webhooks. Use when setting up a SpotDraft webhook endpoint (Settings > Developer settings > Webhooks), fetching the hmac_key from…

hookdeckby hookdeck★ 104 GitHub stars

About this skill

SpotDraft Webhooks

SpotDraft (contract lifecycle management) POSTs JSON to your endpoint when contract activities happen, such as CONTRACT_SENT_TO_COUNTERPARTY or CONTRACT_EXECUTED. Each request carries X-SD-WEBHOOK-CONTENT-HASH, a hex HMAC-SHA512 of the raw body keyed with the workspace's base64-decoded hmac_key. The key isn't shown in the app: you fetch it from the API.

When to Use This Skill

  • How do I verify SpotDraft webhook signatures?
  • Where do I get the SpotDraft webhook hmac_key?
  • Why does my X-SD-WEBHOOK-CONTENT-HASH never match? (usually: the key wasn't base64-decoded, SHA-256 was used instead of SHA-512, or the body was re-serialised)
  • Which contract events does SpotDraft send?

Verification (core)

const crypto = require('crypto');

function verifySpotDraftWebhook(rawBody, contentHash, hmacKey) {    // rawBody: exact bytes
  const key = Buffer.from(hmacKey.trim(), 'base64');                // DECODE the hmac_key
  if (!key.length || !/^[0-9a-fA-F]+$/.test(contentHash || '')) return false;
  const expected = crypto.createHmac('sha512', key).update(rawBody).digest();   // SHA-512
  const given = Buffer.from(contentHash, 'hex');
  return given.length === expected.length && crypto.timingSafeEqual(given, expected);
}
  • Key: the hmac_key from GET /api/v2.1/public/webhooks/hmac_key/, base64-decoded. SpotDraft's sample: hmac.new(base64.b64decode(hmac_key), raw_body, digestmod=hashlib.sha512).hexdigest(). The key string as UTF-8 never matches.
  • Signed content: the raw request body only. No timestamp.
  • Header: X-SD-WEBHOOK-CONTENT-HASH, the bare hex digest (128 characters).
  • Bad or missing hash: 401. Key not configured or not valid base64: 500.

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

See references/verification.md for Python and debugging.

Hookdeck: the SpotDraft source type (SPOTDRAFT) verifies X-SD-WEBHOOK-CONTENT-HASH with the hmac_key, pasted exactly as the API returns it (base64; Hookdeck decodes it). Verification is optional on the source, and Hookdeck applies no timestamp window (SpotDraft signs none).

Events

SpotDraft's Webhooks page lists the only_for_activities values. The contract lifecycle ones:

Activity When it fires
CONTRACT_CREATED A new contract is created
CONTRACT_DATA_UPDATED Contract data changes
CONTRACT_VERSION_UPLOADED A new contract version is uploaded
CONTRACT_SENT_TO_COUNTERPARTY The contract is sent for counterparty review or redlining
CONTRACT_REVIEW_REQUESTED / CONTRACT_REVIEW_COMPLETED Internal review is requested / completed
CONTRACT_SIGNATURE_REQUESTED The contract is marked or sent for signature
CONTRACT_SIGNATURE_DECLINED A signatory declines to sign
CONTRACT_SIGNED A required signatory completes signing
CONTRACT_EXECUTED All required signatures are complete
CONTRACT_VOIDED / CONTRACT_DELETED The contract is voided / deleted
CONTRACT_PROCESS_METRIC_UPDATED Workflow metrics change

The page also lists CONTRACT_MARK_FOR_EXECUTION, CONTRACT_UNMARK_FOR_EXECUTION, CONTRACT_ENTITY_UPDATED and CONTRACT_ACTIVITY_LOG_COMMENT_CREATED; approvals and structured data (CONTRACT_APPROVAL_REQUESTED, CONTRACT_APPROVAL_COMPLETED, CONTRACT_EXTERNAL_METADATA_CREATED / _UPDATED, CONTRACT_KEY_POINTER_CREATION / _UPDATION); counterparties (COUNTER_PARTY_CREATED / _UPDATED, COUNTER_PARTY_CONTACT_CREATED / _UPDATED, COUNTER_PARTY_ADDRESS_CREATED / _UPDATED); and email events (POSTMARK_EMAIL_EVENT, SIGNING_EMAIL_DELIVERED / _OPENED / _NOT_DELIVERED / _LINK_CLICKED, the same four REDLINING_EMAIL_* values, and CONTRACT_SIGNATURE_REQUESTED_NOTIFICATION_SENT).

The guides don't publish the payload fields (they point to the API reference for version-specific fields), and SpotDraft calls a delivery "a change signal": fetch the contract from the API when you need the full record. The examples assume no field and fingerprint the raw body for deduplication; log the first real delivery and add dispatch on the activity field.

Environment Variables

SPOTDRAFT_HMAC_KEY=base64-hmac-key   # GET /api/v2.1/public/webhooks/hmac_key/, exactly as returned

Local Development

# Express / Next.js (use 8000 for FastAPI). No install or account required.
npx hookdeck-cli listen 3000 spotdraft --path /webhooks/spotdraft

Register the printed HTTPS URL, then send a contract to a counterparty. See references/setup.md.

Reference Materials

Full SKILL.md on GitHub

Install spotdraft-webhooks in Claude Code & Claude Desktop

Sign up to install this skill

Create a free account to reveal the install command and save the skill to your library.

  • Reveal the one-line install command
  • Save skills to your synced library
  • Get notified when skills update
Sign up freeI already have an account

Allowed tools

Tools this skill is permitted to call.

No restriction — this skill can use any tool.

Bundled files

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/spotdraft/route.tsexamples/nextjs/lib/verify-spotdraft.tsexamples/nextjs/package.jsonexamples/nextjs/vitest.config.tsreferences/overview.mdreferences/setup.mdreferences/verification.md

FAQ

What does the spotdraft-webhooks skill do?

Receive and verify SpotDraft webhooks. Use when setting up a SpotDraft webhook endpoint (Settings > Developer settings > Webhooks), fetching the hmac_key from the API, verifying the X-SD-WEBHOOK-CONTENT-HASH header (HMAC-SHA512 with the base64-decoded key), handling contract activities such as CONTRACT_EXECUTED, or debugging why the SpotDraft hash never matches.

How do I install the spotdraft-webhooks skill?

Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.

Does the spotdraft-webhooks skill run scripts?

Yes, this skill bundles executable scripts. Review the source before installing.

Related skills

Compare spotdraft-webhooks with