webhook¶
Available from 0.18.0.
Send the result of a check to a webhook you name. Opt-in: nothing is sent unless a pipeline runs this command, and check never calls it.
webhook send¶
| Option | Default | Description |
|---|---|---|
ARTIFACT | compliance-artifact.json | The artifact check wrote. |
--format | json | json (signed) or slack. |
--exit-code | none | The check exit code, added to the message. |
| Setting | Needed for | Description |
|---|---|---|
OPENCOMPLAI_WEBHOOK_URL | both | The receiver. https only (plain http is accepted for localhost). Redirects are not followed. |
OPENCOMPLAI_WEBHOOK_SECRET | json | The HMAC key. A json webhook is always signed, so without it the command exits 2. |
The json payload¶
A small fixed object with the verdict only. It holds no evidence and no repository content.
{"commit_ref":"0123456789ab","event":"opencomplai.check","exit_code":1,
"failed_controls":["Art. 9"],"result":"control_fail","signed":true,
"system_id":"my-system","timestamp":"2026-11-30T10:00:00Z"}
signed says whether the artifact itself carried a signature. It is separate from the webhook signature below.
Verifying the signature¶
Each request carries X-OpenComplAI-Signature: t=<unix seconds>,v1=<hex>. v1 is the HMAC-SHA256, keyed with your secret, of the text <t>. followed by the exact request body bytes. A receiver recomputes it over the raw body (before any JSON parsing), compares in constant time, and rejects a t older than its tolerance (five minutes is a sensible default) so a captured request cannot be replayed.
import hashlib, hmac, time
def valid(secret: str, body: bytes, header: str, tolerance: int = 300) -> bool:
parts = dict(p.split("=", 1) for p in header.split(","))
if abs(time.time() - int(parts["t"])) > tolerance:
return False
mac = hmac.new(secret.encode(), f"{parts['t']}.".encode() + body, hashlib.sha256)
return hmac.compare_digest(mac.hexdigest(), parts["v1"])
The slack format¶
--format slack sends one text message for a Slack incoming webhook: the system, the commit, the result, the failed control ids and the exit code. Slack has no signature header, so none is sent and the webhook URL is the secret; keep it in a CI secret.
Jira¶
Jira has no webhook receiver of its own that takes this payload. Either create the issue from the exit code with the REST call in Notify from the exit code, or point OPENCOMPLAI_WEBHOOK_URL at a Jira Automation "Incoming webhook" rule, which receives the json payload and can create an issue from failed_controls and system_id. The secret is yours to check in the rule or a gateway in front of it.
Exit codes¶
| Code | Meaning |
|---|---|
| 0 | Sent, and the receiver answered 2xx. |
| 2 | The URL (or, for json, the secret) is not set, the URL is not https, or the artifact cannot be read. |
| 3 | The receiver refused the request or could not be reached. The text never repeats the URL. |
In a pipeline, add || true if a failed notification must not fail the job.