Webhooks: events, HMAC signatures, retries
A webhook is an HTTPS address on your server where the portal sends a JSON POST when something
happens to the studio's games: a moderator made a decision, a game was published or hidden, a build was
checked, a player beat a record.
Create a webhook
Dashboard → studio → “Settings” → “Webhooks” → “Add”. You need the owner or admin role and a sign-in within the last 15 minutes.
- URL —
https://, port 443 or 8443, a public host name: local and private addresses,localhost, internal network IPs and the portal's own domains are rejected (webhook_url_invalidwith a reason). The address is checked on save and before every delivery; redirects are not followed. - Events — one or more (table below); games — all of the studio's games or up to 50 selected.
- Secret
whsec_…is shown once — store it on your server. - A studio has up to 5 webhooks. The “Test” button sends a
pingevent (up to 10 times an hour).
Testing a receiver during development. The portal will not call localhost: run the receiver
locally and expose it through an HTTPS tunnel (for example,
cloudflared tunnel --url http://localhost:3000 or ngrok http 3000 — both give a public https://…
address on 443), use that address in the webhook and press “Test” — a ping with a real signature
arrives. For production, create a webhook with your server's address and delete the test one.
Events
| Event | When | data |
|---|---|---|
submission.decided |
a moderator decided on a submission | submissionId, gameId, decision (approved, rejected, changes_requested), reasons — reason codes |
game.published |
a new game version is published | gameId, slug, version, submissionId (when published from a submission) |
game.hidden |
the game was hidden | gameId, reason: studio (hidden by the studio), report (after a report), studio_ban (studio ban) |
build.checked |
automated checks of a build finished | buildId, gameId, status (passed, problem, failed), source (cabinet or cli) |
leaderboard.score_improved |
players beat their all-time best | items — up to 100 entries: gameId, board, player, value, at |
ping |
the “Test” button | empty |
Scores are collected into batches of up to 100 entries about every 10 seconds. player is the
player's alias within your studio: it is stable, but differs from the player's id in other studios and
does not reveal the account.
Request format
POST /instaplay/webhooks HTTP/1.1
Content-Type: application/json
User-Agent: InstaPlay-Webhooks/1
InstaPlay-Event: submission.decided
InstaPlay-Delivery: 0193e1d2-…
InstaPlay-Signature: t=1763980000,v1=5b1f0c…
{"id":"0193e1d2-…","event":"submission.decided","createdAt":"2026-11-24T10:26:40.000Z","studioId":"0193c1…","data":{"submissionId":"0193c5…","gameId":"0193c2…","decision":"approved","reasons":[]}}
The body is up to 64 KB. id in the body equals the InstaPlay-Delivery header and is unique for
every delivery.
Verifying the signature
InstaPlay-Signature: t=<time, Unix seconds>,v1=<signature>. The signature is the hex HMAC-SHA256 of
the string <t>.<request body>, keyed with the whole webhook secret (whsec_…, as a UTF-8 string).
Rules:
- Compute the signature over the raw body — before parsing JSON: any reformatting breaks it.
- Reject the request if
tdiffers from the current time by more than 300 seconds — so an old delivery cannot be replayed. - Compare signatures in constant time. For 24 hours after a secret rotation the header carries two
v1=values (new and previous secret) — accept the request if either matches.
Node.js
// verify-signature.js
import { createHmac, timingSafeEqual } from 'node:crypto'
const TOLERANCE_SEC = 300
export function verifyInstaPlaySignature(rawBody, header, secret, nowSec = Math.floor(Date.now() / 1000)) {
if (typeof header !== 'string') return false
let timestamp = NaN
const signatures = []
for (const part of header.split(',')) {
const [key, value] = part.split('=', 2)
if (key === 't') timestamp = Number(value)
else if (key === 'v1' && value) signatures.push(value)
}
if (!Number.isInteger(timestamp) || Math.abs(nowSec - timestamp) > TOLERANCE_SEC) return false
// rawBody is a Buffer or a string: exactly the bytes that came in the request.
const expected = createHmac('sha256', secret).update(`${timestamp}.`).update(rawBody).digest()
return signatures.some((hex) => {
const given = Buffer.from(hex, 'hex')
return given.length === expected.length && timingSafeEqual(given, expected)
})
}
// server.js — Express: the body is read raw on this route only
import express from 'express'
import { verifyInstaPlaySignature } from './verify-signature.js'
const app = express()
const seen = new Set() // in production — a table or Redis with a TTL
app.post('/instaplay/webhooks', express.raw({ type: 'application/json' }), (req, res) => {
const signature = req.get('InstaPlay-Signature')
if (!verifyInstaPlaySignature(req.body, signature, process.env.INSTAPLAY_WEBHOOK_SECRET)) {
return res.sendStatus(401)
}
const delivery = JSON.parse(req.body.toString('utf8'))
res.sendStatus(204) // answer right away, process in your own queue
if (seen.has(delivery.id)) return
seen.add(delivery.id)
console.log(delivery.event, delivery.data)
})
app.listen(3000)
Python
import hashlib
import hmac
import time
def verify_instaplay_signature(raw_body: bytes, header: str, secret: str, tolerance: int = 300) -> bool:
timestamp, signatures = None, []
for part in (header or "").split(","):
key, _, value = part.partition("=")
if key == "t":
timestamp = value
elif key == "v1" and value:
signatures.append(value)
if timestamp is None or not timestamp.isdigit() or abs(time.time() - int(timestamp)) > tolerance:
return False
expected = hmac.new(secret.encode(), timestamp.encode() + b"." + raw_body, hashlib.sha256).hexdigest()
return any(hmac.compare_digest(expected, s) for s in signatures)
In Flask the raw body is request.get_data(), the header — request.headers.get("InstaPlay-Signature").
PHP
<?php
function verify_instaplay_signature(string $rawBody, string $header, string $secret, int $tolerance = 300): bool
{
$timestamp = null;
$signatures = [];
foreach (explode(',', $header) as $part) {
[$key, $value] = array_pad(explode('=', $part, 2), 2, '');
if ($key === 't') {
$timestamp = $value;
} elseif ($key === 'v1' && $value !== '') {
$signatures[] = $value;
}
}
if ($timestamp === null || !ctype_digit($timestamp) || abs(time() - (int) $timestamp) > $tolerance) {
return false;
}
$expected = hash_hmac('sha256', $timestamp . '.' . $rawBody, $secret);
foreach ($signatures as $signature) {
if (hash_equals($expected, $signature)) {
return true;
}
}
return false;
}
$raw = file_get_contents('php://input');
$header = $_SERVER['HTTP_INSTAPLAY_SIGNATURE'] ?? '';
if (!verify_instaplay_signature($raw, $header, getenv('INSTAPLAY_WEBHOOK_SECRET'))) {
http_response_code(401);
exit;
}
http_response_code(204);
Responses and retries
- Success is any
2xxanswer within 10 seconds.3xxis a failure (redirects are not followed), as are4xx,5xx, a timeout and a TLS error. The portal does not read the response body. - After a failure the delivery is retried after 1 min, 5 min, 30 min, 2 h, 6 h, 12 h and 24 h; after the eighth failure it stops.
- If a webhook has no successful event delivery for three days, it is turned off and an email goes to the contact address. Turn it back on in the dashboard once your server is up.
- Delivery is “at least once”: the same event may arrive twice (including a score batch with a new
id). Process idempotently and order events bycreatedAt, not by arrival order. - While a studio is banned, deliveries pile up for up to 7 days and go out after the ban is lifted.
Log and manual redelivery
Each webhook has a 30-day delivery log: event, status (pending, delivered, failed, dead),
attempt, response code, duration, error, body. “Redeliver” sends the same body with a new id (up to 30
times an hour). “Rotate secret” issues a new secret; the previous one keeps working for 24 hours.