Command Palette

Search for a command to run...

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

sparkpost-webhooks

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

Receive and authenticate SparkPost event webhooks. Use when setting up SparkPost webhook handlers, debugging SparkPost webhook authentication (Basic Auth…

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

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

SparkPost Webhooks

When to Use This Skill

  • How do I receive SparkPost webhooks?
  • How do I authenticate SparkPost webhooks? (there is no signature to verify)
  • Why is my SparkPost webhook returning 401 / why won't SparkPost create my webhook?
  • How do I parse the SparkPost msys batch payload?
  • How do I handle delivery, bounce, click, open, spam_complaint events?
  • What is X-MessageSystems-Batch-ID and how do I deduplicate batches?
  • How do I handle SparkPost relay webhooks (inbound email)?

Critical: SparkPost Event Webhooks Are Not Signed

There is no HMAC, no signature header, and no signing secret. Do not look for one — any code that computes createHmac / hmac.new for a SparkPost event webhook is wrong.

Authentication is credential-based and optional, set by the webhook's auth_type field, whose values are exactly none | basic | oauth2. From SparkPost's "Event Webhook Authentication and Security" doc: "The authentication method is set to 'None' by default when creating a new webhook."

Mode auth_type What SparkPost sends
Basic Auth (recommended) basic Authorization: Basic base64(username:password)
OAuth 2.0 client credentials oauth2 Authorization: Bearer {token}
Legacy token (deprecated) — (auth_token field) X-MessageSystems-Webhook-Token: <token>
None (default) none nothing

Your handler must fail closed: if no credentials are configured, reject. Never accept unauthenticated batches silently.

Not to be confused with Bird's new platform webhooks (bird.com). SparkPost is now owned by Bird, and the old www.sparkpost.com/docs/tech-resources/webhook-authentication/ URL 301-redirects to Bird's docs — but that is a different product with its own Standard Webhooks signing (webhook-id / webhook-timestamp / webhook-signature, whsec_ secrets, email.delivered-style event names). None of that applies here.

Authentication (core)

Basic Auth is the primary path. Parse the header, split on the first colon only, and compare both halves in constant time:

const crypto = require('crypto');

// Fixed-length digest compare: safe even when the two strings differ in length.
const eq = (a, b) => crypto.timingSafeEqual(
  crypto.createHash('sha256').update(a, 'utf8').digest(),
  crypto.createHash('sha256').update(b, 'utf8').digest()
);

function verifyBasicAuth(authorizationHeader, username, password) {
  if (!authorizationHeader || username === undefined) return false; // fail closed
  const [scheme, encoded] = authorizationHeader.split(' ');
  if (!encoded || scheme.toLowerCase() !== 'basic') return false;

  const decoded = Buffer.from(encoded, 'base64').toString('utf8');
  // Malformed base64 decodes to something without a colon — reject.
  const colon = decoded.indexOf(':');
  if (colon === -1) return false;

  // Split on the FIRST colon only: passwords may contain colons.
  const user = decoded.slice(0, colon);
  const pass = decoded.slice(colon + 1);

  // `password` is NOT required by SparkPost's API — an empty password is legitimate.
  return eq(user, username) && eq(pass, password ?? '');
}

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

The examples accept either a valid Basic header or Authorization: Bearer <token> (OAuth 2.0), plus the optional legacy X-MessageSystems-Webhook-Token. They also include a minimal demo POST /oauth/token endpoint. See references/verification.md.

There is no SDK verify helper — the sparkpost npm and sparkpost PyPI clients manage webhook configuration but have no receive/authenticate function. Use built-in crypto (crypto.timingSafeEqual, hmac.compare_digest) as above.

Payload: a JSON Array of msys-Wrapped Events

SparkPost POSTs a batch — a JSON array. Each element has a single msys key wrapping one event-class object, which carries the type field:

[
  { "msys": { "message_event": { "type": "delivery", "event_id": "92356927693813856", "message_id": "000443ee14578172be22", "timestamp": "1460989507" } } },
  { "msys": { "track_event": { "type": "click", "target_link_url": "http://example.com" } } }
]

Read the single key under msys — do not hardcode message_event — then switch on type.

Wrapper key Event types
message_event bounce, delivery, injection, spam_complaint, out_of_band, policy_rejection, delay, sms_status
track_event click, open, initial_open, amp_click, amp_open, amp_initial_open
gen_event generation_failure, generation_rejection
unsubscribe_event list_unsubscribe, link_unsubscribe
relay_event relay_injection, relay_rejection, relay_delivery, `rel
Полный SKILL.md на GitHub

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

FAQ

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

Receive and authenticate SparkPost event webhooks. Use when setting up SparkPost webhook handlers, debugging SparkPost webhook authentication (Basic Auth, OAuth 2.0 Bearer tokens, or the deprecated X-MessageSystems-Webhook-Token header), parsing the batched `msys` payload, or handling email events like delivery, bounce, click, open, spam_complaint, delay, and list_unsubscribe. SparkPost event webhooks are NOT signed — there is no HMAC and no signature header.

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

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

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

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

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

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