Blueprints

Trigger Prefect flow weekly and send email notification

Source

yaml
id: prefect-to-resend-weekly
namespace: company.team

triggers:
  - id: weekly
    type: io.kestra.plugin.core.trigger.Schedule
    cron: "0 0 */7 * *"

tasks:
  - id: trigger_prefect_run
    type: io.kestra.plugin.prefect.CreateFlowRun
    apiUrl: "https://api.prefect.cloud/api"
    accountId: "{{ secret('PREFECT_ACCOUNT_ID') }}"
    workspaceId: "{{ secret('PREFECT_WORKSPACE_ID') }}"
    deploymentId: "{{ secret('PREFECT_DEPLOYMENT_ID') }}"
    apiKey: "{{ secret('PREFECT_API_KEY') }}"
    wait: true
    pollFrequency: PT10S

  - id: send_email
    type: io.kestra.plugin.resend.email.Send
    apiKey: "{{ secret('RESEND_API_KEY') }}"
    from: "Kestra <[email protected]>"
    to:
      - "[email protected]"
    subject: "Weekly Prefect flow run completed"
    html: |
      <h2>Prefect Flow Run Completed</h2>
      <p>
        Deployment <strong>{{ secret('PREFECT_DEPLOYMENT_ID') }}</strong> has finished.
      </p>
      <p>
        Triggered by <strong>{{ flow.namespace }}.{{ flow.id }}</strong><br/>
        Execution ID: <strong>{{ execution.id }}</strong>
      </p>

About this blueprint

System

This flow runs every seven days and:

  • Triggers a Prefect deployment
  • Waits for the flow run to complete
  • Sends an email notification using Resend

Schedule

Create Flow Run

Send

More Related Blueprints

New to Kestra?

Use blueprints to kickstart your first workflows.

Get started with Kestra