Trigger icon
SlackIncomingWebhook icon
DiscordIncomingWebhook icon

React to Hex Run Completions in Real Time

Fire a Kestra flow the moment a Hex project run completes. The trigger polls every minute, dedupes on run ID, and Slack gets the run URL and version.

Categories
BusinessData

Analysts hit refresh in Hex all day; the people consuming their numbers find out by accident. This blueprint inverts that: io.kestra.plugin.hex.projects.Trigger polls the project's most recent run every minute, deduplicates on the run ID so each completed run fires exactly once, and the flow announces to Slack that fresh numbers exist, with the run URL, project version, status, and elapsed time carried directly in the trigger outputs. Whoever refreshed the notebook, on whatever schedule or whim, the consumers hear about it within a minute.

How it works

  1. on_run_completed (io.kestra.plugin.hex.projects.Trigger, disabled by default) polls the Hex API every minute for the project's latest run and fires when it reaches completed status.
  2. Deduplication on the run ID means a run that stays completed across many polls triggers the flow once, never on every poll.
  3. The trigger exposes runId, runUrl, status, projectVersion, startTime, endTime, and elapsedTime as scalar outputs, available under {{ trigger.* }} in every task.
  4. announce_fresh_numbers interpolates those outputs into a Slack message with a direct link to the run.
  5. The errors block alerts a Discord platform channel if the reaction itself fails, so a completed run never goes unannounced without anyone knowing.

What you get

  • Consumers notified within a minute of any completed run, including manual refreshes Kestra did not initiate.
  • Exactly-once semantics per run ID, so a completed run never spams the channel on every poll.
  • The run URL, version, and timing in every announcement, so "which numbers am I looking at" has a link for an answer.
  • A reaction point where notification is just the starting example; any downstream flow can hang off the same trigger.

Who it's for

  • Data teams whose stakeholders ask "did the notebook run yet" in a channel several times a day.
  • Analytics engineers who want downstream automation keyed to Hex publishes they do not control.
  • Platform teams bridging Hex activity into the chat tools where decisions actually happen.

Why orchestrate this with Kestra

Hex knows when its runs complete but has no opinion about what should happen next in the rest of your stack. Kestra turns each completion into an event with typed outputs: this flow posts to Slack, but the same trigger can start an export, kick a downstream pipeline, or update a status page. The polling, deduplication, and retry logic live in the trigger, not in a cron script you maintain.

Prerequisites

  • A Hex project and its project ID.
  • A Hex API token with permission to read the project's runs.
  • A Slack incoming webhook for announcements and a Discord incoming webhook for reactor failures.

Secrets

  • HEX_API_TOKEN: Hex API token used to poll the project's runs.
  • SLACK_WEBHOOK_URL: Slack incoming webhook URL.
  • DISCORD_WEBHOOK_URL: Discord incoming webhook URL.

Quick start

  1. Add the HEX_API_TOKEN, SLACK_WEBHOOK_URL, and DISCORD_WEBHOOK_URL secrets to your Kestra namespace.
  2. Set the trigger's projectId to a real project and flip disabled to false.
  3. Run the project in Hex and watch Slack announce the completion within about a minute.

How to extend

  • Replace the Slack message with a downstream pipeline: export the project's results, refresh a dependent dataset, or start the release snapshot blueprint.
  • Lengthen interval for projects that publish a few times a day, to reduce API polling.
  • Add flows with the same trigger on other project IDs, one reactor per notebook that matters.
  • Route announcements per audience by branching on {{ trigger.projectVersion }} or the time of day.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.