Discord tournament announcements
Use this recipe when a club or community wants a Discord channel to announce completed tournaments without polling.
Status: closed-beta runnable for accounts with webhooks enabled. The v0 event allowlist contains
tournament.completed.
Maintained sample: apps/developer-recipe-discord-announcements.
What you build
- A server endpoint that receives PokerWorks webhook deliveries.
- Signature verification before any side effect.
- A Discord webhook call that posts a short announcement.
- Idempotent handling keyed by
PokerWorks-Event-Id.
Requirements
- A Console project.
- A service account token stored server-side.
- Management scopes:
webhook_endpoints:create,webhook_endpoints:read,webhook_deliveries:read,webhook_deliveries:replay. - A public HTTPS receiver URL.
- A Discord incoming webhook URL stored in your own secret manager.
1. Create the PokerWorks webhook endpoint
Use the Console Webhooks page, or call the management contract from trusted server code with a
pw_mgmt_… token:
Code
Store the reveal-once pwwhsec_… signing secret immediately. It is not shown again.
2. Verify before posting
Your receiver must verify the raw request body before it posts to Discord. The signed input is:
Code
The event body is intentionally minimal in v0:
Code
Post only after verification succeeds. If Discord is down, return a retryable status such as 503
so PokerWorks can retry within the bounded retry window.
3. Replay a failed delivery
Use the Console delivery log to inspect and replay failures. If you are automating from trusted server code, call the management delivery contracts:
Code
Security notes
- Keep
pwwhsec_…,pw_mgmt_…, and the Discord webhook URL in server-side secrets. - Verify signatures before dedupe and before parsing event
data. - Dedupe on
PokerWorks-Event-Id; deliveries are at-least-once. - Do not assume player names or winner details are present in v0.