Nils
03/20/2026, 1:30 PMMarvin
03/20/2026, 1:30 PMMarvin
03/20/2026, 1:35 PM{{ flow_run.id }} and {{ flow_run|ui_url }} are supported
- Save and enable
Infrastructure-as-code example (YAML for prefect automation create)
- This example targets two specific deployments by ID and calls a webhook with templated details.
name: Notify on selected deployments completed
description: Call webhook when flow run completes for selected deployments
enabled: true
trigger:
type: event
posture: Reactive
expect:
- prefect.flow-run.Completed
match:
prefect.resource.id: "prefect.flow-run.*"
match_related:
- prefect.resource.id:
- "prefect.deployment.11111111-2222-3333-4444-555555555555"
- "prefect.deployment.aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"
prefect.resource.role: "deployment"
actions:
- type: call-webhook
block_document_id: "00000000-1111-2222-3333-444444444444"
payload: |
{
"flow_run_id": "{{ flow_run.id }}",
"flow_name": "{{ flow.name }}",
"deployment": "{{ deployment.name }}",
"state": "{{ flow_run.state.name }}",
"ui_url": "{{ flow_run|ui_url }}"
}
- Apply it:
prefect automation create --from-file automation.yaml
Tag-based alternative (no need to list deployments)
- Add a tag (e.g., notify-webhook) to the deployments you want included so their flow runs inherit it.
- Use this trigger filter instead:
trigger:
type: event
posture: Reactive
expect:
- prefect.flow-run.Completed
match:
prefect.tag: "notify-webhook"
Notes
- The webhook action uses a Webhook block. If you haven’t created one yet, go to Blocks → Create block → Webhook and set the URL/method/headers.
- Jinja context in the payload supports rich objects like flow_run, deployment, and filters like {{ flow_run|ui_url }} for a direct link.
Helpful docs
- Automations overview: Automations (v3)
- Events and resource matching (filters): Event triggers and matching
- Call a webhook action: Automation actions
- Webhook block: Webhook block API
Want me to draft this for your exact deployments? If you share the deployment IDs/names you want included (or a tag you prefer), and your webhook’s expected payload shape, I can tailor the YAML/UI steps for you.Nils
03/20/2026, 1:39 PMMarvin
03/20/2026, 1:39 PMMarvin
03/20/2026, 1:45 PMautomation.yaml for your self-hosted instance.Nils
03/20/2026, 1:57 PMMarvin
03/20/2026, 2:03 PM