Solomon Negusse
11/03/2025, 3:23 PMMarvin
11/03/2025, 3:23 PMMarvin
11/03/2025, 3:29 PM{
"event": "external.webhook",
"resource": {
"prefect.resource.id": "webhook.my-service"
}
}
- You can also extract fields from the request body/headers using Jinja and include them in your event (for later parameter mapping). For example:
{
"event": "external.webhook",
"resource": {
"prefect.resource.id": "webhook.my-service"
},
"payload": {
"customer_id": "{{ body.customer_id | default('') }}",
"action": "{{ body.action | default('') }}"
}
}
- CLI alternative (optional):
prefect cloud webhook create my-service-hook \
--description "Triggers deployment from external service" \
--template '{"event":"external.webhook","resource":{"prefect.resource.id":"webhook.my-service"}}'
- Docs:
- Webhooks concept
- Create a webhook (how-to)
- CLI ref: prefect cloud webhook
2) Create an Automation to run your deployment
- In the UI: Automations → Create Automation → Trigger type: “Event”
- Match conditions (example):
- event equals external.webhook
- resource.prefect.resource.id equals webhook.my-service
- Action: “Run deployment”
- Select your deployment
- Optional: map webhook data to deployment parameters with a Jinja template. If you included a payload in the webhook event:
{
"customer_id": "{{ event.payload.customer_id }}",
"action": "{{ event.payload.action }}"
}
- Docs:
- Event triggers
- Automations that run deployments
3) Point your external service to the webhook URL
- After you create the webhook, copy its URL from the webhook detail page.
- Send HTTP requests from your service. Example:
curl -X POST <https://api.prefect.cloud/hooks/<your-webhook-id>> \
-H 'Content-Type: application/json' \
-d '{"customer_id":"123","action":"created"}'
- On success, the endpoint returns 204 No Content. You can monitor incoming events and any template errors in the Event Feed.
Security notes
- The webhook URL is an opaque, secret URL—treat it like a token. Rotate it if exposed:
prefect cloud webhook rotate <webhook-id>
- Authorization headers from the incoming request are stripped by Prefect for safety. If you need verification, use a hard-to-guess URL and/or include a shared secret in the payload and check for it in your Automation’s filters or parameter template logic. Rotate the URL if compromised.
Useful CLI commands
prefect cloud webhook ls
prefect cloud webhook get <webhook-id>
prefect cloud webhook update <webhook-id> --template '<new-template>'
prefect cloud webhook toggle <webhook-id>
prefect cloud webhook delete <webhook-id>
Would you like a concrete example for a specific external service (e.g., GitHub, Stripe, Slack) and parameter mapping for your deployment?Solomon Negusse
11/03/2025, 3:48 PMMarvin
11/03/2025, 3:48 PMMarvin
11/03/2025, 3:51 PMevent
Minimal JSON you can paste in the Advanced/JSON editor to prove it out:
{
"name": "Run deployment on webhook",
"enabled": true,
"trigger": {
"type": "event",
"match": {
"prefect.resource.id": "webhook.my-service"
},
"expect": [
"external.webhook"
]
},
"actions": [
{
"type": "run-deployment",
"deployment_id": "<your-deployment-id>",
"parameters": {
"customer_id": "{{ event.payload.customer_id | default('') }}"
}
}
]
}
Related docs:
- Event triggers: Event triggers
- Creating automations: Creating automations
- Webhooks: Webhooks concept and Create a webhook
If you can share:
- A screenshot or list of the trigger types you do see
- Whether your workspace is 2.x or 3.x, and your role
…I can pinpoint the next step (or provide a ready-to-paste JSON tailored to your setup).