New to Kestra?
Use blueprints to kickstart your first workflows.
Trigger Kestra flows on new Postgres entries using Debezium change data capture. Send Slack notifications and process captured rows with Python automatically.
Capture row-level changes from a Postgres database in near real time using Debezium change data capture (CDC), then react to those changes inside a Kestra flow. Instead of polling tables on a fixed schedule or wiring up a standalone Debezium connector and a separate consumer, this blueprint turns every insert into an event that drives notifications and downstream processing. It solves the classic problem of keeping systems in sync the moment data lands, without building bespoke streaming infrastructure.
A io.kestra.plugin.debezium.postgres.Trigger connects to Postgres over the logical replication stream (pluginName: PGOUTPUT) and watches for committed changes. It uses snapshotMode: INITIAL to read existing rows on first run, format: INLINE to embed captured records, and polls every PT30S (interval). When new rows arrive, the trigger fires a flow execution and exposes the captured data through trigger.uris and a row count via trigger.size.
slack_notificaiton (io.kestra.plugin.slack.notifications.SlackIncomingWebhook) posts a message reporting how many new rows were added ({{ trigger.size }}).json (io.kestra.plugin.serdes.json.IonToJson) converts the captured Ion records from trigger.uris['postgres.order'] into JSON.python (io.kestra.plugin.scripts.python.Script) loads the JSON output and processes the records.Debezium streams changes, but it does not orchestrate what happens next. Kestra adds an event trigger that launches a full workflow on every change, retries on transient failures, captures execution lineage and outputs, and keeps the whole pipeline as declarative YAML you can version and review. The native scheduler in a database (cron or pg_cron) cannot react the instant a row commits, fan out to Slack and Python in one run, or give you per-execution observability the way an orchestrated flow can.
SLACK_WEBHOOK: the Slack incoming webhook URL used by the notification taskStart a local Postgres with CDC enabled, for example with this docker-compose.yml:
services:
db:
image: debezium/postgres:latest
restart: always
environment:
POSTGRES_PASSWORD: example
ports:
- 5433:5432
adminer:
image: adminer
restart: always
ports:
- 8082:8080
Open localhost:8082 to create tables via Adminer (the database listens on port 5433).
Define the SLACK_WEBHOOK secret in Kestra.
Add this flow, insert rows into your table, and watch the trigger fire within the PT30S interval.
trigger.uris at your own table instead of postgres.ordersnapshotMode, pluginName, or interval to match your database setuptrigger.size