Webhook payload
The webhook target sends one POST per release with the whole bundle's text as JSON. Use it to hand a release to an automation service or to your own endpoint.
Settings
| Setting | Default | What |
|---|---|---|
url | Where to post. An https URL with no credentials in it; plain http only to localhost, 127.0.0.1, or [::1]. | |
url_env | Name of the env var holding the URL, for hook URLs that are secrets themselves. Set exactly one of url and url_env. | |
secret_env | Name of the env var holding the signing secret. With none, the request is sent unsigned. | |
images | none | none, url, or base64. |
image_base_url | Required for images: url. Each image's URL is this with the image's bundle path added to its path; a query string on it is kept. The target does not upload images; serve them yourself. |
targets:
- plugin: webhook
url_env: PEBBLE_HOOK_URL
secret_env: PEBBLE_HOOK_SECRETRequest
| Header | Value |
|---|---|
Content-Type | application/json |
Idempotency-Key | justshipped-<app>-<version>, each part URL-encoded. The same on every delivery of one app and version: drop or replace repeats. |
X-Justshipped-Signature | sha256=<hex>: HMAC-SHA256 of the raw request body, keyed with the secret. Sent only when secret_env is set. |
Any 2xx answer counts as delivered. Anything else fails the target, and so does a redirect: the body is never sent on to a URL that was not configured.
Body
The schema is WebhookPayload in @justshipped/sdk, also published as JSON Schema at @justshipped/sdk/schemas/webhook-payload.schema.json.
| Field | What |
|---|---|
schemaVersion | 1 |
event | "release" |
app, version | As in release.json |
idempotencyKey | The Idempotency-Key header's value |
release | release.json in full (see release.schema.json) |
files | [{ path, text }]: every text output release.outputs names (changelog, post, social posts, store text, feeds, email, developer notes) |
images | [{ path, kind, itemId?, url? , base64?, mediaType? }]. Empty with images: none; url set with images: url; base64 and mediaType set with images: base64. |
release includes every change, internal ones too. Send it only to a receiver you would trust with the bundle zip. Files under internal/ (the support memo) are never sent: neither in files nor named in release, whose outputs, file hashes and text edits leave them out.
{
"schemaVersion": 1,
"event": "release",
"app": "Pebble",
"version": "1.4.0",
"idempotencyKey": "justshipped-Pebble-1.4.0",
"release": { "schemaVersion": 1, "app": "Pebble", "version": "1.4.0", "...": "..." },
"files": [
{ "path": "changelog.md", "text": "## New\n\n- Streak reminders.\n" },
{ "path": "social/x.md", "text": "Pebble 1.4.0 is out.\n" }
],
"images": [
{
"path": "images/card.png",
"kind": "template",
"url": "https://pebble.example.com/releases/1.4.0/images/card.png"
}
]
}Verifying the signature
Compute the HMAC over the raw body bytes as received, before any JSON parsing, and compare in constant time. Re-serializing the parsed JSON gives different bytes and a different signature.
Node:
import { createHmac, timingSafeEqual } from "node:crypto";
function verify(rawBody /* Buffer */, header, secret) {
const expected = Buffer.from(`sha256=${createHmac("sha256", secret).update(rawBody).digest("hex")}`);
const given = Buffer.from(header ?? "");
return given.length === expected.length && timingSafeEqual(given, expected);
}Python:
import hashlib
import hmac
def verify(raw_body: bytes, header: str, secret: str) -> bool:
expected = "sha256=" + hmac.new(secret.encode(), raw_body, hashlib.sha256).hexdigest()
return hmac.compare_digest(header or "", expected)To check an implementation: the key Jefe and the body what do ya want for nothing? give sha256=5bdcc146bf60754e6a042426089575c75a003f089d2739839dec58b964ec3843.
Scheduler keys and ids
What each scheduler target needs, and where it comes from. Every one of them only saves drafts: see the drafts-only rule in targets.md.
Config reference
The config file is justshipped.config.yaml at the root of the repository, or the file named by --config. It is optional, and so is every key in it: with no file, values are inferred from the repository (the app name from package.json or the folder, the release tool from its own config files, the forge from the origin remote). justshipped init writes the inferred values out as a file to edit.