-
Notifications
You must be signed in to change notification settings - Fork 0
webhook server
The webhook server is the HTTP-only side of Rob.
- Receives Throne webhook events.
- Validates the URL secret against
webhook_secretandwebhook_secret_hash. - Optionally validates Throne Ed25519 signatures and timestamps.
- Normalises accepted Throne purchase payloads.
- Writes sends into PostgreSQL.
- Respects maintenance mode by inserting
queued_maintenanceinstead ofpending. - Never connects to Discord.
- Entry point:
python -m apps.webhook.main - Host/port:
THRONE_WEBHOOK_HOST/THRONE_WEBHOOK_PORT - Health check:
GET /health - Webhook route:
POST /throne/webhook/{creator_id}/{secret} - The webhook runtime loads
WebhookSettingsonly and can start withoutDISCORD_TOKEN.
APP_ENVLOG_LEVELDATABASE_URLTHRONE_WEBHOOK_HOSTTHRONE_WEBHOOK_PORTTHRONE_WEBHOOK_BASE_URLTHRONE_WEBHOOK_REQUIRE_SIGNATURETHRONE_PUBLIC_KEY_PEMTHRONE_WEBHOOK_DEBUG_LOG_PAYLOADTHRONE_WEBHOOK_TIMESTAMP_HEADERTHRONE_WEBHOOK_SIGNATURE_HEADERTHRONE_WEBHOOK_SIGNED_MESSAGE_FORMATTHRONE_WEBHOOK_MAX_TIMESTAMP_SKEW_SECONDS
DISCORD_TOKEN is not required here.
- When
THRONE_WEBHOOK_REQUIRE_SIGNATURE=true, the webhook rejects requests with401if the timestamp is invalid, the public key is missing, or the Ed25519 signature check fails. - When
THRONE_WEBHOOK_REQUIRE_SIGNATURE=false, the webhook skips Ed25519 signature validation entirely, but it still requires valid JSON plus a matching{creator_id}/{secret}URL pair. - For early local or tunnel-based dev,
falseis acceptable while the real Throne public key and signed-message format are still being verified. - For stricter shared-dev testing, switch it back to
trueand provideTHRONE_PUBLIC_KEY_PEMplus the correct header and message-format settings.
-
Explicit test/setup webhook payloads are detected before send insertion.
-
Explicit test/setup events update creator setup verification timestamps (
setup_verified_at,last_test_webhook_at,last_successful_event_at) and return{"ok": true, "setup_verified": true}. -
Explicit test/setup events do not insert
sendsrows and do not enter the Discord send tracker queue. -
Runtime currently renders registration/setup UI with no embed fallback via a Components V2 compatibility layer until discord.py exposes stable V2 APIs.
-
THRONE_PARSE_TEST_SENDS_AS_REAL_SENDS(defaultfalse) allows known test sender usernames to pass as real sends for dev testing. -
THRONE_TEST_GIFTER_USERNAMEScontrols sender-name-based test detection (defaultmarie_123). -
Known test senders are still inserted as
sendsrows so the public send tracker flow can render, but those rows are stored withis_test_send=true. -
When
THRONE_PARSE_TEST_SENDS_AS_REAL_SENDS=false, known test-sender rows are excluded from leaderboard totals, stats, and leader alerts unless the recipient matchesTHRONE_TEST_SEND_LEADERBOARD_OWNER_USER_ID. -
If test parsing was previously enabled,
scripts/robctl throne invalidate-test-sendscan backfill historical known test sender rows tois_test_send=true. -
Explicit test/setup payloads are always setup-only and never inserted as sends.
-
Webhook payload
price/amountvalues are treated as authoritative minor currency units for send amounts.