Command Palette

Search for a command to run...

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

live-tennis-api-webhooks

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

Receive and verify Live Tennis API webhooks. Use when setting up Live Tennis API webhook handlers, debugging X-LTAPI-Signature-V1 HMAC-SHA256 verification…

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

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

Live Tennis API Webhooks

When to Use This Skill

  • How do I receive Live Tennis API webhooks (live scores, points, break points)?
  • How do I verify the X-LTAPI-Signature-V1 header?
  • How do I move off the deprecated X-LTAPI-Signature header before 2027-02-01?
  • How do I register a webhook with POST /webhooks and keep the signing secret?
  • How do I handle score, score_withdrawn, point, break_point, break_point_result or status frames?
  • Why is my Live Tennis API webhook signature verification failing?

How Live Tennis API Delivers Webhooks

You register an HTTPS URL with POST /webhooks (ULTRA plan, direct API key only, max 3 webhooks per key). The 201 response contains a secret that is shown exactly once: store it as LIVE_TENNIS_API_WEBHOOK_SECRET. Each delivery is one POST of the same frame the push feed sends, plus a top-level delivery_id that is unique per delivery. Delivery is best-effort and at-most-once: one attempt, ~3 second timeout, redirects disabled, and the webhook is disabled after 25 consecutive failures.

Verification (core)

Every request carries X-LTAPI-Signature-V1: t=<unix seconds>,v1=<hex>. Each v1 is the hex HMAC-SHA256, keyed with your webhook secret, of <t>.<raw request body>. Accept the request if any v1 matches, reject a t more than 5 minutes from your clock, and compare in constant time over the raw bytes before parsing JSON. There is no webhook SDK, so verify manually.

The older X-LTAPI-Signature (sha256=<hex> of the body alone) is deprecated and stops on 2027-02-01. Don't fall back to it: it doesn't cover the timestamp, so a re-stamped replay passes.

const crypto = require('crypto');

function verifyLiveTennisSignature(rawBody, header, secret, now = Math.floor(Date.now() / 1000)) {
  let t = null;
  const sigs = [];
  for (const part of String(header || '').split(',')) {
    const i = part.indexOf('=');
    if (i === -1) continue;
    const key = part.slice(0, i).trim();
    const value = part.slice(i + 1).trim();
    if (key === 't') t = value;
    else if (key === 'v1') sigs.push(value);
  }
  if (!t || !/^\d+$/.test(t) || sigs.length === 0 || Math.abs(now - Number(t)) > 300) return false;
  const expected = crypto.createHmac('sha256', secret).update(`${t}.`).update(rawBody).digest();
  // validate hex before Buffer.from(x, 'hex'), which silently truncates
  return sigs.some((s) => /^[0-9a-f]{64}$/i.test(s) && crypto.timingSafeEqual(Buffer.from(s, 'hex'), expected));
}
import hashlib, hmac, re, time

def verify_live_tennis_signature(raw_body: bytes, header: str, secret: str) -> bool:
    parts = [p.strip().partition("=") for p in header.split(",")]
    t = next((v for k, _, v in parts if k == "t"), None)
    sigs = [v.lower() for k, _, v in parts if k == "v1"]
    if not t or not re.fullmatch(r"[0-9]+", t) or not sigs or abs(time.time() - int(t)) > 300:
        return False
    expected = hmac.new(secret.encode(), t.encode() + b"." + raw_body, hashlib.sha256).hexdigest()
    # compare bytes so a non-ASCII header fails verification instead of raising
    return any(hmac.compare_digest(s.encode(), expected.encode()) for s in sigs)

Then dedupe on the body's delivery_id, keeping each id until t + 5 minutes (with several workers, use an atomic insert-if-absent).

For complete handlers with route wiring, event dispatch, and tests, see:

Event Types (X-LTAPI-Event)

The X-LTAPI-Event header names the frame type. The JSON body normally carries the same value in type, and the examples dispatch on the (signed) body type, falling back to the header.

Event Description
score Complete current score after every accepted live-score commit (a missed one self-corrects on the next)
score_withdrawn A score state already sent is withdrawn, deferred or withheld; discard superseded_sequence
point One played point, with a per-match point.seq (an event, not a state)
break_point A break point just arose (server, returner, break_points, win_probability_p1)
break_point_result A break point resolved (outcome is held or broken)
status A match's admin status changed

Choose them at registration with the events array: score (the default), break_point (both break point frames), point and status.

For payload details, see references/overview.md.

Important Headers

Header Description
X-LTAPI-Signature-V1 t=<unix seconds>,v1=<hex>, HMAC-SHA256 of <t>.<raw body>
X-LTAPI-Signature Deprecated: sha256=<hex> of the body alone, sent until 2027-02-01. Don't verify it
X-LTAPI-Event Frame type (score, `score_wi
Полный SKILL.md на GitHub

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

FAQ

Что делает скилл live-tennis-api-webhooks?

Receive and verify Live Tennis API webhooks. Use when setting up Live Tennis API webhook handlers, debugging X-LTAPI-Signature-V1 HMAC-SHA256 verification, moving off the deprecated X-LTAPI-Signature header, registering a webhook with POST /webhooks, or handling live tennis frames like score, score_withdrawn, point, break_point, break_point_result and status.

Как установить скилл live-tennis-api-webhooks?

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

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

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

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

Сравнить live-tennis-api-webhooks с