Trigger icon
SlackIncomingWebhook icon
Query icon

Alert finance in Slack on new high-value SAP HANA transactions

Watch a SAP HANA transactions table for high-value rows and alert finance in Slack with Kestra, marking each row only after the alert lands.

Categories
Data

Turn a SAP HANA transactions table into a near real-time event source for treasury monitoring. This event-driven flow watches FINANCE.TRANSACTIONS for new high-value rows in a specific currency and posts a formatted Slack alert to the finance team the moment any appear, with no polling loop to maintain in application code. The hard problem it solves is safe delivery: rows are flagged as alerted only after the Slack post succeeds and only for the exact transaction ids that were fetched, so a failed, throttled, or rate-limited alert never silently drops a high-value transaction.

How it works

  1. The io.kestra.plugin.jdbc.hana.Trigger polls SAP HANA every minute (interval: PT1M, fetchType: FETCH) for rows matching AMOUNT >= :threshold AND CURRENCY = :currency AND ALERTED = FALSE, ordered by CREATED_AT and capped with LIMIT 100. The threshold and currency are bound as SQL parameters, so the comparison is scoped to one currency and is never currency-blind.
  2. When at least one row matches, the trigger starts an execution and exposes the matched rows on trigger.rows and the count on trigger.size.
  3. The alert_finance_team task (io.kestra.plugin.slack.notifications.SlackIncomingWebhook) posts a Slack Block Kit message with the match count and a masked row list. It retries with a constant PT10S backoff up to three attempts.
  4. Only after the alert succeeds does the mark_alerted task (io.kestra.plugin.jdbc.hana.Query, fetchType: NONE) flip ALERTED = TRUE, scoped to exactly the fetched TRANSACTION_IDs via WHERE TRANSACTION_ID IN (...) rather than the open-ended predicate.
  5. If any task fails, the flow-level errors block fires a second SlackIncomingWebhook with the failing execution id.

What you get

  • Near real-time Slack alerts on high-value transactions, one Block Kit message per execution.
  • At-least-once delivery: the alert fires, then rows are marked, so a crash between the two re-selects and re-alerts those rows rather than dropping them.
  • Masked output: account ids are reduced to the last four digits, and only transaction id, masked account, amount, currency, and timestamp are posted.
  • A self-cleaning queue: the ALERTED marker column drains a first-run backlog at 100 rows per minute.

Who it's for

  • Treasury and finance operations teams monitoring large movements.
  • Data and platform engineers who own the SAP HANA warehouse and want alerting without bespoke code.
  • Compliance and risk functions that need an auditable, scoped trail of what was flagged and when.

Why orchestrate this with Kestra

SAP HANA has no native push-to-Slack capability, and its own scheduling cannot react row by row, post to a webhook, retry on a 429, and then conditionally mark only the rows it just handled. Kestra closes that gap: the database Trigger makes new rows an event, declarative YAML keeps the whole pipeline versioned and reviewable, per-task retry blocks ride out Slack throttling, the errors block guarantees a failure is itself surfaced, and full execution lineage records exactly which transactions were alerted in each run.

Prerequisites

  • A reachable SAP HANA instance. The JDBC URL uses port 39015 and databaseName=HXE; adjust the instance number and database for your tenant. The SAP HANA driver (ngdbc) ships with the plugin.
  • A FINANCE.TRANSACTIONS table with TRANSACTION_ID, ACCOUNT_ID, AMOUNT, CURRENCY, CREATED_AT, and a boolean ALERTED column. TRANSACTION_ID must be numeric for the scoped IN (...) marking to bind safely. An index on (ALERTED, AMOUNT, CURRENCY) keeps the poll sargable.
  • A Slack Incoming Webhook pointing at the finance channel.

Secrets

  • HANA_HOST: hostname or IP of the SAP HANA server.
  • HANA_USERNAME: database user with SELECT and UPDATE on the transactions table.
  • HANA_PASSWORD: password for that database user.
  • SLACK_WEBHOOK: Slack Incoming Webhook URL for the finance alert channel and failure alerts.

Quick start

  1. Add the four secrets above to your Kestra instance.
  2. Adjust the table name, columns, and JDBC URL to match your SAP HANA schema and tenant.
  3. Set the currency and threshold inputs (defaults USD and 100000).
  4. Enable the flow. The trigger starts polling and fires an execution as soon as a matching row appears.

How to extend

  • Route by severity: branch to PagerDuty or email for transactions above a higher tier.
  • Add an enrichment Query to join account or counterparty metadata before posting.
  • Persist a record of every alert to a separate audit table for compliance reporting.
  • Swap the currency or lower the threshold per environment using flow inputs or labels.

Links

Orchestrate with Kestra
Orchestrate Slack with Kestra
Share this Blueprint
See How

New to Kestra?

Use blueprints to kickstart your first workflows.