Summary
The current webhook notification system has hardcoded format handlers for Slack, Teams, PagerDuty, and Discord. Each new service requires a code change to add a new match arm in send_webhook(). This doesn't scale and limits users who want to integrate with services that aren't explicitly supported (e.g., signal-cli JSON-RPC, Mattermost, Ntfy, Gotify, Home Assistant, etc.).
Proposal
Replace the rigid format enum with a user-defined JSON template system:
- Add a
template field to WebhookConfig (optional string)
- Add a
"custom" format option that renders the template using {{placeholder}} substitution
- Add a
"passthrough" format where the job's stdout IS the raw HTTP payload (script owns the format)
- Keep existing presets (slack, discord, etc.) as convenience options, but they become syntactic sugar over the template engine
Available template variables
| Placeholder |
Description |
{{subject}} |
Notification subject line |
{{body}} |
Notification body text |
{{job_name}} |
Name of the job |
{{status}} |
Execution status (succeeded/failed/timed_out) |
{{execution_id}} |
Short execution ID |
{{stdout}} |
Job stdout (requires email_output: always) |
{{stderr}} |
Job stderr |
{{timestamp}} |
RFC3339 timestamp |
Example: signal-cli JSON-RPC
{
"jsonrpc": "2.0",
"method": "send",
"params": {"recipient": ["+1234567890"], "message": "{{subject}}\n{{body}}"},
"id": 1
}
Example: Passthrough mode (script produces Discord embed)
The script prints its own JSON to stdout, Kronforce sends it verbatim to the configured URL. This lets scripts craft rich embeds with custom fields, colors, and formatting that the template system can't easily express.
UI Changes
- Add "Custom Template" and "Passthrough" to the format dropdown
- Show a template textarea when Custom is selected
- Offer preset buttons (Discord, Slack, signal-cli) that pre-fill the template
Motivation
This removes the need for code changes when supporting new webhook targets and gives users full control over the payload shape. One generic engine replaces N hardcoded format handlers.
Implementation Notes
A working prototype exists on branch feat/custom-webhook-templates in abrugh/kronforce with passing tests. Happy to open a PR if the approach looks good.
Summary
The current webhook notification system has hardcoded format handlers for Slack, Teams, PagerDuty, and Discord. Each new service requires a code change to add a new match arm in
send_webhook(). This doesn't scale and limits users who want to integrate with services that aren't explicitly supported (e.g., signal-cli JSON-RPC, Mattermost, Ntfy, Gotify, Home Assistant, etc.).Proposal
Replace the rigid format enum with a user-defined JSON template system:
templatefield toWebhookConfig(optional string)"custom"format option that renders the template using{{placeholder}}substitution"passthrough"format where the job's stdout IS the raw HTTP payload (script owns the format)Available template variables
{{subject}}{{body}}{{job_name}}{{status}}{{execution_id}}{{stdout}}{{stderr}}{{timestamp}}Example: signal-cli JSON-RPC
{ "jsonrpc": "2.0", "method": "send", "params": {"recipient": ["+1234567890"], "message": "{{subject}}\n{{body}}"}, "id": 1 }Example: Passthrough mode (script produces Discord embed)
The script prints its own JSON to stdout, Kronforce sends it verbatim to the configured URL. This lets scripts craft rich embeds with custom fields, colors, and formatting that the template system can't easily express.
UI Changes
Motivation
This removes the need for code changes when supporting new webhook targets and gives users full control over the payload shape. One generic engine replaces N hardcoded format handlers.
Implementation Notes
A working prototype exists on branch
feat/custom-webhook-templatesin abrugh/kronforce with passing tests. Happy to open a PR if the approach looks good.