New to Kestra?
Use blueprints to kickstart your first workflows.
Query a long-running Temporal workflow from Kestra on a schedule, compare the returned state to a threshold, and page Discord when it reports a problem.
Long-running Temporal workflows accumulate internal state, backlog sizes, retry counters, and processed totals, that nobody sees unless something asks. This blueprint asks on a schedule: io.kestra.plugin.temporal.workflow.Query invokes a registered query handler on a running workflow, an If task parses the JSON-encoded answer as a number, and Discord gets paged when the value crosses a threshold. Queries are read-only in Temporal, so the probe observes state without ever mutating it.
probe_state (io.kestra.plugin.temporal.workflow.Query) calls the query handler named by query_type, getBacklogSize by default, on the latest open run of workflow_id. The task exposes one documented output, result, which carries the handler's return value as a JSON-encoded string.check_state (io.kestra.plugin.core.flow.If) parses that string with Pebble's number filter and compares it against backlog_threshold. This works because the alert condition rides on the documented result output with a handler that returns a plain number; a handler returning an object would need a jq extraction first.page_discord posts the workflow ID, the query type, and the reported value. Otherwise log_healthy writes a log line, so the execution history becomes an hourly state timeline.errors block pages Discord separately when the probe itself fails, which usually means the workflow is not running or the query handler is not registered, both worth knowing immediately.Schedule trigger runs the probe hourly.The workflow already knows its own state; what is missing is something outside it that asks regularly, applies a threshold, and escalates. Baking that into the worker couples alerting policy to business code. Kestra keeps the policy outside: the schedule, the threshold, and the paging channel are flow-level configuration, changeable in a YAML review without redeploying a single worker.
query_type and returns a numeric value.apiKey property; for mTLS clusters, provide caCert, clientCert, and clientKey.TEMPORAL_ENDPOINT: Temporal frontend address in host:port format, for example temporal.example.com:7233.DISCORD_WEBHOOK_URL: Discord incoming webhook URL.workflow_id and query_type at a running workflow with a numeric query handler.disabled: false on the hourly trigger.jq filter before the comparison.Loop over a workflow ID list.