<@ULVA73B9P> How can I run a deployment from a web...
# ask-marvin
f
@Marvin How can I run a deployment from a webhook called?
m
To run a deployment from a webhook call in Prefect, you can use automations that respond to webhook events. Here are the steps: 1. Create a Webhook: Prefect allows you to create webhooks that can trigger custom events. Here's an example of a webhook:
Copy code
{
  "event": "model-update",
  "resource": {
    "prefect.resource.id": "product.models.{{ body.model_id }}",
    "prefect.resource.name": "{{ body.friendly_name }}",
    "run_count": "{{body.run_count}}"
  }
}
You can trigger this webhook using a
curl
command:
Copy code
curl -X POST <https://api.prefect.cloud/hooks/34iV2SFke3mVa6y5Y-YUoA> -d "model_id=adhoc" -d "run_count=10" -d "friendly_name=test-user-input"
2. Configure Automations: You can then use the Prefect UI or YAML configuration to create an automation that reacts to these webhook events. Here's a simple YAML trigger configuration:
Copy code
yaml
   triggers:
     - event: "model-update"
       action: "run_deployment"
       deployment_id: "your_deployment_id"
       parameters:
         run_count: "{{ body.run_count }}"
         model_id: "{{ body.model_id }}"
This configuration ensures that when the webhook event
model-update
is received, it will trigger the specified deployment with the provided parameters. You can find more details and examples in the Prefect documentation: Prefect Automations Guide For additional support or specific issues, you can also review relevant GitHub issues like passing results of a completed Flow Run to a Deployment Run: GitHub Issue #11718 Let me know if you need further assistance!