-
Notifications
You must be signed in to change notification settings - Fork 18
Description
The code publishes a standardized webhook response message after a workflow run completes, but only for webhook-triggered work orders configured to reply after completion, and it currently treats all outcomes as HTTP 201 Created.
Purpose:
It conditionally sends (broadcasts) a webhook response after a workflow run finishes, using Phoenix PubSub.
When it runs:
maybe_broadcast_webhook_response/2 checks whether:
• The work order has a trigger
• The trigger is of type :webhook
• The webhook is configured to reply :after_completion
If any of these are not true, the function does nothing.
What it sends:
When the conditions are met, it:
1. Builds a PubSub topic scoped to the work order ("work_order::webhook_response")
2. Determines an HTTP-style status code based on the run state (currently always 201, regardless of outcome)
3. Constructs a response body containing:
• data: the final workflow state from the payload
• meta: run and work-order metadata (IDs, state, error type, timestamps)
Metadata
Metadata
Assignees
Labels
Type
Projects
Status