Skip to content

feat: custom webhook payload templates and passthrough mode - #112

Open
abrugh wants to merge 2 commits into
mikemiles-dev:mainfrom
abrugh:feat/custom-webhook-templates
Open

feat: custom webhook payload templates and passthrough mode#112
abrugh wants to merge 2 commits into
mikemiles-dev:mainfrom
abrugh:feat/custom-webhook-templates

Conversation

@abrugh

@abrugh abrugh commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Closes #80

Summary

Replaces the rigid hardcoded format handlers in send_webhook() with a user-defined JSON template system, so new webhook targets no longer require code changes.

  • custom format — user-defined template with {{placeholder}} substitution: {{subject}}, {{body}}, {{job_name}}, {{status}}, {{execution_id}}, {{stdout}}, {{stderr}}, {{timestamp}}
  • passthrough format — the job's stdout is sent verbatim as the HTTP payload, letting scripts own the payload shape (e.g. rich Discord embeds, signal-cli JSON-RPC)
  • Existing presets (slack, teams, pagerduty, discord, generic) are unchanged
  • UI: format dropdown gains Custom Template + Passthrough options; a template textarea appears for Custom, with Discord / Slack / signal-cli preset buttons that pre-fill it

Example: signal-cli JSON-RPC

{
  "jsonrpc": "2.0",
  "method": "send",
  "params": {"recipient": ["+1234567890"], "message": "{{subject}}\n{{body}}"},
  "id": 1
}

Security job fixes (pre-existing on main — easy to split out)

The Security CI job was failing on main before this PR (new RUSTSEC advisories landed after the last green run). Two small, independent changes included here to get CI green:

  1. Cargo.lock: h2 0.4.14 → 0.4.16 — fixes a real vulnerability (unbounded empty DATA frames). Lockfile-only; no Cargo.toml change, no collision with the open hyper 1.11 dependabot PR.
  2. deny.toml: ignore RUSTSEC-2026-0249 (smartstring unmaintained)⚠️ this is a security-policy exception, feel free to reject it. smartstring is a transitive dep of rhai (script jobs); the crate was archived upstream 2026-05-03 and even rhai 1.26.0 still depends on it, so there is no bump that fixes it — only replacing rhai does. The ignore entry carries a documented reason and a 2026-12-31 re-evaluation date. If you'd rather handle this separately (or replace rhai), drop the deny.toml hunk and the h2 bump can stand alone.

Testing

  • 3 new unit tests for template rendering (all placeholders, missing optional fields, Discord preset)
  • Full suite green: 286 tests, 0 failures
  • cargo clippy --all-targets --all-features clean under RUSTFLAGS=-Dwarnings; cargo fmt --check clean
  • cargo deny check green locally (advisories, bans, licenses, sources)

Backward compatibility

No schema or behavior changes for existing configs — template is an optional field and the five existing formats take the exact same code paths as before.

abrugh and others added 2 commits August 27, 2026 11:38
Add 'custom' and 'passthrough' webhook notification formats.

Custom templates use {{placeholder}} syntax with variables:
subject, body, job_name, status, execution_id, stdout, stderr, timestamp.

Passthrough mode sends script stdout directly as the HTTP payload,
enabling scripts to craft their own webhook-ready JSON.

UI adds template textarea with Discord/Slack/signal-cli presets.
Existing formats (slack, teams, pagerduty, discord, generic) unchanged.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…advisory

h2 0.4.14 has an unbounded empty DATA frames vulnerability (fixed in
0.4.16); the bump is lockfile-only and compatible with hyper 1.10.1.

smartstring (transitive dep of rhai) was archived upstream with no safe
upgrade available (RUSTSEC-2026-0249); ignored with a documented reason
and a re-evaluation date until rhai is replaced.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Custom webhook payload templates (replace hardcoded format handlers)

1 participant