New to Kestra?
Use blueprints to kickstart your first workflows.
Scheduled Kestra flow that polls Klaviyo send jobs during business hours and pages Slack once when a campaign send transitions into a bad state.
Monitor Klaviyo campaign send jobs and page Slack the moment a send goes wrong. This Kestra blueprint gives marketing operations teams real observability over Klaviyo email and SMS send jobs: it polls the Klaviyo Campaign Send Job API on a business-hours schedule, evaluates every job in flight, and alerts a Slack channel exactly once when a job transitions into a failed, cancelled, or error state. It solves a real problem Klaviyo's own UI cannot: a stuck or failed send job stays silent unless someone happens to be watching the dashboard, and naive polling either re-pages the same failure every cycle or never surfaces it at all.
business_hours io.kestra.plugin.core.trigger.Schedule trigger fires every 30 minutes from 08:00 to 18:00 UTC, Monday to Friday, with an explicit timezone.get_send_jobs (io.kestra.plugin.klaviyo.jobs.GetSendJob) fetches the current state of every send job ID in the job_ids input using fetchType: FETCH, so each job is evaluated rather than just the first. It carries a constant retry (4 attempts, 30s apart) and a 5-minute timeout.evaluate_jobs (io.kestra.plugin.core.flow.ForEach, concurrencyLimit: 1) iterates the fetched jobs. For each one, get_last_status (io.kestra.plugin.core.kv.Get) reads the last-seen status from the KV store.route_status (io.kestra.plugin.core.flow.If) alerts only when the current status is in alerting_statuses AND differs from the last-seen value. On a match, alert_unhealthy_send posts a rich Slack Block Kit message; otherwise log_status records the status for the audit trail.record_status (io.kestra.plugin.core.kv.Set) writes the current status back with a 30-day TTL, after the alert branch, so a failed Slack post never silently suppresses a future page.klaviyo_send_job_<id>) holding the last-seen status, used to deduplicate alerts across runs.errors block that alerts Slack if the monitor itself fails (for example, a bad API key).Klaviyo has no native scheduler that watches its own send jobs and routes failures to your incident channel. Kestra fills that gap: a declarative YAML flow with an event-driven Schedule trigger, automatic retries on flaky API calls, KV-backed state so alerts dedupe on transition, full execution lineage and logs for every poll, and a flow-level error handler. You get production-grade monitoring of an external SaaS without standing up a cron box or writing glue scripts.
KLAVIYO_API_KEY: Klaviyo Private API Key, used by get_send_jobs to authenticate against the Campaign Send Job API.SLACK_WEBHOOK_URL: Slack incoming webhook URL used for both the unhealthy-send alert and the flow-failure alert.KLAVIYO_API_KEY and SLACK_WEBHOOK_URL secrets to your Kestra namespace.job_ids input to the send job IDs you want to watch and confirm alerting_statuses match your account's status enum (verify against the Klaviyo Campaign Send Job API).job_ids from a discovery task that lists recently created send jobs, so the watch list stays current instead of being hand-maintained.cron to widen the window or poll around the clock during a launch.alerting_statuses, or branch into PagerDuty, email, or a ticketing system alongside Slack.