PAR-155
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/DiscordWebhook—isDiscordWebhook(URI)+toPayload(DueDelivery)building an embed: credit/debit title + green/red color byamountsign, fields (amount, account, txn, system, memo/message, initiator), ISOtimestamp, footer. Discord embed length limits respected. WebhookDispatcherService.deliver: branch on detection — Discord path sends the embed body and omits theX-Treasury-Signature/X-Treasury-Eventheaders (Discord ignores them and the body isn't our canonical event). Non-Discord path unchanged (signedWebhookEvent). 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
isDiscordWebhookUrlhelper; 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).
Resources
- commitca6b53f Merge pull request #14 from MCCitiesNetwork/developMCCitiesNetwork/treasury-rest-api
- commitdd2716d Deliver Discord-formatted embeds to Discord webhook targets (PAR-155)MCCitiesNetwork/treasury-rest-api
- commitb5cb9f1 Merge pull request #13 from MCCitiesNetwork/developMCCitiesNetwork/economy-explorer
- commitcc7482b Flag Discord webhook targets in the explorer UI (PAR-155)MCCitiesNetwork/economy-explorer
- PR · merged#13 Release: flag Discord webhook targets in /me/webhooks (PAR-155)MCCitiesNetwork/economy-explorer
Comments
No comments yet.
Activity
- ParadauxIO linked a commit — Commit ca6b53f — Merge pull request #14 from MCCitiesNetwork/develop
- ParadauxIO linked a commit — Commit dd2716d — Deliver Discord-formatted embeds to Discord webhook targets (PAR-155)
- ParadauxIO linked a commit — Commit b5cb9f1 — Merge pull request #13 from MCCitiesNetwork/develop
- ParadauxIO linked a commit — Commit cc7482b — Flag Discord webhook targets in the explorer UI (PAR-155)
- ParadauxIO changed status to Status → Done
- ParadauxIO linked a pull request — PR #13 merged — Release: flag Discord webhook targets in /me/webhooks (PAR-155)
- tesks changed status to Status → Pending Release
- ParadauxIO linked a pull request — PR #13 open — Release: flag Discord webhook targets in /me/webhooks (PAR-155)
- ParadauxIO linked a commit — Commit cc7482b — Flag Discord webhook targets in the explorer UI (PAR-155)
- ParadauxIO linked a commit — Commit dd2716d — Deliver Discord-formatted embeds to Discord webhook targets (PAR-155)
- tesks created the issue