Skip to content

Webhook trigger

A webhook routine takes JSON posted to its address, https://<your server>/v1/hooks/routines/<routine id>. It has no filter: every signed event starts it.

Agents makes the secret, which starts aghook_, and shows it once when you set it. A sender signs each request with it in two headers:

  • X-Agents-Timestamp, the time in seconds since 1970.
  • X-Agents-Signature, v1= and the hex HMAC-SHA256 of the timestamp, a dot and the body, keyed with the secret.

Agents refuses a timestamp more than five minutes from its clock, so a captured request can’t be sent again later.

A sender that can’t sign sends Authorization: Bearer <secret> instead. That proves the sender holds the secret, and covers nothing in the body, so keep it to tools you trust with the secret. The secret never goes in the address.

For a signed request, a repeat is the same timestamp and body. For a bearer request, it is the same body, for as long as the routine exists, so put something that changes, such as a time, in each event.