papergames-webhooks
БесплатноЗапускает вложенные скриптыНе проверенReceive and verify Papergames (papergames.io) webhooks, delivered by Svix. Use when setting up a Papergames webhook handler for the embeddable games API…
от hookdeck★ 104 звезды на GitHubОб этом скилле
Papergames Webhooks
Papergames is an online multiplayer board-game platform (Battleship, Tic Tac Toe, Connect 4, Gomoku, Chess) with an embeddable games API. You create a game session over the REST API, embed its playUrl / watchUrl in an iframe, and Papergames sends a webhook as each game in the session starts and finishes. Webhooks are delivered by Svix and signed with the svix- header prefix. (Not to be confused with Paperform, the form builder.)
When to Use This Skill
- How do I receive Papergames webhooks?
- How do I verify a Papergames webhook signature (
svix-signature)? - Where do I find my Papergames webhook secret (
whsec_...)? - How do I handle
game.startedandgame.finishedevents? - How do I find the winner of a Papergames game, or map players to my own user IDs?
- Why is my Papergames webhook signature verification failing?
Verification (core)
| Header | Value |
|---|---|
svix-id |
Unique message ID; the same on every retry, so it's your idempotency key |
svix-timestamp |
Unix seconds |
svix-signature |
Space-delimited v1,<base64> entries (more than one during secret rotation) |
Signed content is {svix-id}.{svix-timestamp}.{raw body}, HMAC-SHA256, standard base64. The key is the base64-decoded part of the secret after whsec_:
const crypto = require('crypto');
// rawBody: exact request bytes (Buffer/string), NOT re-serialized JSON
function verifyPapergames(rawBody, headers, secret = process.env.PAPERGAMES_WEBHOOK_SECRET) {
const key = Buffer.from(secret.replace(/^whsec_/, ''), 'base64');
if (key.length === 0) throw new Error('Invalid PAPERGAMES_WEBHOOK_SECRET');
const expected = Buffer.from(crypto.createHmac('sha256', key)
.update(`${headers['svix-id']}.${headers['svix-timestamp']}.`).update(rawBody).digest('base64'));
return headers['svix-signature'].split(' ').some((entry) => {
const [version, sig] = entry.split(',', 2);
if (version !== 'v1' || !sig) return false; // ignore unknown version tags
const candidate = Buffer.from(sig);
return candidate.length === expected.length && crypto.timingSafeEqual(candidate, expected);
});
}
Also check svix-timestamp is a positive integer within your tolerance. Papergames publishes no number; the examples default to 5 minutes (the Svix libraries' default) and let you widen or disable it with PAPERGAMES_WEBHOOK_TOLERANCE_SECONDS, because a strict window can reject late retries or replays (see references/verification.md). The official svix library (npm and PyPI) is a supported alternative, with a fixed 5-minute window. Read the raw body: express.raw(), await request.text() in Next.js, await request.body() in FastAPI.
For complete handlers with tests, see examples/express/, examples/nextjs/, examples/fastapi/.
Payload Envelope
The body is Papergames' own envelope, not the Standard Webhooks type / data shape. Route on body.eventType; the game session is body.payload. There's no event-type header, so parse the body after verification:
{
"eventType": "game.finished",
"payload": {
"createdAt": "2023-11-03T10:34:28.191Z",
"gamesPlayed": 1,
"players": [
{ "externalId": "PEP_001", "name": "Pepito", "score": 1 },
{ "externalId": "JD_001", "name": "John Doe", "score": 0 }
],
"status": "playing",
"uid": "8qgmUmqJj",
"updatedAt": "2023-11-03T10:34:57.484Z"
}
}
uidis the game session ID returned when you created the session; use it to find your record.externalIdis your user ID, present only if you passedexternalUserIdon the iframe URL. Fall back touid+name.- There's no
winnerfield: compareplayers[].scoreongame.finished. statusstays"playing"ongame.finished(a session can hold several games), so don't use it to detect the end of a session.- The docs' prose names the root
webhookPayloadwhile the JSON examples have no wrapper. The examples follow the JSON and also accept the envelope nested underwebhookPayload.
Common Event Types
Event (eventType) |
Fired when |
|---|---|
game.started |
A game within a game session starts (can fire several times per session) |
game.finished |
A game within a game session finishes (can fire several times per session) |
These are the only two documented events. Each endpoint subscribes to the events it chooses, and the list may grow, so acknowledge unknown types with 2xx. After all retries fail, Svix sends a message.attempt.exhausted operational webhook. Papergames doesn't document its payload or which endpoint receives it. See references/overview.md.
Delivery Semantics
Return 2xx quickly and process asynchronously. Failed attempts are retried immediately
Установить papergames-webhooks в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл papergames-webhooks?
Receive and verify Papergames (papergames.io) webhooks, delivered by Svix. Use when setting up a Papergames webhook handler for the embeddable games API, debugging svix-id / svix-timestamp / svix-signature verification (HMAC-SHA256, base64, whsec_ secret), or handling game session events game.started and game.finished (eventType / payload envelope, scores, externalId).
Как установить скилл papergames-webhooks?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл papergames-webhooks запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic