Skip to main content

Webhooks

A webhook is a content resource, prefixed WHK_, that sends an outbound HTTP request when a platform event fires, with its URL, headers, and body rendered from LiquidJS templates against the event payload.

Each webhook binds to one event name (CaseCreated, ThreatReportCreated, and the rest listed below), and sends the request with the configured HTTP method. A {{ credential.<name> }} reference in any template resolves against a stored credential, so secrets never sit in the template text. Webhooks route cases, threat reports, and usage alerts to external systems such as Slack, Jira, and PagerDuty.

Trigger events​

eventName takes one of the following values. Each event delivers a payload whose top-level key names the object below, plus a type field equal to the event name. Templates read the payload directly, so a ThreatReportCreated body references {{ threatReport.name }}.

EventPayload keyFires when
CaseCreatedcaseA case is opened.
CaseClosedcaseA case is closed.
CaseStatusChangedcaseThe status of a case changes, from a user, an agent, or the automatic hold of inactive cases. case.status is the new status. The payload also carries previousStatus and reason (StaleCaseAutoHold for the automatic hold, otherwise null). A close fires both CaseClosed and CaseStatusChanged.
CaseInitialAnalysisCompletedcaseThe agent finishes initial analysis on a case.
ContentWorkItemCreatedcontentWorkItemA content work item is created.
ThreatReportCreatedthreatReportA threat report is created.
CircuitBreakerTrippedcircuitBreakerA platform circuit breaker trips.
SimbaUsageAlertalertAgent usage crosses a configured quota threshold.
AlertQueuedalertAn alert enters the triage queue.
AlertInitialScoreCompletedalertTriage assigns an alert its first priority score.
AlertPromotedalertAn alert is promoted to a case. The payload also carries caseId and promotedByUserId.
AlertExpiredalertAn alert leaves the queue without promotion.
AlertTriageFailurealertTriage cannot finish an alert. The payload also carries reason.
CaseNewAlertEvidenceAttachedcaseAn alert is attached to an existing case as new evidence. The payload also carries alert and promotedByUserId.
TriagePromotionThresholdChangedthresholdThe dynamic promotion threshold of a Space changes value. See Promotion threshold changes.

Space-scoped events also carry organization (id, name) and space (id, name, catalogName) objects, and fire only webhooks in that Space.

Promotion threshold changes​

TriagePromotionThresholdChanged fires when the triage promotion cycle of a Space with a weekly budget stores a new threshold value. A low remaining budget raises the threshold, so alerts that score below it stay in triage instead of becoming cases. Use this event to review the triage queue or raise the budget of the Space.

FieldTypeDescription
threshold.spaceIdstringThe Space whose threshold changed.
threshold.previousinteger or nullThe stored threshold before this change. On the first computation for the Space, this is the cold-start value. null only when no threshold was stored.
threshold.currentintegerThe new threshold, from 1 to 10. Alerts with a priority below it stay in triage.
threshold.previousComputedAtstring or nullISO 8601 time of the previous computation. null when previous is the cold-start value set at creation or after a budget edit.
threshold.computedAtstringISO 8601 time of this computation.
threshold.weeklyBudgetUsdnumberThe weekly budget of the Space, in USD.
threshold.remainingWeeklyBudgetUsdnumberWeekly budget minus this week's Triage and Cases spend, in USD. Never below 0. When automatic case analysis is off, Cases spend is not subtracted.
threshold.remainingCaseCapacityUsdnumberThe budget left for automatic case analysis after the triage reserve, in USD. 0 when automatic case analysis is off. The threshold uses this value minus the expected cost of the cases in analysis, so the threshold can rise while this value stays high.

The threshold depends on the remaining budget, the number of cases in analysis, and the fraction of the week left, so the event can fire often when the budget is tight. Each change fires a separate event: a move from 7 to 8 and then from 8 to 9 sends two. Delivery is best effort, and an event may be delivered more than once. Recipients should handle duplicate events. A budget edit resets the stored threshold without firing the event.

Use triggerExpression to fire only on the changes that matter. Liquid evaluates the expression with these rules:

  • A null threshold.previous compares like 0, so threshold.previous < 7 is true and threshold.previous > 7 is false. Test for it with threshold.previous == nil.
  • To find the first computation for a Space, test threshold.previousComputedAt == nil. On the first computation, previous holds the cold-start value, not null.
  • Liquid has no parentheses, and and and or evaluate from right to left.

To fire when the threshold rises above 7:

threshold.current > 7 and threshold.previous <= 7

To link to the triage queue, build the URL from the identity fields: https://<your Perpetual host>/{{ organization.id }}/{{ space.id }}/triage.

Templating​

The url, headers values, and body are LiquidJS templates. Two kinds of reference resolve at send time.

ReferenceResolves to
{{ <field> }}A field of the event payload, e.g. {{ case.name }} or {{ type }}. Any Liquid filter applies, so {{ case.summary | json }} escapes a value for a JSON body.
{{ credential.<name> }}A stored credential by name. Use bracket notation ({{ credential["my-key"] }}) when the name is not a valid identifier. Text and OAuth2 credentials substitute their value string. For an AwsRole or HmacSignature credential, Perpetual computes a signed request header over the final request.

Inputs​

FieldTypeRequiredDescription
namestringRequiredWebhook name.
eventNameenumRequiredThe platform event that fires this webhook. See Trigger events for the values and their payloads.
urlstringRequiredThe request URL, a Liquid template. Renders against the event payload and any credential.* references.
methodenumRequiredHTTP method for the request: GET, POST, PUT, PATCH, DELETE.
headersobjectRequiredRequest headers as a string-to-string map. Each value is a Liquid template. An empty object sends no headers.
bodystringOptionalThe request body, a Liquid template. Absent sends no body.
triggerExpressionstringOptionalA Liquid expression evaluated against the event payload. The webhook fires only when it is true. Absent always fires.
folderPathstringOptionalFolder location within the Space, e.g. Webhooks/Slack.

Outputs​

A webhook returns no fields of its own.

Plus the common resource fields.