Skip to content

Trigger a monitor from a webhook

A webhook trigger gives a monitor a URL. A POST to it starts a run at once, and the request body is available to the check. Use it to run smoke tests after a deploy, or to check something when another system says so.

  1. Open the monitor and find Webhook triggers (“Start a run from a deploy pipeline or another tool”).
  2. Select New webhook trigger and name it, such as after-deploy.
  3. Copy the URL and the token. Copy the token now: SREInsights keeps only a hash of it and can’t show it again.

A monitor can have up to 10 triggers. New token replaces a token; the old one stops working at once.

Terminal window
curl -X POST "https://console.sreinsights.com/api/v1/hooks/<trigger id>" \
-H "Authorization: Bearer pwt_…" \
-H "Content-Type: application/json" \
-d '{ "commit": "4f2a9c1", "params": { "env": "staging" } }'

If the sender can’t set Authorization, send the token as X-SREInsights-Token: pwt_….

The answer is 202 with { "queued": true, … }. If a run is already queued or running, nothing new starts and the answer says "queued": false with the reason.

  • The whole JSON body (up to 64 KB) is trigger.body in the check: ${trigger.body.commit} in a setting, trigger.body.commit in an expression.
  • Parameters come from the trigger’s saved inputs, overridden by the body’s params. A sender that can’t nest objects may send them as top-level fields with the parameters’ names.

For example, an HTTP check on https://${params.env}.example.com/version with the assertion json.commit == trigger.body.commit fails if the deploy didn’t land.

- name: Smoke test in SREInsights
run: |
curl -fsS -X POST "https://console.sreinsights.com/api/v1/hooks/${{ vars.SREINSIGHTS_TRIGGER_ID }}" \
-H "Authorization: Bearer ${{ secrets.SREINSIGHTS_TRIGGER_TOKEN }}" \
-H "Content-Type: application/json" \
-d "{\"commit\": \"${GITHUB_SHA}\"}"
Status Code Means
400 VALIDATION_FAILED A parameter is missing or wrong; the answer names it.
401 TRIGGER_UNAUTHORIZED Wrong token, or the trigger or monitor was deleted.
409 TRIGGER_DISABLED The trigger is turned off.
409 MONITOR_PAUSED The monitor is paused.
413 TRIGGER_BODY_TOO_LARGE The body is over 64 KB.

See also Webhooks in the REST API.