XExecution icon
DiscordIncomingWebhook icon
Webhook icon

Celebrate Growth Milestones on X from an Analytics Webhook

Celebrate growth milestones on X automatically. An analytics webhook fires a Kestra flow that posts the milestone number and notifies Discord internally.

Categories
Business

The dashboard crossed one hundred thousand downloads at 3 a.m. and nobody noticed until the standup. This blueprint turns the threshold crossing itself into the announcement. The analytics system POSTs the numeric value to a Kestra webhook, and io.kestra.plugin.x.XExecution interpolates the number into a reviewed customMessage line and posts the execution notification. The task is an execution notification poster, so the post always leads with the execution state and flow id, carries the milestone line, and ends with a link to the execution, a public broadcast that the milestone flow ran with the number attached. Discord receives an internal note with the exact figure that went public. Because posts on X are public and instant, the milestone line is a fixed sentence with one interpolated number rather than free-form generation, and the 280 character cap covers the full rendered post, status line and link included.

How it works

  1. on_milestone (io.kestra.plugin.core.trigger.Webhook) exposes an endpoint guarded by a secret key. The analytics system POSTs a JSON body with the numeric value when a tracked metric crosses its threshold.
  2. post_milestone (io.kestra.plugin.x.XExecution) authenticates with the OAuth 1.0a credential set, consumer key and secret plus access token and secret, and posts the execution notification. The task renders its bundled execution template, so the post opens with the execution state and flow id, carries the customMessage milestone line, and closes with a link to the execution. The 280 character cap applies to that full rendered post, which keeps the milestone line short by design.
  3. The number uses a {{ trigger.body.value ?? inputs.milestone_value }} fallback, so the same flow serves webhook-driven milestones in production and manual runs during setup.
  4. notify_internal (io.kestra.plugin.discord.DiscordIncomingWebhook) posts the figure and execution id to the team channel, so marketing knows the milestone is already public and nobody posts it twice.
  5. The errors block sends a distinct Discord alert when posting fails, because a milestone that passes unannounced cannot be celebrated retroactively with the same effect.

What you get

  • Milestone posts published the moment the metric crosses the threshold, with no human watching a dashboard.
  • A milestone line that is a reviewed sentence with one interpolated number, never improvised at publish time, framed by the execution state and an execution link.
  • An internal Discord note carrying the public figure, so the team sees what followers see.
  • A failure path that reports when the post did not go out, separating reached from celebrated.

Who it's for

  • Developer relations teams who want download, star, or signup milestones announced while the number is fresh.
  • Product marketers tired of discovering milestones days late in a weekly report.
  • Anyone who has watched a round number slip past uncelebrated.

Why orchestrate this with Kestra

An analytics alert can email a human, but a human posts hours later or not at all. Kestra turns the alert into the publication itself, keeps the four OAuth credentials in secrets, records every public post in the execution history, and guarantees through the errors block that a failed post becomes a loud internal message instead of a silent gap.

Prerequisites

  • An X developer app with OAuth 1.0a user context credentials for the account that posts.
  • An analytics or product metrics system able to POST JSON to a webhook URL when a threshold is crossed.
  • A Discord incoming webhook for internal notes and failure alerts.

Secrets

  • X_CONSUMER_KEY: X app consumer key (API key).
  • X_CONSUMER_SECRET: X app consumer secret (API secret).
  • X_ACCESS_TOKEN: OAuth 1.0a access token for the posting account.
  • X_ACCESS_SECRET: OAuth 1.0a access secret for the posting account.
  • DISCORD_WEBHOOK_URL: Discord incoming webhook for internal notes and failure alerts.
  • MILESTONE_WEBHOOK_KEY: secret key guarding the milestone webhook endpoint.

Quick start

  1. Add the six secrets to your Kestra namespace.
  2. Execute the flow manually with the default inputs and confirm the post appears on the X account and the Discord note arrives, then delete the test post.
  3. Review the post sentence carefully, it is public the moment the task runs.
  4. Point the analytics threshold alert at the webhook URL with its key.

How to extend

  • Switch to app-only authentication by replacing the four OAuth properties with bearerToken, as shown in the plugin documentation.
  • Format the number with thousands separators in a small script task before posting, so 100000 reads as 100,000.
  • Guard against duplicate webhooks by recording the last celebrated value in a KV store entry and failing early when it has not grown.
  • Attach a celebratory image by extending the flow once media upload is part of your posting toolchain.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.