DiscordIncomingWebhook icon
WorkflowEvents icon

React to Mistral Workflow Events with a Kestra Trigger

React to Mistral workflow events from Kestra with a polling trigger, and post the event type, workflow name, and execution ID to Discord.

Categories
AI

Mistral workflows finish, fail, and get canceled on Mistral's side; this blueprint makes those moments actionable in your orchestrator. The io.kestra.plugin.mistral.WorkflowEvents polling trigger checks the Mistral API every minute and starts one Kestra execution per event, with the event fields exposed as trigger outputs. Here the reaction is a Discord message, but the same execution can load results, kick off downstream pipelines, or open incidents.

How it works

  1. on_workflow_event (io.kestra.plugin.mistral.WorkflowEvents) polls at interval: PT1M for the three lifecycle event types: WorkflowExecutionCompleted, WorkflowExecutionFailed, and WorkflowExecutionCanceled. The trigger ships disabled so importing the blueprint never starts polling by accident.
  2. Each event starts one execution with scalar trigger outputs: {{ trigger.eventType }}, {{ trigger.workflowName }}, {{ trigger.workflowExecId }}, and {{ trigger.eventTimestamp }}. The full event payload is available as raw JSON in {{ trigger.attributes }} for tasks that need more than the scalars.
  3. report_event posts the event type, workflow name, and remote execution ID to Discord.
  4. The errors block posts a distinct Discord alert if the reaction fails, so an event that could not be processed is visible rather than lost.

What you get

  • Event-driven reactions to Mistral workflow outcomes without writing a polling service.
  • One auditable Kestra execution per event, with the event fields recorded as trigger outputs.
  • Scalar fields safe to interpolate into JSON payloads, plus the raw payload in attributes when you need details.
  • A failure alert so the reactor itself cannot break silently.

Who it's for

  • Teams running Mistral agent workflows who need downstream pipelines to start the moment a workflow finishes.
  • On-call engineers who want failed or canceled agent runs surfaced in chat immediately.
  • Anyone pairing fire-and-forget RunWorkflow starts with an asynchronous completion handler.

Why orchestrate this with Kestra

Reacting to remote events usually means a custom poller, a queue, and a consumer, each with its own failure modes. Kestra collapses that into one declarative trigger: the platform handles the polling schedule, deduplication into executions, secrets for the API key, and a history of every event that ever fired, next to the reaction it triggered.

Prerequisites

  • A Mistral API key with access to Mistral workflows and their events.
  • At least one registered Mistral workflow producing execution events.
  • A Discord incoming webhook for event reports and failure alerts.

Secrets

  • MISTRAL_API_KEY: Mistral API bearer token.
  • DISCORD_WEBHOOK_URL: Discord incoming webhook URL.

Quick start

  1. Add the two secrets to your Kestra namespace.
  2. Set disabled: false on the on_workflow_event trigger.
  3. Run any Mistral workflow and watch the Discord message arrive within a minute of it finishing.

How to extend

  • Add workflowName to the trigger to react to a single workflow instead of all of them.
  • Branch on {{ trigger.eventType }} with an If task to page on failures and stay quiet on completions.
  • Parse {{ trigger.attributes }} with a script task when the reaction needs fields beyond the scalars.
  • Narrow eventTypes to WorkflowExecutionFailed to turn this flow into a pure failure alarm.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.