New to Kestra?
Use blueprints to kickstart your first workflows.
Gate Sonilo music generation jobs on their terminal status and alert Slack when a job fails or the API cannot be reached.
A generative media pipeline that silently swallows a failed Sonilo job looks the same as one that succeeded, until a downstream video or podcast assembly step opens an empty audio file. This blueprint submits a canary text-to-music generation on a schedule, waits for Sonilo's own terminal status, and pages Slack the moment a job fails or the API itself cannot be reached, instead of letting a bad generation flow downstream unnoticed.
generate_music (io.kestra.plugin.sonilo.GenerateMusicFromText) submits music_prompt for generation_duration_seconds in output_format, which forces Sonilo's async mode and internal polling for wav/mp3. allowFailure: true means a connection or authentication failure still lets the flow continue instead of aborting.classify_generation_status (io.kestra.plugin.core.debug.Return) checks whether outputs.generate_music.status is defined; if not, UNREACHABLE. Otherwise it matches the status against Sonilo's own normalized terminal values (succeeded/completed/success for COMPLETED, failed/canceled/cancelled/error for FAILED), falling back to UNKNOWN for anything else.route_by_generation_status (io.kestra.plugin.core.flow.Switch) branches on that string: COMPLETED logs a quiet confirmation, FAILED pages Slack with the task id and prompt, UNREACHABLE pages Slack separately, and defaults logs the raw unrecognized status.log_audit_status records a status line on every run regardless of branch, so the execution history is a continuous generation-health trend.errors block pages Slack separately if the flow itself fails outright.sonilo_health_gate_schedule trigger polls every 6 hours with explicit input overrides, shipped disabled: true until you add a real API token.status output (COMPLETED / FAILED / UNKNOWN / UNREACHABLE) you can chart or gate other flows on.Calling the Sonilo API from a script tells you one job's outcome once. This flow keeps every canary check in the execution history, turns the result into a typed output other flows can depend on, and gives you a Switch branch to grow into real remediation (retrying with a simpler prompt, falling back to a stock audio bed, opening a ticket) without rewriting the check itself.
generation_duration_seconds to keep canary runs cheap. No self-hostable open-source Docker image exists for Sonilo, so test this blueprint directly against the live API.SONILO_API_TOKEN: Sonilo Platform API token, sent as Authorization: Bearer.SLACK_WEBHOOK_URL: Slack incoming webhook used for the failed alert, the unreachable alert, and the flow-failure alert.SECRET_SONILO_API_TOKEN and SECRET_SLACK_WEBHOOK_URL as base64, for example echo -n "<your-api-token>" | base64 and echo -n "<your-webhook-url>" | base64.SONILO_API_TOKEN and SLACK_WEBHOOK_URL secrets.music_prompt, generation_duration_seconds, and output_format at their defaults for a cheap canary run, or set your own.status reads COMPLETED.sonilo_health_gate_schedule.outputs.generate_music.audioUri (switch fetchType logic or add a follow-up task) to verify the generated file is non-empty, not just that the API reported success.Loop task to catch format-specific regressions.