Marco Ruta
02/24/2025, 3:22 PMMarvin
02/24/2025, 3:22 PM{{ flow_run.id }}
to include the flow run ID.
2. Flow Run Status: Use {{ flow_run.state.name }}
to include the flow run's current state or status.
For example, your JSON payload could look something like this:
json
{
"flow_run_id": "{{ flow_run.id }}",
"status": "{{ flow_run.state.name }}"
}
Make sure the output of your template, when rendered, is valid JSON. You can find more details and examples in the Prefect 2.x Automations documentation.
If you need further guidance on setting up webhooks, you might find the Prefect Webhooks Guide useful.Marco Ruta
02/24/2025, 3:23 PMMarco Ruta
02/24/2025, 3:23 PMMarvin
02/24/2025, 3:23 PM{{ flow_run.id }}
in your JSON payload. This usually happens when the placeholder isn't being correctly substituted with the expected runtime value.
Here are a few things to check:
1. Placeholder Syntax: Ensure that the placeholders are correctly formatted using Jinja syntax. Double-check that you're using {{ flow_run.id }}
exactly as shown.
2. Context Availability: Verify that the context in which the placeholders are being rendered has access to the flow_run
object. This is necessary for the placeholders to be substituted with actual values.
3. Notification Configuration: Review your notification policy configuration to ensure that it is set up to pass the correct context to the webhook.
Since there are no related GitHub issues, this might be a specific configuration issue or a bug not yet reported. If the problem persists, consider reaching out to the Prefect community or support for further assistance.Marco Ruta
02/24/2025, 3:46 PMMarvin
02/24/2025, 3:46 PM{{ flow_run.id }}
. Prefect Cloud, on the other hand, provides more comprehensive support for automations and templating in notifications.
2. Webhook Templates: Prefect's webhook system allows you to define templates for how notifications are processed. However, if you're seeing errors related to placeholders, it might be due to the limited support in your current setup.
If you're relying on a self-hosted Prefect server and experiencing issues with placeholders in custom notifications, you may need to consider alternative approaches, such as processing the notification payload externally before sending it to the webhook.
For more detailed guidance, you can refer to the Prefect Webhooks Guide and the Notification Configuration sections.