Files

70 lines
2.2 KiB
Markdown

# 05 Discord Webhook Delivery
Implementation guide: [Ticket Implementation Guide](../ticket-implementation-guide.md)
## Branch
`codex/v0.5-webhook-notification/05-discord-webhook-delivery`
Start this branch from `codex/v0.5-webhook-notification/04-generic-webhook-delivery`.
## Goal
Deliver `ticket_status_changed` notifications to Discord webhooks with configurable message text.
## Requirements
- Implement queued delivery for notification actions using the `discord` channel.
- Send an HTTP `POST` request to the configured Discord webhook URL.
- Render the configured message template before delivery.
- Supported template variables:
- `$url`
- `$ticket_key`
- `$ticket_title`
- `$project_name`
- `$status_from`
- `$status_to`
- `$actor_name`
- Send Discord payload `{ "content": "<rendered message>" }`.
- Validate or guard that rendered Discord messages are non-empty.
- Respect Discord content length limits.
- Persist delivery logs using the same delivery logging rules as the generic webhook channel.
## Acceptance Criteria
- Discord actions receive a rendered text message for ticket status changes.
- Template variables are replaced with event payload values.
- Unknown template text remains literal text.
- Empty rendered messages are rejected before delivery and logged as failed.
- Generic webhook actions continue to deliver their JSON payload unchanged.
## Tests
- Template rendering tests for every supported variable.
- HTTP fake tests asserting Discord payload shape.
- Tests for empty template output and content length validation.
- Delivery log tests for successful and failed Discord requests.
- Regression tests proving webhook channel behavior remains unchanged.
## Verification
- `vendor/bin/pint --dirty --format agent`
- `php artisan test --compact tests/Feature/Notifications`
- `git diff --check`
## Commit And Push
- Commit only this ticket's changes.
- Push with `git push origin codex/v0.5-webhook-notification/05-discord-webhook-delivery`.
## Out of Scope
- Discord embeds or rich formatting
- Discord bot tokens
- Slack, Teams, email, or other channels
- Delivery attempt UI
- User bell notifications
- Unread counters
- Incoming webhooks
- API or MCP management endpoints