OpenFn / OpenFn/docs

Update Webhook Triggers: Add Async and Sync

Open
#736 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
23
Forks
20
Avg merge
3d 1h
Merged PRs (30d)
6

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)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The entry point mentioned is maybe_broadcast_webhook_response/2; start by locating it and tracing the Phoenix PubSub broadcast conditions. Confirm the intended async and sync behavior and status mapping for each workflow outcome, then verify that after-completion webhook responses include the stated payload and metadata without broadcasting otherwise.

Written by the indexing model from the issue text.

Assessment

Tech stack
elixir
Domain
api
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.