New to Kestra?
Use blueprints to kickstart your first workflows.
Read a DigitalOcean account balance on a schedule and alert Slack with the real remaining credit before services are suspended.
A DigitalOcean account running on promotional or prepaid credit shows no warning as that credit runs down, the droplets, databases, and load balancers it pays for keep running right up until the balance crosses zero, at which point the account owes money and risks suspension for non-payment with no notice beyond an email easy to miss. This blueprint reads the account's real balance on a schedule and alerts Slack with the exact remaining credit or amount owed, never an invented figure.
probe_balance (io.kestra.plugin.digitalocean.billing.GetBalance) reads
accountBalance (negative means credit remaining, zero or positive means money
owed), monthToDateUsage, and monthToDateBalance, with allowFailure: true so a
bad or expired API token does not stop the flow before it can be classified as
PROBE_FAILED below.classify_balance_status (io.kestra.plugin.core.debug.Return) returns
PROBE_FAILED when the probe did not return at all, CRITICAL when
accountBalance is at or above zero, WARNING when the real remaining credit is
below low_credit_warning_threshold_usd, HEALTHY otherwise.route_by_balance_status (io.kestra.plugin.core.flow.Switch) branches on that
status: HEALTHY logs it, the other three alert Slack with the real dollar figures,
never an invented number. A defaults branch logs anything unexpected.log_audit_summary always runs last. The errors block posts to Slack if the flow
itself fails outside the gate logic above.billing.GetBalance and its signed-balance convention.DigitalOcean's own notifications for a depleted balance arrive by email, easy to miss in a shared inbox, and carry no severity tiering of their own. Kestra adds the schedule, a warning tier before the balance actually crosses zero, and a Slack alert with the real figures as one declarative, auditable flow.
DIGITALOCEAN_TOKEN: personal access token used by the probe task.
SLACK_WEBHOOK: Slack incoming webhook URL used by the alert tasks and the errors
block.
In Kestra OSS, set these as base64-encoded environment variables, for example
SECRET_DIGITALOCEAN_TOKEN, SECRET_SLACK_WEBHOOK.
HEALTHY on an account
with more than the threshold in remaining credit, or CRITICAL if the account
already owes money.low_credit_warning_threshold_usd above the account's current remaining
credit, run again, it should report WARNING naming the real figure.every_morning trigger.ListBillingHistory to break the alert down by which resource type drove the
month-to-date usage, not only the total.droplet.Action when CRITICAL, gated behind an explicit operator-supplied droplet
ID, never an automatic bulk shutdown.generatedAt across runs to alert if the figures themselves have gone stale,
meaning the account's billing data is not refreshing as expected.accountBalance's sign convention is easy to get backwards, negative means credit
remaining, zero or positive means money owed, this gate's classification depends on
that being read correctly.monthToDateUsage resets each billing period, a WARNING or CRITICAL reading near
the start of a new period reflects the account's actual remaining credit, not a bug in
this gate.