Skip to content

Webhooks & Notifications

The Incubator dispatches HMAC-SHA256 signed, event-filtered webhooks asynchronously whenever key specification, test-health, or version events happen — with built-in rich cards for Slack, Discord, and Microsoft Teams, plus custom local JSON/Markdown templates.


Event Trigger
roadmap.upserted Spec created or changed status/version (metadata-only re-syncs are deduplicated).
spec.claimed / spec.released Developer or agent acquires or releases a soft advisory TTL lease.
spec.approved Human checkpoint approval recorded (spechatch approve).
spec.revised Living revision opened with a Change Delta (spechatch revise).
spec.regressed / spec.recovered CI/local JUnit ingestion detects a failing spec or a subsequent fix.
spec.abandoned Spec explicitly marked abandoned.
version.bumped Atomic project version bumped via spechatch version bump --remote or spechatch_version.
webhook.ping Manual connectivity test (spechatch webhook test <id>).

2. Register a Webhook (slack, discord, teams, or json)

Section titled “2. Register a Webhook (slack, discord, teams, or json)”

Register project webhooks with spechatch webhook add (requires maintainer+ or superuser):

Terminal window
# Microsoft Teams (Power Automate Workflows incoming webhook URL)
spechatch webhook add "https://prod-xx.westeurope.logic.azure.com/workflows/..." \
--format teams \
--events roadmap.upserted,spec.regressed,spec.approved,version.bumped
# Slack Incoming Webhook
spechatch webhook add "https://hooks.slack.com/services/T000/B000/XXXX" \
--format slack \
--events spec.regressed,spec.recovered,spec.approved,version.bumped
# Discord Webhook
spechatch webhook add "https://discord.com/api/webhooks/123456/abcdef" \
--format discord \
--events roadmap.upserted,spec.regressed
# Raw JSON with HMAC-SHA256 signing secret
spechatch webhook add "https://ci.example.com/hooks/spechatch" \
--format json \
--secret "my-shared-hmac-secret"

Out of the box, --format teams renders clean Microsoft Teams Adaptive Cards showing the spec ID, title, event, kind, status transition (draft → done), version, and actor:

Microsoft Teams Adaptive Cards delivered by spechatch webhooks


3. Test, Inspect Deliveries & Manage Webhooks

Section titled “3. Test, Inspect Deliveries & Manage Webhooks”

Every webhook keeps a rolling 50-row delivery log with HTTP status codes, latencies, and error messages:

Terminal window
# List project webhooks (secrets are never exposed)
spechatch webhook list
# Send a synchronous ping to verify connectivity
spechatch webhook test whk_01abc...
# Inspect recent deliveries
spechatch webhook deliveries whk_01abc... --limit 20
# Temporarily pause or re-enable a webhook
spechatch webhook toggle whk_01abc... --disable
spechatch webhook toggle whk_01abc... --enable
# Delete a webhook
spechatch webhook delete whk_01abc...

4. Custom Local Payload Templates (--template)

Section titled “4. Custom Local Payload Templates (--template)”

Need custom Slack Block Kit layouts, Teams Adaptive Card buttons, or custom JSON for an internal automation? Pass --template <file> on add or update.

Available template placeholders:

  • {{event}}, {{project}}, {{spec_id}}, {{title}}, {{kind}}
  • {{status}}, {{previous_status}}, {{status_transition}}
  • {{version}}, {{actor}}, {{next_action}}, {{timestamp}}

Example custom JSON template (webhook-card.json):

{
"text": "[{{project}}] {{spec_id}} — {{title}} ({{status_transition}} @ v{{version}}) by {{actor}}"
}

Apply or clear a custom template anytime:

Terminal window
# Attach custom template to an existing webhook
spechatch webhook update whk_01abc... --template webhook-card.json
# Revert to the built-in format preset
spechatch webhook update whk_01abc... --clear-template

5. Verifying HMAC-SHA256 Signatures (Custom Receivers)

Section titled “5. Verifying HMAC-SHA256 Signatures (Custom Receivers)”

When a webhook is configured with --secret, spechatch signs the raw JSON request body and sends:

  • X-Spechatch-Event: event name (e.g. spec.regressed)
  • X-Spechatch-Signature: sha256=<hex_digest>

Verify signatures in Python:

import hashlib
import hmac
def verify_signature(raw_body: bytes, header_sig: str, secret: str) -> bool:
expected = "sha256=" + hmac.new(secret.encode(), raw_body, hashlib.sha256).hexdigest()
return hmac.compare_digest(expected, header_sig)