Metric webhooks
A key result in OKR Hub can score itself from the number it measures. Whoever may update the key result connects a metric on its page: a name, a baseline (which scores 0.0), a target (1.0) and, for a webhook, an address with a secret. Each number posted there becomes a grade between the baseline and the target, linear and kept between 0 and 1, recorded as a check-in by whoever set the metric up and marked as the metric’s.
The webhook sits outside the versioned API: no API key, no scopes, just the
metric’s own secret. Metrics are set up, paused and given new secrets on the
key result’s page, not through the API, which reads them: a key result’s
metric says which one drives it, and a check-in’s metric which one
recorded it.
Posting a number
The address (…/api/okrhub/metrics/<sourceId>, on Taktoria’s own domain) and
the secret (it starts tkm_) are on the key result’s page.
The secret is shown once, when the metric is connected or given a New
secret; keep it like a password, since it lets anyone who holds it move the
key result’s score.
A good answer is 200:
recorded is false when the grade is the one the metric last made: the
number is remembered but adds nothing to the history, so posting a flat metric
every day is fine. A test answers "test": true and "recorded": false.
How it sits beside people’s check-ins
A person may still check in on a key result a metric drives. Their check-in stands in the history beside the metric’s, and is the key result’s latest until the metric next moves. A Final grade on the scorecard is the score whatever the metric does.
The metric writes as whoever set it up, and only while they could have
written it themselves: still in the workspace, holding an OKR Hub seat, not a
Viewer, and allowed to update the key result. When they no longer are, the
webhook answers 403 until somebody who may update the key result saves its
settings and so takes it over.
Answers
Errors are a JSON body with one code, { "error": "paused" }, rather than the
versioned API’s error object.
Limits
metric-webhook-ip allows 600 requests per 10 minutes from one address,
counted before the secret is checked, and metric-webhook 60 an hour per
metric once it is. A metric moves daily, not by the second: post when the
number changes. Answers past the secret carry the rate limit headers described
under Errors and pagination.