Paradaux
IssuesPAR-155Done
0

Webhook dispatcher: send a rich Discord embed when the target is a Discord webhook

Goal

When a registered webhook target is a Discord webhook URL, the dispatcher should auto-detect it and POST a nicely-formatted Discord embed (Discord's {username, embeds:[…]} shape) instead of the raw WebhookEvent JSON — so players can point a webhook straight at a Discord channel and get readable transaction messages with zero glue code. Still substrate (PAR-151/PAR-153): no new gameplay, just smarter delivery formatting.

Detection

Host ∈ {discord.com, discordapp.com, canary.discord.com, ptb.discord.com} and path matches ^/api(/v\d+)?/webhooks/\d+/.+. (https-only is already enforced by the SSRF guard; Discord resolves to public Cloudflare addresses so it passes.)

Behaviour (treasury-rest-api dispatcher)

  • New util/DiscordWebhookisDiscordWebhook(URI) + toPayload(DueDelivery) building an embed: credit/debit title + green/red color by amount sign, fields (amount, account, txn, system, memo/message, initiator), ISO timestamp, footer. Discord embed length limits respected.
  • WebhookDispatcherService.deliver: branch on detection — Discord path sends the embed body and omits the X-Treasury-Signature/X-Treasury-Event headers (Discord ignores them and the body isn't our canonical event). Non-Discord path unchanged (signed WebhookEvent). Success is still any 2xx (Discord returns 204); 429/5xx ride the existing retry/backoff/auto-disable.
  • Unit test for detection + payload shape.

economy-explorer (cosmetic)

  • Shared isDiscordWebhookUrl helper; show a Discord badge on the webhooks table/detail and a hint under the create-form URL input ("Looks like a Discord webhook — deliveries will be sent as a rich embed").

Tracking

Follow-up to PAR-151 (feed/dispatcher) and PAR-153 (explorer self-service).

Comments

No comments yet.

Activity

  • ParadauxIO linked a commit — Commit ca6b53f — Merge pull request #14 from MCCitiesNetwork/developJun 14, 2026, 12:25 PM
  • ParadauxIO linked a commit — Commit dd2716d — Deliver Discord-formatted embeds to Discord webhook targets (PAR-155)Jun 14, 2026, 12:25 PM
  • ParadauxIO linked a commit — Commit b5cb9f1 — Merge pull request #13 from MCCitiesNetwork/developJun 14, 2026, 12:25 PM
  • ParadauxIO linked a commit — Commit cc7482b — Flag Discord webhook targets in the explorer UI (PAR-155)Jun 14, 2026, 12:25 PM
  • ParadauxIO changed status to Status → DoneJun 14, 2026, 12:25 PM
  • ParadauxIO linked a pull request — PR #13 merged — Release: flag Discord webhook targets in /me/webhooks (PAR-155)Jun 14, 2026, 12:25 PM
  • tesks changed status to Status → Pending ReleaseJun 14, 2026, 12:24 PM
  • ParadauxIO linked a pull request — PR #13 open — Release: flag Discord webhook targets in /me/webhooks (PAR-155)Jun 14, 2026, 12:24 PM
  • ParadauxIO linked a commit — Commit cc7482b — Flag Discord webhook targets in the explorer UI (PAR-155)Jun 14, 2026, 12:23 PM
  • ParadauxIO linked a commit — Commit dd2716d — Deliver Discord-formatted embeds to Discord webhook targets (PAR-155)Jun 14, 2026, 12:23 PM
  • tesks created the issueJun 14, 2026, 12:20 PM