Schedule icon
Evaluate icon
Return icon
Switch icon
Log icon
SlackIncomingWebhook icon

TypeSafe Ticket Urgency Compliance Gate

Gate support ticket or record content on urgency probability via the TypeSafe API and alert Slack when content is critical.

Categories
BusinessData

A support ticket or incident record that says "losing customers right now" should never wait in a queue behind routine requests, but a human has to read it first for that to happen. This blueprint evaluates content against a calibrated yes/no urgency question through the TypeSafe API, classifies the result against a probability threshold, and pages Slack the moment something crosses it, instead of relying on someone noticing in time.

How it works

  1. evaluate_ticket_urgency (io.kestra.plugin.typesafe.Evaluate) sends ticket_content as the state and a single NOUL question (is_urgent) asking whether the content conveys urgency. allowFailure: true means a connection or authentication failure still lets the flow continue instead of aborting.
  2. classify_urgency_level (io.kestra.plugin.core.debug.Return) checks whether outputs.evaluate_ticket_urgency.answers is defined; if not, UNREACHABLE. Otherwise it compares the is_urgent answer's noul probability (0 to 1) against urgency_threshold, returning CRITICAL or NORMAL.
  3. route_by_urgency (io.kestra.plugin.core.flow.Switch) branches on that string: NORMAL logs a quiet confirmation, CRITICAL pages Slack with the probability and content, UNREACHABLE pages Slack separately, and defaults logs the raw outcome.
  4. log_audit_status records a status line on every run regardless of branch, so the execution history is a continuous triage trend.
  5. The errors block pages Slack separately if the flow itself fails outright.
  6. The typesafe_urgency_gate_schedule trigger runs an hourly canary check with explicit input overrides, shipped disabled: true; see How to extend for wiring it to real tickets.

What you get

  • A calibrated urgency check backed by a typed question and answer, not a brittle keyword match.
  • A three-way status output (CRITICAL / NORMAL / UNREACHABLE) you can chart or gate other flows on.
  • A Slack page carrying the exact urgency probability behind a critical reading.
  • A separate failure channel for the gate flow itself, plus a standing audit log line per run.

Who it's for

  • Support and operations teams who want an automatic first-pass triage signal before a human reads every incoming ticket or record.
  • Platform teams adding a consistent, typed classification step to an existing intake pipeline instead of ad hoc keyword rules.

Why orchestrate this with Kestra

A keyword filter in a script is brittle and untraceable; this flow makes the classification a first-class, typed step. Every evaluation is recorded in the execution history, the result becomes a typed output other flows can depend on, and the Switch branch is one edit away from real routing (paging on-call, opening a priority ticket) without rewriting the check itself.

Prerequisites

  • A TypeSafe API key, created at typesafe.ai. No self-hostable open-source Docker image exists for the TypeSafe API, so test this blueprint directly against the live API; the plugin's own documentation does not state whether a free tier exists, so verify current pricing before relying on it for volume.
  • A Slack incoming webhook for the critical and unreachable alerts.

Secrets

  • TYPESAFE_API_KEY: TypeSafe API key used to authenticate the evaluation request.
  • SLACK_WEBHOOK_URL: Slack incoming webhook used for the critical alert, the unreachable alert, and the flow-failure alert.
  • OSS note: if your Kestra instance reads secrets from environment variables instead of a secrets backend, set SECRET_TYPESAFE_API_KEY and SECRET_SLACK_WEBHOOK_URL as base64, for example echo -n "<your-api-key>" | base64 and echo -n "<your-webhook-url>" | base64.

Quick start

  1. Add the TYPESAFE_API_KEY and SLACK_WEBHOOK_URL secrets.
  2. Set ticket_content to a real example and urgency_threshold to the probability you want to gate on.
  3. Run the flow once and confirm status reads CRITICAL for an urgent example and NORMAL for a routine one.
  4. Enable typesafe_urgency_gate_schedule, or replace it with a webhook trigger fed by your real ticket intake.

How to extend

  • Replace the Schedule trigger with a Webhook trigger so every incoming ticket is evaluated as it arrives instead of on a fixed interval.
  • Add a CHOICE question (for example routing by department) alongside is_urgent and branch the Switch on both answers.
  • Use the confidence field on the answer to route low-confidence evaluations to human review instead of trusting a borderline score.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.