I have a Prefect Cloud event webhook that creates an Event with a nested JSON object in payload
that comes from the webhook body (via ..., "payload": {{body|tojson}}, ...
in the webhook template). So far so good (after some trial and error).
Next I want to use an Automation for those events to trigger a deployment, and pass the Event payload as a parameter. I tried:
{
"myparam": {{event.payload}}
}
But a “parameters must be valid JSON” validation error appears. The deployment parameter is a pydantic model with several other nested models so I’d really rather not explode each parameter individually if there’s a way to pass on the whole object.
{"myparam": "{{event.payload}}"}
ends up with the whole object serialised as a string, as does {"myparam": "{{event.payload|tojson}}"}
Help!
Semi-related, if I edit the Automation in the UI it doesn’t seem to save the JSON template — when I reload or access it via the API it just has ..., "parameters": {}
. Updating via the API works, subject to the above.