Command Palette

Search for a command to run...

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

emarsys-webhooks

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

Receive and authenticate SAP Emarsys webhooks. Use when setting up an endpoint for the Emarsys Automation Center Webhook node, checking HTTP Basic…

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

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

SAP Emarsys Webhooks

SAP Emarsys calls your endpoint from the Automation Center Webhook node. You define a Webhook node preset (Automation > Webhook Node Presets > Create preset) with an HTTPS URL, an authentication method and a body. Calls are not signed. With HTTP basic authentication, each request carries an Authorization: Basic base64(username:password) header and your endpoint authenticates the sender by checking those credentials.

The preset offers HTTP basic authentication (username and password), JWT authentication (secret key) or OAuth2. This skill, like Hookdeck's SAP Emarsys source (type EMARSYS), covers HTTP basic only; JWT and OAuth2 are not covered.

When to Use This Skill

  • How do I receive SAP Emarsys Webhook node calls?
  • How do I check Basic authentication on an Emarsys webhook endpoint?
  • Does Emarsys sign webhook payloads? (No: use the shared Basic credentials)
  • How do I deduplicate with deduplication_id, or discard a contact with a 406?
  • Why does my Emarsys webhook endpoint return 401, or fail verification in Hookdeck?

Setup Note (Hookdeck)

Choose HTTP basic authentication in the Webhook node preset. Hookdeck never answers with a 401 challenge, so the credentials have to arrive with each request; if deliveries show as failed verification, they are not.

The Emarsys docs don't say whether Basic credentials are sent preemptively, so there is no WWW-Authenticate round trip to rely on. Neither Hookdeck nor the examples here send a challenge.

Verification (core)

const crypto = require('crypto');

const sha256 = (v) => crypto.createHash('sha256').update(v).digest();
const safeEqual = (a, b) => crypto.timingSafeEqual(sha256(a), sha256(b)); // equal-length digests

function parseBasicAuth(header) {
  const m = typeof header === 'string' && /^basic +([A-Za-z0-9+/]+={0,2})$/i.exec(header);
  if (!m || m[1].length % 4 !== 0) return null;                  // strict alphabet and padding
  const raw = Buffer.from(m[1], 'base64');
  if (raw.toString('base64') !== m[1]) return null;              // rejects junk after valid creds
  const i = raw.indexOf(0x3a);                                   // split on the FIRST colon
  return i < 0 ? null : { user: raw.subarray(0, i), pass: raw.subarray(i + 1) };
}

function verifyEmarsys(headers, user = process.env.EMARSYS_WEBHOOK_USERNAME,
                       pass = process.env.EMARSYS_WEBHOOK_PASSWORD) {
  if (!user || !pass) return false;                              // fail closed
  const c = parseBasicAuth(headers.authorization);
  if (!c) return false;
  const userOk = safeEqual(c.user, user), passOk = safeEqual(c.pass, pass); // no short-circuit
  return userOk && passOk;
}
  • Header: Authorization: Basic base64(username:password); the scheme is case-insensitive.
  • Python: base64.b64decode(token, validate=True), reject unless re-encoding gives back the same token (older Pythons ignore stray padding), split with partition(b":"), then hmac.compare_digest on bytes for username and password (encode both sides; never pass a str, which raises on non-ASCII).
  • Missing or malformed header, or a mismatch: 401. Evaluate both comparisons before deciding.
  • A static shared credential authenticates the sender, not the body, and gives no replay protection (no signature, no timestamp). Use HTTPS and rotate the credential if it leaks.
  • Read the body raw (express.raw({ type: '*/*' })) so any content type works, and parse it only after the check.

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

Payload and Events

There is no vendor event field or event-type list. The preset defines the body:

Part Description
Contact field values Top-level keys you select in the preset
Additional data Static key-value pairs, also top level
event_data Optional; attributes of the triggering event
deduplication_id, ems_program_id, event_time Operational fields; their names can be changed in the preset

The examples use clearly labelled illustrative payloads: "Webhook node contact payload" and "Webhook node with event_data". Use deduplication_id for idempotency when present. The docs don't state the HTTP method; the examples accept POST.

Responses and Retries

  • 200 (any success): handled.
  • A failed request is retried with intervals growing from 30 s to 10 min. After the 11th failure the program goes to Fail-safe mode.
  • 406 discards the contact and keeps the program running. The examples use it for bodies that can never be processed (invalid JSON, not an object). Authentication failures return 401.

Environment Variables

EMARSYS_WEBHOOK_USERNAME=your-webhook-username   # Webhook node preset: HTTP basic username
EMARSYS_WEBHOOK_PASSWORD=your-webhook-password   # Webhook node preset
Полный SKILL.md на GitHub

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

FAQ

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

Receive and authenticate SAP Emarsys webhooks. Use when setting up an endpoint for the Emarsys Automation Center Webhook node, checking HTTP Basic authentication, debugging 401s, or handling preset-defined contact and event_data payloads with deduplication_id.

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

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

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

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

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

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